summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-08-31 16:46:56 +0900
committerMichel Dänzer <michel@daenzer.net>2016-09-21 15:41:16 +0900
commit53be26b00e83f871f0afd39caa5a7a1d6ec4aea1 (patch)
treefd0e61e6e00cbb6df3b93ba8754df434cac1bfe5
parent156b5bc00da2eecb71cad517136f8cd74cf5d2c9 (diff)
Add support for ScreenPtr::SyncSharedPixmap
This allows deferring shared pixmap updates between different drivers. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/radeon_kms.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 0d61d49b..4a5f9da7 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -585,6 +585,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)
{
@@ -601,6 +630,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 */
+
+
static Bool
radeon_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
{
@@ -618,7 +656,7 @@ radeon_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
RegionPtr region;
if (master_has_sync_shared_pixmap(scrn, dirty))
- radeon_sync_shared_pixmap(dirty);
+ call_sync_shared_pixmap(dirty);
region = dirty_region(dirty);
if (RegionNil(region))
@@ -2298,6 +2336,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))