Bug 27453 - XVideo corruption with certain video sizes.
Summary: XVideo corruption with certain video sizes.
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: 7.5 (2009.10)
Hardware: Other All
: medium normal
Assignee: Carl Worth
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-04 14:53 UTC by Nick Bowler
Modified: 2010-04-08 13:39 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Screenshot of the breakage. (636.10 KB, image/png)
2010-04-04 14:53 UTC, Nick Bowler
no flags Details
fixup stride on i965 overlay (918 bytes, patch)
2010-04-08 02:07 UTC, Daniel Vetter
no flags Details | Splinter Review

Description Nick Bowler 2010-04-04 14:53:58 UTC
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.
Comment 1 Calvin Walton 2010-04-04 20:46:32 UTC
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.
Comment 2 Julien Cristau 2010-04-05 01:52:24 UTC
Sounds similar to #27417.
Comment 3 Nick Bowler 2010-04-05 05:59:16 UTC
Indeed, it sounds very similar.

*** This bug has been marked as a duplicate of bug 27417 ***
Comment 4 Daniel Vetter 2010-04-08 02:07:43 UTC
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)?

Thanks alot.
Comment 5 Calvin Walton 2010-04-08 12:17:48 UTC
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.
Aborted

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.
Comment 6 Calvin Walton 2010-04-08 12:50:18 UTC
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 7 Daniel Vetter 2010-04-08 13:15:45 UTC
> --- Comment #6 from Calvin Walton <calvin.walton@gmail.com> 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.
Comment 8 Nick Bowler 2010-04-08 13:39:17 UTC
Since this bug report ended up revealing and correcting a somewhat different issue, I'm changing the resolution to "fixed".


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.