[PATCH xf86-video-ati] Pass extents to amdgpu_scanout_do_update by value

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

 



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

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

(Ported from amdgpu commit 8af989546907ad9fb491d940e1936d3bfc89276b)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 93261dc8d..f056bf3b4 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -817,7 +817,7 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 		radeon_scanout_do_update(crtc, scanout_id,
 					 screen->GetWindowPixmap(screen->root),
-					 box);
+					 *box);
 		radeon_bo_wait(drmmode_crtc->scanout[scanout_id].bo);
 	}
 }
@@ -3282,7 +3282,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			}
 
 			radeon_scanout_do_update(crtc, scanout_id, new_front,
-						 &extents);
+						 extents);
 
 			drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
 							drmmode_crtc->scanout_update_pending);
diff --git a/src/radeon.h b/src/radeon.h
index 0815cd984..598a83c17 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -672,7 +672,7 @@ Bool radeon_dri3_screen_init(ScreenPtr screen);
 
 /* radeon_kms.c */
 Bool radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
-			      PixmapPtr src_pix, BoxPtr extents);
+			      PixmapPtr src_pix, BoxRec extents);
 void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
 				   , RegionPtr pBSRegion
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 8c3d15eb0..26810e084 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -903,10 +903,10 @@ radeon_dirty_update(ScrnInfoPtr scrn)
 
 Bool
 radeon_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;
     RADEONInfoPtr info = RADEONPTR(scrn);
@@ -915,11 +915,11 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
 
     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 (!radeon_scanout_extents_intersect(xf86_crtc, extents))
+    if (!radeon_scanout_extents_intersect(xf86_crtc, &extents))
 	return FALSE;
 
     if (drmmode_crtc->tear_free) {
@@ -965,9 +965,9 @@ radeon_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:
@@ -981,9 +981,9 @@ radeon_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);
     }
 
@@ -1015,7 +1015,7 @@ radeon_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 	drmmode_crtc->dpms_mode == DPMSModeOn) {
 	if (radeon_scanout_do_update(crtc, drmmode_crtc->scanout_id,
 				     screen->GetWindowPixmap(screen->root),
-				     &region->extents))
+				     region->extents))
 	    RegionEmpty(region);
     }
 
@@ -1096,7 +1096,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
     scanout_id = drmmode_crtc->scanout_id ^ 1;
     if (!radeon_scanout_do_update(xf86_crtc, scanout_id,
 				  pScreen->GetWindowPixmap(pScreen->root),
-				  &region->extents))
+				  region->extents))
 	return;
     RegionEmpty(region);
 
-- 
2.16.2



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

  Powered by Linux