xf86-video-intel: src/sna/sna_video.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jan 31 16:26:32 PST 2013


 src/sna/sna_video.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit cf0576f87102b1535268691e7e29661b0f9ee73b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 1 00:19:21 2013 +0000

    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 at chris-wilson.co.uk>

diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index 05d76dd..07fa829 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);


More information about the xorg-commit mailing list