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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michel Dänzer <michel.daenzer@xxxxxxx>

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 03b8a482d..addee9ca0 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -745,7 +745,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 (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
 				dirty->slave_dst =
 					drmmode_crtc->scanout[scanout_id].pixmap;
 				break;
@@ -1294,7 +1294,7 @@ 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 (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
 			PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
 			break;
 		}
@@ -1321,7 +1321,11 @@ 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)
diff --git a/src/radeon.h b/src/radeon.h
index ca509561a..d815d3f00 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -184,6 +184,32 @@ typedef enum {
 #define RADEON_PIXMAP_SHARING 1
 #define radeon_is_gpu_screen(screen) (screen)->isGPU
 #define radeon_is_gpu_scrn(scrn) (scrn)->is_gpu
+
+static inline ScreenPtr
+radeon_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
+radeon_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 radeon_is_gpu_screen(screen) 0
 #define radeon_is_gpu_scrn(scrn) 0
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index f76d76a91..5ae94f5c8 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -546,7 +546,7 @@ dirty_region(PixmapDirtyUpdatePtr dirty)
 static void
 redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
 {
-	ScrnInfoPtr pScrn = xf86ScreenToScrn(dirty->src->drawable.pScreen);
+	ScrnInfoPtr pScrn = xf86ScreenToScrn(dirty->slave_dst->drawable.pScreen);
 
 	if (RegionNil(region))
 		goto out;
@@ -579,12 +579,12 @@ radeon_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
 void
 radeon_sync_shared_pixmap(PixmapDirtyUpdatePtr dirty)
 {
-    ScreenPtr master_screen = dirty->src->master_pixmap->drawable.pScreen;
+    ScreenPtr master_screen = radeon_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 (!radeon_dirty_src_equals(dirty, ent->slave_dst))
 	    continue;
 
 	region = dirty_region(ent);
@@ -599,7 +599,7 @@ radeon_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 = radeon_dirty_master(dirty);
 
     return master_screen->SyncSharedPixmap != NULL;
 }
@@ -615,7 +615,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 = radeon_dirty_master(dirty);
 
     master_screen->SyncSharedPixmap(dirty);
 }
@@ -625,7 +625,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(radeon_dirty_master(dirty));
 
     return master_scrn->driverName == scrn->driverName;
 }
@@ -660,7 +660,7 @@ radeon_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 (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap))
 	    return xf86_crtc;
     }
 
@@ -677,7 +677,7 @@ radeon_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 (radeon_dirty_src_equals(dirty, drmmode_crtc->prime_scanout_pixmap)) {
 	    RegionPtr region;
 
 	    if (master_has_sync_shared_pixmap(scrn, dirty))
@@ -854,10 +854,10 @@ radeon_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 = radeon_dirty_master(ent);
 
 				xorg_list_for_each_entry(region_ent, &master_screen->pixmap_dirty_list, ent) {
-					if (region_ent->slave_dst == ent->src)
+					if (radeon_dirty_src_equals(ent, region_ent->slave_dst))
 						break;
 				}
 			}
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux