Correct way to retrieve dma-buf metadata over cross-domain protocol

30 views
Skip to first unread message

Madushan Nishantha

unread,
Mar 11, 2024, 11:34:55 AMMar 11
to crosvm-dev
I'm trying to write a standalone(without using sommelier proxy) wayland client using virtio-gpu cross-domain protocol.

I'm having some issues with zwp_linux_dmabuf_v1 protocol. Sometimes the client crashes because stride and modifiers are wrong when calling "zwp_linux_buffer_params_v1::add".

I see sommelier uses "DRM_IOCTL_VIRTGPU_RESOURCE_INFO_CROS" ioctl to get the correct metadata from the host, but this ioctl is not available on upstream kernel(sommelier also doesn't work for me with wayland dma-buf because of this).

Also I see "CROSS_DOMAIN_CMD_GET_IMAGE_REQUIREMENTS" can be used to get the proper metadata. I tried it but it sometimes return incorrect stride, I'm not sure why. Also I have to immediately allocate a host blob for the returned resource id. Otherwise next call of this type fails with "RutabagaError::AlreadyInUse".

What is the correct way to get this metadata? I saw in the chromium bug tracker that arcvm uses "cross-domain resource sharing" for this. What is it? is there some implementation I can use as reference?

Thank you,

Madushan Nishantha

unread,
Mar 11, 2024, 12:41:49 PMMar 11
to crosvm-dev, Madushan Nishantha
I figured out that I can always get the correct stride and metadata(at least on my intel iGPU and for and egl application) by setting "GBM_BO_USE_TEXTURING" flag when doing "CROSS_DOMAIN_CMD_GET_IMAGE_REQUIREMENTS" call. I was using "GBM_BO_USE_LINEAR | GBM_BO_USE_SCANOUT" before like sommelier does. but looks like those flags are not correct for egl buffers.

I would still like to avoid the useless host blob allocation if I can as this might(probably?) waste a lot of memory when resizing a window?
Reply all
Reply to author
Forward
0 new messages