---
name: "wayland_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_zwp_linux_dmabuf_v1_t"
---

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

factory for creating dmabuf-based wl\_buffers

## NAME

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

## SYNOPSIS

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

Inherits **wayland::proxy\_t**.

### Public Types

enum class **wrapper\_type** { **standard**, **display**, **foreign**, **proxy\_wrapper** }\

### Public Member Functions

**zwp\_linux\_buffer\_params\_v1\_t** **create\_params** ()\
 create a temporary object for buffer parameters  **zwp\_linux\_dmabuf\_feedback\_v1\_t** **get\_default\_feedback** ()\
 get default feedback  bool **can\_get\_default\_feedback** () const\
 Check whether the **get\_default\_feedback** function is available with the currently bound version of the protocol.  **zwp\_linux\_dmabuf\_feedback\_v1\_t** **get\_surface\_feedback** (**surface\_t** const &surface)\
 get feedback for a surface  bool **can\_get\_surface\_feedback** () const\
 Check whether the **get\_surface\_feedback** function is available with the currently bound version of the protocol.  std::function\< void(uint32\_t)\> & **on\_format** ()\
 supported buffer format  std::function\< void(uint32\_t, uint32\_t, uint32\_t)\> & **on\_modifier** ()\
 supported buffer format modifier  uint32\_t **get\_id** () const\
 Get the id of a proxy object.  std::string **get\_class** () const\
 Get the interface name (class) of a proxy object.  uint32\_t **get\_version** () const\
 Get the protocol object version of a proxy object.  **wrapper\_type** **get\_wrapper\_type** () const\
 Get the type of a proxy object.  void **set\_queue** (**event\_queue\_t** queue)\
 Assign a proxy to an event queue.  wl\_proxy \* **c\_ptr** () const\
 Get a pointer to the underlying C struct.  bool **proxy\_has\_object** () const\
 Check whether this wrapper actually wraps an object.  **operator bool** () const\
 Check whether this wrapper actually wraps an object.  bool **operator==** (const **proxy\_t** &right) const\
 Check whether two wrappers refer to the same object.  bool **operator!=** (const **proxy\_t** &right) const\
 Check whether two wrappers refer to different objects.  void **proxy\_release** ()\
 Release the wrapped object (if any), making this an empty wrapper.

### Static Public Attributes

static constexpr std::uint32\_t **create\_params\_since\_version** = 1\
 Minimum protocol version required for the **create\_params** function.  static constexpr std::uint32\_t **get\_default\_feedback\_since\_version** = 4\
 Minimum protocol version required for the **get\_default\_feedback** function.  static constexpr std::uint32\_t **get\_surface\_feedback\_since\_version** = 4\
 Minimum protocol version required for the **get\_surface\_feedback** 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 **1519** of file **wayland-client-protocol-unstable.hpp**.

## Member Enumeration Documentation

### enum class wayland::proxy\_t::wrapper\_type` [strong]`, ` [inherited]`

Underlying wl\_proxy type and properties of a **proxy\_t** that affect construction, destruction, and event handling

**Enumerator**

- *standard*

  *C pointer is a standard type compatible with wl\_proxy\*. Events are dispatched and it is destructed when the* **proxy\_t** *is destructed. User data is set.*

- *display*

  *C pointer is a wl\_display\*. No events are dispatched, wl\_display\_disconnect is called when the* **proxy\_t** *is destructed. User data is set.*

- *foreign*

  *C pointer is a standard type compatible with wl\_proxy\*, but another library owns it and it should not be touched in a way that could affect the operation of the other library. No events are dispatched, wl\_proxy\_destroy is not called when the* **proxy\_t** *is destructed, user data is not touched. Consequently, there is no reference counting for the* **proxy\_t***. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy the wl\_proxy.*

- *proxy\_wrapper*

  *C pointer is a wl\_proxy\* that was constructed with wl\_proxy\_create\_wrapper. No events are dispatched, wl\_proxy\_wrapper\_destroy is called when the* **proxy\_t** *is destroyed. Reference counting is active. A reference to the* **proxy\_t** *creating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed.*

*Definition at line* **116** *of file* **wayland-client.hpp***.*

## Member Function Documentation

### wl\_proxy \* wayland::proxy\_t::c\_ptr () const` [inherited]`

*Get a pointer to the underlying C struct.*

**Returns**

*The underlying wl\_proxy wrapped by this* **proxy\_t** *if it exists, otherwise an exception is thrown*

### bool zwp\_linux\_dmabuf\_v1\_t::can\_get\_default\_feedback () const

*Check whether the* **get\_default\_feedback** *function is available with the currently bound version of the protocol.*

*Definition at line* **5230** *of file* **wayland-client-protocol-unstable.cpp***.*

### bool zwp\_linux\_dmabuf\_v1\_t::can\_get\_surface\_feedback () const

*Check whether the* **get\_surface\_feedback** *function is available with the currently bound version of the protocol.*

*Definition at line* **5242** *of file* **wayland-client-protocol-unstable.cpp***.*

### zwp\_linux\_buffer\_params\_v1\_t zwp\_linux\_dmabuf\_v1\_t::create\_params ()

*create a temporary object for buffer parameters*

**Returns**

*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* **5217** *of file* **wayland-client-protocol-unstable.cpp***.*

### std::string wayland::proxy\_t::get\_class () const` [inherited]`

*Get the interface name (class) of a proxy object.*

**Returns**

*The interface name of the object associated with the proxy*

### zwp\_linux\_dmabuf\_feedback\_v1\_t zwp\_linux\_dmabuf\_v1\_t::get\_default\_feedback ()

*get default feedback 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* **5224** *of file* **wayland-client-protocol-unstable.cpp***.*

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

*Get the id of a proxy object.*

**Returns**

*The id the object associated with the proxy*

### zwp\_linux\_dmabuf\_feedback\_v1\_t zwp\_linux\_dmabuf\_v1\_t::get\_surface\_feedback (surface\_t const & surface)

*get feedback for a surface*

**Parameters**

*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* **5236** *of file* **wayland-client-protocol-unstable.cpp***.*

### uint32\_t wayland::proxy\_t::get\_version () const` [inherited]`

*Get the protocol object version of a proxy object. Gets the protocol object version of a proxy object, or 0 if the proxy was created with unversioned API.*

*A returned value of 0 means that no version information is available, so the caller must make safe assumptions about the object's real version.*

**display\_t** *will always return version 0.*

**Returns**

*The protocol object version of the proxy or 0*

### wrapper\_type wayland::proxy\_t::get\_wrapper\_type () const` [inline]`, ` [inherited]`

*Get the type of a proxy object.*

*Definition at line* **302** *of file* **wayland-client.hpp***.*

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

*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* **5248** *of file* **wayland-client-protocol-unstable.cpp***.*

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

*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* **5253** *of file* **wayland-client-protocol-unstable.cpp***.*

### wayland::proxy\_t::operator bool () const` [inherited]`

*Check whether this wrapper actually wraps an object.*

**Returns**

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

### bool wayland::proxy\_t::operator!= (const proxy\_t & right) const` [inherited]`

*Check whether two wrappers refer to different objects.*

### bool wayland::proxy\_t::operator== (const proxy\_t & right) const` [inherited]`

*Check whether two wrappers refer to the same object.*

### bool wayland::proxy\_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*

### void wayland::proxy\_t::proxy\_release ()` [inherited]`

*Release the wrapped object (if any), making this an empty wrapper. Note that* **display\_t** *instances cannot be released this way. Attempts to do so are ignored.*

**Examples** **foreign\_display.cpp***.*

### void wayland::proxy\_t::set\_queue (event\_queue\_t queue)` [inherited]`

*Assign a proxy to an event queue.*

**Parameters**

*queue The event queue that will handle this proxy*

*Assign proxy to event queue. Events coming from proxy will be queued in queue instead of the display's main queue.*

*See also:* **display\_t::dispatch\_queue()***.*

**Examples** **proxy\_wrapper.cpp***.*

## Member Data Documentation

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

*Minimum protocol version required for the* **create\_params** *function.*

*Definition at line* **1556** *of file* **wayland-client-protocol-unstable.hpp***.*

### constexpr std::uint32\_t wayland::zwp\_linux\_dmabuf\_v1\_t::get\_default\_feedback\_since\_version = 4` [static]`, ` [constexpr]`

*Minimum protocol version required for the* **get\_default\_feedback** *function.*

*Definition at line* **1570** *of file* **wayland-client-protocol-unstable.hpp***.*

### constexpr std::uint32\_t wayland::zwp\_linux\_dmabuf\_v1\_t::get\_surface\_feedback\_since\_version = 4` [static]`, ` [constexpr]`

*Minimum protocol version required for the* **get\_surface\_feedback** *function.*

*Definition at line* **1592** *of file* **wayland-client-protocol-unstable.hpp***.*

## Author

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