intel / libva

Libva is an implementation for VA-API (Video Acceleration API)
http://intel.github.io/libva/
Other
660 stars 302 forks source link

Framebuffer capture with VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME does not work #798

Open neon12345 opened 9 months ago

neon12345 commented 9 months ago

Problem: Framebuffer capture with VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME does not work. I have tried this with a simple implementation, but ffmpeg is a better way to reproduce the issue. The captured frames have some parts of the real picture with pixel soup on top and parts of readable text from previous bash sessions and other stuff. It seems a wrong part of memory is used as the framebuffer, which also leaks information from memory. I don't know if this is a bug or unsupported usage of libva, but it was working in an older version of Ubuntu.

Command used: ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi output.mp4 (with replaced crtc_id)

Hardware: Intel Iris Xe Graphics (TigerLake-LP GT2) laptop

OS versions with different versions of the software stack (including kernel):

Debian 12 bookworm fresh install                not working
Ubuntu 23.10 upcoming LTS fresh install         not working
An older Ubuntu LTS live dvd    (with XOrg instead of Xwayland and the oldest software versions)  working

all with intel-media-va-driver-non-free

neon12345 commented 9 months ago

It seems the problem is due to the unsupported drm format modifier I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC. I changed my implementation to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and added MUTTER_DEBUG_USE_KMS_MODIFIERS=0 to /etc/environment. This forced gnome to use the working I915_FORMAT_MOD_X_TILED modifier.

XinfengZhang commented 7 months ago

X tile should also has some potential problem, should be Y or 4 tile.