amdgpu-kms uses shared fences for its prime exported dmabufs,
instead of an exclusive fence. Therefore we need to wait for
all fences of the dmabuf reservation object to prevent
unsynchronized rendering and flipping.

This patch was tested to behave properly with intel-kms +
radeon/amdgpu/nouveau-kms for correct prime sync during
pageflipping under DRI3/Present.

Should fix https://bugs.freedesktop.org/show_bug.cgi?id=95472
at least for page-flipped presentation.

Suggested-by: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
Cc: Michel Dänzer <michel.daenzer at amd.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: David Airlie <airlied at linux.ie>
---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 922709b..4b74b96 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12043,7 +12043,7 @@ static void intel_mmio_flip_work_func(struct 
work_struct *w)
        /* For framebuffer backed by dmabuf, wait for fence */
        resv = i915_gem_object_get_dmabuf_resv(obj);
        if (resv)
-               WARN_ON(reservation_object_wait_timeout_rcu(resv, false, false,
+               WARN_ON(reservation_object_wait_timeout_rcu(resv, true, false,
                                                            
MAX_SCHEDULE_TIMEOUT) < 0);

        intel_pipe_update_start(crtc);
@@ -14700,7 +14700,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
        if (resv) {
                long lret;

-               lret = reservation_object_wait_timeout_rcu(resv, false, true,
+               lret = reservation_object_wait_timeout_rcu(resv, true, true,
                                                           
MAX_SCHEDULE_TIMEOUT);
                if (lret == -ERESTARTSYS)
                        return lret;
-- 
2.7.0

Reply via email to