xf86-video-amdgpu: Branch 'master' - 4 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Dec 1 08:06:21 UTC 2016


 src/amdgpu_drv.h      |    3 +--
 src/amdgpu_kms.c      |   30 +++++++++++++++++++++---------
 src/drmmode_display.c |   20 ++++++++++----------
 3 files changed, 32 insertions(+), 21 deletions(-)

New commits:
commit d60ea478cf2215ded7e1acf5817a0dae07e54026
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 30 16:28:27 2016 +0900

    Call amdgpu_drm_abort_entry on failure to flip to a scanout pixmap
    
    Fixes leaking the corresponding struct amdgpu_drm_queue list entry in
    that case.
    
    (Ported from radeon commit e2942449171fe628a7726e59bcaab65e27d88563)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index f8556c9..b2d098a 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -714,6 +714,7 @@ amdgpu_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
 					      0, drm_queue_seq, 0) != 0) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s\n",
 			   __func__, strerror(errno));
+		amdgpu_drm_abort_entry(drm_queue_seq);
 		return;
 	}
 
@@ -985,6 +986,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
 					      0, drm_queue_seq, 0) != 0) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s\n",
 			   __func__, strerror(errno));
+		amdgpu_drm_abort_entry(drm_queue_seq);
 		return;
 	}
 
commit aea70298ef0d53fc81aa1fd22c8566920a856223
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 30 16:27:10 2016 +0900

    Call ValidateGC after ChangeClip in amdgpu_sync_scanout_pixmaps
    
    The wrong order meant that the clipping region wasn't actually applied,
    so it always copied the full contents from the other scanout pixmap.
    
    (Ported from radeon commit 14c3f59f5157885ad8f941f0bad6c0c5e3db12f8)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 8a2fd30..f8556c9 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -403,8 +403,8 @@ amdgpu_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr new_region,
 
 	gc = GetScratchGC(dst->depth, pScreen);
 	if (gc) {
-		ValidateGC(dst, gc);
 		gc->funcs->ChangeClip(gc, CT_REGION, sync_region, 0);
+		ValidateGC(dst, gc);
 		sync_region = NULL;
 		gc->ops->CopyArea(src, dst, gc, 0, 0, dst->width, dst->height, 0, 0);
 		FreeScratchGC(gc);
commit 0f79c30619168c6845b143c6ed94ade307383068
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 30 16:25:52 2016 +0900

    Fix amdgpu_scanout_extents_intersect for GPU screens
    
    Fixes incorrect screen updates with TearFree enabled on PRIME slave
    outputs which are not located at (0, 0).
    
    (Ported from radeon commit a995f5830916a0fee5126263d1bfe48632be3a15)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 48e65a1..8a2fd30 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -300,11 +300,21 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 static Bool
 amdgpu_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents)
 {
-	extents->x1 -= xf86_crtc->filter_width >> 1;
-	extents->x2 += xf86_crtc->filter_width >> 1;
-	extents->y1 -= xf86_crtc->filter_height >> 1;
-	extents->y2 += xf86_crtc->filter_height >> 1;
-	pixman_f_transform_bounds(&xf86_crtc->f_framebuffer_to_crtc, extents);
+#ifdef AMDGPU_PIXMAP_SHARING
+	if (xf86_crtc->scrn->is_gpu) {
+		extents->x1 -= xf86_crtc->x;
+		extents->y1 -= xf86_crtc->y;
+		extents->x2 -= xf86_crtc->x;
+		extents->y2 -= xf86_crtc->y;
+	} else
+#endif
+	{
+		extents->x1 -= xf86_crtc->filter_width >> 1;
+		extents->x2 += xf86_crtc->filter_width >> 1;
+		extents->y1 -= xf86_crtc->filter_height >> 1;
+		extents->y2 += xf86_crtc->filter_height >> 1;
+		pixman_f_transform_bounds(&xf86_crtc->f_framebuffer_to_crtc, extents);
+	}
 
 	extents->x1 = max(extents->x1, 0);
 	extents->y1 = max(extents->y1, 0);
commit 082b6b8ca1878f4b7ab0b25d16b85ba40748ac57
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Nov 30 16:21:28 2016 +0900

    Take current scanout_id into account everywhere involved with TearFree
    
    Fixes various potential issues with TearFree enabled, e.g. outputs
    freezing after display configuration changes.
    
    (Ported from radeon commit e543ef3a2fb304cbe3a965fb780632af2e4186f4)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 4eb4cf4..3a24fa7 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -292,8 +292,7 @@ typedef struct {
 Bool amdgpu_dri3_screen_init(ScreenPtr screen);
 
 /* amdgpu_kms.c */
-void amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame,
-				   uint64_t usec, void *event_data);
+Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id);
 
 /* amdgpu_present.c */
 Bool amdgpu_present_screen_init(ScreenPtr screen);
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index bc48ca6..48e65a1 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -582,7 +582,7 @@ amdgpu_prime_scanout_do_update(xf86CrtcPtr crtc, unsigned scanout_id)
 	return ret;
 }
 
-void
+static void
 amdgpu_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 				     void *event_data)
 {
@@ -757,7 +757,7 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
 }
 #endif
 
-static Bool
+Bool
 amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
@@ -863,7 +863,7 @@ amdgpu_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
 	drmmode_crtc->scanout_update_pending = FALSE;
 }
 
-void
+static void
 amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 							  void *event_data)
 {
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 30a0f54..79c9390 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -663,6 +663,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+	unsigned scanout_id = drmmode_crtc->scanout_id ^ info->tear_free;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	int saved_x, saved_y;
 	Rotation saved_rotation;
@@ -714,7 +715,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		fb_id = drmmode->fb_id;
 #ifdef AMDGPU_PIXMAP_SHARING
 		if (crtc->randr_crtc && crtc->randr_crtc->scanout_pixmap) {
-			fb_id = drmmode_crtc->scanout[0].fb_id;
+			fb_id = drmmode_crtc->scanout[scanout_id].fb_id;
 			x = y = 0;
 		} else
 #endif
@@ -758,11 +759,10 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 				pBox->x2 = max(pBox->x2, pScrn->virtualX);
 				pBox->y2 = max(pBox->y2, pScrn->virtualY);
 
-				drmmode_crtc->scanout_id = 0;
-				fb_id = drmmode_crtc->scanout[0].fb_id;
+				fb_id = drmmode_crtc->scanout[scanout_id].fb_id;
 				x = y = 0;
 
-				amdgpu_scanout_update_handler(crtc, 0, 0, drmmode_crtc);
+				amdgpu_scanout_do_update(crtc, scanout_id);
 				amdgpu_glamor_finish(pScrn);
 			}
 		}
@@ -845,7 +845,7 @@ done:
 	} else {
 		crtc->active = TRUE;
 
-		if (fb_id != drmmode_crtc->scanout[0].fb_id)
+		if (fb_id != drmmode_crtc->scanout[scanout_id].fb_id)
 			drmmode_crtc_scanout_free(drmmode_crtc);
 	}
 
@@ -1096,13 +1096,13 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t * red, uint16_t * green,
 static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+	unsigned scanout_id = drmmode_crtc->scanout_id;
 	AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn);
 	ScreenPtr screen = crtc->scrn->pScreen;
 	PixmapDirtyUpdatePtr dirty;
 
 	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
-		if (dirty->slave_dst !=
-		    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
+		if (dirty->slave_dst != drmmode_crtc->scanout[scanout_id].pixmap)
 			continue;
 
 		PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
@@ -1127,13 +1127,13 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 	}
 
 #ifdef HAS_DIRTYTRACKING_ROTATION
-	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[0].pixmap,
+	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap,
 				 0, 0, 0, 0, RR_Rotate_0);
 #elif defined(HAS_DIRTYTRACKING2)
-	PixmapStartDirtyTracking2(ppix, drmmode_crtc->scanout[0].pixmap,
+	PixmapStartDirtyTracking2(ppix, drmmode_crtc->scanout[scanout_id].pixmap,
 				  0, 0, 0, 0);
 #else
-	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[0].pixmap, 0, 0);
+	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap, 0, 0);
 #endif
 	return TRUE;
 }


More information about the xorg-commit mailing list