[PATCH xf86-video-amdgpu] Simplify drmmode_crtc_scanout_update

Michel Dänzer michel at daenzer.net
Fri Apr 20 15:35:20 UTC 2018


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

Use our own BoxRec for the extents, and RegionEmpty for clearing the
scanout damage region.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2d1540d7b..8b670af42 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -727,8 +727,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 	if (drmmode_crtc->scanout[scanout_id].pixmap &&
 	    (!drmmode_crtc->tear_free ||
 	     drmmode_crtc->scanout[scanout_id ^ 1].pixmap)) {
-		RegionPtr region;
-		BoxPtr box;
+		BoxRec extents = { .x1 = 0, .y1 = 0,
+				   .x2 = scrn->virtualX, .y2 = scrn->virtualY };
 
 		if (!drmmode_crtc->scanout_damage) {
 			drmmode_crtc->scanout_damage =
@@ -740,21 +740,13 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 				       drmmode_crtc->scanout_damage);
 		}
 
-		region = DamageRegion(drmmode_crtc->scanout_damage);
-		RegionUninit(region);
-		region->data = NULL;
-		box = RegionExtents(region);
-		box->x1 = 0;
-		box->y1 = 0;
-		box->x2 = max(box->x2, scrn->virtualX);
-		box->y2 = max(box->y2, scrn->virtualY);
-
 		*fb = amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
 		*x = *y = 0;
 
 		amdgpu_scanout_do_update(crtc, scanout_id,
 					 screen->GetWindowPixmap(screen->root),
-					 *box);
+					 extents);
+		RegionEmpty(DamageRegion(drmmode_crtc->scanout_damage));
 		amdgpu_glamor_finish(scrn);
 	}
 }
-- 
2.17.0



More information about the amd-gfx mailing list