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

Chris Wilson ickle at kemper.freedesktop.org
Thu Jul 17 01:31:54 PDT 2014


 src/sna/sna_display.c |   85 +++++++++++++++++++++++++-------------------------
 1 file changed, 44 insertions(+), 41 deletions(-)

New commits:
commit 95f08c171ebd9b594112ab006c4460702a22bec1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jul 17 09:20:35 2014 +0100

    sna: Busy-wait for the kernel to catch up when flipping
    
    If the kernel reports that it is busy, it has not yet finished
    processing a pending flip and we have multiple CRTC queued, just wait
    for the kernel to clear its backlog before submitting the next flip. On
    the other hand, if we can just overwrite the pending flip results.
    However, the EBUSY may actually be a genuine report by the kernel of an
    error, so check for an invalid CRTC first.
    
    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 89767ed..747d261 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4929,9 +4929,37 @@ fixup_flip:
 		}
 		arg.reserved = 0;
 
+retry_flip:
 		DBG(("%s: crtc %d id=%d, pipe=%d  --> fb %d\n",
 		     __FUNCTION__, i, crtc->id, crtc->pipe, arg.fb_id));
 		if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_PAGE_FLIP, &arg)) {
+			ERR(("%s: pageflip failed with err=%d\n", __FUNCTION__, errno));
+
+			if (errno == EBUSY) {
+				struct drm_mode_crtc mode;
+
+				memset(&mode, 0, sizeof(mode));
+				mode.crtc_id = crtc->id;
+				drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode);
+
+				DBG(("%s: crtc=%d, valid?=%d, fb attached?=%d, expected=%d\n",
+				     __FUNCTION__,
+				     mode.crtc_id, mode.mode_valid,
+				     mode.fb_id, fb_id(crtc->bo)));
+
+				if (mode.fb_id != fb_id(crtc->bo))
+					goto fixup_flip;
+
+				if (count == 0)
+					return 0;
+
+				DBG(("%s: throttling on busy flip / waiting for kernel to catch up\n", __FUNCTION__));
+				drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_THROTTLE, 0);
+				sna->kgem.need_throttle = false;
+
+				goto retry_flip;
+			}
+
 			xf86DrvMsg(sna->scrn->scrnIndex, X_ERROR,
 				   "page flipping failed, on CRTC:%d (pipe=%d), disabling %s page flips\n",
 				   crtc->id, crtc->pipe, data ? "synchronous": "asynchronous");
commit 0a9d3dd8c83749992e643675f16486092f2b00fa
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jul 17 08:53:13 2014 +0100

    sna: Silence valgrind when reading plane properties
    
    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 7390754..89767ed 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2198,6 +2198,8 @@ static int plane_details(struct sna *sna, struct plane *p)
 		if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_OBJ_GETPROPERTIES, &arg))
 			arg.count_props = 0;
 	}
+	VG(VALGRIND_MAKE_MEM_DEFINED(arg.props_ptr, sizeof(uint32_t)*arg.count_props));
+	VG(VALGRIND_MAKE_MEM_DEFINED(arg.prop_values_ptr, sizeof(uint64_t)*arg.count_props));
 
 	for (i = 0; i < arg.count_props; i++) {
 		struct drm_mode_get_property prop;
@@ -2234,6 +2236,7 @@ static int plane_details(struct sna *sna, struct plane *p)
 					/* XXX we assume that the mapping between kernel enum and
 					 * RandR remains fixed for our lifetimes.
 					 */
+					VG(VALGRIND_MAKE_MEM_DEFINED(enums, sizeof(*enums)*prop.count_enum_blobs));
 					for (j = 0; j < prop.count_enum_blobs; j++) {
 						DBG(("%s: rotation[%d] = %s [%lx]\n", __FUNCTION__,
 						     j, enums[j].name, (long)enums[j].value));
commit 0a57b55f0fcfa93b38015535002cb11eeaf1dd3a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jul 17 08:32:14 2014 +0100

    sna: Remove extraneous function wrapping
    
    Since we only have the single callsite for do_page_flip, the wrapper is
    not adding any meaningful information.
    
    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 18d70e8..7390754 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4842,30 +4842,30 @@ sna_crtc_flip(struct sna *sna, struct sna_crtc *crtc, struct kgem_bo *bo, int x,
 	return true;
 }
 
-static int do_page_flip(struct sna *sna, struct kgem_bo *bo,
-			sna_flip_handler_t handler, void *data)
+int
+sna_page_flip(struct sna *sna,
+	      struct kgem_bo *bo,
+	      sna_flip_handler_t handler,
+	      void *data)
 {
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
-	int width = sna->scrn->virtualX;
-	int height = sna->scrn->virtualY;
+	const int width = sna->scrn->virtualX;
+	const int height = sna->scrn->virtualY;
 	int count = 0;
 	int i;
 
+	DBG(("%s: handle %d attached\n", __FUNCTION__, bo->handle));
+	assert(bo->refcnt);
+
+	assert((sna->flags & SNA_IS_HOSTED) == 0);
 	assert((sna->flags & SNA_TEAR_FREE) == 0);
 	assert(sna->mode.flip_active == 0);
 
 	if ((sna->flags & (data ? SNA_HAS_FLIP : SNA_HAS_ASYNC_FLIP)) == 0)
 		return 0;
 
-	/*
-	 * Queue flips on all enabled CRTCs
-	 * Note that if/when we get per-CRTC buffers, we'll have to update this.
-	 * Right now it assumes a single shared fb across all CRTCs, with the
-	 * kernel fixing up the offset of each CRTC as necessary.
-	 *
-	 * Also, flips queued on disabled or incorrectly configured displays
-	 * may never complete; this is a configuration error.
-	 */
+	kgem_bo_submit(&sna->kgem, bo);
+
 	for (i = 0; i < sna->mode.num_real_crtc; i++) {
 		struct sna_crtc *crtc = config->crtc[i]->driver_private;
 		struct drm_mode_crtc_page_flip arg;
@@ -4949,35 +4949,7 @@ fixup_flip:
 		count++;
 	}
 
-	return count;
-}
-
-int
-sna_page_flip(struct sna *sna,
-	      struct kgem_bo *bo,
-	      sna_flip_handler_t handler,
-	      void *data)
-{
-	int count;
-
-	DBG(("%s: handle %d attached\n", __FUNCTION__, bo->handle));
-	assert(bo->refcnt);
-	assert((sna->flags & SNA_IS_HOSTED) == 0);
-
-	kgem_bo_submit(&sna->kgem, bo);
-
-	/*
-	 * Queue flips on all enabled CRTCs
-	 * Note that if/when we get per-CRTC buffers, we'll have to update this.
-	 * Right now it assumes a single shared fb across all CRTCs, with the
-	 * kernel fixing up the offset of each CRTC as necessary.
-	 *
-	 * Also, flips queued on disabled or incorrectly configured displays
-	 * may never complete; this is a configuration error.
-	 */
-	count = do_page_flip(sna, bo, handler, data);
 	DBG(("%s: page flipped %d crtcs\n", __FUNCTION__, count));
-
 	return count;
 }
 


More information about the xorg-commit mailing list