---
name: "wayland_server_zwp_linux_dmabuf_v1_t"
section: "3"
platform: "linux"
package: "waylandpp-dev"
version: "1.0.0-6+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/wayland_server_zwp_linux_dmabuf_v1_t"
---

# wayland\_server\_zwp\_linux\_dmabuf\_v1\_t(3)

factory for creating dmabuf-based wl\_buffers

## NAME

wayland::server::zwp\_linux\_dmabuf\_v1\_t - factory for creating dmabuf-based wl\_buffers

## SYNOPSIS

`#include <wayland-server-protocol-unstable.hpp>`

Inherits wayland::server::resource\_t.

### Public Member Functions

std::function\< void()\> & **on\_destroy** ()\
 unbind the factory  std::function\< void(**zwp\_linux\_buffer\_params\_v1\_t**)\> & **on\_create\_params** ()\
 create a temporary object for buffer parameters  std::function\< void(**zwp\_linux\_dmabuf\_feedback\_v1\_t**)\> & **on\_get\_default\_feedback** ()\
 get default feedback  std::function\< void(**zwp\_linux\_dmabuf\_feedback\_v1\_t**, **surface\_t**)\> & **on\_get\_surface\_feedback** ()\
 get feedback for a surface  void **format** (uint32\_t format, bool post=true)\
 supported buffer format  void **modifier** (uint32\_t **format**, uint32\_t modifier\_hi, uint32\_t modifier\_lo, bool post=true)\
 supported buffer format modifier  bool **can\_modifier** () const\
 Check whether the **modifier** function is available with the currently bound version of the protocol.  bool **proxy\_has\_object** () const\
 Check whether this wrapper actually wraps an object.  void **post\_no\_memory** () const\
 uint32\_t **get\_id** () const\
 client\_t **get\_client** () const\
 unsigned int **get\_version** () const\
 std::string **get\_class** ()\

### Static Public Attributes

static constexpr std::uint32\_t **format\_since\_version** = 1\
 Minimum protocol version required for the **format** function.  static constexpr std::uint32\_t **modifier\_since\_version** = 3\
 Minimum protocol version required for the **modifier** function.

## Detailed Description

factory for creating dmabuf-based wl\_buffers

Following the interfaces from: https://www.khronos.org/registry/egl/extensions/EXT/EGL\_EXT\_image\_dma\_buf\_import.txt https://www.khronos.org/registry/EGL/extensions/EXT/EGL\_EXT\_image\_dma\_buf\_import\_modifiers.txt and the Linux DRM sub-system's AddFb2 ioctl.

This interface offers ways to create generic dmabuf-based wl\_buffers.

Clients can use the get\_surface\_feedback request to get dmabuf feedback for a particular surface. If the client wants to retrieve feedback not tied to a surface, they can use the get\_default\_feedback request.

The following are required from clients:

- •

  Clients must ensure that either all data in the dma-buf is coherent for all subsequent read access or that coherency is correctly handled by the underlying kernel-side dma-buf implementation.

- •

  Don't make any more attachments after sending the buffer to the compositor. Making more attachments later increases the risk of the compositor not being able to use (re-import) an existing dmabuf-based wl\_buffer.

The underlying graphics stack must ensure the following:

- •

  The dmabuf file descriptors relayed to the server will stay valid for the whole lifetime of the wl\_buffer. This means the server may at any time use those fds to import the dmabuf into any kernel sub-system that might accept it.

However, when the underlying graphics stack fails to deliver the promise, because of e.g. a device hot-unplug which raises internal errors, after the wl\_buffer has been successfully created the compositor must not raise protocol errors to the client when dmabuf import later fails.

To create a wl\_buffer from one or more dmabufs, a client creates a zwp\_linux\_dmabuf\_params\_v1 object with a zwp\_linux\_dmabuf\_v1.create\_params request. All planes required by the intended format are added with the 'add' request. Finally, a 'create' or 'create\_immed' request is issued, which has the following outcome depending on the import success.

The 'create' request,

- •

  on success, triggers a 'created' event which provides the final wl\_buffer to the client.

- •

  on failure, triggers a 'failed' event to convey that the server cannot use the dmabufs received from the client.

For the 'create\_immed' request,

- •

  on success, the server immediately imports the added dmabufs to create a wl\_buffer. No event is sent from the server in this case.

- •

  on failure, the server can choose to either:

- •

  terminate the client by raising a fatal error.

- •

  mark the wl\_buffer as failed, and send a 'failed' event to the client. If the client uses a failed wl\_buffer as an argument to any request, the behaviour is compositor implementation-defined.

For all DRM formats and unless specified in another protocol extension, pre-multiplied alpha is used for pixel values.

Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes are done by bumping the version number in the protocol and interface names and resetting the interface version. Once the protocol is to be declared stable, the 'z' prefix and the version number in the protocol and interface names are removed and the interface version number is reset.

Definition at line **1631** of file **wayland-server-protocol-unstable.hpp**.

## Member Function Documentation

### bool zwp\_linux\_dmabuf\_v1\_t::can\_modifier () const

Check whether the **modifier** function is available with the currently bound version of the protocol.

Definition at line **4960** of file **wayland-server-protocol-unstable.cpp**.

### void zwp\_linux\_dmabuf\_v1\_t::format (uint32\_t format, bool post = `true`)

supported buffer format

**Parameters**

*format* DRM\_FORMAT code

This event advertises one buffer format that the server supports. All the supported formats are advertised once when the client binds to this interface. A roundtrip after binding guarantees that the client has received all supported formats.

For the definition of the format codes, see the zwp\_linux\_buffer\_params\_v1::create request.

Starting version 4, the format event is deprecated and must not be sent by compositors. Instead, use get\_default\_feedback or get\_surface\_feedback.

Definition at line **4950** of file **wayland-server-protocol-unstable.cpp**.

### std::string wayland::server::resource\_t::get\_class ()` [inherited]`

Retrieve the interface name (class) of a resource object.

**Returns**

Interface name of the resource object.

### client\_t wayland::server::resource\_t::get\_client () const` [inherited]`

Get the associated client

**Returns**

the client that owns the resource.

### uint32\_t wayland::server::resource\_t::get\_id () const` [inherited]`

Get the internal ID of the resource

**Returns**

the internal ID of the resource

### unsigned int wayland::server::resource\_t::get\_version () const` [inherited]`

Get interface version

**Returns**

Interface version this resource has been constructed with.

### void zwp\_linux\_dmabuf\_v1\_t::modifier (uint32\_t format, uint32\_t modifier\_hi, uint32\_t modifier\_lo, bool post = `true`)

supported buffer format modifier

**Parameters**

*format* DRM\_FORMAT code \
 *modifier\_hi* high 32 bits of layout modifier \
 *modifier\_lo* low 32 bits of layout modifier

This event advertises the formats that the server supports, along with the modifiers supported for each format. All the supported modifiers for all the supported formats are advertised once when the client binds to this interface. A roundtrip after binding guarantees that the client has received all supported format-modifier pairs.

For legacy support, DRM\_FORMAT\_MOD\_INVALID (that is, modifier\_hi == 0x00ffffff and modifier\_lo == 0xffffffff) is allowed in this event. It indicates that the server can support the format with an implicit modifier. When a plane has DRM\_FORMAT\_MOD\_INVALID as its modifier, it is as if no explicit modifier is specified. The effective modifier will be derived from the dmabuf.

A compositor that sends valid modifiers and DRM\_FORMAT\_MOD\_INVALID for a given format supports both explicit modifiers and implicit modifiers.

For the definition of the format and modifier codes, see the zwp\_linux\_buffer\_params\_v1::create and zwp\_linux\_buffer\_params\_v1::add requests.

Starting version 4, the modifier event is deprecated and must not be sent by compositors. Instead, use get\_default\_feedback or get\_surface\_feedback.

Definition at line **4955** of file **wayland-server-protocol-unstable.cpp**.

### std::function\< void(zwp\_linux\_buffer\_params\_v1\_t)\> & zwp\_linux\_dmabuf\_v1\_t::on\_create\_params ()

create a temporary object for buffer parameters

**Parameters**

*params\_id* the new temporary

This temporary object is used to collect multiple dmabuf handles into a single batch to create a wl\_buffer. It can only be used once and should be destroyed after a 'created' or 'failed' event has been received.

Definition at line **4932** of file **wayland-server-protocol-unstable.cpp**.

### std::function\< void()\> & zwp\_linux\_dmabuf\_v1\_t::on\_destroy ()

unbind the factory Objects created through this interface, especially wl\_buffers, will remain valid.

Definition at line **4926** of file **wayland-server-protocol-unstable.cpp**.

### std::function\< void(zwp\_linux\_dmabuf\_feedback\_v1\_t)\> & zwp\_linux\_dmabuf\_v1\_t::on\_get\_default\_feedback ()

get default feedback

**Parameters**

*id*

This request creates a new wp\_linux\_dmabuf\_feedback object not bound to a particular surface. This object will deliver feedback about dmabuf parameters to use if the client doesn't support per-surface feedback (see get\_surface\_feedback).

Definition at line **4938** of file **wayland-server-protocol-unstable.cpp**.

### std::function\< void(zwp\_linux\_dmabuf\_feedback\_v1\_t, surface\_t)\> & zwp\_linux\_dmabuf\_v1\_t::on\_get\_surface\_feedback ()

get feedback for a surface

**Parameters**

*id* \
 *surface*

This request creates a new wp\_linux\_dmabuf\_feedback object for the specified wl\_surface. This object will deliver feedback about dmabuf parameters to use for buffers attached to this surface.

If the surface is destroyed before the wp\_linux\_dmabuf\_feedback object, the feedback object becomes inert.

Definition at line **4944** of file **wayland-server-protocol-unstable.cpp**.

### void wayland::server::resource\_t::post\_no\_memory () const` [inherited]`

Post 'not enough memory' error to the client

If the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance.

### bool wayland::server::resource\_t::proxy\_has\_object () const` [inherited]`

Check whether this wrapper actually wraps an object.

**Returns**

true if there is an underlying object, false if this wrapper is empty

## Member Data Documentation

### constexpr std::uint32\_t wayland::server::zwp\_linux\_dmabuf\_v1\_t::format\_since\_version = 1` [static]`, ` [constexpr]`

Minimum protocol version required for the **format** function.

Definition at line **1724** of file **wayland-server-protocol-unstable.hpp**.

### constexpr std::uint32\_t wayland::server::zwp\_linux\_dmabuf\_v1\_t::modifier\_since\_version = 3` [static]`, ` [constexpr]`

Minimum protocol version required for the **modifier** function.

Definition at line **1760** of file **wayland-server-protocol-unstable.hpp**.

## Author

Generated automatically by Doxygen for Wayland++ from the source code.
