Opened 18 years ago

Closed 17 years ago

#1842 closed patch (fixed)

VLD + 1080i HDTV broken in 0.19-fixes

Reported by: jesse@… Owned by: danielk
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords: unichrome openchrome vld hdtv 1080i sp8000e sp13000 minimyth
Cc: teague@… Ticket locked: no

Description

1080i HDTV playback doesn't seem to work on VIA CN400 (unichrome-pro) chipsets via VGA output. Instead of the expected video, I can only see a bluish blank screen. Xine can playback a 1080i clip on the same machine from MythVideo? (the sound doesn't work, but I think that's a Xine bug), and mplayer can play back the same 1080i clip on the same machine from MythVideo? (with sound, but the A/V sync is poor and audio drops out after a while). When I try the 'Internal' player, I get audio, but just a bluish blank screen in place of the video.

I've performed this test on an SP8000e board and an SP13000 board, with 512M DDR 400 and 1GB DDR 400, respectively. No difference.

I'm using minimyth, and I've tried version 0.19-12, as well as 0.19-13beta2. The latter includes this patch, but the patch doesn't help:

diff -Naur mythtv-0.19-old/libs/libmythtv/videoout_xv.cpp mythtv-0.19-new/libs/libmythtv/videoout_xv.cpp
--- mythtv-0.19-old/libs/libmythtv/videoout_xv.cpp      2006-02-08 08:38:17.000000000 -0800
+++ mythtv-0.19-new/libs/libmythtv/videoout_xv.cpp      2006-05-21 07:20:31.000000000 -0700
@@ -794,7 +794,7 @@
         myth2av_codecid(myth_codec_id, vld, idct, mc);

         if (vld)
-            xvmc_buf_attr->SetNumSurf(16);
+            xvmc_buf_attr->SetNumSurf(8);

         vbuffers.Init(xvmc_buf_attr->GetNumSurf(),
                       false /* create an extra frame for pause? */,

Also, there is an openchrome discussion taking place here. Thomas Hellström's post from the above discussion link is what gave us the idea to try reducing the number of XvMC frames/surfaces as in the patch above.

The closest thing I've seen to a ticket matching this problem is #2, but I think we've ruled out going from 16 to 8 surfaces with the above patch. Also, I'm not sure why that ticket was closed as there is no explanation.

Attachments (5)

1842.patch (463 bytes) - added by danielk 18 years ago.
Lowers maximum number of buffers (for XvMC-VLD HDTV)
cn400.diff (3.8 KB) - added by teague@… 18 years ago.
Quick patch to make HD hardware decoding work on my CN400
cn400-mythtv-vid.patch (4.2 KB) - added by teague@… 17 years ago.
Patch against mythtv-vid to get it working on the CN400 chipset.
cn400-mythtv-vid-video.patch (4.5 KB) - added by teague@… 17 years ago.
Updated patch to get VLD decoding working for the mythtv-vid branch
cn400-mythtv-vid-config.patch (1.2 KB) - added by teague@… 17 years ago.
Fixed broken configure logic for VLD

Download all attachments as: .zip

Change History (26)

comment:1 Changed 18 years ago by danielk

Milestone: 0.20
Owner: changed from Isaac Richards to danielk
Priority: majorminor
Severity: highmedium
Version: 0.19head

comment:2 Changed 18 years ago by danielk

Resolution: fixed
Status: newclosed

(In [10104]) Fixes #1842 in mythtv-vid. Fixes VideoBuffers::CreateBuffers?() and removes VLD hack.

The problems was that the VideoBuffers::Init() call in CreateBuffers?() used "numbuffers" rather than "surfs.size()". So the extra allocated surfaces were never used in decoding.

comment:3 Changed 18 years ago by jesse@…

Resolution: fixed
Status: closedreopened

Backported this patch to 0.19 and I still get a blank bluish screen on an SP8000e. Another person tried the patch on an SP13000 without luck too.

comment:4 Changed 18 years ago by Isaac Richards

Resolution: fixed
Status: reopenedclosed

Reopen only if you meant to type 'Tested the current mythtv-vid branch...' but trac somehow mangled that to 'Backported this patch to 0.19...'.

comment:5 Changed 18 years ago by jesse@…

Resolution: fixed
Status: closedreopened

Tested with svn r10109. HDTV support w/VLD is vastly improved. Mythtv's Internal player can now handle low res HDTV, however, it can't handle 1080i.

I think the remaining issue may be memory related. The SP8000e (and I want to say all CN400 chipsets, but I'm no authority) can only allocate 64M of RAM to the video chipset in the BIOS. I think mythfrontend may be keeping too much of that memory allocated in the background.

Here's the result of my testing 1080i with xine and mythtv's Internal player from within MythVideo? on an SP8000e:

1.) Neither can handle 1080i with mythfrontend loaded. I get this error from xine when launched by MythVideo?:

(EE) VIA(0): [XvMC] ViaXvMCCreateSurface: Unable to allocate frambuffer memory! Unable to create XvMC Surface. video_out_xxmc: ERROR: Accelerated surface allocation failed. video_out_xxmc: You are probably out of framebuffer memory. video_out_xxmc: Falling back to software decoding.

2.) Xine can play 1080i if mythfrontend is NOT loaded. i.e., replace mythfrontend in /root/.xinitrc with xine -pfhq /path/to/1080i.mpg. So apparently mythfrontend/MythVideo is allocating some video memory and failing to let it go before xine is started.

3.) mythtv's Internal player can now handle low res HDTV, like the open movie, "Elephant's Dream" at 1024x576. (http://www.elephantsdream.org/) However, it can't handle 1080i. I get picture with 1080i, but it is segmented by vertical lines and playback is choppy.

Xine can handle Elephant's Dream too, but also fails to play 1080i with mythfrontend loaded in the background (see number 2 above). I can't conclusively say if mythtv's Internal player is suffering from the same video memory starvation as Xine or not, but that's my guess.

Changed 18 years ago by danielk

Attachment: 1842.patch added

Lowers maximum number of buffers (for XvMC-VLD HDTV)

comment:6 Changed 18 years ago by danielk

Can you try the "1842.patch" I just attached. If it doesn't work, try reducing the changed value one surface at a time until it works.

comment:7 Changed 18 years ago by danielk

Resolution: invalid
Status: reopenedclosed

No reply from ticket submitter, closing ticket.

comment:8 Changed 18 years ago by jesse@…

Resolution: invalid
Status: closedreopened

Used SVN 10186 as a base. Tried from max_num_xvmc_surfaces(12) to max_num_xvmc_surfaces(8). Blue screen at all times.

I also just noticed that my 1024x576 test movie is DivX, so it doesn't have anything to do with XvMC. I suppose the DivX playback in SVN MythVideo? is better than in 0.19 because the movie wouldn't play in 0.19. However, I don't know if low res MPEG2 HDTV (i.e. 720p) is working or not as I have no sources. All I have is 1080i, and it's not working.

I have a dedicated test box now (SP13000), so future testing will be much faster.

comment:9 Changed 18 years ago by danielk

Resolution: invalid
Status: reopenedclosed

There appears to be a problem with the OpenChrome? drivers with respect to XvMC memory allocation. I sent Ivor an e-mail yesterday, and it looks like they are looking into it. Until the driver problem is fixed there little point in trying to fix this on the MythTV side.

Jesse, can you reopen this ticket when there is a resolution on the driver side that requires a MythTV change? (I noticed you are on the OpenChrome? mailing list). Please also note it on the ticket if no change is needed in MythTV, but a certain driver revison is needed for HDTV XvMC with the OpenChrome? drivers.

comment:10 Changed 18 years ago by anonymous

Cc: teague@… added

comment:11 Changed 18 years ago by masterclc@…

Resolution: invalid
Status: closedreopened

VLD + 1080i still broken on latest release (0.20) and current SVN ;) In addition 720p is too stuttery to watch. In Xine both of these resolutions work on the Pro chipsets using xxmc output (CN400 on the SP13000 seems to be a common board, it is also confirmed on the SP8000 and the Commell LV-667). There is a thread discussing this on the mailing list, with a patch to at least display the video, though apparently the decoder now can't keep up: http://www.gossamer-threads.com/lists/mythtv/dev/226412

I realize Daniel is away ATM, so I am mostly just document the progress thus far. Another thread where this is being discussed currently: http://www.gossamer-threads.com/lists/mythtv/dev/226133

Thanks!

-Chad

comment:12 Changed 18 years ago by teague@…

I had a look at those two threads; it's great that there seems to be some traction on why the decoding thread is taking so long.

In the meantime, however, I've been using the following patch for about a month. (Sorry it took so long for me to post!) It lets me watch 1080i and 720p HD content on my CN400-based Epia board (SP8000)

It does two things: first, it decreases the number of XvMC surfaces allocated from 16 to 12. This takes care of the blue screen/no video problem.

Second, it makes the decoding thread realtime as well, gives it a lower priority than the display thread, and changes the RT thread scheduler to round-robin instead of FIFO. This takes care of the stuttering audio problem (though, as evidenced in the above threads, it seems to be pasting over the root cause which seems to be lock-based.) It also means that if you feed your decoder a corrupt stream and it hangs MythTV, it also hangs your entire box (SysRq? magic excepted.)

So, this isn't a "real" fix (at least not the second half of it.) YMMV, but it works for me.

Changed 18 years ago by teague@…

Attachment: cn400.diff added

Quick patch to make HD hardware decoding work on my CN400

comment:13 Changed 18 years ago by danielk

Resolution: invalid
Status: reopenedclosed

Please make the patch against mythtv-vid, and also make sure that this works when you don't run with special run-time thread priorities (if possible).

Reopen when the patch is ready for mythtv-vid (which may already do some of this).

comment:14 Changed 18 years ago by anonymous

I realize this ticket is closed, but I'd just like to point out that the above cn400.diff patch works and applies well on 0.20-fixes. Masking the problem or not, it actually gets something displayed on my TV.

comment:15 Changed 17 years ago by teague@…

Resolution: invalid
Status: closedreopened

Got the mythtv-vid branch working on my CN400 (Unichrome-based EPIA-SP8000 motherboard.) The following patch is much less invasive than the previous: it fixes three separate issues to get playback working.

1 - get_glx_version() - the fix for nVidia cards makes my X server segfault if it's run more than once. Patch uses static variables to make sure the server is only queried once. Probably a better way to do this.

2 - VideoOutputXv::CreateXvMCSurfaces() - my motherboard only allows 64 Mb of DRI memory. After XvMCSurfaces, there needs to be the equivalent of 5 additional surfaces free for the OSD and rendering surfaces. The patch allocates 5 surfaces more than what is asked for, then deallocates them to ensure that the memory is available. There might also be a better way to this, too.

3 - myth2av_codecid() - when requesting the VLD codec, we need both the vld and mc flags set.

With these three things fixed, the mythtv-vid branch performs substantially better than the trunk. Awesome!

Changed 17 years ago by teague@…

Attachment: cn400-mythtv-vid.patch added

Patch against mythtv-vid to get it working on the CN400 chipset.

comment:16 Changed 17 years ago by danielk

Milestone: 0.200.21
Type: defectpatch

comment:17 Changed 17 years ago by danielk

Teague, according to the patch, the OpenChrome? drivers now support MC decoding, not just VLD, is this correct?

comment:18 Changed 17 years ago by danielk

Resolution: invalid
Status: reopenedclosed

No response from patch submitter about suspected problem with patch in three weeks.

comment:19 Changed 17 years ago by teague@…

Resolution: invalid
Status: closedreopened

danielk - Yikes, my apologies for not getting back to this sooner.

I did some hunting, and you are right -- it's not that the OpenChrome? drivers support MC decoding, but that MC capabilities are not required for VLD. I've updated the patch and will attach it below.

There was also some recent borkage in configure that kept VLD from being enabled. I will also include a patch for that.

Changed 17 years ago by teague@…

Updated patch to get VLD decoding working for the mythtv-vid branch

Changed 17 years ago by teague@…

Fixed broken configure logic for VLD

comment:20 Changed 17 years ago by danielk

(In [14439]) Refs #1842. Applies patch from teague at WISC p edu to mythtv-vid to fix CN400 playback.

comment:21 Changed 17 years ago by danielk

Resolution: fixed
Status: reopenedclosed

(In [14477]) Refs #2287. Fixes #1842. Fixes #3943. Fixes #3479. Merges mythtv-vid to svn trunk.

After the merge last week, I applied some patches that were waiting in the queue for mythtv-vid.

  • Fixes some issues with VIA CN400 drivers not displaying 1080i frames.
  • Adds a workaround to for crashes due to bugs in the Intel and VIA OpenGL drivers.
  • Allows OpenGL rendering to work with GLX 1.2 for ATI and Intel cards.
  • Seperates preconfigured zoom and aspect ratio override modes, "W" is still the binding for zoom, and "Ctrl-W" now overrides the aspect ratio specified in a video file.
  • Adds a new OpenGL video renderer output filter from Mark Kendall.
  • Reworks some of the OpenGL video renderer locking for greater stability.
Note: See TracTickets for help on using tickets.