19 #ifndef MIRAL_WAYLAND_SHM_H
20 #define MIRAL_WAYLAND_SHM_H
24 #include <wayland-client.h>
29 struct WaylandShmPool;
35 std::shared_ptr<WaylandShmPool> pool,
42 auto data() const ->
void* {
return data_; }
43 auto size() const ->
mir::geometry::Size {
return size_; }
46 auto is_in_use() const ->
bool {
return self_ptr !=
nullptr; }
50 auto use() -> wl_buffer*;
55 static wl_buffer_listener
const buffer_listener;
57 static void handle_release(
void *
data, wl_buffer*);
59 std::shared_ptr<WaylandShmPool>
const pool;
63 wl_buffer*
const buffer;
64 std::shared_ptr<WaylandShmBuffer> self_ptr;
81 std::vector<std::shared_ptr<WaylandShmBuffer>> buffers;
Definition: wayland_shm.h:32
auto use() -> wl_buffer *
Marks this buffer as in-use and assumes the resulting wl_buffer is sent to the compositor....
Definition: wayland_shm.cpp:137
auto data() const -> void *
Definition: wayland_shm.h:42
auto is_in_use() const -> bool
Returns if this buffer is currently being used by the compositor. In-use buffers keep themselves aliv...
Definition: wayland_shm.h:46
auto stride() const -> mir::geometry::Stride
Definition: wayland_shm.h:44
auto size() const -> mir::geometry::Size
Definition: wayland_shm.h:43
~WaylandShmBuffer()
Definition: wayland_shm.cpp:132
WaylandShmBuffer(std::shared_ptr< WaylandShmPool > pool, void *data, mir::geometry::Size size, mir::geometry::Stride stride, wl_buffer *buffer)
Definition: wayland_shm.cpp:117
A single WaylandShm does not efficiently provision multiple buffers for multiple window sizes....
Definition: wayland_shm.h:70
WaylandShm(wl_shm *shm)
Does not take ownership of the wl_shm.
Definition: wayland_shm.cpp:153
auto get_buffer(mir::geometry::Size size, mir::geometry::Stride stride) -> std::shared_ptr< WaylandShmBuffer >
Always returns a buffer of the correct size that is not in-use.
Definition: wayland_shm.cpp:158
Definition: dimensions.h:36
detail::IntWrapper< struct StrideTag > Stride
Definition: dimensions.h:55
Definition: splash_session.h:24