All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu] Pass extents to amdgpu_scanout_do_update by value
@ 2018-03-08 18:08 Michel Dänzer
  0 siblings, 0 replies; only message in thread
From: Michel Dänzer @ 2018-03-08 18:08 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

amdgpu_scanout_extents_intersect could leave the scanout damage region
in an invalid state, triggering debugging checks in pixman:

*** BUG ***
In pixman_region_append_non_o: The expression r->x1 < r->x2 was false
Set a breakpoint on '_pixman_log_error' to debug

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_drv.h      |  2 +-
 src/amdgpu_kms.c      | 24 ++++++++++++------------
 src/drmmode_display.c |  4 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index acf697730..8a77b05fd 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -347,7 +347,7 @@ Bool amdgpu_dri3_screen_init(ScreenPtr screen);
 
 /* amdgpu_kms.c */
 Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
-			      PixmapPtr src_pix, BoxPtr extents);
+			      PixmapPtr src_pix, BoxRec 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 b287fcc6e..7ec610f5d 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -804,21 +804,21 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
 
 Bool
 amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
-			 PixmapPtr src_pix, BoxPtr extents)
+			 PixmapPtr src_pix, BoxRec extents)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
-	RegionRec region = { .extents = *extents, .data = NULL };
+	RegionRec region = { .extents = extents, .data = NULL };
 	ScrnInfoPtr scrn = xf86_crtc->scrn;
 	ScreenPtr pScreen = scrn->pScreen;
 	DrawablePtr pDraw;
 
 	if (!xf86_crtc->enabled ||
 	    !drmmode_crtc->scanout[scanout_id].pixmap ||
-	    extents->x1 >= extents->x2 || extents->y1 >= extents->y2)
+	    extents.x1 >= extents.x2 || extents.y1 >= extents.y2)
 		return FALSE;
 
 	pDraw = &drmmode_crtc->scanout[scanout_id].pixmap->drawable;
-	if (!amdgpu_scanout_extents_intersect(xf86_crtc, extents))
+	if (!amdgpu_scanout_extents_intersect(xf86_crtc, &extents))
 		return FALSE;
 
 	if (drmmode_crtc->tear_free) {
@@ -860,9 +860,9 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
 		pScreen->SourceValidate = NULL;
 		CompositePicture(PictOpSrc,
 				 src, NULL, dst,
-				 extents->x1, extents->y1, 0, 0, extents->x1,
-				 extents->y1, extents->x2 - extents->x1,
-				 extents->y2 - extents->y1);
+				 extents.x1, extents.y1, 0, 0, extents.x1,
+				 extents.y1, extents.x2 - extents.x1,
+				 extents.y2 - extents.y1);
 		pScreen->SourceValidate = SourceValidate;
 
  free_dst:
@@ -876,9 +876,9 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
 
 		ValidateGC(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);
+				     xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1,
+				     extents.x2 - extents.x1, extents.y2 - extents.y1,
+				     extents.x1, extents.y1);
 		FreeScratchGC(gc);
 	}
 
@@ -908,7 +908,7 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 	    drmmode_crtc->dpms_mode == DPMSModeOn) {
 		if (amdgpu_scanout_do_update(crtc, drmmode_crtc->scanout_id,
 					     screen->GetWindowPixmap(screen->root),
-					     &region->extents))
+					     region->extents))
 			RegionEmpty(region);
 	}
 
@@ -989,7 +989,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),
-				      &region->extents))
+				      region->extents))
 		return;
 	RegionEmpty(region);
 
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3513c1f93..85970d164 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -754,7 +754,7 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 		amdgpu_scanout_do_update(crtc, scanout_id,
 					 screen->GetWindowPixmap(screen->root),
-					 box);
+					 *box);
 		amdgpu_glamor_finish(scrn);
 	}
 }
@@ -3079,7 +3079,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			}
 
 			amdgpu_scanout_do_update(crtc, scanout_id, new_front,
-						 &extents);
+						 extents);
 
 			drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
 							drmmode_crtc->scanout_update_pending);
-- 
2.16.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-08 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 18:08 [PATCH xf86-video-amdgpu] Pass extents to amdgpu_scanout_do_update by value Michel Dänzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.