bo flags isn't passed through wayland-drm protocl, how weston respect these flags?

Scott Anderson scott.anderson at collabora.com
Tue Aug 6 03:46:54 UTC 2019


On 6/08/19 1:03 pm, HalleyZhao wrote:
> 
> Hi experts:
> when we create buffer object at wayland client side, there are some 
> usage flags, for example gbm_bo_flags.
> but when we pass these buffer fd to weston through wayland-drm protocl, 
> these flags are ignored.
> then, how weston respect these flags when using the buffer object?
> thanks.
> 
> 
>      <!-- Create a wayland buffer for the prime fd.  Use for regular and 
> planar
>           buffers.  Pass 0 for offset and stride for unused planes. -->
>      <request name="create_prime_buffer" since="2">
>        <arg name="id" type="new_id" interface="wl_buffer"/>
>        <arg name="name" type="fd"/>
>        <arg name="width" type="int"/>
>        <arg name="height" type="int"/>
>        <arg name="format" type="uint"/>
>        <arg name="offset0" type="int"/>
>        <arg name="stride0" type="int"/>
>        <arg name="offset1" type="int"/>
>        <arg name="stride1" type="int"/>
>        <arg name="offset2" type="int"/>
>        <arg name="stride2" type="int"/>
>      </request>
> 
> --------------------------------

Hi,

I think GPU drivers have their own driver-specific ways to get extra 
metadata associated with the buffer. So if you're simply passing a 
buffer allocated from the same driver, things should "just work". But 
it's not as easy when you're mixing GPUs/drivers.

Somewhat recently, 'modifiers' which describe extra information about a 
buffer were introduced to remove some of this driver-specific magic [1]. 
Although, not every driver supports modifiers yet.

Also, by the sounds of it, you're using the wl_drm interface directly. 
This isn't really a good idea, and it was supposed to be a private 
implementation detail of Mesa, and doesn't support modifiers. 
wp_linux_dmabuf [2] is the modern and more properly standardized way to
create a wl_buffer from a dmabuf.

Scott


[1] https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#format-modifiers
[2] 
https://gitlab.freedesktop.org/wayland/wayland-protocols/blob/master/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml


More information about the wayland-devel mailing list