Skip to contentSkip to conversation

drm: rcar-du: track dma-buf fences

PATCH In review Emre Ucan 3 participants 3 messages Apr 30, 2018 – May 5, 2018

Subsystems (3)
lore
Share & tools
lore

Emre Ucan

author
#0 lore raw

PATCH v3 1/1 drm: rcar-du: track dma-buf fences

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.

---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +5 -0
index 2c260c3..73c7948 100644
@@ -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:
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v3 1/1
#1 lore raw
Quoted 15 lines · Emre Ucan

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().

Quoted 6 lines

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.

Quoted 34 lines
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +5 -0
index 2c260c3..73c7948 100644
@@ -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:
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v3 1/1
#2 lore raw
In reply to Emre Ucan

Hi Emre,

Thank you for the patch.

Quoted 15 lines · 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().

Quoted 6 lines

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.

and taken in my tree for v4.18.

Quoted 27 lines
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c260c3..73c7948 100644

drivers/gpu/drm/rcar-du/rcar_du_vsp.c +5 -0
@@ -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:
Signature · 10 lines
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel