[PATCH xf86-video-amdgpu] Adapt to PixmapDirtyUpdateRec::src being a DrawablePtr

Michel Dänzer michel at daenzer.net
Tue Aug 15 08:26:27 UTC 2017


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

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_drv.h      | 26 ++++++++++++++++++++++++++
 src/amdgpu_kms.c      | 20 ++++++++++----------
 src/drmmode_display.c | 10 +++++++---
 3 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index e5c44dc36..9e088e71a 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -170,6 +170,32 @@ typedef enum {
 #define AMDGPU_PIXMAP_SHARING 1
 #define amdgpu_is_gpu_screen(screen) (screen)->isGPU
 #define amdgpu_is_gpu_scrn(scrn) (scrn)->is_gpu
+
+static inline ScreenPtr
+amdgpu_dirty_master(PixmapDirtyUpdatePtr dirty)
+{
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+	ScreenPtr screen = dirty->src->pScreen;
+#else
+	ScreenPtr screen = dirty->src->drawable.pScreen;
+#endif
+
+	if (screen->current_master)
+		return screen->current_master;
+
+	return screen;
+}
+
+static inline Bool
+amdgpu_dirty_src_equals(PixmapDirtyUpdatePtr dirty, PixmapPtr pixmap)
+{
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+	return dirty->src == &pixmap->drawable;
+#else
+	return dirty->src == pixmap;
+#endif
+}
+
 #else
 #define amdgpu_is_gpu_screen(screen) 0
 #define amdgpu_is_gpu_scrn(scrn) 0
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index c86f117f9..20a552baa 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -448,7 +448,7 @@ dirty_region(PixmapDirtyUpdatePtr dirty)
 static void
 redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
 {
-	ScrnInfoPtr scrn = xf86ScreenToScrn(dirty->src->drawable.pScreen);
+	ScrnInfoPtr scrn = xf86ScreenToScrn(dirty->slave_dst->drawable.pScreen);
 
 	if (RegionNil(region))
 		goto out;
@@ -481,12 +481,12 @@ amdgpu_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
 void
 amdgpu_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
 {
-	ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+	ScreenPtr master_screen = amdgpu_dirty_master(dirty);
 	PixmapDirtyUpdatePtr ent;
 	RegionPtr region;
 
 	xorg_list_for_each_entry(ent, &master_screen->pixmap_dirty_list, ent) {
-		if (ent->slave_dst != dirty->src)
+		if (!amdgpu_dirty_src_equals(dirty, ent->slave_dst))
 			continue;
 
 		region = dirty_region(ent);
@@ -501,7 +501,7 @@ amdgpu_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
 static Bool
 master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
-	ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+	ScreenPtr master_screen = amdgpu_dirty_master(dirty);
 
 	return master_screen->SyncSharedPixmap != NULL;
 }
@@ -517,7 +517,7 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 static void
 call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
 {
-	ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+	ScreenPtr master_screen = amdgpu_dirty_master(dirty);
 
 	master_screen->SyncSharedPixmap(dirty);
 }
@@ -527,7 +527,7 @@ call_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
 static Bool
 master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
-	ScrnInfoPtr master_scrn = xf86ScreenToScrn(dirty->src->master_pixmap->drawable.pScreen);
+	ScrnInfoPtr master_scrn = xf86ScreenToScrn(amdgpu_dirty_master(dirty));
 
 	return master_scrn->driverName == scrn->driverName;
 }
@@ -562,7 +562,7 @@ amdgpu_prime_dirty_to_crtc(PixmapDirtyUpdatePtr dirty)
 		xf86CrtcPtr xf86_crtc = xf86_config->crtc[c];
 		drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
 
-		if (drmmode_crtc->prime_scanout_pixmap == dirty->src)
+		if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap))
 			return xf86_crtc;
 	}
 
@@ -579,7 +579,7 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
 	Bool ret = FALSE;
 
 	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
-		if (dirty->src == drmmode_crtc->prime_scanout_pixmap) {
+		if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
 			RegionPtr region;
 
 			if (master_has_sync_shared_pixmap(scrn, dirty))
@@ -756,10 +756,10 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
 			PixmapDirtyUpdatePtr region_ent = ent;
 
 			if (master_has_sync_shared_pixmap(scrn, ent)) {
-				ScreenPtr master_screen = ent->src->master_pixmap->drawable.pScreen;
+				ScreenPtr master_screen = amdgpu_dirty_master(ent);
 
 				xorg_list_for_each_entry(region_ent, &master_screen->pixmap_dirty_list, ent) {
-					if (region_ent->slave_dst == ent->src)
+					if (amdgpu_dirty_src_equals(ent, region_ent->slave_dst))
 						break;
 				}
 			}
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 75cf7842f..552bff896 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -683,7 +683,7 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 		xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list,
 					 ent) {
-			if (dirty->src == drmmode_crtc->prime_scanout_pixmap) {
+			if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
 				dirty->slave_dst =
 					drmmode_crtc->scanout[scanout_id].pixmap;
 				break;
@@ -1249,7 +1249,7 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 	PixmapDirtyUpdatePtr dirty;
 
 	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
-		if (dirty->src == drmmode_crtc->prime_scanout_pixmap) {
+		if (amdgpu_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
 			PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
 			break;
 		}
@@ -1276,7 +1276,11 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 
 	drmmode_crtc->prime_scanout_pixmap = ppix;
 
-#ifdef HAS_DIRTYTRACKING_ROTATION
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+	PixmapStartDirtyTracking(&ppix->drawable,
+				 drmmode_crtc->scanout[scanout_id].pixmap,
+				 0, 0, 0, 0, RR_Rotate_0);
+#elif defined(HAS_DIRTYTRACKING_ROTATION)
 	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap,
 				 0, 0, 0, 0, RR_Rotate_0);
 #elif defined(HAS_DIRTYTRACKING2)
-- 
2.14.1



More information about the amd-gfx mailing list