summaryrefslogtreecommitdiff
path: root/src/sna/sna_video.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-09-29 10:57:23 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-29 11:21:41 +0100
commit4a7587ca1c076f25eed67751f9a9e26c5dcd1692 (patch)
treecc0518393c4d5d200f58d3fad0d51e3aa3a3b917 /src/sna/sna_video.c
parent36d142153b45f4c95d606d14bbbb51d8fdec5d2e (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/sna/sna_video.c')
-rw-r--r--src/sna/sna_video.c9
1 files changed, 9 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;
}