FreeBSDDesktop / kms-drm

the DRM part of the linuxkpi-based KMS
63 stars 26 forks source link

drm and libva compatibility #140

Open nomatter2k opened 5 years ago

nomatter2k commented 5 years ago

I have a home server with E3-1246v3 CPU running FreeBSD 12.0-RELEASE-p3. I heard the FreeBSD port of Plex Media Server started to support HW transcoding a few months ago, and tried to use the feature, but failed. I talked with the port maintainers of plexmediaserver_plexpass and libva, and found the failure point. VA_DRM_IsRenderNodeFd() inside libva always fails in my environment, because /dev/drm/128 symbolic linked to /dev/dri/renderD128 has device number 0x208. The function checks whether the raw device number st_rdev has the bit 7 (0x80) set to decide if it is a DRM-capable node. The number 0x80 itself is hard-coded inside the function. When I removed the condition from the function, I could use vaapi-based hardware encoding using ffmpeg. I don't know what's the meaning of the bit 7, but it looks like a protocol between drm module and libva. (at least in linux) Of course it can be fixed from the libva, but with regards to possible applications those statically linked libva, I think it is better to be fixed in drm module.

nomatter2k commented 5 years ago

It looks like that FreeBSD raw device numbers are not in major:minor form and same with inode number. If they really are, is it possible to create /dev/drm/0 having 256-aligned inode number?

johalun commented 5 years ago

Thanks for the report. We'll take a look at this.

jbeich commented 5 years ago

0x80 bit in st_rdev refers to DRM_NODE_RENDER according to libdrm. See also intel/libva@936f548d999a