-
Notifications
You must be signed in to change notification settings - Fork 60
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
vabackend: support 10/12 bit formats #120
Conversation
Hmm. Probably what's required is that the NVConfig must store the fact that multiple formats and bit depths are associated with the profile, and then return the various pixel formats in the surface attributes, so that we don't care what RT_FORMAT is passed to createConfig. |
And createContext probably has to look at the render targets to see what format they are to set the right format on the decoder. |
Patch looks good so far. But yeah, you ran straight into the issue I spotted, two codecs that support multiple bit-depths. There are a couple of ways I can see at the moment.
I think we need to understand how the other drivers are handling it, but I have a suspicion that NVDEC is the only one that requires knowing the bit-depth before creating the context meaning VA-API isn't designed to handle that scenario. |
Pushed a change that uses render target at context creation time to set decoder output format. Works with |
Well some good news at least, it seems that Chrome always provides the RTFormat to vaCreateConfig, so we will be able to get the correct format either by using that, or the passed in render targets when creating the context. Althought, it seems it only supports 10-bit for VP9 profiles 2 and 3. The changes look good. Looks like I'll have to manually install the 520 driver as the normal package I rely on hasn't been updated yet. Should we be doing a We may end up trying to patch ffmpeg to pass in the RTFormat just so we're never left guessing, but I think that can wait for a while. |
0c0a53c
to
c742daa
Compare
Addressed comments and tidied it up a bit. I think we will have to keep 12bit disabled, as it's currently failing for non-obvious reasons. |
Yeah, there's a cuda problem. Of course. |
It can't truncate as it's sharing memory and the 10 and 12 bit formats share the same underlying format so they should be identical. So using the 10 bit one should work for 12 bit formats, in theory. |
The latest nvidia 520 drivers include support for the required DRM formats to allow exporting of 10/12 bit surfaces. The driver currently has incomplete support and various bits and pieces commented out. This change is an initial attempt to implement the required support for the relevant profiles. Things are simple where the profile and bit depth have a 1:1 correspondence, but AV1Profile0 includes both 8 and 10 bit content, while VP9Profile2 includes 10 and 12 bit. In these cases, we have to have a way to learn from the caller what format is desired. In the most straight-forward case, the call to createConfig will specify which format the caller wants as an RtFormat, but this is optional. They are allowed to specify nothing. On the other hand, other callers can provide pre-allocated surfaces when calling createContext, and we can look at the surface format to work out what they want. What if a caller didn't provide either hint? We'd end up having to guess and just assume 8bit. In practice, we believe that all relevant callers use one of the above patterns.
c742daa
to
90413a7
Compare
Updated to use the Y10 format for 12 bit content. |
Managed to get 520 installed. Looks good, but I was only able to test HEVC 10 and 12-bit as my card doesn't support the 10 and 12-bit VP9 profile 2. Thanks for the patch! |
The latest nvidia 520 drivers include support for the required DRM
formats to allow exporting of 10/12 bit surfaces.
The driver currently has incomplete support and various bits and
pieces commented out.
This change is an initial attempt to implement the required support for
the relevant profiles.
Things are simple where the profile and bit depth have a 1:1
correspondence, but AV1Profile0 includes both 8 and 10 bit content,
while VP9Profile2 includes 10 and 12 bit.
In these cases, we have to have a way to learn from the caller what
format is desired. In the most straight-forward case, the call to
createConfig will specify which format the caller wants as an RtFormat,
but this is optional. They are allowed to specify nothing.
On the other hand, other callers can provide pre-allocated surfaces
when calling createContext, and we can look at the surface format to
work out what they want.
What if a caller didn't provide either hint? We'd end up having to
guess and just assume 8bit. In practice, we believe that all relevant
callers use one of the above patterns.
Fixes #34