wayland_server_shm_pool_t - Man Page

a shared memory pool

Synopsis

#include <wayland-server-protocol.hpp>

Inherits wayland::server::resource_t.

Public Member Functions

std::function< void(buffer_t, int32_t, int32_t, int32_t, int32_t, shm_format)> & on_create_buffer ()
create a buffer from the pool
std::function< void()> & on_destroy ()
destroy the pool
std::function< void(int32_t)> & on_resize ()
change the size of the pool mapping
bool proxy_has_object () const
Check whether this wrapper actually wraps an object.
void post_no_memory () const
uint32_t get_id () const
client_t get_client () const
unsigned int get_version () const
std::string get_class ()

Detailed Description

a shared memory pool

The wl_shm_pool object encapsulates a piece of memory shared between the compositor and client. Through the wl_shm_pool object, the client can allocate shared memory wl_buffer objects. All objects created through the same pool share the same underlying mapped memory. Reusing the mapped memory avoids the setup/teardown overhead and is useful when interactively resizing a surface or for many small buffers.

Definition at line 327 of file wayland-server-protocol.hpp.

Member Function Documentation

std::string wayland::server::resource_t::get_class () [inherited]

Retrieve the interface name (class) of a resource object.

Returns

Interface name of the resource object.

client_t wayland::server::resource_t::get_client () const [inherited]

Get the associated client

Returns

the client that owns the resource.

uint32_t wayland::server::resource_t::get_id () const [inherited]

Get the internal ID of the resource

Returns

the internal ID of the resource

unsigned int wayland::server::resource_t::get_version () const [inherited]

Get interface version

Returns

Interface version this resource has been constructed with.

std::function< void(buffer_t, int32_t, int32_t, int32_t, int32_t, shm_format)> & shm_pool_t::on_create_buffer ()

create a buffer from the pool

Parameters

id buffer to create
offset buffer byte offset within the pool
width buffer width, in pixels
height buffer height, in pixels
stride number of bytes from the beginning of one row to the beginning of the next row
format buffer pixel format

Create a wl_buffer object from the pool.

The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event.

A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it.

Definition at line 1692 of file wayland-server-protocol.cpp.

std::function< void()> & shm_pool_t::on_destroy ()

destroy the pool Destroy the shared memory pool.

The mmapped memory will be released when all buffers that have been created from this pool are gone.

Definition at line 1698 of file wayland-server-protocol.cpp.

std::function< void(int32_t)> & shm_pool_t::on_resize ()

change the size of the pool mapping

Parameters

size new size of the pool, in bytes

This request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger.

This request only changes the amount of bytes that are mmapped
by the server and does not touch the file corresponding to the
file descriptor passed at creation time. It is the client's
responsibility to ensure that the file is at least as big as
the new pool size.

Definition at line 1704 of file wayland-server-protocol.cpp.

void wayland::server::resource_t::post_no_memory () const [inherited]

Post 'not enough memory' error to the client

If the compositor has not enough memory to fulfill a certail request of the client, this function can be called to notify the client of this circumstance.

bool wayland::server::resource_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

Author

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

Info

Wed Oct 5 2022 Version 1.0.0 Wayland++