xf86-video-intel: 2 commits - src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Aug 15 15:08:55 PDT 2012


 src/sna/sna_display.c |   87 +++++++++++++++++++++++++++-----------------------
 1 file changed, 47 insertions(+), 40 deletions(-)

New commits:
commit 1a389842347bab9d91240444e161589071eb9a47
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Aug 15 23:07:16 2012 +0100

    sna: Avoid queuing a pageflip on a DPMS off pipe
    
    If the pipe is not running, attempting to queue a pageflip will result
    in an error and us disabling the output in retaliation.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 841d841..c36dda9 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -141,6 +141,7 @@ static unsigned get_fb(struct sna *sna, struct kgem_bo *bo,
 	     __FUNCTION__, width, height, scrn->depth, scrn->bitsPerPixel));
 
 	assert(bo->tiling != I915_TILING_Y);
+	assert((bo->pitch & 63) == 0);
 
 	VG_CLEAR(arg);
 	arg.width = width;
@@ -2943,38 +2944,42 @@ void sna_mode_redisplay(struct sna *sna)
 
 		for (i = 0; i < config->num_crtc; i++) {
 			struct sna_crtc *crtc = config->crtc[i]->driver_private;
-			struct drm_mode_crtc_page_flip arg;
 
-			DBG(("%s: crtc %d active? %d\n",
-			     __FUNCTION__, i, crtc->bo != NULL));
+			DBG(("%s: crtc %d [%d, pipe=%d] active? %d\n",
+			     __FUNCTION__, i, crtc->id, crtc->pipe, crtc->bo != NULL));
 			if (crtc->bo != old)
 				continue;
 
-			arg.crtc_id = crtc->id;
-			arg.fb_id = get_fb(sna, new,
-					   sna->scrn->virtualX,
-					   sna->scrn->virtualY);
-			if (arg.fb_id == 0)
-				goto disable;
-
-			/* Only the reference crtc will finally deliver its page flip
-			 * completion event. All other crtc's events will be discarded.
-			 */
-			arg.user_data = 0;
-			arg.flags = DRM_MODE_PAGE_FLIP_EVENT;
-			arg.reserved = 0;
-
-			if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_PAGE_FLIP, &arg)) {
-				DBG(("%s: flip [fb=%d] on crtc %d [%d] failed - %d\n",
-				     __FUNCTION__, arg.fb_id, i, crtc->id, errno));
+			assert(config->crtc[i]->enabled);
+
+			if (crtc->dpms_mode == DPMSModeOn) {
+				struct drm_mode_crtc_page_flip arg;
+				arg.crtc_id = crtc->id;
+				arg.fb_id = get_fb(sna, new,
+						   sna->scrn->virtualX,
+						   sna->scrn->virtualY);
+				if (arg.fb_id == 0)
+					goto disable;
+
+				/* Only the reference crtc will finally deliver its page flip
+				 * completion event. All other crtc's events will be discarded.
+				 */
+				arg.user_data = 0;
+				arg.flags = DRM_MODE_PAGE_FLIP_EVENT;
+				arg.reserved = 0;
+
+				if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_PAGE_FLIP, &arg)) {
+					DBG(("%s: flip [fb=%d] on crtc %d [%d, pipe=%d] failed - %d\n",
+					     __FUNCTION__, arg.fb_id, i, crtc->id, crtc->pipe, errno));
 disable:
-				sna_crtc_disable(config->crtc[i]);
-				continue;
+					sna_crtc_disable(config->crtc[i]);
+					continue;
+				}
+				sna->mode.shadow_flip++;
 			}
 
 			kgem_bo_destroy(&sna->kgem, old);
 			crtc->bo = kgem_bo_reference(new);
-			sna->mode.shadow_flip++;
 		}
 
 		if (sna->mode.shadow) {
commit 615739556dd1cc4565eb1c47f93fe8abd697802f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Aug 15 20:10:52 2012 +0100

    sna: Only continue to update the shadow buffer if the flips succeeded
    
    If the flip fail, we disable the crtc and may end up disabling the
    output, removing the shadow (and old scanout bo) in the process.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 7754efa..841d841 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2977,23 +2977,25 @@ disable:
 			sna->mode.shadow_flip++;
 		}
 
-		/* XXX only works if the kernel stalls fwrites to the current
-		 * scanout whilst the flip is pending
-		 */
-		while (sna->mode.shadow_flip)
-			sna_mode_wakeup(sna);
-		(void)sna->render.copy_boxes(sna, GXcopy,
-					     sna->front, new, 0, 0,
-					     sna->front, old, 0, 0,
-					     REGION_RECTS(region),
-					     REGION_NUM_RECTS(region),
-					     COPY_LAST);
-		kgem_submit(&sna->kgem);
-
-		sna_pixmap(sna->front)->gpu_bo = old;
-		sna->mode.shadow = new;
-
-		new->flush = old->flush;
+		if (sna->mode.shadow) {
+			/* XXX only works if the kernel stalls fwrites to the current
+			 * scanout whilst the flip is pending
+			 */
+			while (sna->mode.shadow_flip)
+				sna_mode_wakeup(sna);
+			(void)sna->render.copy_boxes(sna, GXcopy,
+						     sna->front, new, 0, 0,
+						     sna->front, old, 0, 0,
+						     REGION_RECTS(region),
+						     REGION_NUM_RECTS(region),
+						     COPY_LAST);
+			kgem_submit(&sna->kgem);
+
+			sna_pixmap(sna->front)->gpu_bo = old;
+			sna->mode.shadow = new;
+
+			new->flush = old->flush;
+		}
 
 		RegionEmpty(region);
 	}


More information about the xorg-commit mailing list