[PATCH xf86-video-amdgpu 3/3] Make amdgpu_scanout_do_update take a PixmapPtr instead of a DrawablePtr

Michel Dänzer michel at daenzer.net
Fri Aug 18 08:55:03 UTC 2017


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

All callers were already passing in a pixmap.

This allows simplifying the rotated scanout case slightly.

(Ported from radeon commit d822a0f47070374ad0c1a97b559bae27724dc52a)

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

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 13237470a..75c2a2653 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -341,7 +341,7 @@ Bool amdgpu_dri3_screen_init(ScreenPtr screen);
 
 /* amdgpu_kms.c */
 Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
-			       DrawablePtr src_draw, BoxPtr extents);
+			      PixmapPtr src_pix, BoxPtr extents);
 void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
 				   , RegionPtr pBSRegion
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index f665a01cd..e0b735819 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -806,7 +806,7 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
 
 Bool
 amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
-			 DrawablePtr src_draw, BoxPtr extents)
+			 PixmapPtr src_pix, BoxPtr extents)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
 	RegionRec region = { .extents = *extents, .data = NULL };
@@ -834,10 +834,9 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
 		PictFormatPtr format = PictureWindowFormat(pScreen->root);
 		int error;
 		PicturePtr src, dst;
-		XID include_inferiors = IncludeInferiors;
 
-		src = CreatePicture(None, src_draw, format, CPSubwindowMode,
-				    &include_inferiors, serverClient, &error);
+		src = CreatePicture(None, &src_pix->drawable, format, 0L, NULL,
+				    serverClient, &error);
 		if (!src) {
 			ErrorF("Failed to create source picture for transformed scanout "
 			       "update\n");
@@ -880,7 +879,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
 		GCPtr gc = GetScratchGC(pDraw->depth, pScreen);
 
 		ValidateGC(pDraw, gc);
-		(*gc->ops->CopyArea)(src_draw, pDraw, gc,
+		(*gc->ops->CopyArea)(&src_pix->drawable, pDraw, gc,
 				     xf86_crtc->x + extents->x1, xf86_crtc->y + extents->y1,
 				     extents->x2 - extents->x1, extents->y2 - extents->y1,
 				     extents->x1, extents->y1);
@@ -912,7 +911,7 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 	    !drmmode_crtc->flip_pending &&
 	    drmmode_crtc->dpms_mode == DPMSModeOn) {
 		if (amdgpu_scanout_do_update(crtc, drmmode_crtc->scanout_id,
-					     &screen->GetWindowPixmap(screen->root)->drawable,
+					     screen->GetWindowPixmap(screen->root),
 					     &region->extents))
 			RegionEmpty(region);
 	}
@@ -993,7 +992,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
 
 	scanout_id = drmmode_crtc->scanout_id ^ 1;
 	if (!amdgpu_scanout_do_update(xf86_crtc, scanout_id,
-				      &pScreen->GetWindowPixmap(pScreen->root)->drawable,
+				      pScreen->GetWindowPixmap(pScreen->root),
 				      &region->extents))
 		return;
 	RegionEmpty(region);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index edd955ece..ad3325be6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -779,7 +779,7 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 		*x = *y = 0;
 
 		amdgpu_scanout_do_update(crtc, scanout_id,
-					 &screen->GetWindowPixmap(screen->root)->drawable,
+					 screen->GetWindowPixmap(screen->root),
 					 box);
 		amdgpu_glamor_finish(scrn);
 	}
@@ -2850,8 +2850,8 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 				goto error;
 			}
 
-			amdgpu_scanout_do_update(crtc, scanout_id,
-						 &new_front->drawable, &extents);
+			amdgpu_scanout_do_update(crtc, scanout_id, new_front,
+						 &extents);
 
 			drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
 							drmmode_crtc->scanout_update_pending);
-- 
2.14.1



More information about the amd-gfx mailing list