Package: gdk

Class gdk:dmabuf-texture-builder

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

display
The display property of type gdk:display (Read / Write)
The display that this texture will be used on.
fourcc
The fourcc property of type guint (Read / Write)
The format of the texture, as a fourcc value.
height
The height property of type guint (Read / Write)
The height of the texture.
Default value: 0
modifier
The modifier property of type guint64 (Read / Write)
The modifier.
Default value: 0
n-planes
The n-planes property of type guint (Read / Write)
The number of planes of the texture. Note that you can set properties for other planes, but they will be ignored when constructing the texture.
premultiplied
The premultiplied property of type :boolean (Read / Write)
Whether the alpha channel is premultiplied into the others. Only relevant if the format has alpha.
Default value: true
update-region
The update-region property of type cairo:region-t (Read / Write)
The update region of update-texture value.
update-texture
The update-texture property of type gdk:texture (Read / Write)
The texture the update-region value is an update for.
width
The width property of type :uint (Read / Write)
The width of the texture.
Default value: 0

Details

The gdk:dmabuf-texture-builder object is a builder used to construct gdk:texture objects from DMA buffers. DMA buffers are commonly called dma-bufs.

DMA buffers are a feature of the Linux kernel to enable efficient buffer and memory sharing between hardware such as codecs, GPUs, displays, cameras and the kernel drivers controlling them. For example, a decoder may want its output to be directly shared with the display server for rendering without a copy.

Any device driver which participates in DMA buffer sharing, can do so as either the exporter or importer of buffers (or both).

The memory that is shared via DMA buffers is usually stored in non-system memory (maybe in device’s local memory or something else not directly accessible by the CPU), and accessing this memory from the CPU may have higher-than-usual overhead.

In particular for graphics data, it is not uncommon that data consists of multiple separate blocks of memory, for example one block for each of the red, green and blue channels. These blocks are called planes. DMA buffers can have up to four planes. Even if the memory is a single block, the data can be organized in multiple planes, by specifying offsets from the beginning of the data.

DMA buffers are exposed to user-space as file descriptors allowing to pass them between processes. If a DMA buffer has multiple planes, there is one file descriptor per plane.

The format of the data (for graphics data, essentially its colorspace) is described by a 32-bit integer. These format identifiers are defined in the header file drm_fourcc.h and commonly referred to as fourcc values, since they are identified by 4 ASCII characters. Additionally, each DMA buffer has a modifier, which is a 64-bit integer that describes driver-specific details of the memory layout, such as tiling or compression.

For historical reasons, some producers of dma-bufs do not provide an explicit modifier, but instead return DMA_FORMAT_MOD_INVALID to indicate that their modifier is implicit. GTK tries to accommodate this situation by accepting DMA_FORMAT_MOD_INVALID as modifier.

The operation of the gdk:dmabuf-texture-builder object is quite simple: Create a texture builder, set all the necessary properties, and then call the gdk:dmabuf-texture-builder-build object to create the new texture.

The required properties for a dma-buf texture are
  • The width and height in pixels.
  • The fourcc code and modifier which identify the format and memory layout of the dma-buf.
  • The file descriptor, offset and stride for each of the planes.
GdkDmabufTextureBuilder can be used for quick one-shot construction of textures as well as kept around and reused to construct multiple textures.

For further information, see the Linux kernel Linux kernel documentation and the drm_fourcc.h header file.

Since 4.14
 

Inherited Slot Access Functions

See also

2024-7-11