Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdadecoder checker error #227

Closed
acidanthera-bot opened this issue Apr 14, 2017 · 34 comments
Closed

vdadecoder checker error #227

acidanthera-bot opened this issue Apr 14, 2017 · 34 comments

Comments

@acidanthera-bot
Copy link
Collaborator

@xelanaiznac opened vit9696/Shiki#5

hi.
I don't know if it Is the right place to speak about this but z170 and z270 with Nvidia discrete graphic card can not have shiki working due to error about vdadecoder (VDADecoderCreate failed. err: -12473).
on older system (z97 for example) it was possible adding iMac.kext (thanks to igork) which inject the correct values of iovarenderid and iovarendersubid.
from shiki faq we learned this:

"How can I inject IOVARendererID/IOVARendererSubID in certain NVIDIA GPUs?
NVIDIA drivers do not properly add these values necessary for VDA decoding for Maxwell GPUs in their Web drivers. You could add them with a plist-only kext. The correct values for VP4 GPUs are:
IOVARendererID → <08 00 04 01>
IOVARendererSubID → <03 00 00 00>
VP3 ones want a different IOVARendererID → <04 00 04 01>.
Thanks to igork for noticing it."

I'm using pascal gtx 1080 and I found out there https://en.wikipedia.org/wiki/Nvidia_PureVideo that my gpu is a vp8. maybe we have to use different iovarenderid and subbed values?

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Hi,

This FAQ entry is written in a rather opaque manner and does not outline some internal details I know. I will explain them below but you will still have to find a solution yourself. If you know any interested people you could also point them to this message. Perhaps igork knows something else but I have no idea whether he touched Pascal.

So, as of 10.12.4 AppleGVA video decoding framework only knows about the following decoders:

  • NVIDIA VP2 (earlier 8xxx)
  • NVIDIA VP3 (later 8xxx)
  • NVIDIA VP4 (2xx)
  • Intel Gen6 (Sandy)
  • Intel Gen7 (Ivy)
  • Intel Gen75 (Haswell)
  • Intel Gen8 (Broadwell)
  • Intel Gen9 (Skylake)
  • ATI / AMD (not much is known here)

AMD decoders are an unrelated question, and Intel decoders could be "offline" and "online". Both kinds of Intel decoders are capable of performing hardware video decoding (well, probably except Gen6, support of which seems to be very partial).

  • Online means that your Intel GPU is active, has a framebuffer with connectors, so one could attach a screen to it.
  • Offline means that Intel GPU is active, but its framebuffer has no connectors (so one could not attach a screen to it).

According to /System/Library/PrivateFrameworks/AppleGVA.framework/Resources/Info.plist most recent macs that have discrete (AMD / NVIDIA) GPUs still use Intel decoder, mainly due to energy efficiency. This is determined not only heuristically but also by a special Info.plist flag forceOfflineRenderer set to true. This is why the latest Shiki versions implement -shikigva boot argument to let people remove this flag and therefore be able to use a single Intel GPU on a model with a discrete GPU.

The maximum support level of VP4 means that if you have NVIDIA newer than 2xx series you cannot use NVIDIA hardware video decoder at all (despite some stupid people using forceNV defaults preference).

However, to be able to use Intel offline hardware video decoder a valid IOVARendererID key should be present in IOReg for all the accelerators (including NVIDIA). I have redone my nvAcceleratorParent::SetAccelProperties reverse-engineering from the recent web driver (378.05.05.05f01) and unfortunately discovered that nothing changed there:

int nvAcceleratorParent::SetAccelProperties(nvAcceleratorParent* this) {
	int rendererId = 0;
	int rendererSubId = 0;
	int oclass = GetCardOclass(this);
	if (oclass <= 0x88B0) {
		if (oclass == 0x74B0) {
			rendererId = 0x1040002;
		} else if (oclass == 0x85B1) {
			rendererId = 0x1040008;
			rendererSubId = 1;
		} else {
			if (oclass != 0x86B1)
				return;
			rendererId = 0x1040008;
			rendererSubId = 2;
		}
		SetProperty(this, "IOVARendererID", &rendererId, 4LL);
		if (rendererSubId)
			SetProperty(this, "IOVARendererSubID", &rendererSubId, 4LL);
	} else if (oclass == 0x88B1) {
		rendererId = 0x1040004;
		SetProperty(this, "IOVARendererID", &rendererId, 4LL);
	} else if (oclass == 0x95B1 || oclass == 0x90B1) {
		rendererId = 0x1040008;
		rendererSubId = 3;
		SetProperty(this, "IOVARendererID", &rendererId, 4LL);
		SetProperty(this, "IOVARendererSubID", &rendererSubId, 4LL);
	}
}

As you see basically NVIDIA added a hack for iMac14,2 and similar with 6xx GPUs (oclass 0x95B1) by pretending that they are VP4 GPUs. So, injecting 0x1040008 for Maxwell GPUs did nothing but extend the same hack a little further. Since AppleGVA won't recognise any other value, you are pretty much bound to use one of those known IDs for Pascal cards as well.

One last note is that starting with 10.12.3 you need to recompile VDADecoderChecker, and starting with 10.12.4 few users reported that there are plist injection issues for their Maxwell GPUs.

@acidanthera-bot
Copy link
Collaborator Author

@darthsian commented

Hi, i made some test with GTX 950 on z97 and z170 platforms.

On z97 (i7 4790k) is everything ok. Quick Sync supported and VDADecoderChecker output ""Hardware acceleration is fully supported".
macOS 10.12.4
SMBIOS iMac14,2
IGPU device is enabled, and present with a connector-less AAPL,ig-platform-id <04 00 12 04>
Discrete GPU is properly configured with IOVARendererID present in IOReg;
IOVARendererID → <08 00 04 01> (via iMac.kext)
IOVARendererSubID → <03 00 00 00> (via iMac.kext)
VDADecoderChecker confirms Intel Offline (Online) VDA decoder working;
IMEI device is present in IOReg;
No override preferences are used;
Mac model set to the one supporting hardware acceleration;

On z170 (i5 6600)
macOS 10.2.4
SMBIOS14,2 or 17,1 (tried both of them)
connector-less AAPL,ig-platform-id <01 00 12 19>, others same as above
VDADecoderChecker output this:
GVA info: Successfully connected to the Intel plugin, offline Gen9
AVDCreateGPUAccelerator: Error loading GPU renderer
VDADecoderCreate failed. err: -12473
An error was returned by the decoder layer. This may happen for example because of bitstream/data errors during a decode operation. This error may also be returned from VDADecoderCreate when hardware decoder resources are available on the system but currently in use by another process.
VDADecoderCreate failed. err: -12473

And MacX Video Converter shows "Hardware encoding supported: NO"

Without IOVARendererID → <08 00 04 01> (via iMac.kext), IOVARendererSubID → <03 00 00 00> (via iMac.kext) VDADecoderChecker output this:
VDADecoderCreate failed. err: -12473
An error was returned by the decoder layer. This may happen for example because of bitstream/data errors during a decode operation. This error may also be returned from VDADecoderCreate when hardware decoder resources are available on the system but currently in use by another process.
VDADecoderCreate failed. err: -12473

but MacX Video Converter shows "Hardware encoding supported: YES" and i can use Quick Sync for encoding.

It looks like that problem is somewhere in Skylake/Kabylake or in Intel HD 530/630 and AppleIntelSKLGraphicsFramebuffer because older platforms works with the procedure described in Shiki's FAQ without problems.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Well, encoding and decoding go via different routes, so the easiest way to check whether decoding actually works( but VDADecoderChecker lies to you) is to pick a large video file and to play it in QuickTime (example). Unfortunately other than the compilation issue I mentioned above I know of no other false positives, so probably your hardware video decoding does not work indeed.

From what I know HD530 (0x1912) graphics works fine for some people but there are memory limit issues (the value may vary from 64 MB to 128 MB) and it could be dependent on mac model (the best variant should be iMac17,1). Could point you to the material compilation on applelife, but that's mostly all of it. I have no such card, and could only wish you luck trying and experimenting.

@acidanthera-bot
Copy link
Collaborator Author

@ghodgeon commented

Thank you for the information! I have a 1080Ti and 980Ti and Intel HD 530 'working' in one machine. If I load the display through the onboard HDMI port, we have successful hardware acceleration. The moment I plug in a monitor into one of the GPU's, we lose hardware acceleration.

is this related to the Maxwell 'fake' injection advice you have above? The other GPU's need to read the same IOVARendererSubID for things to stay alive? Appreciate everything you've done so far....Stumped from here on in !

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Well, I cannot really say more than I already did. Everything is related probably, don't own time and hardware to investigate it any further.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

I was linked to a kext by @mologie fixing this issue today:
https://github.com/mologie/NVWebDriverLibValFix

While currently a bit immature it seems to be doing right things, and resolves this issue.
Looking forward for it getting rewritten with the help of Lilu :)

Upd: unfortunately seems to be still there.

@acidanthera-bot
Copy link
Collaborator Author

@barijaona commented

I made a discovery which seems related to this issue.

I too have a Z170 with discrete Nvidia :

  • i5 6600K,
  • GTX960,
  • SMBIOS iMac17,1,
  • IGPU is enabled in BIOS, (corrected)
  • Intel is not injected,
  • macOS 10.12.6

I am quite surprised being now able to read iTunes DRM protected videos with Shiki installed, but without any injection of IOVARendererID / IOVARendererSubID. Is this normal ?

Decoding seems OK : I am able to play in QuickTime the big video file you pointed to as an example.

Output of VDADecoderChecker is :

GVA info: Successfully connected to the Intel plugin, offline Gen9 
IOVARendererID property not found 
AVDCreateGPUAccelerator: Error loading GPU renderer
VDADecoderCreate failed. err: -12473
An error was returned by the decoder layer. This may happen for example because of bitstream/data errors during a decode operation. This error may also be returned from VDADecoderCreate when hardware decoder resources are available on the system but currently in use by another process.
VDADecoderCreate failed. err: -12473

I had visual problems with iBooks, Xcode… , but it's not the transparent windows anymore. These problems were fixed by installing NVWebDriverLibValFix in CLOVER/kext/Other.

Other details are available on the GPU branch of my CLOVER folder. Serial numbers and SmUUID were deliberately removed.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

This is normal, if you check the FAQ you would see that Shiki enables software decoder, and therefore is not dependent on hardware decoder. Yet you will have issues with streaming and non-drm content.

@acidanthera-bot
Copy link
Collaborator Author

@barijaona commented

I have updated my GPU branch to enable QuickSync.

I found that the "model" name given to the IGPU device has some influence.
If I inject "Skylake Desktop GT2", QuickSync is OK (even if VDADecoderChecker fails with slightly different error messages), but the most visible difference can be seen in Intel Power Gadget. It does not display anymore the GT frequency, only the IA frequency!

Example of output running the 4K video in QuickTime Player :

sans titre

Here is my SSDT (which - as a precaution - also includes injection of the property to fix Skylake glitches) :

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20160422-64(RM)
 * Copyright (c) 2000 - 2016 Intel Corporation
 * 
 * Disassembling to non-symbolic legacy ASL operators
 *
 * Disassembly of iASLMU8y1U.aml, Tue Aug  1 20:35:55 2017
 *
 * Original Table Header:
 *     Signature        "SSDT"
 *     Length           0x000001B7 (439)
 *     Revision         0x01
 *     Checksum         0x3E
 *     OEM ID           "toleda"
 *     OEM Table ID     "100s530"
 *     OEM Revision     0x00003000 (12288)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20160422 (538313762)
 */
DefinitionBlock ("", "SSDT", 1, "toleda", "100s530", 0x00003000)
{
    External (_SB_.PCI0, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.GFX0._ADR, UnknownObj)    // (from opcode)
    External (_SB_.PCI0.HECI._ADR, UnknownObj)    // (from opcode)

    Scope (\_SB.PCI0)
    {
        Name (GFX0._STA, Zero)  // _STA: Status
        Device (IGPU)
        {
            Name (_ADR, 0x00020000)  // _ADR: Address
            Method (_INI, 0, NotSerialized)  // _INI: Initialize
            {
                Store (Zero, \_SB.PCI0.GFX0._ADR)
            }

            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                If (LEqual (Arg2, Zero))
                {
                    Return (Buffer (One)
                    {
                         0x03                                           
                    })
                }

                Return (Package (0x08)
                {
                    "AAPL,ig-platform-id", 
                    Buffer (0x04)
                    {
                         0x01, 0x00, 0x12, 0x19                         
                    }, 

                    "model", 
                    Buffer (0x14)
                    {
                        "Skylake Desktop GT2"
                    }, 

                    "AAPL,GfxYTile", 
                    Buffer (0x04)
                    {
                         0x01, 0x00, 0x00, 0x00                         
                    }, 

                    "hda-gfx", 
                    Buffer (0x0A)
                    {
                        "onboard-1"
                    }
                })
            }
        }

        Name (HECI._STA, Zero)  // _STA: Status
        Device (IMEI)
        {
            Name (_ADR, 0x00160000)  // _ADR: Address
            Method (_INI, 0, NotSerialized)  // _INI: Initialize
            {
                Store (Zero, \_SB.PCI0.HECI._ADR)
            }

            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                If (LEqual (Arg2, Zero))
                {
                    Return (Buffer (One)
                    {
                         0x03                                           
                    })
                }

                Return (Package (0x02)
                {
                    "device-id", 
                    Buffer (0x04)
                    {
                         0x3A, 0xA1, 0x00, 0x00                         
                    }
                })
            }
        }
    }

    Store ("ssdt-ami_100_skl-hd530_v2.0 github.com/toleda", Debug)
}

Do you see any explanation ?

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Well, without reversing it is hard to say, to be honest. And without the hardware it is even harder.
If I remember correctly, AppleGVA from 10.11 was not matching by anything but device-id, but this could have changed with the two major releases. Don't know really.

What I do know is that connector-less SKL/KBL GPU works perfectly with AMD GPUs with WhateverGreen, so I am pretty certain the only issue is IOVARenderer stuff, and the rest is just coincidence.

@acidanthera-bot
Copy link
Collaborator Author

@barijaona commented

I guess this is not directly related to AppleGVA itself, but more to the equivalent of Nvidia Optimus/AMD PowerXPress that Apple has developed.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Would rather not guess, but this is possible indeed.

@acidanthera-bot
Copy link
Collaborator Author

@barijaona commented

I confirm that injecting a "correct" Nvidia IOVARendererID breaks Intel QuickSync.

I noticed that injecting a "dummy" IOVARendererID (for instance 01 01 01 01) suppress "GVA error: IORegistryEntryCreateCFProperty failed for display number X, IOVARendererID property not found" log messages sent by AppleGVA.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

So does this just make AppleGVA gracefully fail without the IOVARenderer error messages? I.e. hardware video decoding remains broken but QuickSync works, right?

@acidanthera-bot
Copy link
Collaborator Author

@barijaona commented

Yes :

  • QuickSync (at least encoding through MacX Video Converter Pro) works.

  • VDADecoderChecker output remains :

VDADecoderCreate failed. err: -12473
An error was returned by the decoder layer. This may happen for example because of bitstream/data errors during a decode operation. This error may also be returned from VDADecoderCreate when hardware decoder resources are available on the system but currently in use by another process.
VDADecoderCreate failed. err: -12473
  • QuickTime Player uses VTDecoderXPCService and CPU

@acidanthera-bot
Copy link
Collaborator Author

@barijaona commented

It looks like AppleGVA (or something else in VideoToolbox.framework) is requesting the VDA hardware decoder without releasing it.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Starting with version 1.2.0 of NvidiaGraphicsFixup there will be several improvements for NVIDIA owners. Among them:

  • builtin HDMI audio activation
  • builtin IOVARendererID injection (no need for iMac.kext)
  • builtin codesign override (no need for NVWebDriverLibValFix.kext)

At this moment you can only compile the driver on your own (requires you to recompile Lilu and all the plugins from the source code). Keep an eye on it once it is released. Among making the life easier with less kexts to use it might improve the situation with hardware video decoding for Pascal users, though likely with only Haswell/Broadwell CPUs.

@acidanthera-bot
Copy link
Collaborator Author

@ZOMGsheikh commented

Keep an eye on it once it is released. Among making the life easier with less kexts to use it might improve the situation with hardware video decoding for Pascal users

Is this aiming to decode from the dGPU or forward it to Intel quick sync like native mac? If dGPU, for skylake users will the connector-less platform id work for quicksync decode/encode?

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

It fixes the compatibility with Intel decoders and encoders on Maxwell and supposedly Pascal. With Skylake+ CPUs in addition to the latest NvidiaGraphicsFixup you will also have to use shikigva=4 boot argument.

@acidanthera-bot
Copy link
Collaborator Author

@ZOMGsheikh commented

Finally it works, with latest Lilu, Shiki and NvidiaGraphicsFixUp for a high bitrate file playback in Quicktime, I see low CPU usage and my iGPU in a connector less mode shows usage in intel power gadget. I was also able to do a screen recording in quicktime with iGPU doing the work. This was with i7 6700 and GTX 1070 in Sierra 10.12.6. But theres a major catch, anything outside quicktime, like web browser video from Youtube or VLC again kick back to CPU than iGPU for decoding which results in higher usage. Should I use one of these commands to force?:

defaults write com.apple.AppleGVA forceNV -boolean yes — forces NVIDIA decoder
defaults write com.apple.AppleGVA forceIntel -boolean yes — forces Intel decoder
defaults write com.apple.coremedia hardwareVideoDecoder force

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

No, you should not, it is hard to say at this point why there could be any issue in other programs, but I would assume it is the same on "supported" platforms. Most reliable ways to confirm that hardware video decoding works this are VDADecoderChecker and iTunes/QuickTime. As for "how good" it works, only Apple knows.

@acidanthera-bot
Copy link
Collaborator Author

@ZOMGsheikh commented

VDADecoderChecker still gives me an error though. I'll test this with High Sierra and see.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

That is very strange. It is likely that something is misconfigured, because I am pretty certain it works fine on 10.12.6. We tested it on a similar configuration but with 7700K. In my opinion, you better recheck the FAQ steps, perhaps something was forgotten about.

There also is a chance you have corrupted dyld shared cache, follow the corresponding FAQ entry to check it and rebuild it.

@acidanthera-bot
Copy link
Collaborator Author

@ZOMGsheikh commented

I get this:

GVA info: Successfully connected to the Intel plugin, offline Gen9
AVDCreateGPUAccelerator: Error loading GPU renderer
VDADecoderCreate failed. err: -12473
An error was returned by the decoder layer. This may happen for example because of bitstream/data errors during a decode operation. This error may also be returned from VDADecoderCreate when hardware decoder resources are available on the system but currently in use by another process.
VDADecoderCreate failed. err: -12473

Connection to Intel plugin seems fine. But is it ok for VDADecoder to fail?

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

No. It is not how it should look like.

@acidanthera-bot
Copy link
Collaborator Author

@infernoboy commented

I compiled and tried Lilu, Shiki, and NvidiaGraphicsFixup on High Sierra with a 7700K and 1080 GPU, and get the same error:

GVA info: Successfully connected to the Intel plugin, offline Gen95

VDADecoderCreate failed. err: -12473

It also seems to break Quick Sync with MacX Video Converter saying hardware encoding isn't supported.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Um, you better reread the previous messages and the FAQ, to be honest. Or maybe even wait for a release, perhaps more simplified instructions get published with time. On your hardware you will need shikigva=4 at least, and the rest is to be followed from the FAQ.

While I do understand that not everybody got the fixes right away, I ask you to read everything carefully and avoid posting to this issue tracker too much. 10.13 is believed to be buggy and problematic, and since I do not have it on real hardware I cannot tell you what is wrong there if anything. 10.12.6 is known to work just fine, but even a small mistake will prevent you from having hardware video decoding and encoding, and I cannot spend much time exploring what went wrong, sorry.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Yeah, that would be just fine. Issue tracker is more about bug reports, and at the moment there is no clear understanding whether our bugs exist in the first place.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

As a temporary workaround for 10.13 specific issues I added a process whitelist. It is activated by 8th bit, thus making one provide shikigva=12. If you need more processes, add them yourself. I could accept a few during this weekend if you post them here.

For 10.12 you will be fine with a shared cache rebuild (see https://github.com/vit9696/Shiki/issues/10#issuecomment-334925025).

@acidanthera-bot
Copy link
Collaborator Author

@emiliogonzalezjunior commented

I am using High Sierra and the shikivga=12 boot arg is working. However, Davinci Resolve isn't present in the Process whitelist . Airplay also doesn't seem to be working (GT=0 in the intel power gadget), is it possible to include airplay in the process whitelist?

davinci resolve file path: /DaVinci Resolve.app/Contents/MacOS/Resolve

Thank You for your great work!

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

Yes, it is… Please, submit pull requests if you need more paths (obviously you must test the result first). I hope to make a proper fix for High Sierra sooner or later though.

@acidanthera-bot
Copy link
Collaborator Author

@ZOMGsheikh commented

Is this "Process Whitelist" High Sierra specific? Because I am still using 10.12.6 and in there Firefox, Opera or Chrome still not using HW decoding, I was wondering if I should add something for 10.12.6.

@acidanthera-bot
Copy link
Collaborator Author

@vit9696 commented

From what I am aware, yes. If they do not, most likely they have bugs (or you have configuration issues). Sorry, there is not much to say other than written in the FAQ, and I am not a support bureau.

@acidanthera-bot
Copy link
Collaborator Author

@ZOMGsheikh commented

I am little confused, how does one use the patches.plist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant