diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-16 21:55:16 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-16 22:03:25 +0100 |
commit | 6692077aca2dcb7754b23b6404ff2db2f70228dc (patch) | |
tree | 5ae205719c13ec37e760c7120ff5d16d52fc7556 | |
parent | d8c9b2c85256c870f9677a590f190856826c821c (diff) | |
download | xf86-video-intel-6692077aca2dcb7754b23b6404ff2db2f70228dc.tar.gz xf86-video-intel-6692077aca2dcb7754b23b6404ff2db2f70228dc.tar.bz2 xf86-video-intel-6692077aca2dcb7754b23b6404ff2db2f70228dc.zip |
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@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_video.h | 1 | ||||
-rw-r--r-- | src/sna/sna_video_overlay.c | 17 | ||||
-rw-r--r-- | src/sna/sna_video_sprite.c | 11 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/sna/sna_video.h b/src/sna/sna_video.h index f3978f84b..875f8cce7 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 7a5b5dbf2..7dc74b755 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 1a1883baf..dbcb4709e 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; } |