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

Chris Wilson ickle at kemper.freedesktop.org
Tue Jan 28 09:38:26 PST 2014


 src/sna/kgem.c        |   43 +++++++++++++++++++++++++++++++++++++++----
 src/sna/sna_display.c |   11 ++++++-----
 2 files changed, 45 insertions(+), 9 deletions(-)

New commits:
commit 8b0ebebcab21647348f769c25ca0c1d81d169e75
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 28 16:30:47 2014 +0000

    sna: Be a little more assertive in retiring after set-domain
    
    After a successful set-domain for writing with the CPU, we know that the
    buffer is idle so remove it from our request tracking. (External clients
    complicate matters in that they may keep the bo active even after our
    set-domain.) On the contrary, because of read-read optimisations a bo
    may still be active after a set-domain for reading by the CPU, in which
    we need to remain conservative in retiring the bo.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 66f5e7b..2cf2c89 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -245,8 +245,20 @@ static void assert_tiling(struct kgem *kgem, struct kgem_bo *bo)
 	(void)do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &tiling);
 	assert(tiling.tiling_mode == bo->tiling);
 }
+
+static void assert_bo_retired(struct kgem_bo *bo)
+{
+	DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
+	     bo->handle, bo->domain, bo->exec != NULL, bo->rq != NULL));
+	assert(bo->refcnt);
+	assert(bo->rq == NULL);
+	assert(bo->exec == NULL);
+	assert(list_is_empty(&bo->request));
+}
+
 #else
 #define assert_tiling(kgem, bo)
+#define assert_bo_retired(bo)
 #endif
 
 static void kgem_sna_reset(struct kgem *kgem)
@@ -493,6 +505,25 @@ static void kgem_bo_retire(struct kgem *kgem, struct kgem_bo *bo)
 	assert(list_is_empty(&bo->vma));
 
 	if (bo->rq) {
+		__kgem_bo_clear_busy(bo);
+		kgem_retire(kgem);
+	} else {
+		assert(!bo->needs_flush);
+		ASSERT_IDLE(kgem, bo->handle);
+	}
+
+	assert_bo_retired(bo);
+}
+
+static void kgem_bo_maybe_retire(struct kgem *kgem, struct kgem_bo *bo)
+{
+	DBG(("%s: retiring bo handle=%d (needed flush? %d), rq? %d [busy?=%d]\n",
+	     __FUNCTION__, bo->handle, bo->needs_flush, bo->rq != NULL,
+	     __kgem_busy(kgem, bo->handle)));
+	assert(bo->exec == NULL);
+	assert(list_is_empty(&bo->vma));
+
+	if (bo->rq) {
 		if (!__kgem_busy(kgem, bo->handle)) {
 			__kgem_bo_clear_busy(bo);
 			kgem_retire(kgem);
@@ -532,7 +563,7 @@ retry:
 
 	DBG(("%s: flush=%d, domain=%d\n", __FUNCTION__, bo->flush, bo->domain));
 	if (bo->exec == NULL) {
-		kgem_bo_retire(kgem, bo);
+		kgem_bo_maybe_retire(kgem, bo);
 		bo->domain = DOMAIN_NONE;
 	}
 	bo->gtt_dirty = true;
@@ -5693,9 +5724,13 @@ void kgem_bo_sync__cpu_full(struct kgem *kgem, struct kgem_bo *bo, bool write)
 		set_domain.write_domain = write ? I915_GEM_DOMAIN_CPU : 0;
 
 		if (do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain) == 0) {
-			if (bo->exec == NULL)
+			if (write) {
 				kgem_bo_retire(kgem, bo);
-			bo->domain = write ? DOMAIN_CPU : DOMAIN_NONE;
+				bo->domain = DOMAIN_CPU;
+			} else {
+				kgem_bo_maybe_retire(kgem, bo);
+				bo->domain = DOMAIN_NONE;
+			}
 		}
 	}
 }
@@ -6540,7 +6575,7 @@ void kgem_buffer_read_sync(struct kgem *kgem, struct kgem_bo *_bo)
 			     offset, length))
 			return;
 	}
-	kgem_bo_retire(kgem, &bo->base);
+	kgem_bo_maybe_retire(kgem, &bo->base);
 	bo->base.domain = DOMAIN_NONE;
 }
 
commit b99c8cbefdd8fec686ad81fbffebb70d43880779
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 28 12:51:00 2014 +0000

    sna: Cancel the backlight change if set-property(DPMS) fails
    
    If the kernel reports an error from setting the DPMS property, we need
    to undo the local changes and propagate back the error to the caller.
    Although the latter is prevented by the RandR API, we can at least
    restore the backlight.
    
    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 c28f558..cf3e576 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2418,11 +2418,12 @@ sna_output_dpms(xf86OutputPtr output, int dpms)
 					  sna_output->dpms_mode,
 					  dpms);
 
-	if (output->crtc)
-		drmModeConnectorSetProperty(sna->kgem.fd,
-					    sna_output->id,
-					    sna_output->dpms_id,
-					    dpms);
+	if (output->crtc &&
+	    drmModeConnectorSetProperty(sna->kgem.fd,
+					sna_output->id,
+					sna_output->dpms_id,
+					dpms))
+		dpms = sna_output->dpms_mode;
 
 	if (dpms == DPMSModeOn)
 		sna_output_dpms_backlight(output,


More information about the xorg-commit mailing list