i.MX8M: Import dma buffer in gbm fails when used with modifiers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8M: Import dma buffer in gbm fails when used with modifiers

1,406 Views
cmeissl
Contributor I

Hi,

We try to integrate a custom wayland compositor on the i.MX8M and having some issues with the gbm buffer handling.

The library we use manually creates a gbm bo with either gbm_bo_create or gbm_bo_create_with_modifiers depending on if modifiers are present on the format previously selected. In both cases the fd is read with gbm_bo_get_fd. The buffer is afterwards (re-)imported with either gbo_bo_import(gbm_device, GBM_BO_IMPORT_FD, gbm_import_fd_data, SCANOUT) or gbm_bo_import(gbm_device, GBM_BO_IMPORT_FD_MODIFIER, gbm_import_fd_modifier_data, SCANOUT) depending on if the buffer has modifiers set other than linear/invalid. This export/import is done to support multi output/render devices.

Default the AR24 format with modifier Vivante_super_tiled is used. This will create a buffer with modifiers, where the import through gbm_bo_import will fail with an error of ENOENT.

As the libgbm is closed source I could not have look what happens there, but a run an strace and found that the ioclt DRM_IOCTL_PRIME_FD_TO_HANDLE is called in the kernel. I tried to follow the calls in the kernel and it seems that the call chain is:

DRM_IOCTL_PRIME_FD_TO_HANDLE -> drivers/gpu/drm/drm_prime.c:drm_prime_fd_to_handle_ioctl -> driver.prime_fd_to_handle -> drivers/gpu/drm/imx/imx-drm-core.c.prime_fd_to_handle -> drivers/gpu/drm/drm_prime.c:drm_gem_prime_handle_to_fd -> drm_gem_object_lookup -> -ENOENT

So it seems that the lookup of the handle fails with -ENOENT.

When using Linear or Invalid the buffer can be imported successfully.

I am a bit out of options, so maybe someone could help us and tell us what we are doing wrong.

Thanks in advance,

Br,

Christian

0 Kudos
2 Replies

1,076 Views
cmeissl
Contributor I

Hi Igor,

Sorry for late reply.

We use a development kit from TQ-Systems and built the firmware with yocto (hardknott). The gpu-viv version from hardknott is 6.4.3.p2.0.
After some investigation and looking at weston-imx it seems that gbm_bo_import is not supported on the device and will always return NULL.
We have worked around that the same way as implemented in weston-imx by using drm_prime_fd_to_handle to get the GEM handle(s) and use them for adding the framebuffer.

Best regards,
Christian

 

0 Kudos

1,323 Views
igorpadykov
NXP Employee
NXP Employee

Hi Christian

 

could you please clarify which BSP and gpu-viv version used in the case. 

There are may be some changes.

 

Best regards
igor

0 Kudos