libgbm: Problems importing dmabuf on device with multiple DRM devices
System information
- Platform: i.MX6 SoC
- OS: Debian Bullseye
- GPU: Vivante GC2000
- Kernel version: 5.10.43
- Mesa version: OpenGL ES 2.0 Mesa 20.3.5 (From weston logs)
- Desktop manager and compositor: Weston
The issue
The kernel exposes two drm devices on i.MX6 -
- card0 / render128 - etnaviv
- card1 - imx-drm
From digging into the mesa side of things - it looks like the kmsro driver is being used on the device.
When importing a dmabuf (coming from gstreamer) the following steps are executed in weston -
- the buffer object is imported using gbm_bo_import
- get handles for planes - https://gitlab.freedesktop.org/wayland/weston/-/blob/9.0/libweston/backend-drm/fb.c#L355
- create a framebuffer using drmAddFb()
It seems that the handles returned in step 2 are based on the render device rather than the display / scanout device. The call to addFb() in Step 3 results in the following debug message from the kernel DRM sub-system -
Failed to lookup GEM object
As a test, the problem goes away when the etnaviv kernel driver is disabled.
Let me know if there are any other details I can provide to help fix the issue.
The issue seems to have similar symptoms as reported in this thread at - https://lists.freedesktop.org/archives/etnaviv/2018-July/001864.html. But I am not familiar with android / mesa so could be mistaken.