Documentation for <wlr/render/wlr_renderer.h>

Back to index

Table of contents

wlr_render_timer_create()

struct wlr_render_timer *wlr_render_timer_create(​struct wlr_renderer *renderer);

Allocate and initialise a new render timer.

wlr_render_timer_destroy()

void wlr_render_timer_destroy(​struct wlr_render_timer *timer);

Destroy the render timer.

wlr_render_timer_get_duration_ns()

int wlr_render_timer_get_duration_ns(​struct wlr_render_timer *timer);

Get the render duration in nanoseconds from the timer.

Returns -1 if the duration is unavailable.

struct wlr_renderer

struct wlr_renderer {
	// Capabilities required for the buffer used as a render target (bitmask of
	// enum wlr_buffer_cap)
	uint32_t render_buffer_caps;
	
	struct {
		struct wl_signal destroy;
		/**
		 * Emitted when the GPU is lost, e.g. on GPU reset.
		 *
		 * Compositors should destroy the renderer and re-create it.
		 */
		struct wl_signal lost;
	} events;
	
	struct {
		/**
		 * Does the renderer support color transforms on its output?
		 */
			bool output_color_transform;
	} features;
	
	// private state
	
	const struct wlr_renderer_impl *impl;
};

A renderer for basic 2D operations.

wlr_renderer_autocreate()

struct wlr_renderer *wlr_renderer_autocreate(​struct wlr_backend *backend);

Automatically create a new renderer.

Selects an appropriate renderer type to use depending on the backend, platform, environment, etc.

wlr_renderer_destroy()

void wlr_renderer_destroy(​struct wlr_renderer *renderer);

Destroys the renderer.

Textures must be destroyed separately.

wlr_renderer_get_drm_fd()

int wlr_renderer_get_drm_fd(​struct wlr_renderer *r);

Obtains the FD of the DRM device used for rendering, or -1 if unavailable.

The caller doesn't have ownership of the FD, it must not close it.

wlr_renderer_get_texture_formats()

const struct wlr_drm_format_set *wlr_renderer_get_texture_formats(​struct wlr_renderer *r, uint32_t buffer_caps);

Get the formats supporting sampling usage.

The buffer capabilities must be passed in.

Buffers allocated with a format from this list may be passed to wlr_texture_from_buffer().

wlr_renderer_init_wl_display()

bool wlr_renderer_init_wl_display(​struct wlr_renderer *r, struct wl_display *wl_display);

wlr_renderer_init_wl_shm()

bool wlr_renderer_init_wl_shm(​struct wlr_renderer *r, struct wl_display *wl_display);