xf86-video-intel: 4 commits - src/sna/kgem.c src/sna/sna_video.h src/sna/sna_video_overlay.c src/sna/sna_video_sprite.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Aug 16 15:32:05 PDT 2013


 src/sna/kgem.c              |    8 ++++++++
 src/sna/sna_video.h         |    1 +
 src/sna/sna_video_overlay.c |   20 +++++++++++++++++++-
 src/sna/sna_video_sprite.c  |   15 +++++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit fed9ca236a0b5bbd7f1d137aa4ef9c2caf26719c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 16 22:43:26 2013 +0100

    sna/video: Turn off passthrough if given a zero name
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c
index 7dc74b7..0b53e6e 100644
--- a/src/sna/sna_video_overlay.c
+++ b/src/sna/sna_video_overlay.c
@@ -541,6 +541,9 @@ sna_video_overlay_put_image(ClientPtr client,
 		DBG(("%s: using passthough, name=%d\n",
 		     __FUNCTION__, *(uint32_t *)buf));
 
+		if (*(uint32_t*)buf == 0)
+			goto invisible;
+
 		frame.bo = kgem_create_for_name(&sna->kgem, *(uint32_t*)buf);
 		if (frame.bo == NULL) {
 			DBG(("%s: failed to open bo\n", __FUNCTION__));
diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index dbcb470..0323e46 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -373,6 +373,9 @@ static int sna_video_sprite_put_image(ClientPtr client,
 		DBG(("%s: using passthough, name=%d\n",
 		     __FUNCTION__, *(uint32_t *)buf));
 
+		if (*(uint32_t*)buf == 0)
+			goto invisible;
+
 		frame.bo = kgem_create_for_name(&sna->kgem, *(uint32_t*)buf);
 		if (frame.bo == NULL)
 			return BadAlloc;
commit 18e274425d728baa62445dc091cae6b1eab94a89
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 16 21:58:29 2013 +0100

    sna: Make sure that external scanouts are immediately discarded
    
    An issue with passthrough Xv buffers is that they end up in the scanout
    cache and potentially reused instead of being immediately discarded.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index e7de38c..56d32cb 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1833,6 +1833,13 @@ static void kgem_bo_move_to_scanout(struct kgem *kgem, struct kgem_bo *bo)
 	assert(!bo->snoop);
 	assert(!bo->io);
 
+	if (bo->purged) {
+		DBG(("%s: discarding purged scanout - external name?\n",
+		     __FUNCTION__));
+		kgem_bo_free(kgem, bo);
+		return;
+	}
+
 	DBG(("%s: moving %d [fb %d] to scanout cache, active? %d\n",
 	     __FUNCTION__, bo->handle, bo->delta, bo->rq != NULL));
 	if (bo->rq)
@@ -3511,6 +3518,7 @@ struct kgem_bo *kgem_create_for_name(struct kgem *kgem, uint32_t name)
 
 	bo->reusable = false;
 	bo->flush = true;
+	bo->purged = true; /* no coherency guarrantees */
 
 	debug_alloc__bo(kgem, bo);
 	return bo;
commit 6692077aca2dcb7754b23b6404ff2db2f70228dc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 16 21:55:16 2013 +0100

    sna/video: Keep a ref to the passthrough overlay bo
    
    Otherwise we will destroy it at the end of the frame whilst it is still
    meant to be shown. Not normally an issue as the next frame is show
    before it vanishes, but is if the image is shown for an extended period
    of time.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video.h b/src/sna/sna_video.h
index f3978f8..875f8cc 100644
--- a/src/sna/sna_video.h
+++ b/src/sna/sna_video.h
@@ -98,6 +98,7 @@ struct sna_video {
 	bool textured;
 	Rotation rotation;
 	int plane;
+	struct kgem_bo *bo;
 
 	int SyncToVblank;	/* -1: auto, 0: off, 1: on */
 	int AlwaysOnTop;
diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c
index 7a5b5db..7dc74b7 100644
--- a/src/sna/sna_video_overlay.c
+++ b/src/sna/sna_video_overlay.c
@@ -138,6 +138,10 @@ static int sna_video_overlay_stop(ClientPtr client,
 		       DRM_IOCTL_I915_OVERLAY_PUT_IMAGE,
 		       &request);
 
+	if (video->bo)
+		kgem_bo_destroy(&sna->kgem, video->bo);
+	video->bo = NULL;
+
 	sna_video_free_buffers(video);
 	sna_window_set_port((WindowPtr)draw, NULL);
 	return Success;
@@ -445,7 +449,18 @@ sna_video_overlay_show(struct sna *sna,
 
 	DBG(("%s: flags=%x\n", __FUNCTION__, request.flags));
 
-	return drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_OVERLAY_PUT_IMAGE, &request) == 0;
+	if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_OVERLAY_PUT_IMAGE, &request)) {
+		DBG(("%s: Putimage failed\n", __FUNCTION__));
+		return false;
+	}
+
+	if (video->bo != frame->bo) {
+		if (video->bo)
+			kgem_bo_destroy(&sna->kgem, video->bo);
+		video->bo = kgem_bo_reference(frame->bo);
+	}
+
+	return true;
 }
 
 static int
diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 1a1883b..dbcb470 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -72,8 +72,13 @@ static int sna_video_sprite_stop(ClientPtr client,
 		xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
 			   "failed to disable plane\n");
 
+	if (video->bo)
+		kgem_bo_destroy(&video->sna->kgem, video->bo);
+	video->bo = NULL;
+
 	video->plane = 0;
 	sna_window_set_port((WindowPtr)draw, NULL);
+
 	return Success;
 }
 
@@ -296,6 +301,12 @@ sna_video_sprite_show(struct sna *sna,
 
 	frame->bo->domain = DOMAIN_NONE;
 	video->plane = s.plane_id;
+
+	if (video->bo != frame->bo) {
+		if (video->bo)
+			kgem_bo_destroy(&sna->kgem, video->bo);
+		video->bo = kgem_bo_reference(frame->bo);
+	}
 	return true;
 }
 
commit d8c9b2c85256c870f9677a590f190856826c821c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 16 21:47:25 2013 +0100

    sna/video: Mark the sprite color key as changed when disabling
    
    Otherwise we will forgot to send the command to turn off the colorkey.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 221ba79..1a1883b 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -91,6 +91,7 @@ static int sna_video_sprite_set_attr(ClientPtr client,
 	} else if (attribute == xvAlwaysOnTop) {
 		DBG(("%s: ALWAYS_ON_TOP: %d -> %d\n", __FUNCTION__,
 		     video->AlwaysOnTop, !!value));
+		video->color_key_changed = true;
 		video->AlwaysOnTop = !!value;
 	} else
 		return BadMatch;


More information about the xorg-commit mailing list