[PATCH xf86-video-ati 2/2] Add support for ScreenPtr::SyncSharedPixmap

Michel Dänzer michel at daenzer.net
Wed Aug 31 08:55:43 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

This allows deferring shared pixmap updates between different drivers.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---

This change requires a corresponding xserver change adding the
SyncSharedPixmap field. I'll only push it once the xserver change has
landed.

 src/radeon_kms.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 0c8996d..f43c30f 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -485,6 +485,35 @@ radeon_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
     }
 }
 
+
+#if HAS_SYNC_SHARED_PIXMAP
+
+static Bool
+master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+{
+    ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+
+    return master_screen->SyncSharedPixmap != NULL;
+}
+
+static Bool
+slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
+{
+    ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen;
+
+    return slave_screen->SyncSharedPixmap != NULL;
+}
+
+static void
+call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
+{
+    ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+
+    master_screen->SyncSharedPixmap(dirty);
+}
+
+#else /* !HAS_SYNC_SHARED_PIXMAP */
+
 static Bool
 master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
@@ -501,6 +530,15 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
     return slave_scrn->driverName == scrn->driverName;
 }
 
+static void
+call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
+{
+    radeon_sync_shared_pixmap(dirty);
+}
+
+#endif /* HAS_SYNC_SHARED_PIXMAPS */
+
+
 void
 radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 				    void *event_data)
@@ -518,7 +556,7 @@ radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t u
 	    continue;
 
 	if (master_has_sync_shared_pixmap(scrn, dirty))
-	    radeon_sync_shared_pixmap(dirty);
+	    call_sync_shared_pixmap(dirty);
 
 	region = dirty_region(dirty);
 	redisplay_dirty(dirty, region);
@@ -2128,6 +2166,9 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 #ifdef RADEON_PIXMAP_SHARING
     pScreen->StartPixmapTracking = PixmapStartDirtyTracking;
     pScreen->StopPixmapTracking = PixmapStopDirtyTracking;
+#if HAS_SYNC_SHARED_PIXMAP
+    pScreen->SyncSharedPixmap = radeon_sync_shared_pixmap;
+#endif
 #endif
 
    if (!xf86CrtcScreenInit (pScreen))
-- 
2.9.3



More information about the amd-gfx mailing list