diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-29 10:57:23 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-29 11:21:41 +0100 |
commit | 4a7587ca1c076f25eed67751f9a9e26c5dcd1692 (patch) | |
tree | cc0518393c4d5d200f58d3fad0d51e3aa3a3b917 /src | |
parent | 36d142153b45f4c95d606d14bbbb51d8fdec5d2e (diff) |
sna/video: Discard old video buffers when the frame size changes
Back in the good old days of the overlay, we only needed to care about
having a frame buffer large enough to hold the data. This changed with
the sprite interface which encodes the width x height into the
framebuffer and so we need to be careful when handing back a cached
buffer that it does indeed match the required dimensions.
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_video.c | 9 | ||||
-rw-r--r-- | src/sna/sna_video.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c index 2083a227..61f66151 100644 --- a/src/sna/sna_video.c +++ b/src/sna/sna_video.c @@ -96,6 +96,12 @@ sna_video_buffer(struct sna_video *video, if (video->buf && __kgem_bo_size(video->buf) < frame->size) sna_video_free_buffers(video); + if (video->buf && video->buf->scanout) { + if (frame->width != video->width || + frame->height != video->height) + sna_video_free_buffers(video); + } + if (video->buf == NULL) { if (video->tiled) { video->buf = kgem_create_2d(&video->sna->kgem, @@ -107,6 +113,9 @@ sna_video_buffer(struct sna_video *video, } } + video->width = frame->width; + video->height = frame->height; + return video->buf; } diff --git a/src/sna/sna_video.h b/src/sna/sna_video.h index cbb3ea3b..996377bd 100644 --- a/src/sna/sna_video.h +++ b/src/sna/sna_video.h @@ -92,6 +92,7 @@ struct sna_video { /** YUV data buffers */ struct kgem_bo *old_buf[2]; struct kgem_bo *buf; + int width, height; int alignment; bool tiled; |