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:47:57 +0900
commitbdee9f4dd4f21015e7696e06c4b485ab2b3a16dc (patch)
tree751f7fcf6341ede0beb70dac5fa20d4a37d28af0
parent97d7386caf7ba53d2cf398b8a9bb65d0a2a4770a (diff)
Add support for ScreenPtr::SyncSharedPixmap
This allows deferring shared pixmap updates between different drivers. (Ported from radeon commit 53be26b00e83f871f0afd39caa5a7a1d6ec4aea1) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_kms.c43
1 files changed, 42 insertions, 1 deletions
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))