[PATCH v2 xf86-video-amdgpu] Add amdgpu_dirty_src_drawable helper
Michel Dänzer
michel at daenzer.net
Thu Nov 23 10:48:31 UTC 2017
From: Michel Dänzer <michel.daenzer at amd.com>
Allows tidying up amdgpu_dirty_src_equals and redisplay_dirty slightly.
v2:
* Different approach for amdgpu_dirty_master
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_drv.h | 18 +++++++++---------
src/amdgpu_kms.c | 7 ++-----
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 4ee13e12b..055c3c3e9 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -177,24 +177,24 @@ amdgpu_master_screen(ScreenPtr screen)
static inline ScreenPtr
amdgpu_dirty_master(PixmapDirtyUpdatePtr dirty)
+{
+ return amdgpu_master_screen(dirty->slave_dst->drawable.pScreen);
+}
+
+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 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
More information about the amd-gfx
mailing list