Documentation for <wlr/render/swapchain.h>

Back to index

Table of contents

struct wlr_swapchain

struct wlr_swapchain {
	struct wlr_allocator *allocator; // NULL if destroyed
	
	int width, height;
	struct wlr_drm_format format;
	
	struct wlr_swapchain_slot slots[];
	
	struct wl_listener allocator_destroy;
};

wlr_swapchain_acquire()

struct wlr_buffer *wlr_swapchain_acquire(​struct wlr_swapchain *swapchain, int *age);

Acquire a buffer from the swap chain.

The returned buffer is locked. When the caller is done with it, they must unlock it by calling wlr_buffer_unlock.

WLR_SWAPCHAIN_CAP

#define WLR_SWAPCHAIN_CAP

wlr_swapchain_create()

struct wlr_swapchain *wlr_swapchain_create(​struct wlr_allocator *alloc, int width, int height, const struct wlr_drm_format *format);

wlr_swapchain_destroy()

void wlr_swapchain_destroy(​struct wlr_swapchain *swapchain);

wlr_swapchain_has_buffer()

bool wlr_swapchain_has_buffer(​struct wlr_swapchain *swapchain, struct wlr_buffer *buffer);

wlr_swapchain_set_buffer_submitted()

void wlr_swapchain_set_buffer_submitted(​struct wlr_swapchain *swapchain, struct wlr_buffer *buffer);

Mark the buffer as submitted for presentation. This needs to be called by swap chain users on frame boundaries.

If the buffer hasn't been created via the swap chain, the call is ignored.

struct wlr_swapchain_slot

struct wlr_swapchain_slot {
	struct wlr_buffer *buffer;
	bool acquired; // waiting for release
	int age;
	
	struct wl_listener release;
};