diff mbox

drm/exynos: make overlay data to be updated to valid hw

Message ID 1369727928-5613-1-git-send-email-inki.dae@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Inki Dae May 28, 2013, 7:58 a.m. UTC
This patch makes sure that overlay data are updated
to real hardware enabled when framebuffer is released.
For this, this patch checks if crtc and encoder are
valid or not, and then makes it waiting for signal
synchroniztion to only valid encoder.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |    9 ++++++---
 drivers/gpu/drm/exynos/exynos_drm_encoder.h |    2 +-
 drivers/gpu/drm/exynos/exynos_drm_fb.c      |   13 +++++++++++--
 3 files changed, 18 insertions(+), 6 deletions(-)

Comments

Inki Dae May 28, 2013, 1:44 p.m. UTC | #1
2013/5/28 Inki Dae <inki.dae@samsung.com>

> This patch makes sure that overlay data are updated
> to real hardware enabled when framebuffer is released.
> For this, this patch checks if crtc and encoder are
> valid or not, and then makes it waiting for signal
> synchroniztion to only valid encoder.
>
> Signed-off-by: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c |    9 ++++++---
>  drivers/gpu/drm/exynos/exynos_drm_encoder.h |    2 +-
>  drivers/gpu/drm/exynos/exynos_drm_fb.c      |   13 +++++++++++--
>  3 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> index c63721f..9a6e3fd 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> @@ -220,18 +220,21 @@ static void exynos_drm_encoder_commit(struct
> drm_encoder *encoder)
>         exynos_encoder->dpms = DRM_MODE_DPMS_ON;
>  }
>
> -void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb)
> +void exynos_drm_encoder_complete_scanout(struct drm_crtc *crtc)
>  {
>         struct exynos_drm_encoder *exynos_encoder;
>         struct exynos_drm_manager_ops *ops;
> -       struct drm_device *dev = fb->dev;
> +       struct drm_device *dev = crtc->dev;
>         struct drm_encoder *encoder;
>
>         /*
>          * make sure that overlay data are updated to real hardware
> -        * for all encoders.
> +        * for valid encoders.
>          */
>         list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
> {
> +               if (encoder->crtc != crtc)
> +                       continue;
> +
>                 exynos_encoder = to_exynos_encoder(encoder);
>                 ops = exynos_encoder->manager->ops;
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
> b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
> index 89e2fb0..e8dee1c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
> @@ -32,6 +32,6 @@ void exynos_drm_encoder_plane_mode_set(struct
> drm_encoder *encoder, void *data);
>  void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void
> *data);
>  void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void
> *data);
>  void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void
> *data);
> -void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb);
> +void exynos_drm_encoder_complete_scanout(struct drm_crtc *crtc);
>
>  #endif
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> index 0e04f4e..1fc7ae6 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> @@ -68,12 +68,21 @@ static int check_fb_gem_memory_type(struct drm_device
> *drm_dev,
>  static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
>  {
>         struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
> +       struct drm_device *dev = fb->dev;
> +       struct drm_crtc *crtc;
>         unsigned int i;
>
>         DRM_DEBUG_KMS("%s\n", __FILE__);
>
> -       /* make sure that overlay data are updated before relesing fb. */
> -       exynos_drm_encoder_complete_scanout(fb);
> +       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
> +               if (crtc->fb == fb) {
>

Sorry, crtc->fb could be new fb so in this case, this condition will always
be failed. This patch will be posted again after fixed.

Thanks,
Inki Dae

+                       /*
> +                        * make sure that overlay data are updated before
> +                        * relesing fb.
> +                        */
> +                       exynos_drm_encoder_complete_scanout(crtc);
> +               }
> +       }
>
>         drm_framebuffer_cleanup(fb);
>
> --
> 1.7.5.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index c63721f..9a6e3fd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -220,18 +220,21 @@  static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 	exynos_encoder->dpms = DRM_MODE_DPMS_ON;
 }
 
-void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb)
+void exynos_drm_encoder_complete_scanout(struct drm_crtc *crtc)
 {
 	struct exynos_drm_encoder *exynos_encoder;
 	struct exynos_drm_manager_ops *ops;
-	struct drm_device *dev = fb->dev;
+	struct drm_device *dev = crtc->dev;
 	struct drm_encoder *encoder;
 
 	/*
 	 * make sure that overlay data are updated to real hardware
-	 * for all encoders.
+	 * for valid encoders.
 	 */
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+		if (encoder->crtc != crtc)
+			continue;
+
 		exynos_encoder = to_exynos_encoder(encoder);
 		ops = exynos_encoder->manager->ops;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
index 89e2fb0..e8dee1c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
@@ -32,6 +32,6 @@  void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data);
 void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data);
 void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data);
 void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb);
+void exynos_drm_encoder_complete_scanout(struct drm_crtc *crtc);
 
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 0e04f4e..1fc7ae6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -68,12 +68,21 @@  static int check_fb_gem_memory_type(struct drm_device *drm_dev,
 static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
 {
 	struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
+	struct drm_device *dev = fb->dev;
+	struct drm_crtc *crtc;
 	unsigned int i;
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
-	/* make sure that overlay data are updated before relesing fb. */
-	exynos_drm_encoder_complete_scanout(fb);
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+		if (crtc->fb == fb) {
+			/*
+			 * make sure that overlay data are updated before
+			 * relesing fb.
+			 */
+			exynos_drm_encoder_complete_scanout(crtc);
+		}
+	}
 
 	drm_framebuffer_cleanup(fb);