[PATCH xf86-video-amdgpu] Add support for ScreenPtr::SyncSharedPixmap
Michel Dänzer
michel at daenzer.net
Wed Sep 28 08:00:18 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
This allows deferring shared pixmap updates between different drivers.
(Ported from radeon commit 53be26b00e83f871f0afd39caa5a7a1d6ec4aea1)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_kms.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index a159c84..4ae7995 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -491,6 +491,35 @@ amdgpu_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)
{
@@ -507,6 +536,15 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
return slave_scrn->driverName == scrn->driverName;
}
+static void
+call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
+{
+ amdgpu_sync_shared_pixmap(dirty);
+}
+
+#endif /* HAS_SYNC_SHARED_PIXMAPS */
+
+
static Bool
amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
{
@@ -524,7 +562,7 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
RegionPtr region;
if (master_has_sync_shared_pixmap(scrn, dirty))
- amdgpu_sync_shared_pixmap(dirty);
+ call_sync_shared_pixmap(dirty);
region = dirty_region(dirty);
if (RegionNil(region))
@@ -1803,6 +1841,9 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
#ifdef AMDGPU_PIXMAP_SHARING
pScreen->StartPixmapTracking = PixmapStartDirtyTracking;
pScreen->StopPixmapTracking = PixmapStopDirtyTracking;
+#if HAS_SYNC_SHARED_PIXMAP
+ pScreen->SyncSharedPixmap = amdgpu_sync_shared_pixmap;
+#endif
#endif
if (!xf86CrtcScreenInit(pScreen))
--
2.9.3
More information about the amd-gfx
mailing list