Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#8621 closed Developer Task (Won't Fix)

Add VDA support

Reported by: markk Owned by: jyavenard
Priority: minor Milestone: unknown
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This is a tracking ticket for adding VDA hardware accelerated H.264 decoding for Mac OS X

Attachments (0)

Change History (12)

comment:1 Changed 4 years ago by markk

  • Owner changed from janne to markk
  • Status changed from new to accepted

comment:2 Changed 4 years ago by markk

  • Milestone changed from unknown to 0.24

comment:3 Changed 4 years ago by markk

(In [25571]) Add support for the VideoDecodeAcceleration? framework on OS X.

This enables video acceleration on certain hardware when running OS X 10.6.3 and above (see http://developer.apple.com/mac/library/technotes/tn2010/tn2267.html)

There are 2 outstanding issues:-

  • there is no interlaced and repeat picture detection (and hence no deinterlacing). This will require some additional parsing or perhaps a tie in into the existing H264 parser.
  • some H264 broadcast streams are broken. So far the only problem seems to be BBC HD.

Implementation wise, the VDA library is loaded dynamically in order to simplify package management (the framework is only available on newer versions of OS X) and the additional privatedecoder_vda_defs file replicates the required elements of the framework headers as the headers are currently private.

There is a clear performance improvement, though nothing approaching the gains seen with, for example, VDPAU on the same hardware - no doubt due to the additional overhead of transferring the frames back into main memory (and back to GPU memory again).

The interaction with the Quartz video renderer is untested.

Refs #8621.

comment:4 Changed 4 years ago by markk

(In [26098]) Refactor VideoOutputOpenGL to allow efficient subclassing and extend
OpenGLVideo to enable direct update of the output video textures via
hardware decoders.

This will be used by VAAPI in the short term (if I ever get it working
properly) and probably VDPAU and VDA for 0.25. There are other potential
issues such as deinterlacing of RGBA frames (generally a bad idea) but
I'll deal with those as they arise.

Refs #8593. Refs #8621

comment:5 Changed 4 years ago by anonymous

comment:6 Changed 4 years ago by markk

  • Milestone changed from 0.24 to 0.25

Pushing back completion to 0.25 as there are unresolved issues and hence VDA decoding will need to be flagged as experimental for 0.24.

Current issues are:-

  • certain broadcast streams will fail a short period into decoding, usually somewhere between 16 and 30 frames. Possibly reference frame related. Offenders include BBC HD and hdpvr output.
  • interlaced detection is not working
  • av sync issues on some streams (probably need to get tralph on the case to fix some timestamp ordering)

comment:7 Changed 4 years ago by markk

(In [26593]) Improved av sync with the VDA decoder. We now use the pts exclusively and force AvFormatDecoder? to use reordered pts timestamps. Thanks to tralph for the suggestions. Refs #8621

comment:8 Changed 4 years ago by stuartm

  • Milestone 0.25 deleted

Milestone 0.25 deleted

comment:9 Changed 3 years ago by markk

  • Type changed from enhancement to Developer Task

comment:10 Changed 2 years ago by markk

  • Owner markk deleted
  • Status changed from accepted to assigned

comment:11 Changed 2 years ago by danielk

  • Resolution set to Won't Fix
  • Status changed from assigned to closed

Without someone to work on this..

comment:12 Changed 2 years ago by jyavenard

  • Milestone changed from 0.25 to unknown
  • Owner set to jyavenard

VDA decoding doesn't work with interlaced content.
This results in various crashes, hang or kernel panic.

In 2c08a7d1788b4a8183a70c288be0cec46a3f36d0, I disabled VDA playback for interlaced content. While this is obviously a big downside as playing content such as BBC HD will just fail on all but the most powerful macs (mac mini 2010, macbook air 2011, entry-level MBP 2012 13" all fail to play the BBC HD sample when using software decode).

How VDA will behave is dependent on the graphic adapter being used.
Mark Kendall reported that it worked on his mac with a nvidia adapter (I don't know which nvidia that is).
On my iMac with an ATI 6970M, I would only get the top half properly decoded, the bottom half stays green.
On a 2011 macbook air with an intel HD3000, the whole picture decoded is green.
On my mac mini 2010 with a nvidia 320M, it either hangs or cause a kernel panic

While obviously it would be nice to play interlaced content with VDA, if it's to get it to work only occasionally and get corrupted decoding, a crash or worse a kernel panic most of the time: there's no other choice without further investigations.

The following bug report was submitted to Apple:

The VDA framework doesn't state anything in regards to interlaced videos. Experimentations prove that VDA doesn't handle it properly.
However, creating the decoder doesn't fail.

When trying to decode h264 interlaced video, using the VDA framework will result in either a crash, a hang or a kernel panic.

The kernel panic can be consistently reproduced on a mac mini 2010 with a nvidia 320M graphic adapter.

The side-effects will vary depending on which video card you are using. ATI and Intel are more resistant to crashes.
On nvidia, it's where the worst issues can be seen.

Examples of videos causing issues:

http://dvb-antares.com/ftp/HD/BBC_H264_test6.ts

Intel: only get green crap
ATI: top half is good, bottom half is green
nVidia 320M: hang for a while. Leave the machine in unstable state, you can't reboot it, put it to sleep. Hard reset is the only salvation.

Video sample that will cause consistently a kernel panic on nvidia 320M
http://samples.ffmpeg.org/V-codecs/h264/tij-h264.avi

Kernel panic backtrace on mac mini 2010 with 320M:

Interval Since Last Panic Report:  -21 sec
Panics Since Last Report:          1
Anonymous UUID:                    11D8A7A9-943C-4F2E-8804-1B81C62084DF

Sat Mar 17 23:01:01 2012
panic(cpu 1 caller 0xffffff80002c266d): Kernel trap at 0xffffff7f817e288d, type 14=page fault, registers:
CR0: 0x0000000080010033, CR2: 0x0000000000000000, CR3: 0x000000000c38a000, CR4: 0x0000000000000660
RAX: 0x0000000000000000, RBX: 0xffffff807325ba40, RCX: 0xffffff806dcef07c, RDX: 0x000000004b4b4b4b
RSP: 0xffffff807325b8c0, RBP: 0xffffff807325b8e0, RSI: 0xffffff807325ba40, RDI: 0xffffff80654bd000
R8:  0x000000000003ffe0, R9:  0x0000000000000001, R10: 0xffffff7f817970be, R11: 0xffffff80111f15e8
R12: 0xffffff800cabcd88, R13: 0xffffff80654bd000, R14: 0xffffff80654bd000, R15: 0x0000000000000000
RFL: 0x0000000000010246, RIP: 0xffffff7f817e288d, CS:  0x0000000000000008, SS:  0x0000000000000010
CR2: 0x0000000000000000, Error code: 0x0000000000000002, Faulting CPU: 0x1

Backtrace (CPU 1), Frame : Return Address
0xffffff807325b580 : 0xffffff8000220702 
0xffffff807325b600 : 0xffffff80002c266d 
0xffffff807325b7a0 : 0xffffff80002d7a1d 
0xffffff807325b7c0 : 0xffffff7f817e288d 
0xffffff807325b8e0 : 0xffffff7f8179a0b0 
0xffffff807325baa0 : 0xffffff7f817e2f68 
0xffffff807325bb60 : 0xffffff7f81797119 
0xffffff807325bbc0 : 0xffffff800065239e 
0xffffff807325bbe0 : 0xffffff8000652c7a 
0xffffff807325bc40 : 0xffffff800065341b 
0xffffff807325bd80 : 0xffffff80002a3b78 
0xffffff807325be80 : 0xffffff8000223006 
0xffffff807325beb0 : 0xffffff8000214829 
0xffffff807325bf10 : 0xffffff800021bb58 
0xffffff807325bf70 : 0xffffff80002aeb80 
0xffffff807325bfb0 : 0xffffff80002d8383 
      Kernel Extensions in backtrace:
         com.apple.GeForce(7.1.8)[61FD1644-DA39-3645-9380-7F490FB000DB]@0xffffff7f8178c000->0xffffff7f8184bfff
            dependency: com.apple.NVDAResman(7.1.8)[94BA87BA-B128-3310-9860-98EC67AB7FAF]@0xffffff7f808e7000
            dependency: com.apple.iokit.IONDRVSupport(2.3.2)[4B3F84DC-18B3-3897-BC56-4E3940878047]@0xffffff7f808d5000
            dependency: com.apple.iokit.IOPCIFamily(2.6.8)[F63D4ABE-42DA-33EF-BADD-3415B0CB0179]@0xffffff7f80863000
            dependency: com.apple.iokit.IOGraphicsFamily(2.3.2)[FE536983-1897-3D6B-965E-24B5A67080DA]@0xffffff7f8089d000

BSD process name corresponding to current thread: MythFrontend

Mac OS version:
11D50b

Kernel version:
Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64
Kernel UUID: 7B6546C7-70E8-3ED8-A6C3-C927E4D3D0D6
System model name: Macmini4,1 (Mac-F2208EC8)

System uptime in nanoseconds: 113132298799
last loaded kext at 7277751980: com.apple.driver.AppleHWSensor	1.9.4d0 (addr 0xffffff7f81d8f000, size 28672)
last unloaded kext at 104747606707: com.apple.driver.AppleMCP89RootPortPM	1.11 (addr 0xffffff7f81d1e000, size 24576)
loaded kexts:
com.apple.driver.AppleHWSensor	1.9.4d0
com.apple.filesystems.autofs	3.0
com.apple.driver.AudioAUUC	1.59
com.apple.driver.ApplePlatformEnabler	2.0.4d2
com.apple.driver.AGPM	100.12.42
com.apple.driver.AppleHDA	2.1.7f9
com.apple.driver.AppleMikeyHIDDriver	122
com.apple.driver.AppleUpstreamUserClient	3.5.9
com.apple.driver.AppleMCCSControl	1.0.26
com.apple.driver.AppleMikeyDriver	2.1.7f9
com.apple.GeForce	7.1.8
com.apple.driver.AppleLPC	1.5.3
com.apple.iokit.IOUserEthernet	1.0.0d1
com.apple.Dont_Steal_Mac_OS_X	7.0.0
com.apple.driver.AudioIPCDriver	1.2.2
com.apple.driver.ACPI_SMC_PlatformPlugin	4.7.5d4
com.apple.driver.AppleIRController	312
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless	1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib	1.0.0d1
com.apple.BootCache	33
com.apple.iokit.SCSITaskUserClient	3.0.3
com.apple.iokit.IOAHCIBlockStorage	2.0.1
com.apple.driver.AppleFWOHCI	4.8.9
com.apple.driver.AppleUSBHub	4.5.0
com.apple.driver.AppleEFINVRAM	1.5.0
com.apple.driver.AppleSDXC	1.1.4
com.apple.iokit.AppleBCM5701Ethernet	3.0.8b2
com.apple.driver.AirPort.Brcm4331	513.20.19
com.apple.driver.AppleAHCIPort	2.2.0
com.apple.driver.AppleUSBEHCI	4.5.8
com.apple.driver.AppleUSBOHCI	4.4.5
com.apple.driver.AppleRTC	1.4
com.apple.driver.AppleHPET	1.6
com.apple.driver.AppleACPIButtons	1.4
com.apple.driver.AppleSMBIOS	1.7
com.apple.driver.AppleACPIEC	1.4
com.apple.driver.AppleAPIC	1.5
com.apple.driver.AppleIntelCPUPowerManagementClient	167.3.0
com.apple.nke.applicationfirewall	3.2.30
com.apple.security.quarantine	1.1
com.apple.driver.AppleIntelCPUPowerManagement	167.3.0
com.apple.kext.triggers	1.0
com.apple.driver.AppleAVBAudio	1.0.0d11
com.apple.driver.DspFuncLib	2.1.7f9
com.apple.driver.AppleHDAController	2.1.7f9
com.apple.iokit.IOHDAFamily	2.1.7f9
com.apple.nvidia.nv50hal	7.1.8
com.apple.NVDAResman	7.1.8
com.apple.iokit.IOFireWireIP	2.2.4
com.apple.iokit.IOSurface	80.0
com.apple.iokit.IOBluetoothSerialManager	4.0.3f12
com.apple.iokit.IOSerialFamily	10.0.5
com.apple.iokit.IOAVBFamily	1.0.0d22
com.apple.iokit.IOAudioFamily	1.8.6fc6
com.apple.kext.OSvKernDSPLib	1.3
com.apple.driver.AppleSMBusController	1.0.10d0
com.apple.driver.ApplePolicyControl	3.0.16
com.apple.driver.AppleGraphicsControl	3.0.16
com.apple.iokit.IONDRVSupport	2.3.2
com.apple.iokit.IOGraphicsFamily	2.3.2
com.apple.driver.AppleSMC	3.1.1d8
com.apple.driver.IOPlatformPluginFamily	4.7.5d4
com.apple.driver.AppleSMBusPCI	1.0.10d0
com.apple.driver.BroadcomUSBBluetoothHCIController	4.0.3f12
com.apple.driver.AppleUSBBluetoothHCIController	4.0.3f12
com.apple.iokit.IOBluetoothFamily	4.0.3f12
com.apple.driver.AppleUSBHIDKeyboard	152.3
com.apple.driver.AppleHIDKeyboard	152.3
com.apple.driver.AppleUSBHIDMouse	170.4
com.apple.driver.AppleHIDMouse	170.4
com.apple.iokit.IOUSBHIDDriver	4.4.5
com.apple.driver.AppleUSBMergeNub	4.5.3
com.apple.driver.AppleUSBComposite	4.5.8
com.apple.iokit.IOSCSIMultimediaCommandsDevice	3.0.3
com.apple.iokit.IOBDStorageFamily	1.6
com.apple.iokit.IODVDStorageFamily	1.7
com.apple.iokit.IOCDStorageFamily	1.7
com.apple.driver.XsanFilter	403
com.apple.iokit.IOAHCISerialATAPI	2.0.1
com.apple.iokit.IOSCSIArchitectureModelFamily	3.0.3
com.apple.iokit.IOFireWireFamily	4.4.5
com.apple.iokit.IOUSBUserClient	4.5.8
com.apple.driver.NVSMU	2.2.9
com.apple.iokit.IOEthernetAVBController	1.0.0d5
com.apple.iokit.IO80211Family	412.2
com.apple.iokit.IONetworkingFamily	2.0
com.apple.iokit.IOAHCIFamily	2.0.7
com.apple.iokit.IOUSBFamily	4.5.8
com.apple.driver.AppleEFIRuntime	1.5.0
com.apple.iokit.IOHIDFamily	1.7.1
com.apple.iokit.IOSMBusFamily	1.1
com.apple.security.sandbox	177.3
com.apple.kext.AppleMatch	1.0.0d1
com.apple.security.TMSafetyNet	7
com.apple.driver.DiskImages	331.3
com.apple.iokit.IOStorageFamily	1.7
com.apple.driver.AppleKeyStore	28.18
com.apple.driver.AppleACPIPlatform	1.4
com.apple.iokit.IOPCIFamily	2.6.8
com.apple.iokit.IOACPIFamily	1.4
Model: Macmini4,1, BootROM MM41.0042.B00, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, SMC 1.65f2
Graphics: NVIDIA GeForce 320M, NVIDIA GeForce 320M, PCI, 256 MB
Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142353637334648302D4346382020
Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142353637334648302D4346382020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x93), Broadcom BCM43xx 1.0 (5.100.98.75.19)
Bluetooth: Version 4.0.3f12, 2 service, 18 devices, 1 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Serial ATA Device: INTEL SSDSA2M040G2GC, 40.02 GB
Serial ATA Device: HL-DT-STDVDRW  GA32N
USB Device: Keyboard Hub, apple_vendor_id, 0x1006, 0x24400000 / 2
USB Device: Apple Keyboard, apple_vendor_id, 0x0220, 0x24420000 / 3
USB Device: Apple Optical USB Mouse, apple_vendor_id, 0x0304, 0x06400000 / 4
USB Device: BRCM2070 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0x06600000 / 3
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8218, 0x06630000 / 7
USB Device: IR Receiver, apple_vendor_id, 0x8242, 0x06500000 / 2
Last edited 2 years ago by jyavenard (previous) (diff)

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.