<br><div>some buffer attributes may influence how weston use it, for example: tiling mode, <a href="https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)" title="Swizzling (computer graphics)" style="text-decoration-line: none; color: rgb(11, 0, 128); background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: sans-serif; font-size: 14px;">Swizzling</a>, compression.</div><div>weston may depend on these attribute to decide to assign the buffer to a hw plane or composite it as texture.</div><div><br></div><br><div id="">--------------------------------<br></div><div id=""><br></div><br><div id="origbody"><div style="background: #f2f2f2;">----- 原始邮件 -----<br>发件人:Pekka Paalanen <ppaalanen@gmail.com><br>收件人:"HalleyZhao" <halleyzhao@sina.com><br>抄送人:"wayland-devel" <wayland-devel@lists.freedesktop.org><br>主题:Re: bo flags isn't passed through wayland-drm protocl, how weston respect these flags?<br>日期:2019年08月06日 15点57分<br></div><br>On Tue, 06 Aug 2019 09:03:51 +0800<br>"HalleyZhao" <halleyzhao@sina.com> wrote:<br>> 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.<br>> <br>>     <!-- 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><br>> --------------------------------<br>> <br>Hi,<br>why should the compositor care about usage flags at all?<br>What are you thinking about here?<br>The buffer has already been allocated by the client. The primary<br>purpose of the usage flags is to guide the allocation, so the<br>compositor has no use for them.<br>Compositor's usage of the buffer on the other hand is implied by the<br>Wayland protocol. If you attach the wl_buffer to a wl_surface, then the<br>buffer will be used as a texture, possibly as a KMS FB, and maybe more<br>if it turns out suitable (Weston implements only the texture and KMS FB<br>cases). If you use the wl_buffer in some other Wayland interface, then<br>that other interface implies how it will be used.<br>Scott is also right.<br>gbm_bo_flags predate DRM format modifiers. gbm_bo_flags guide the GBM<br>implementation in choosing the modifier, and the modifier will be sent<br>to the Wayland compositor to describe the data layout of the buffer in<br>zwp_linux_dmabuf extension.<br>As you can see, gbm_bo_create_with_modifiers() does not take<br>gbm_bo_flags at all.<br>Thanks,<br>pq<br></div>