diff options
author | Rahul Sharma <rahul.sharma@samsung.com> | 2013-01-03 05:44:04 -0500 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2013-01-06 23:58:37 -0500 |
commit | 663d8766702c8bb8da31b040b6d6e900b09edbf7 (patch) | |
tree | ff627211888040e0273a46588487a90ebd16be4d /drivers | |
parent | 28998afa1380a4ba7ad2d5e9a2ab76a15417b8b1 (diff) |
drm/exynos: move finish page flip to a common place
This patch implements the exynos_drm_crtc_finish_pageflip in
exynos_drm_crtc.c. This avoids the duplication of same code
in mixer, fimd and vidi.
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Stephane Marchesin <marcheu@chromium.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_crtc.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_crtc.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_vidi.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_mixer.c | 33 |
5 files changed, 36 insertions, 88 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index d59a03a6508f..e8894bc9e6d5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -393,3 +393,33 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc) | |||
393 | exynos_drm_fn_encoder(private->crtc[crtc], &crtc, | 393 | exynos_drm_fn_encoder(private->crtc[crtc], &crtc, |
394 | exynos_drm_disable_vblank); | 394 | exynos_drm_disable_vblank); |
395 | } | 395 | } |
396 | |||
397 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) | ||
398 | { | ||
399 | struct exynos_drm_private *dev_priv = dev->dev_private; | ||
400 | struct drm_pending_vblank_event *e, *t; | ||
401 | struct timeval now; | ||
402 | unsigned long flags; | ||
403 | |||
404 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
405 | |||
406 | spin_lock_irqsave(&dev->event_lock, flags); | ||
407 | |||
408 | list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, | ||
409 | base.link) { | ||
410 | /* if event's pipe isn't same as crtc then ignore it. */ | ||
411 | if (crtc != e->pipe) | ||
412 | continue; | ||
413 | |||
414 | do_gettimeofday(&now); | ||
415 | e->event.sequence = 0; | ||
416 | e->event.tv_sec = now.tv_sec; | ||
417 | e->event.tv_usec = now.tv_usec; | ||
418 | |||
419 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); | ||
420 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
421 | drm_vblank_put(dev, crtc); | ||
422 | } | ||
423 | |||
424 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
425 | } | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index 8ac3969bb35b..3e197e6ae7d9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h | |||
@@ -18,5 +18,6 @@ | |||
18 | int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); | 18 | int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); |
19 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); | 19 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); |
20 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); | 20 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); |
21 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc); | ||
21 | 22 | ||
22 | #endif | 23 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9accd4660840..102f4168f4ab 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -663,34 +663,6 @@ static struct exynos_drm_manager fimd_manager = { | |||
663 | .display_ops = &fimd_display_ops, | 663 | .display_ops = &fimd_display_ops, |
664 | }; | 664 | }; |
665 | 665 | ||
666 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) | ||
667 | { | ||
668 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | ||
669 | struct drm_pending_vblank_event *e, *t; | ||
670 | struct timeval now; | ||
671 | unsigned long flags; | ||
672 | |||
673 | spin_lock_irqsave(&drm_dev->event_lock, flags); | ||
674 | |||
675 | list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, | ||
676 | base.link) { | ||
677 | /* if event's pipe isn't same as crtc then ignore it. */ | ||
678 | if (crtc != e->pipe) | ||
679 | continue; | ||
680 | |||
681 | do_gettimeofday(&now); | ||
682 | e->event.sequence = 0; | ||
683 | e->event.tv_sec = now.tv_sec; | ||
684 | e->event.tv_usec = now.tv_usec; | ||
685 | |||
686 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); | ||
687 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
688 | drm_vblank_put(drm_dev, crtc); | ||
689 | } | ||
690 | |||
691 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | ||
692 | } | ||
693 | |||
694 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | 666 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) |
695 | { | 667 | { |
696 | struct fimd_context *ctx = (struct fimd_context *)dev_id; | 668 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
@@ -710,7 +682,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
710 | goto out; | 682 | goto out; |
711 | 683 | ||
712 | drm_handle_vblank(drm_dev, manager->pipe); | 684 | drm_handle_vblank(drm_dev, manager->pipe); |
713 | fimd_finish_pageflip(drm_dev, manager->pipe); | 685 | exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe); |
714 | 686 | ||
715 | /* set wait vsync event to zero and wake up queue. */ | 687 | /* set wait vsync event to zero and wake up queue. */ |
716 | if (atomic_read(&ctx->wait_vsync_event)) { | 688 | if (atomic_read(&ctx->wait_vsync_event)) { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 99bfc38dfaa2..ae09d44af264 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -372,34 +372,6 @@ static struct exynos_drm_manager vidi_manager = { | |||
372 | .display_ops = &vidi_display_ops, | 372 | .display_ops = &vidi_display_ops, |
373 | }; | 373 | }; |
374 | 374 | ||
375 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) | ||
376 | { | ||
377 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | ||
378 | struct drm_pending_vblank_event *e, *t; | ||
379 | struct timeval now; | ||
380 | unsigned long flags; | ||
381 | |||
382 | spin_lock_irqsave(&drm_dev->event_lock, flags); | ||
383 | |||
384 | list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, | ||
385 | base.link) { | ||
386 | /* if event's pipe isn't same as crtc then ignore it. */ | ||
387 | if (crtc != e->pipe) | ||
388 | continue; | ||
389 | |||
390 | do_gettimeofday(&now); | ||
391 | e->event.sequence = 0; | ||
392 | e->event.tv_sec = now.tv_sec; | ||
393 | e->event.tv_usec = now.tv_usec; | ||
394 | |||
395 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); | ||
396 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
397 | drm_vblank_put(drm_dev, crtc); | ||
398 | } | ||
399 | |||
400 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | ||
401 | } | ||
402 | |||
403 | static void vidi_fake_vblank_handler(struct work_struct *work) | 375 | static void vidi_fake_vblank_handler(struct work_struct *work) |
404 | { | 376 | { |
405 | struct vidi_context *ctx = container_of(work, struct vidi_context, | 377 | struct vidi_context *ctx = container_of(work, struct vidi_context, |
@@ -424,7 +396,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) | |||
424 | 396 | ||
425 | mutex_unlock(&ctx->lock); | 397 | mutex_unlock(&ctx->lock); |
426 | 398 | ||
427 | vidi_finish_pageflip(subdrv->drm_dev, manager->pipe); | 399 | exynos_drm_crtc_finish_pageflip(subdrv->drm_dev, manager->pipe); |
428 | } | 400 | } |
429 | 401 | ||
430 | static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) | 402 | static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 21db89530fc7..e9dbf7935e91 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <drm/exynos_drm.h> | 35 | #include <drm/exynos_drm.h> |
36 | 36 | ||
37 | #include "exynos_drm_drv.h" | 37 | #include "exynos_drm_drv.h" |
38 | #include "exynos_drm_crtc.h" | ||
38 | #include "exynos_drm_hdmi.h" | 39 | #include "exynos_drm_hdmi.h" |
39 | #include "exynos_drm_iommu.h" | 40 | #include "exynos_drm_iommu.h" |
40 | 41 | ||
@@ -949,35 +950,6 @@ static struct exynos_mixer_ops mixer_ops = { | |||
949 | .win_disable = mixer_win_disable, | 950 | .win_disable = mixer_win_disable, |
950 | }; | 951 | }; |
951 | 952 | ||
952 | /* for pageflip event */ | ||
953 | static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) | ||
954 | { | ||
955 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | ||
956 | struct drm_pending_vblank_event *e, *t; | ||
957 | struct timeval now; | ||
958 | unsigned long flags; | ||
959 | |||
960 | spin_lock_irqsave(&drm_dev->event_lock, flags); | ||
961 | |||
962 | list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, | ||
963 | base.link) { | ||
964 | /* if event's pipe isn't same as crtc then ignore it. */ | ||
965 | if (crtc != e->pipe) | ||
966 | continue; | ||
967 | |||
968 | do_gettimeofday(&now); | ||
969 | e->event.sequence = 0; | ||
970 | e->event.tv_sec = now.tv_sec; | ||
971 | e->event.tv_usec = now.tv_usec; | ||
972 | |||
973 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); | ||
974 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
975 | drm_vblank_put(drm_dev, crtc); | ||
976 | } | ||
977 | |||
978 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | ||
979 | } | ||
980 | |||
981 | static irqreturn_t mixer_irq_handler(int irq, void *arg) | 953 | static irqreturn_t mixer_irq_handler(int irq, void *arg) |
982 | { | 954 | { |
983 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; | 955 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; |
@@ -1006,7 +978,8 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) | |||
1006 | } | 978 | } |
1007 | 979 | ||
1008 | drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe); | 980 | drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe); |
1009 | mixer_finish_pageflip(drm_hdmi_ctx->drm_dev, ctx->pipe); | 981 | exynos_drm_crtc_finish_pageflip(drm_hdmi_ctx->drm_dev, |
982 | ctx->pipe); | ||
1010 | 983 | ||
1011 | /* set wait vsync event to zero and wake up queue. */ | 984 | /* set wait vsync event to zero and wake up queue. */ |
1012 | if (atomic_read(&ctx->wait_vsync_event)) { | 985 | if (atomic_read(&ctx->wait_vsync_event)) { |