Class

GdkDmabufTextureBuilder

since: 4.14

Description [src]

final class Gdk.DmabufTextureBuilder : GObject.Object
{
  /* No available fields */
}

GdkDmabufTextureBuilder is a builder used to construct GdkTexture 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 don’t 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 GdkDmabufTextureBuilder is quite simple: Create a texture builder, set all the necessary properties, and then call gdk_dmabuf_texture_builder_build() 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

Available since: 4.14

Hierarchy

hierarchy this GdkDmabufTextureBuilder ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

gdk_dmabuf_texture_builder_new

Creates a new texture builder.

since: 4.14

Instance methods

gdk_dmabuf_texture_builder_build

Builds a new GdkTexture with the values set up in the builder.

since: 4.14

gdk_dmabuf_texture_builder_get_display

Returns the display that this texture builder is associated with.

since: 4.14

gdk_dmabuf_texture_builder_get_fd

Gets the file descriptor for a plane.

since: 4.14

gdk_dmabuf_texture_builder_get_fourcc

Gets the format previously set via gdk_dmabuf_texture_builder_set_fourcc() or 0 if the format wasn’t set.

since: 4.14

gdk_dmabuf_texture_builder_get_height

Gets the height previously set via gdk_dmabuf_texture_builder_set_height() or 0 if the height wasn’t set.

since: 4.14

gdk_dmabuf_texture_builder_get_modifier

Gets the modifier value.

since: 4.14

gdk_dmabuf_texture_builder_get_n_planes

Gets the number of planes.

since: 4.14

gdk_dmabuf_texture_builder_get_offset

Gets the offset value for a plane.

since: 4.14

gdk_dmabuf_texture_builder_get_premultiplied

Whether the data is premultiplied.

since: 4.14

gdk_dmabuf_texture_builder_get_stride

Gets the stride value for a plane.

since: 4.14

gdk_dmabuf_texture_builder_get_update_region

Gets the region previously set via gdk_dmabuf_texture_builder_set_update_region() or NULL if none was set.

since: 4.14

gdk_dmabuf_texture_builder_get_update_texture

Gets the texture previously set via gdk_dmabuf_texture_builder_set_update_texture() or NULL if none was set.

since: 4.14

gdk_dmabuf_texture_builder_get_width

Gets the width previously set via gdk_dmabuf_texture_builder_set_width() or 0 if the width wasn’t set.

since: 4.14

gdk_dmabuf_texture_builder_set_display

Sets the display that this texture builder is associated with.

since: 4.14

gdk_dmabuf_texture_builder_set_fd

Sets the file descriptor for a plane.

since: 4.14

gdk_dmabuf_texture_builder_set_fourcc

Sets the format of the texture.

since: 4.14

gdk_dmabuf_texture_builder_set_height

Sets the height of the texture.

since: 4.14

gdk_dmabuf_texture_builder_set_modifier

Sets the modifier.

since: 4.14

gdk_dmabuf_texture_builder_set_n_planes

Sets the number of planes of the texture.

since: 4.14

gdk_dmabuf_texture_builder_set_offset

Sets the offset for a plane.

since: 4.14

gdk_dmabuf_texture_builder_set_premultiplied

Sets whether the data is premultiplied.

since: 4.14

gdk_dmabuf_texture_builder_set_stride

Sets the stride for a plane.

since: 4.14

gdk_dmabuf_texture_builder_set_update_region

Sets the region to be updated by this texture. Together with GdkDmabufTextureBuilder:update-texture this describes an update of a previous texture.

since: 4.14

gdk_dmabuf_texture_builder_set_update_texture

Sets the texture to be updated by this texture. See gdk_dmabuf_texture_builder_set_update_region() for an explanation.

since: 4.14

gdk_dmabuf_texture_builder_set_width

Sets the width of the texture.

since: 4.14

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gdk.DmabufTextureBuilder:display

The display that this texture will be used on.

since: 4.14

Gdk.DmabufTextureBuilder:fourcc

The format of the texture, as a fourcc value.

since: 4.14

Gdk.DmabufTextureBuilder:height

The height of the texture.

since: 4.14

Gdk.DmabufTextureBuilder:modifier

The modifier.

since: 4.14

Gdk.DmabufTextureBuilder:n-planes

The number of planes of the texture.

since: 4.14

Gdk.DmabufTextureBuilder:premultiplied

Whether the alpha channel is premultiplied into the others.

since: 4.14

Gdk.DmabufTextureBuilder:update-region

The update region for GdkGLTextureBuilder:update-texture.

since: 4.14

Gdk.DmabufTextureBuilder:update-texture

The texture GdkDmabufTextureBuilder:update-region is an update for.

since: 4.14

Gdk.DmabufTextureBuilder:width

The width of the texture.

since: 4.14

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GdkDmabufTextureBuilderClass {
  /* no available fields */
}

No description available.