Corrupted EGLImages from decoded VAAPI frames on Intel iGPUs and Arc A750
VAAPI decoding and then wrapping in an EGLImage results in corruption in certain circumstances on Intel hardware. To be clear, it is the wrapping only step, as I have verified that the decoded VAImage is valid in all situations. It only becomes corrupted during/after being wrapped in an EGLImage. Furthermore, decoding and rendering on Intel discrete GPU hardware is broken, with the same visual corruption. Since the corruption is identical on iGPUs and discrete Intel cards, the problem isn't specific to the Arc hardware, although it could be Intel graphics hardware in general. My guess is if this is fixed on the A750, it will also be fixed when decoding on the iGPU as well.
Here are the instances where it works:
- WORKING: Decode video on the iGPU (/dev/dri/renderD128) and then OpenGL ES render on the iGPU
- WORKING: Decode video on a non-Intel PCIe graphics card (/dev/dri/renderD130) and OpenGL ES render on the iGPU
And here's where it fails:
- BROKEN: Decoding/rendering on Intel Arc A750 in any configuration, even with internal video disabled an no other GPUs in the system (verified on kernel 6.2.0-rc3) - To be clear, VAAPI decoding works on A750 as you can dump the VAImage to disk and it looks right, it just doesn't render properly after the EGLImage wrap step.
- BROKEN: Decode on iGPU (no display connected), render OpenGL on an AMD PCIe graphics card
The decoding is being done using either vaDeriveImage
or vaExportSurfaceHandle
to get a VAImage from the hardware decoder. I have verified in all cases that this step works, even on an A750 with kernel 6.2.0-rc3. The bug is somewhere in the step going from VAImage to EGLImage. There should be no issue with this on devices that decode and render using the same hardware, as is the case with the Arc cards. In fact, even if there needs to be a copy over PCIe and a resulting slowdown due to no DMA, there still should not be any corruption.
On my system, /dev/dri contains these three entries:
- [card0] Built-in Alder Lake GPU (i5-12400)
- [card1] Intel Arc A750
- [card2] AMD Radeon RX 640