summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-02-01 00:19:21 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-02-01 00:22:57 +0000
commitcf0576f87102b1535268691e7e29661b0f9ee73b (patch)
treef8e6d51107f16129bb7c78e32558f8ce830390a8
parent268285d9a64fc47fe81fe5bfbfbd1890dad53e1e (diff)
sna/video: Correct computation of planar frame size
The total frame size is less than 3 times the subsampled chroma planes due to the additional alignment bytes. Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1104180 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_video.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index 05d76dda..07fa829f 100644
--- a/src/sna/sna_video.c
+++ b/src/sna/sna_video.c
@@ -215,19 +215,22 @@ sna_video_frame_init(struct sna *sna,
align = 1024;
#endif
- /* Determine the desired destination pitch (representing the chroma's pitch,
- * in the planar case.
+ /* Determine the desired destination pitch (representing the
+ * chroma's pitch in the planar case).
*/
if (is_planar_fourcc(id)) {
+ assert((width & 1) == 0);
+ assert((height & 1) == 0);
if (video->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
frame->pitch[0] = ALIGN((height / 2), align);
frame->pitch[1] = ALIGN(height, align);
- frame->size = 3U * frame->pitch[0] * width;
+ frame->size = width;
} else {
frame->pitch[0] = ALIGN((width / 2), align);
frame->pitch[1] = ALIGN(width, align);
- frame->size = 3U * frame->pitch[0] * height;
+ frame->size = height;
}
+ frame->size *= frame->pitch[0] + frame->pitch[1];
} else {
if (video->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
frame->pitch[0] = ALIGN((height << 1), align);