All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm: rcar-du: track dma-buf fences
@ 2018-04-30 12:02 Emre Ucan
  2018-04-30 16:05 ` Daniel Vetter
  2018-05-05 14:14 ` Laurent Pinchart
  0 siblings, 2 replies; 3+ messages in thread
From: Emre Ucan @ 2018-04-30 12:02 UTC (permalink / raw)
  To: dri-devel; +Cc: laurent.pinchart

We have to check dma-buf reservation objects of our framebuffers before
we use them. Otherwise, another driver might be writing on the same
buffer which we are using. This would cause visible tearing effects
on display.

We can use existing atomic helper functions to solve this problem.

v2 changes:
- Remove drm_atomic_helper_wait_for_fences() call in rcar_du_kms.c.
  The commit_tail() function in drm_atomic_helper.c, which calls our
  atomic_commit_tail() implementation, already calls it.
- Remove proposed rcar_du_vsp_set_fence_for_plane() function.
  Call drm_gem_fb_prepare_fb(), which calls
  drm_atomic_set_fence_for_plane().

v3 changes:
- Sort the added header file alphabetically.
- Check return value of drm_gem_fb_prepare_fb() and clean up in the case
  of error.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 2c260c3..73c7948 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -17,6 +17,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_plane_helper.h>
 
 #include <linux/bitops.h>
@@ -237,6 +238,10 @@ static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
 		}
 	}
 
+	ret = drm_gem_fb_prepare_fb(plane, state);
+	if (ret)
+		goto fail;
+
 	return 0;
 
 fail:
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] drm: rcar-du: track dma-buf fences
  2018-04-30 12:02 [PATCH v3] drm: rcar-du: track dma-buf fences Emre Ucan
@ 2018-04-30 16:05 ` Daniel Vetter
  2018-05-05 14:14 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2018-04-30 16:05 UTC (permalink / raw)
  To: Emre Ucan; +Cc: laurent.pinchart, dri-devel

On Mon, Apr 30, 2018 at 02:02:04PM +0200, Emre Ucan wrote:
> We have to check dma-buf reservation objects of our framebuffers before
> we use them. Otherwise, another driver might be writing on the same
> buffer which we are using. This would cause visible tearing effects
> on display.
> 
> We can use existing atomic helper functions to solve this problem.
> 
> v2 changes:
> - Remove drm_atomic_helper_wait_for_fences() call in rcar_du_kms.c.
>   The commit_tail() function in drm_atomic_helper.c, which calls our
>   atomic_commit_tail() implementation, already calls it.
> - Remove proposed rcar_du_vsp_set_fence_for_plane() function.
>   Call drm_gem_fb_prepare_fb(), which calls
>   drm_atomic_set_fence_for_plane().
> 
> v3 changes:
> - Sort the added header file alphabetically.
> - Check return value of drm_gem_fb_prepare_fb() and clean up in the case
>   of error.
> 
> Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> index 2c260c3..73c7948 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -17,6 +17,7 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_plane_helper.h>
>  
>  #include <linux/bitops.h>
> @@ -237,6 +238,10 @@ static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
>  		}
>  	}
>  
> +	ret = drm_gem_fb_prepare_fb(plane, state);
> +	if (ret)
> +		goto fail;
> +
>  	return 0;
>  
>  fail:
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] drm: rcar-du: track dma-buf fences
  2018-04-30 12:02 [PATCH v3] drm: rcar-du: track dma-buf fences Emre Ucan
  2018-04-30 16:05 ` Daniel Vetter
@ 2018-05-05 14:14 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2018-05-05 14:14 UTC (permalink / raw)
  To: Emre Ucan; +Cc: dri-devel

Hi Emre,

Thank you for the patch.

On Monday, 30 April 2018 15:02:04 EEST Emre Ucan wrote:
> We have to check dma-buf reservation objects of our framebuffers before
> we use them. Otherwise, another driver might be writing on the same
> buffer which we are using. This would cause visible tearing effects
> on display.
> 
> We can use existing atomic helper functions to solve this problem.
> 
> v2 changes:
> - Remove drm_atomic_helper_wait_for_fences() call in rcar_du_kms.c.
>   The commit_tail() function in drm_atomic_helper.c, which calls our
>   atomic_commit_tail() implementation, already calls it.
> - Remove proposed rcar_du_vsp_set_fence_for_plane() function.
>   Call drm_gem_fb_prepare_fb(), which calls
>   drm_atomic_set_fence_for_plane().
> 
> v3 changes:
> - Sort the added header file alphabetically.
> - Check return value of drm_gem_fb_prepare_fb() and clean up in the case
>   of error.
> 
> Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and taken in my tree for v4.18.

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c260c3..73c7948 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -17,6 +17,7 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_plane_helper.h>
> 
>  #include <linux/bitops.h>
> @@ -237,6 +238,10 @@ static int rcar_du_vsp_plane_prepare_fb(struct
> drm_plane *plane, }
>  	}
> 
> +	ret = drm_gem_fb_prepare_fb(plane, state);
> +	if (ret)
> +		goto fail;
> +
>  	return 0;
> 
>  fail:

-- 
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-05 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 12:02 [PATCH v3] drm: rcar-du: track dma-buf fences Emre Ucan
2018-04-30 16:05 ` Daniel Vetter
2018-05-05 14:14 ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.