Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 228473 - x11-drivers/xf86-video-openchrome XvMC allocation fixes
Summary: x11-drivers/xf86-video-openchrome XvMC allocation fixes
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 292702
Blocks:
  Show dependency tree
 
Reported: 2008-06-20 09:44 UTC by Hasse Hagen Johansen
Modified: 2009-12-16 20:28 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
debug patch (debug.patch,1.33 KB, patch)
2008-11-25 14:16 UTC, Daniel Drake (RETIRED)
Details | Diff
Modified patch (myxvmcdebug.patch,3.39 KB, patch)
2008-11-25 21:36 UTC, Robert
Details | Diff
kernel debug patch (drmdebug.patch,1.68 KB, patch)
2008-11-26 10:26 UTC, Daniel Drake (RETIRED)
Details | Diff
xf86-video-openchrome fix (ioctlfix.patch,1.12 KB, patch)
2008-11-26 23:27 UTC, Daniel Drake (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hasse Hagen Johansen 2008-06-20 09:44:43 UTC
I have for a couple of weeks had a fight getting xvmc n my via s8000e working again. Today I found the cause to be the kernel version newer than tuxonice-sources-2.6.25-r4

I have tried my old r3 version which works. My r4 and r5 doesn't work. I can see at r4 there was an update to genpatches. When using one of the failing versions I get this error when trying using via xvmc with mythtv:

ViaXvMC: Could not allocate timestamp blit area.
2008-06-20 11:25:39.231 VideoOutputXv Error: Unable to create XvMC Context, status(11): BadAlloc
2008-06-20 11:25:39.233 VideoOutputXv Error: Could not open XvMC port...

			You may wish to verify that your DISPLAY
			environment variable does not use an external
			network connection.

			You may also wish to verify that
			/etc/X11/XvMCConfig contains the correct
			vendor's XvMC library.

The exact same configuration works on earlier versions of the kernel(and I am also using the same kernel configuration file)

Reproducible: Always

Steps to Reproduce:
1.Boot affected kernel
2.start mythtv and tail mythtv logs
3.Watch tv. See the log

Actual Results:  
ViaXvMC: Could not allocate timestamp blit area.
2008-06-20 11:25:39.231 VideoOutputXv Error: Unable to create XvMC Context, status(11): BadAlloc
2008-06-20 11:25:39.233 VideoOutputXv Error: Could not open XvMC port...

			You may wish to verify that your DISPLAY
			environment variable does not use an external
			network connection.

			You may also wish to verify that
			/etc/X11/XvMCConfig contains the correct
			vendor's XvMC library.

Expected Results:  
Not these errors:

ViaXvMC: Could not allocate timestamp blit area.
2008-06-20 11:25:39.231 VideoOutputXv Error: Unable to create XvMC Context, status(11): BadAlloc
Comment 1 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-06-20 12:29:08 UTC
Does this also happen on gentoo-sources and/or vanilla-sources?
Comment 2 Hasse Hagen Johansen 2008-06-20 13:40:59 UTC
Ok. I will try compiling from gentoo and vanilla and report back
Comment 3 Hasse Hagen Johansen 2008-06-20 19:42:37 UTC
gentoo-sources-2.6.25-r4 & r5 works fine and doesn't break xvmc

At the moment I am compiling the newest available vanilla-source (version scheme seems to be different from gentoo and tuxonice sources)

Any vanilla version you would prefer. Is there one matching tuxonice without the various patches?
Comment 4 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-06-20 19:49:05 UTC
(In reply to comment #3)
> gentoo-sources-2.6.25-r4 & r5 works fine and doesn't break xvmc
> 
> At the moment I am compiling the newest available vanilla-source (version
> scheme seems to be different from gentoo and tuxonice sources)
> 
> Any vanilla version you would prefer. Is there one matching tuxonice without
> the various patches?

My main point is to determine if this is >any-sources-2.6.24-r4 related or specific to TuxOnIce, if this is TuxOnIce (the one single patch besides gentoo-patches) fault - then please report this upstream also.
Comment 5 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-06-20 19:50:06 UTC
( pressed Enter too soon )

As every version you mentioned uses same version of TuxOnIce it seems to be related to either gentoo-patches or changes in stable kernel (2.6.24.x).
Comment 6 Hasse Hagen Johansen 2008-06-20 20:00:59 UTC
I don't know if you missed the first line in my last post :-)

with gentoo-sources-2.6.25-r4 & r5 via xvmc works fine. The problem seems to be tuxonice related, but to be sure I will try the newest vanilla-sources available
Comment 7 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-06-20 20:13:24 UTC
(In reply to comment #6)
> I don't know if you missed the first line in my last post :-)
> 
> with gentoo-sources-2.6.25-r4 & r5 via xvmc works fine. The problem seems to be
> tuxonice related

No, I have not missed it - see my comment #5 - it's the same TuxOnIce version.
Comment 8 Hasse Hagen Johansen 2008-06-21 08:40:25 UTC
Ok. vanilla-sources 2.5.25.5 also has the bug
Comment 9 Krzysztof Pawlik (RETIRED) gentoo-dev 2008-06-21 09:38:10 UTC
(In reply to comment #8)
> Ok. vanilla-sources 2.5.25.5 also has the bug
> 

Comment 10 Hasse Hagen Johansen 2008-06-21 18:39:27 UTC
Ok. I did a lot of testing. I must have made a mistake in some of the versions I have reported working in earlier comments. So here is a summary of tests I have done today:

gentoo-sources-2.6.25-r3 working
gentoo-sources-2.6.25-r5 NOT working
gentoo-sources 2.6.25-r4 NOT working
vanilla-sources-2.6.25.5 NOT working
vanilla-sources-2.6.26-rc6 NOT working
vanilla-sources-2.6.25.3 NOT working
vanilla-sources-2.6.25 NOT working
vanilla-sources-2.6.25.1 NOT working
tuxonice-sources-2.6.25-r5 NOT working
tuxonice-sources-2.6.25-r4 NOT working
tuxonice-sources-2.6.25-r3 working

I know it may seem strange that I cannot get any of the vanilla-sources working, but then again I don't know which vanilla version tuxonice/gentoo sources 2.6.25-r3 is based on
Comment 11 Hasse Hagen Johansen 2008-06-22 19:53:14 UTC
Ok. Found out what is causing this bug. It seems to either be using the SLUB memory allocator or CONFIG_RESOURCES_64BIT set in kernel config..I will just compile one last kernel then I can tell.
Comment 12 Hasse Hagen Johansen 2008-06-24 20:12:48 UTC
Ok. Did some last test. I can get the bug to show consitently when using a kernel where I use the SLUB memory allocator instead of SLAB.
Comment 13 Duane Griffin 2008-07-12 02:30:15 UTC
Do you see anything interesting in dmesg after the error occurs? Which video driver are you using?
Comment 14 Hasse Hagen Johansen 2008-07-29 10:46:11 UTC
Ohh.I have just revisited this bug(got a private mail regarding it). I see that my last answer isn't in the report.

I don't see anything in dmesg when this happens
Comment 15 Hasse Hagen Johansen 2008-07-29 10:47:03 UTC
And I am using the via openchrome driver. I have also tried the xorg driver and unichrome driver. All behave the same
Comment 16 Robert 2008-07-30 11:06:53 UTC
I'm not running Gentoo, but I've seen this same problem in both Slackware 12.0 and Ubuntu 8.04 so I believe this problem to be distribution independent.

Before I found this bug report I did some testing on my own to try to find the problem. Here's what I did.

When I was running Slackware 12.0 I would see this problem whenever trying to upgrade my kernel to 2.6.24.x or 2.6.25-rcX. I didn't spend any time looking into the problem back then.

When I installed Ubuntu 8.04 the problem showed itself again. I found an old 2.6.20 kernel where the problem didn't show. I then used git bisect and got to this:

c153f45f9b7e30289157bba3ff5682291df16caa is first bad commit
commit c153f45f9b7e30289157bba3ff5682291df16caa
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Sep 3 12:06:45 2007 +1000

    drm: Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove
DRM_DEVICE.
    The data is now in kernel space, copied in/out as appropriate
according to t This results in DRM_COPY_{TO,FROM}_USER going away, and
error paths to deal with those failures.  This also means that XFree86
4.2.0 support for i810 DR is lost.

    Signed-off-by: Dave Airlie <airlied@linux.ie>

I e-mailed Dave Airlie and Eric Anholt and asked about this. Dave responded with:

> If you look for  the userspace code is possibly using drmCommandNone when 
> it should be using drmCommandWriteRead or something like that..
>
> Dave.

I've grepped through mythtv and openchrome driver/XvMC libraries, but have not found any explicit calls to drmCommandNone.

Yesterday I found this bug report and read that Hasse could get around the problem by switching from SLUB to SLAB so I checked the kernel configuration I'd used in my tests. I had been using SLUB since it was introduced. I also recompiled some failing kernels with SLAB instead of SLUB and indeed, the problem disappeared. I cannot reproduce the problem when using SLAB.

However, SLUB seems to work well for me in kernels before the c153f45f9b7e3028.. commit.

So, to me it looks like the c153f4.. commit breaks XvMC if using SLUB.

In my most recent tests I've been using an up-to-date Ubuntu 8.04 with MythTV 0.21, openchrome Xorg driver from SVN (revision 584) and vanilla Linux kernels of various versions.

Let me know if any more information is wanted.

The only error I find in logs which seems relevant to this is, as Hasse already has posted:
ViaXvMC: Could not allocate timestamp blit area.
2008-07-29 19:30:11.098 VideoOutputXv Error: Unable to create XvMC Context, status(11): BadAlloc
Comment 17 Andy Flach 2008-11-10 13:11:32 UTC
I have demonstrated this bug in both Mythbuntu 8.04 and 8.10 on a Via Epia SP8000e, which uses the Via C3 Eden (fanless) processor: It is impossible to get XvMC working with MythTV on these distributions, and the symptoms are as described in this bug report. 
Comment 18 Daniel Drake (RETIRED) gentoo-dev 2008-11-25 14:16:52 UTC
Created attachment 173349 [details, diff]
debug patch

Please apply this patch to x11-drivers/xf86-video-openchrome (I assume that's what you are using). It should cause more messages to be printed above:

 ViaXvMC: Could not allocate timestamp blit area.

It will help us diagnose why the allocation is failing.
Comment 19 Robert 2008-11-25 21:36:01 UTC
Created attachment 173392 [details, diff]
Modified patch

I applied the patch from comment 18, but had to change some more because I'm using a Unichrome Pro (CN400). I'm attaching my modified debug patch.

With my patch I see this:

updateLowLevelBuf failure:
 ret=-12, size=423940, mem->size=423940
updateLowLevelBuf failed with code -1
ViaXvMC: Could not allocate timestamp blit area.

This is with Ubuntu 8.10, Ubuntu kernel 2.6.27-7-generic and openchrome from SVN (revision 686).
Comment 20 Daniel Drake (RETIRED) gentoo-dev 2008-11-26 10:26:42 UTC
Created attachment 173424 [details, diff]
kernel debug patch

OK, digging further, please apply this patch to the kernel (version 2.6.27 if possible) and examine the dmesg output after reproducing this error
Comment 21 Robert 2008-11-26 22:42:53 UTC
Output from drmdebug.patch:
[  196.063397] sman_alloc tmp failed
[  196.063450] Video memory allocation failed, type=0 size=222599230

openchrome outputs the same information as in comment 19. This is with ubuntu's 2.6.27 kernel.
Comment 22 Daniel Drake (RETIRED) gentoo-dev 2008-11-26 23:27:54 UTC
Created attachment 173540 [details, diff]
xf86-video-openchrome fix

Ah! Think I found the bug.
Please apply this patch to xf86-video-openchrome and see if things are any better.
Comment 23 Robert 2008-11-27 07:28:54 UTC
That patch seems to fix the problem and make XvMC work again. Thanks for looking into this Daniel!

(I'm now sometimes seeing mythtv freezing when starting video, but that's probably a different problem because I don't see any memory allocation errors.)
Comment 24 Daniel Drake (RETIRED) gentoo-dev 2008-11-27 20:20:40 UTC
Thanks for testing. Over to the X11 maintainers then. I submitted the patch upstream here:
http://wiki.openchrome.org/pipermail/openchrome-devel/2008-November/000140.html
Comment 25 Andy Flach 2008-11-28 17:52:59 UTC
I also confirm that the ioctlfix.patch works with Mythbuntu 8.10 on a Via Epia SP8000e.
Comment 26 Daniel Drake (RETIRED) gentoo-dev 2009-01-17 13:35:39 UTC
The patch was accepted upstream:
http://www.openchrome.org/trac/changeset/694
Comment 27 Rémi Cardona (RETIRED) gentoo-dev 2009-08-17 23:06:33 UTC
I think upstream should be pinged to make proper releases, it's been a long time since their last one.

In any case, feel free to make the modifications/patches, no-one in the X team has via/openchrome hardware.

Thanks
Comment 28 Jeroen Roovers (RETIRED) gentoo-dev 2009-11-10 18:05:51 UTC
Does x11-drivers/xf86-video-openchrome-0.2.904 include all the fixes? It's up for stabilisation soon (bug #292702).
Comment 29 Daniel Drake (RETIRED) gentoo-dev 2009-11-10 18:34:25 UTC
yep
Comment 30 Tomáš Chvátal (RETIRED) gentoo-dev 2009-12-16 20:28:01 UTC
This bug is fixed. New version including all these fixes is in stable...