Created attachment 34666 [details]
Screenshot of the breakage.
Playing any video (with at least the YV12 colourspace) whose width is not one of:
a) a multiple of 8
b) two less than a multiple of 8.
using XVideo results in garbage output, as shown in attached screenshot. It looks like the chroma is correct, but the luma is wrong. The output does not depend on the actual window size.
For example, widths of 846 and 848 are OK, 850 and 852 are corrupt, 854 and 856 are OK again, etc. The problem is easily reproducible by using mplayer -vf scale=852:-2 on any video.
I'm using xf86-video-intel-2.11.0 with a GM45.
I can confirm this on my 965GM. To add some additional details, this only occurs when using the "Intel(R) Textured Video" XV adapter; the "Intel(R) Video Overlay" simply refuses to accept unusual video sizes (giving a BadAlloc error).
This isn't typically a problem, as most video encoding is done with sizes that are a multiple of 16 pixels for encoder efficiency.
Sounds similar to #27417.
Indeed, it sounds very similar.
*** This bug has been marked as a duplicate of bug 27417 ***
Created attachment 34806 [details] [review]
fixup stride on i965 overlay
This should fix the BadAlloc problem for odd video sizes on the overlay xv adaptor on i965. Can someone please test this (I don't have a i965G laying around)?
Hmm. I can't test this patch without rolling back to an earlier git of the intel driver, the current one doesn't start at all on my card!
I'm getting an assertion:
X: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
Right after this is printed to the X log:
[ 729.905] (==) intel(0): DPMS enabled
[ 729.905] (==) intel(0): Intel XvMC decoder enabled
[ 729.905] (II) intel(0): Set up textured video
[ 729.905] (II) intel(0): Set up overlay video
Which means that it probably has to do with the recent overlay/xvmc changes pushed in. I'll bisect that and make a new bug if appropriate.
OK, I can confirm that your patch (tested against 2.11.0) fixes the BadAlloc errors when using the XV Video Overlay with unusual video widths. There are no errors printed, and the video is displayed correctly.
> --- Comment #6 from Calvin Walton <firstname.lastname@example.org> 2010-04-08 12:50:18 PDT ---
> OK, I can confirm that your patch (tested against 2.11.0) fixes the BadAlloc
> errors when using the XV Video Overlay with unusual video widths. There are no
> errors printed, and the video is displayed correctly.
Thanks for testing.
Since this bug report ended up revealing and correcting a somewhat different issue, I'm changing the resolution to "fixed".