[PATCH xf86-video-amdgpu] Add amdgpu_dirty_src_drawable helper

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

 



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

Allows tidying up redisplay_dirty slightly.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_drv.h | 20 ++++++++++----------
 src/amdgpu_kms.c |  7 ++-----
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 4ee13e12b..7e1a40af6 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -175,26 +175,26 @@ amdgpu_master_screen(ScreenPtr screen)
 	return screen;
 }
 
-static inline ScreenPtr
-amdgpu_dirty_master(PixmapDirtyUpdatePtr dirty)
+static inline DrawablePtr
+amdgpu_dirty_src_drawable(PixmapDirtyUpdatePtr dirty)
 {
 #ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
-	ScreenPtr screen = dirty->src->pScreen;
+	return dirty->src;
 #else
-	ScreenPtr screen = dirty->src->drawable.pScreen;
+	return &dirty->src->drawable;
 #endif
+}
 
-	return amdgpu_master_screen(screen);
+static inline ScreenPtr
+amdgpu_dirty_master(PixmapDirtyUpdatePtr dirty)
+{
+	return amdgpu_master_screen(amdgpu_dirty_src_drawable(dirty));
 }
 
 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
+	return amdgpu_dirty_src_drawable(dirty) == &pixmap->drawable;
 }
 
 
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index a5f2040a8..c15711224 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -479,11 +479,8 @@ dirty_region(PixmapDirtyUpdatePtr dirty)
 static void
 redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
 {
-#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
-	ScrnInfoPtr src_scrn = xf86ScreenToScrn(dirty->src->pScreen);
-#else
-	ScrnInfoPtr src_scrn = xf86ScreenToScrn(dirty->src->drawable.pScreen);
-#endif
+	ScrnInfoPtr src_scrn =
+		xf86ScreenToScrn(amdgpu_dirty_src_drawable(dirty)->pScreen);
 
 	if (RegionNil(region))
 		goto out;
-- 
2.15.0



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

  Powered by Linux