[Needs EXA] Video playback failes with compiz enabled

Bug #269357 reported by Tim Besard on 2008-09-12
104
This bug affects 5 people
Affects Status Importance Assigned to Milestone
xserver-xorg-driver-ati
Fix Released
High
xserver-xorg-video-ati (Ubuntu)
High
Unassigned
Declined for Intrepid by Bryce Harrington

Bug Description

Binary package hint: xserver-xorg-video-radeon

Video playbacks fails on the included radeon driver, when compiz is enabled. This is caused by the the XAA accelerator, which is used when compiz is enabled. That accelerator does not support a mechanism to migrate pixmaps from system ram to vram [1], which makes video playback fail with the following errors:
     X11 error: BadAlloc (insufficient resources for operation)

Using the new EXA accelerator instead of the old XAA one [2], makes video playback possible. This accelerator should be the default one when using the radeon driver, as having to disable 3D effects when you want to play video is HIGHLY annoying, especially when Compiz is enabled by default.

The Xorg option to force EXA:
    Option "AccelMethod" "EXA"

System details:
  Xorg window system 1:7.4~2ubuntu1
  RADEON display driver 1:6.9.0+git20080826.a3cc1d7a-2ubuntu2
  Sapphire X1650 Pro
  Ubuntu Intreprid, fully updated

Created an attachment (id=2149)
My xorg.conf

Created an attachment (id=2150)
Output from xvinfo

Created an attachment (id=2151)
My current Xorg.0.log

Created an attachment (id=2152)
Out from emerge --info on my Gentoo system.

This file might include some useful information for anybody reviewing this bug.

Update. After reverting back to 6.8.0 (trying to get rid of the bug) it turned
out I'm still experiencing it. I just never tried playing very large video clips
before moving to 6.8.2 it seems. Anyway, this bug still bugs me and is valid, so
please take a look at this sometime.

This bug appears similar to one at:

https://bugs.freedesktop.org/show_bug.cgi?id=474

The above bug has been repoened.

I am experiencing problems with XV unable to play high definition 1920x1080
video streams under mythtv. Lower resolution video streams play perfectly. When
displaying a HD stream, mythtv repeatedly reports:

X Error: BadAlloc (insufficient resources for operation) 11
  Major opcode: 142
  Minor opcode: 19
  Resource id: 0x0

I am running linux-2.6.12-gentoo-r1, xorg 6.8.2, ATI binary Radeon X800 XL 256MB
fglrx version 8.14.13, on a Pentium 4 2.4 GHz system.

I have the same problem on a 256M ram box with xorg 7.0 and i815 onboard video.
I had tha same problem on home box (NVidia card there) with older X, but I
upgraded ram to 256M+512M and it stopped to happen. On to bug report.

Trying to run "mplayer -v valles3d_hd.wmv" says:
...
Starting playback...
lavc_audio: error
avg. framerate: 4 fps
*** [vo] Allocating mp_image_t, 1280x720x12bpp YUV planar, 1382400 bytes
get_path('subfont.ttf') -> '/home/vda/.mplayer/subfont.ttf'
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
[xv] dx: 0 dy: 0 dw: 1273 dh: 764
A: 4,0 V: 3,0 A-V: 0,974 ct: 0,000 1/ 1 ??% ??% ??,?% 0 0
Type: 0, display: 873f910, resourceid: 1a00001, serial: 5c
Error code: b, request code: 8c, minor code: 13
MPlayer interrupted by signal 6 in module: vo_check_events
...

mplayer -v -vo x11, which does not use XVideo, works fine.

diff -u mplayer_xvideo.log mplayer_x11.log:

 Decoder is capable of YUV output (flags 0x1b)
 VDec: vo config request - 1280 x 720 (preferred csp: Packed YUY2)
 Trying filter chain: vo
-VDec: using Planar YV12 as output csp (no 0)
+VDec: using BGRA as output csp (no 3)
 Movie-Aspect is undefined - no prescaling applied.
-VO Config (1280x720->1280x720,flags=0,'MPlayer',0x32315659)
-VO: [xv] 1280x720 => 1280x720 Planar YV12
-VO: Description: X11/Xv
-VO: Author: Gerd Knorr <email address hidden> and others
-Xvideo image format: 0x35315652 (RV15) packed
-Xvideo image format: 0x36315652 (RV16) packed
-Xvideo image format: 0x32595559 (YUY2) packed
-Xvideo image format: 0x32315659 (YV12) planar
-Xvideo image format: 0x30323449 (I420) planar
-Xvideo image format: 0x59565955 (UYVY) packed
-using Xvideo port 57 for hw scaling
-[xv] dx: 0 dy: 0 dw: 1280 dh: 768
+VO Config (1280x720->1280x720,flags=0,'MPlayer',0x42475220)
+VO: [x11] 1280x720 => 1280x720 BGRA
+VO: Description: X11 ( XImage/Shm )
+VO: Author: Aaron Holtzman <email address hidden>
+Sharing memory.
+SwScaler: using unscaled BGRA -> BGRA special converter
 INFO: Win32/DMO video codec init OK.
 Selected video codec: [wmv9dmo] vfm:dmo (Windows Media Video 9 DMO)
 ==========================================================================
@@ -145,25 +139,17 @@
 lavc_audio: error

 avg. framerate: 4 fps
-*** [vo] Allocating mp_image_t, 1280x720x12bpp YUV planar, 1382400 bytes
+*** [vo] Allocating mp_image_t, 1280x720x32bpp BGR packed, 3686400 bytes
 get_path('subfont.ttf') -> '/home/vda/.mplayer/subfont.ttf'
 New_Face failed. Maybe the font path is wrong.
 Please supply the text font file (~/.mplayer/subfont.ttf).
 subtitle font: load_sub_face failed.
-[xv] dx: 0 dy: 0 dw: 1273 dh: 764
-X11 error: BadAlloc (insufficient resources for operation)
-Type: 0, display: 873f910, resourceid: 1a00001, serial: 5c
-Error code: b, request code: 8c, minor code: 13
-
-MPlayer interrupted by signal 6 in module: vo_check_events
-MPlayer crashed. This shouldn't happen.

valles3d_hd.wmv is available at:
http://video.mars.asu.edu:81/valles3d_hd.wmv
http://128.100.103.4/mirror/mars/valles3d_hd.wmv
(you do not need to download all of it, just a few megs will do).

This looks like a duplicate of https://bugs.freedesktop.org/show_bug.cgi?id=2445
but I'm confused by the last comment from Matthew Tippett, saying it should be
fixed.
I also get the same problem with an intel 855 gm card and xorg 7.1 trying to
play Elephants_Dream_HD.avi available here :
http://orange.blender.org/download

mplayer crash with the BadAlloc error :
...
VO: [xv] 1920x1080 => 1920x1080 Planar YV12
...
X11 error: BadAlloc (insufficient resources for operation)

Xine crash with only : xiTK received SIGSEGV signal, RIP.

mplayer allow to scale down the resolution, and at 800x600 the movie plays fine:
$ mplayer -vf scale=800:600 Elephants_Dream_HD.avi
...
VO: [xv] 800x600 => 1066x600 Planar YV12
...

The limit seems to be somewhere between 800x600 and 1024x768, which is still
quite far from 1920x1080.
I don't know if this information is relevant and what it exactly means :
$ xvinfo |grep max
    maximum XvImage size: 1920 x 1080

The i810 driver can benefit from the CacheLines option, by adding this in
xorg.conf :
Option "CacheLines" "1024"

With the following, I can still not play the movie at its native 1920x1080
resolution, but with mplayer scaling it down at 1024x768 , it works.

Apparently, the default for CacheLines is 512, and it can go up to 1040 with an
intel 855 GM chipset.

Sorry, the maximum CacheLines is in fact 1280.
What I find a bit strange however is that increasing VideoRam (default is 65536)
doesn't seem to help at all. I believe this chipset support up to 128MB, and
that's also what xorg log seems to tell when I try to set VideoRam to a higher
value:

(WW) I810(0): VideoRAM reduced to 196608 kByte (page aligned - was 200000)
(WW) I810(0): VideoRam reduced to 131072 kByte (limited to aperture size)
(II) I810(0): Will attempt to tell the BIOS that there is 12288 kB VideoRAM
(II) I810(0): BIOS now sees 12288 kB VideoRAM
(--) I810(0): Pre-allocated VideoRAM: 8060 kByte
(**) I810(0): VideoRAM: 131072 kByte
(--) I810(0): Maximum frambuffer space: 130904 kByte

I tried with mplayer again (with VideoRam to either 65536 or 131072) to see what
was the highest 16:9 resolution that didn't crash.
With the default CacheLines (512), it's 1072x603
With CacheLines set to the max (1280), it's 1728x972

This time, I tried to set the lowest VideoRam, using power of two.
If VideoRam is set to 8192, i810 fails to allocate framebuffer, and xorg can't
start. With VideoRam 16384, it works fine, and I still get the same result with
mplayer than with VideoRam 65536 or 131072.
So VideoRam seems to have 0 influence on this issue, is this expected ?
CacheLines however has a direct influence on it.

I see this on my notebook as well trying to play HD (1280x720) video.

xorg 7.1.1 w/ intel 1.7.2 driver

Intel 945GM w/ 2 GB of RAM

(II) I810(0): detected 7932 kB stolen memory.
(II) I810(0): Kernel reported 488960 total, 1 used
(II) I810(0): I830CheckAvailableMemory: 1955836 kB available
(II) I810(0): Monitoring connected displays enabled
(II) I810(0): Will attempt to tell the BIOS that there is 12288 kB VideoRAM

(II) I810(0): BIOS now sees 12288 kB VideoRAM
(--) I810(0): Pre-allocated VideoRAM: 7932 kByte
(==) I810(0): VideoRAM: 65536 kByte

The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 499 error_code 11 request_code 141 minor_code 19)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

The original reporter said this was on an ATI chip, but for those running with
Intel chips you need to use the option...

Option "LinearAlloc" "8192"

to give more memory to the allocator to allow for HDTV playback.

Oops. I totally missed that in the man page :embarrassed:

I'm curious, is there a reason the driver cannot allocate this automatically
somehow under various conditions?

Thank you for your help!

Normally XAA gets a small portion of memory for offscreen allocation, but due to
rasterizer limits it only gets a smaller portion of memory and it just so
happens that the Xv allocator uses the same memory manager and suffers from the
same restrictions even though the hardware Xv setup doesn't have the limits.

So, we end up allowing the user to add extra memory resources to the allocator
specifically for Xv. We can define some conditions to allocate more Xv memory,
but it just hasn't been done and so it's left to the user to allocate it.

I'm seeing this as well under Ubuntu 6.10 (xorg 7.1). Sporadically, when I try
to launch the vlc media player, I see this error message:

X Error of failed request: BadAlloc (insufficient resources for operation)
 Major opcode of failed request: 141 (XVideo)
 Minor opcode of failed request: 19 ()
 Serial number of failed request: 82
 Current serial number in output stream: 83

Rebooting X is the only solution. My video card is:

Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller

I am using the standard i810 xorg driver.

Removing me from this bug as the original report is ATI related - not Intel.

Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.

Probably a duplicate of bug #474.

To original reporter only:
Please test with a more recent version of Xserver and reopen if it persists. Better yet, open another report as this is swamped by fixed issues on other cards.

The problem PERSISTS with the latest xorg and i810 driver. I had to use the Cachelines trick to make my HD video to work with my Intel 945 card. Otherwise, totem,mplayer,vlc/etc they all crash because Xv can't cope with the large video files.

To test it, just download an HD trailer with an Xv-capable media player.

Please note that for SOME i8xx cards, the Cachelines trick does not work at all, and for those users, they can only hope for a fixed driver.

Confirming with xorg-x11-server-Xorg-1.3.0.0-5.fc7 and
Section "Device"
        Identifier "Videocard0"
        Driver "i810"
        Option "VideoRam" "65536"
        Option "LinearAlloc" "6144"
EndSection

I get this even with small videos (320x200) if played multiple times with mplayer, which suggest a video memory leak.

From bug 10912:
"
After talking to Eric, he mentioned that the problem is because of the use of
XAA. And although he doesn't directly mention what the work-around is, he
repeated it to me during our talk. Add to the device section:
        Option "AccelMethod" "EXA"

It doesn't exactly work well on my machine (performance-wise), but it does play
instead of crashing.
"

As Hadess says, yes, it works and doesn't crash, but performance is *awful*, and it appears to slow down all other windowing operations in Compiz, too.

For example, changing faces on the cube takes almost a full second if I have any windows up on the new cube face. Without EXA, it's liquid-smooth, no drag or delay.

Binary package hint: xserver-xorg-video-radeon

Video playbacks fails on the included radeon driver, when compiz is enabled. This is caused by the the XAA accelerator, which is used when compiz is enabled. That accelerator does not support a mechanism to migrate pixmaps from system ram to vram [1], which makes video playback fail with the following errors:
     X11 error: BadAlloc (insufficient resources for operation)

Using the new EXA accelerator instead of the old XAA one [2], makes video playback possible. This accelerator should be the default one when using the radeon driver, as having to disable 3D effects when you want to play video is HIGHLY annoying, especially when Compiz is enabled by default.

The Xorg option to force EXA:
    Option "AccelMethod" "EXA"

System details:
  Xorg window system 1:7.4~2ubuntu1
  RADEON display driver 1:6.9.0+git20080826.a3cc1d7a-2ubuntu2
  Sapphire X1650 Pro
  Ubuntu Intreprid, fully updated

Gabriel Rota (gabriel-rota) wrote :

I have added
Option "AccelMethod" "EXA"

vi /etc/X11/xorg.conf

Section "Device"
        Identifier "Configured Video Device"
+ Option "AccelMethod" "EXA"
EndSection

works fine :)

this fix all opengl problem in
https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/179042/comments/18

Bryce Harrington (bryce) wrote :

Probably related to / dupe of #267297

Changed in xserver-xorg-video-ati:
importance: Undecided → High
status: New → Triaged
Bryce Harrington (bryce) wrote :

Can you please attach your /var/log/Xorg.0.log and the output of 'lspci -vvnn'? Thanks ahead of time.

Bryce Harrington (bryce) on 2008-10-01
Changed in xserver-xorg-video-ati:
status: Triaged → Confirmed
allartk (allartk) wrote :

enabling exa had another draw back for me (and so maybe for others too):
https://bugs.freedesktop.org/show_bug.cgi?id=16193

(nb should I fill in a bug for this in launchpad too? )

Tim Besard (maleadt) wrote :

Bryce Harrington: I haden't spotted your reply earlier, I'll attach those logs right now.

allartk: I do not have this problem after enabling EXA, nor the message in my log. Some screen "corruption" appears when an application is starting up, but this is not related with the problem you are describing.

Tim Besard (maleadt) wrote :
Tim Besard (maleadt) wrote :
Bryce Harrington (bryce) wrote :

I think we may look into switching to EXA by default on -ati in jaunty. I need to investigate why it still uses XAA in case there are other issues that have to be addressed first.

Changed in xserver-xorg-video-ati:
status: Confirmed → Triaged
Øyvind Stegard (oyvinst) wrote :

Hi folks. I just tested the Intrepid RC live-CD on a laptop of mine, and XVideo is plain out of the question. Totem always crashes with the BadAlloc-error. The laptop has an ATI X1400 (R5XX) graphics card in it. I know I can solve it all after installation by going the Catalyst/fglrx-way, but I was really hoping I could use the open source drivers by now. Also, needless to say, this is a rather serious issue, since Compiz is enabled by default, after all ..

I will try changing the acceleration-method to EXA after I've got this Intrepid-thing installed for real. Just hope I won't get the corruption problem.

01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility X1400
 Subsystem: Lenovo Device 202a
 Flags: bus master, fast devsel, latency 0, IRQ 16
 Memory at d8000000 (32-bit, prefetchable) [size=128M]
 I/O ports at 2000 [size=256]
 Memory at ee000000 (32-bit, non-prefetchable) [size=64K]
 [virtual] Expansion ROM at ee020000 [disabled] [size=128K]
 Capabilities: [50] Power Management version 2
 Capabilities: [58] Express Legacy Endpoint, MSI 00
 Capabilities: [80] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-

Øyvind Stegard (oyvinst) wrote :

I've god Intrepid installed, and switched to EXA-acceleration in the radeon driver. It works great ! Video no longer causes crashes. I'm also pleased to see how much better the radeon-driver works compared to fglrx (for general non-gaming usage). I haven't observed any issues with corruption, yet.

marmuta (marmuta) wrote :

Please consider adding this option when switching to EXA:

   Option "AccelDFS" "true"

Without this flash videos slow down dramatically to some erratic 2 fps with 100% cpu.

Happens with EXA on a R430 [Radeon X800 XL] and
xserver-xorg-video-radeon 1:6.9.0+git20081003.f9826a56-0ubuntu2.

Øyvind Stegard (oyvinst) wrote :

An update on enabling EXA-acceleration in xserver-xorg-video-radeon 6.9.0+git20081003.f9826a56-0ubuntu2:
There are small corruption issues, and so it is right to still default to XAA.

The issues are not big, however:
* If I use a bitmap-font in Gnome-terminal (yes, "Fixed 6x13" is my favorite of all times), there is annoying glyph-corruption. This never happens with fonts that are anti-aliased, so workaround is to not use bitmapped fonts in Gnome-terminal.

* There is occasional small corruptions around check-box-widgets in web page forms when scrolling the page in Firefox. I've only seen this on pages with a large number of these boxes, like a typical GMail inbox.

* Very rarely, there is slight corruption below the mouse cursor, but only for certain applications. I've seen it in Emacs and when running a remote Firefox using X-forwarding (on RHEL5).

I plan to post proper bug-reports of these issues when I get around to it. And of course, if anyone knows about work-arounds for these issues, please do tell !

Also worth mentioning that I have tried the latest GIT-snapshot of the radeon-driver, and it works fine, but none of the issues above are fixed.

Øyvind Stegard (oyvinst) wrote :

Oh, and aside from the small corruption issues I mentioned above, the radeon-driver works extremely well, and is truly excellent for general desktop usage with Compiz. AMD/fglrx-developers should be ashamed of themselves.

Bryce Harrington (bryce) wrote :

Oyvind, thanks for the analysis/feedback on that. I'm thinking it's likely we'll switch to EXA for Jaunty. Would you mind ensuring that we have LP bug reports for each of those corruption issues, so we can forward them upstream and hopefully get them resolved before Jaunty? Include your lspci -vvnn, Xorg.0.log and (if possible) a photo in each bug report since we'll need that info when upstreaming.

Changed in xserver-xorg-video-ati:
status: Triaged → In Progress
Bryce Harrington (bryce) wrote :

[Setting to In Progress since this will be closed once we shift to EXA in Jaunty]

I'm excited about the prospects of fixing EXA acceleration for Jaunty, but in the meantime, the state of the driver currently is not an acceptable replacement for the proprietary driver and should not be the default in Intrepid. The average user who can no longer play videos with any media player is not going to be happy...

on., 29.10.2008 kl. 21.40 +0000, skrev Bryce Harrington:
> Oyvind, thanks for the analysis/feedback on that. I'm thinking it's
> likely we'll switch to EXA for Jaunty. Would you mind ensuring that we
> have LP bug reports for each of those corruption issues, so we can
> forward them upstream and hopefully get them resolved before Jaunty?
> Include your lspci -vvnn, Xorg.0.log and (if possible) a photo in each
> bug report since we'll need that info when upstreaming.
<snip>

Hi,

Yes, I will see to it that each of the corruption-issues I mentioned
will get a LP bug. They can propagate upstream from here, like you said.
I can reproduce all of the issues easily, except the mouse cursor
corruption, which is more rare. I'll make sure the necessary info is
included in each report.

Regards,
Øyvind

Øyvind Stegard (oyvinst) wrote :

I've filed individual reports about the different corruption issues:

Bitmap-font glyph corruption in Gnome-terminal [EXA enabled]:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/291040

Form check-box corruption in Firefox [Human GTK-theme, EXA enabled]:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/291045

Occasional mouse cursor corruption [EXA enabled]:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/291053

Occasional tiny window decoration corruption [EXA enabled, Compiz]:
https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/291055

Bryce Harrington (bryce) wrote :

Can you also test if this issue can be reproduced with mplayer? I'm wondering if this is an exact dupe of bug 38939. If so, the bugs could be merged. It's got a workaround for using mplayer.

Changed in xserver-xorg-driver-ati:
status: Unknown → Confirmed
yjmalmsteen85 (nirvana705) wrote :

HI!!!
I've the same problem with my Intrepid! When I try to play some videos, vlc and totem crash. I have a Matrox video card (VGA compatible controller: Matrox Graphics, Inc. MGA G400/G450 (rev 03).
I don't use any restricted driver, and I didn't install any video driver. I've just installed Intrepid!! The command "glxinfo |grep rendering" answers:"Yes", but I can't activate any effect. So I don't know if compiz is activated or not!!
This is the output of vlc when I try to play a video:

[????????] x11 video output error: X11 request 140.19 failed with error code 11:
 BadAlloc (insufficient resources for operation)
X Error of failed request: BadAlloc (insufficient resources for operation)
  Major opcode of failed request: 140 (XVideo)
  Minor opcode of failed request: 19 ()
  Serial number of failed request: 87
  Current serial number in output stream: 88
Segmentation fault

Komoto (komoto) wrote :

I'm getting this issue on Ubuntu 8.10.

I've got an ATI X1550 (MSI RX1550 TD256EH).

When Visual Effects (in System -> Preferences -> Appearance) is set to anything but "None", the following applications die the moment you try to play a video through them:
  o VLC
  o Mplayer
  o Miro (xine backend)
  o Totem

Mplayer can be made to play video by starting it with the command:
mplayer -vo x11 your_video.avi

Possible duplicate:
https://bugs.launchpad.net/bugs/282988

cu_ (avkv-prasad) wrote :

Thanks Komoto. That worked. And now vlc works too with the following command.

vlc --vout x11

With my Radeon 9600 Pro, when I EXA enabled, my xserver would randomly freeze when under load. I fixed this by adding 'Option "AGPMode" "1"' to my xorg.conf under the "Device" section for the video device.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xserver-xorg-video-ati - 1:6.9.0+git20081003.f9826a56-0ubuntu6

---------------
xserver-xorg-video-ati (1:6.9.0+git20081003.f9826a56-0ubuntu6) jaunty; urgency=low

  * Add 104_use_exa.patch: Switches to EXA acceleration by default.
    + See https://wiki.ubuntu.com/X/Blueprints/RadeonXaaToExa
    + Should close the following bugs (please reopen if not):
      LP: #227936, #269357, 68224 110384 132707

 -- Bryce Harrington <email address hidden> Fri, 19 Dec 2008 19:46:27 -0800

Changed in xserver-xorg-video-ati:
status: In Progress → Fix Released

Closing, EXA acceleration should be a lot better with recent xserver (>1.6.1) and recent x86-video-ati. Reopen if you have same issue with such recent software.

Changed in xserver-xorg-driver-ati:
status: Confirmed → Fix Released
tags: added: iso-testing
Dan Quade (danquade) wrote :

Why is bug #278196 marked as duplicate?
It has nothing to do with this one.

Video playback works fine on my system, but Rhythmbox crashes with visualizations.

Please fix this error.

Changed in xserver-xorg-driver-ati:
importance: Unknown → High
Changed in xserver-xorg-driver-ati:
importance: High → Unknown
Changed in xserver-xorg-driver-ati:
importance: Unknown → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.