[PATCH] present: Query the right CRTC to use each time

Chris Wilson chris at chris-wilson.co.uk
Sun Jun 1 09:11:33 PDT 2014

As the CRTCs may be reconfigured between each invocation, we can not
assume that the previous CRTC we used last time will still be valid for
this call. Either we need a way to validate the CRTC or, more
conveniently, query the CRTC to use each time. Note, that this still
does not validate the CRTC is passed in by the user - and xshmfence does
not mix well with asynchronous errors from X (i.e. the client can
trivially deadlock waiting for a signal that will never come).

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
 present/present.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/present/present.c b/present/present.c
index e35de94..d1bb9d4 100644
--- a/present/present.c
+++ b/present/present.c
@@ -673,15 +673,8 @@ present_pixmap(WindowPtr window,
     if (!screen_priv || !screen_priv->info)
         target_crtc = NULL;
-    else if (!target_crtc) {
-        /* Update the CRTC if we have a pixmap or we don't have a CRTC
-         */
-        if (!pixmap)
-            target_crtc = window_priv->crtc;
-        if (!target_crtc)
-            target_crtc = present_get_crtc(window);
-    }
+    else if (!target_crtc)
+        target_crtc = present_get_crtc(window);
     present_get_ust_msc(window, target_crtc, &ust, &crtc_msc);

More information about the xorg-devel mailing list