[PATCH] glamor: use screen blockhandler rather than dix one

Dave Airlie airlied at gmail.com
Thu Jan 22 22:18:49 PST 2015


From: Dave Airlie <airlied at redhat.com>

This adds glamor into the block handler call chain
in the correct place.

This should fix interactions between glamor and drivers
requiring damage from glamor.

it retains the external API, and consolidates the
two interfaces.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 glamor/glamor.c      | 32 ++++++++++++++++----------------
 glamor/glamor_priv.h |  1 +
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 78e8278..8b57d9b 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -237,29 +237,31 @@ glamor_destroy_pixmap(PixmapPtr pixmap)
     return fbDestroyPixmap(pixmap);
 }
 
-void
-glamor_block_handler(ScreenPtr screen)
+static void glamor_bh_private(glamor_screen_private *glamor_priv)
 {
-    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
-
     glamor_make_current(glamor_priv);
     glamor_priv->tick++;
     glFlush();
     glamor_fbo_expire(glamor_priv);
 }
 
-static void
-_glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask)
+void
+glamor_block_handler(ScreenPtr screen)
 {
-    glamor_screen_private *glamor_priv = data;
-
-    glamor_make_current(glamor_priv);
-    glFlush();
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+    glamor_bh_private(glamor_priv);
 }
 
 static void
-_glamor_wakeup_handler(void *data, int result, void *last_select_mask)
+_glamor_block_handler(ScreenPtr screen, void *timeout, void *readmask)
 {
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    screen->BlockHandler = glamor_priv->saved_procs.block_handler;
+    screen->BlockHandler(screen, timeout, readmask);
+    screen->BlockHandler = _glamor_block_handler;
+
+    glamor_bh_private(glamor_priv);
 }
 
 static void
@@ -443,11 +445,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
         goto fail;
 
     if (flags & GLAMOR_USE_SCREEN) {
-        if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
-                                            _glamor_wakeup_handler,
-                                            glamor_priv)) {
-            goto fail;
-        }
+
+        glamor_priv->saved_procs.block_handler = screen->BlockHandler;
+        screen->BlockHandler = _glamor_block_handler;
 
         glamor_priv->saved_procs.create_gc = screen->CreateGC;
         screen->CreateGC = glamor_create_gc;
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index f699497..ed6e2d1 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -215,6 +215,7 @@ struct glamor_saved_procs {
 #if XSYNC
     SyncScreenFuncsRec sync_screen_funcs;
 #endif
+    ScreenBlockHandlerProcPtr block_handler;
 };
 
 #define CACHE_FORMAT_COUNT 3
-- 
1.9.3



More information about the xorg-devel mailing list