Listener state for Wayland screencopy frames backed by DMA-BUFs. More...
#include <src/platform/linux/wayland.h>
Public Types | |
| enum | status_e { WAITING , READY , REINIT } |
| Capture state for the active screencopy request. More... | |
Public Member Functions | |
| void | buffer (zwlr_screencopy_frame_v1 *frame, std::uint32_t format, std::uint32_t width, std::uint32_t height, std::uint32_t stride) |
| Record DMA-BUF buffer parameters from the compositor. | |
| void | buffer_done (zwlr_screencopy_frame_v1 *frame) |
| Allocate or import the buffer once the compositor finished describing it. | |
| bool | cancel () |
| Withdraw the request that is waiting for the compositor to copy a frame. | |
| void | damage (zwlr_screencopy_frame_v1 *frame, std::uint32_t x, std::uint32_t y, std::uint32_t width, std::uint32_t height) |
| Record damaged frame bounds reported by the compositor. | |
| dmabuf_t (const dmabuf_t &)=delete | |
| dmabuf_t (dmabuf_t &&)=delete | |
| void | failed (zwlr_screencopy_frame_v1 *frame) |
| Mark the frame capture as failed. | |
| void | flags (zwlr_screencopy_frame_v1 *frame, std::uint32_t flags) |
| Record frame flags reported by the compositor. | |
| frame_t * | get_next_frame () |
| Select the inactive frame slot for the next screencopy request. | |
| void | linux_dmabuf (zwlr_screencopy_frame_v1 *frame, std::uint32_t format, std::uint32_t width, std::uint32_t height) |
| Record Linux DMA-BUF parameters advertised for the frame. | |
| void | listen (zwlr_screencopy_manager_v1 *screencopy_manager, zwp_linux_dmabuf_v1 *dmabuf_interface, const std::map< std::uint32_t, std::vector< std::uint64_t > > *supported_modifiers, wl_output *output, bool blend_cursor=false, const std::map< std::uint32_t, std::vector< std::uint64_t > > *encoder_modifiers=nullptr) |
| Start a screencopy request and attach the DMA-BUF listener callbacks. | |
| dmabuf_t & | operator= (const dmabuf_t &)=delete |
| dmabuf_t & | operator= (dmabuf_t &&)=delete |
| void | ready (zwlr_screencopy_frame_v1 *frame, std::uint32_t tv_sec_hi, std::uint32_t tv_sec_lo, std::uint32_t tv_nsec) |
| Mark the current screencopy frame as ready and store its timestamp. | |
Static Public Member Functions | |
| static void | buffer_params_created (void *data, struct zwp_linux_buffer_params_v1 *params, struct wl_buffer *wl_buffer) |
| Store the Wayland buffer created for a DMA-BUF parameter request. | |
| static void | buffer_params_failed (void *data, struct zwp_linux_buffer_params_v1 *params) |
| Mark DMA-BUF buffer creation as failed. | |
Public Attributes | |
| frame_t * | current_frame |
| Frame descriptor currently being filled by the compositor. | |
| std::array< frame_t, 2 > | frames {} |
| Double-buffered frame descriptors. | |
| zwlr_screencopy_frame_v1_listener | listener |
| Callback table registered on screencopy frames. | |
| status_e | status {READY} |
| Current state of the active screencopy request, initially ready. | |
| bool | with_damage {false} |
| Ask the compositor for the next frame that differs, rather than for a frame now. | |
Listener state for Wayland screencopy frames backed by DMA-BUFs.
| void wl::dmabuf_t::buffer | ( | zwlr_screencopy_frame_v1 * | frame, |
| std::uint32_t | format, | ||
| std::uint32_t | width, | ||
| std::uint32_t | height, | ||
| std::uint32_t | stride ) |
Record DMA-BUF buffer parameters from the compositor.
| frame | Screencopy frame that advertised shared-memory fallback data. |
| format | DRM pixel format for the shared-memory buffer. |
| width | Frame width in pixels. |
| height | Frame height in pixels. |
| stride | Number of bytes per row in the buffer. |
| void wl::dmabuf_t::buffer_done | ( | zwlr_screencopy_frame_v1 * | frame | ) |
Allocate or import the buffer once the compositor finished describing it.
| frame | Screencopy frame whose buffer description is complete. |
|
static |
Store the Wayland buffer created for a DMA-BUF parameter request.
| data | Pointer to the dmabuf_t instance associated with the callback. |
| params | DMA-BUF parameter object that completed buffer creation. |
| wl_buffer | Wayland buffer created from the DMA-BUF planes. |
|
static |
Mark DMA-BUF buffer creation as failed.
| data | Pointer to the dmabuf_t instance associated with the callback. |
| params | DMA-BUF parameter object that failed buffer creation. |
| bool wl::dmabuf_t::cancel | ( | ) |
Withdraw the request that is waiting for the compositor to copy a frame.
Only a request whose copy has been asked for can be withdrawn. Before that the buffer for it is still being created, and its callback refers to the request.
| void wl::dmabuf_t::damage | ( | zwlr_screencopy_frame_v1 * | frame, |
| std::uint32_t | x, | ||
| std::uint32_t | y, | ||
| std::uint32_t | width, | ||
| std::uint32_t | height ) |
Record damaged frame bounds reported by the compositor.
| frame | Screencopy frame that reported damage. |
| x | Left edge of the damaged rectangle. |
| y | Top edge of the damaged rectangle. |
| width | Damaged rectangle width in pixels. |
| height | Damaged rectangle height in pixels. |
| void wl::dmabuf_t::failed | ( | zwlr_screencopy_frame_v1 * | frame | ) |
Mark the frame capture as failed.
| frame | Screencopy frame that failed. |
| void wl::dmabuf_t::flags | ( | zwlr_screencopy_frame_v1 * | frame, |
| std::uint32_t | flags ) |
Record frame flags reported by the compositor.
| frame | Screencopy frame that reported flags. |
| flags | Wayland screencopy flags such as vertical inversion. |
|
inline |
Select the inactive frame slot for the next screencopy request.
| void wl::dmabuf_t::linux_dmabuf | ( | zwlr_screencopy_frame_v1 * | frame, |
| std::uint32_t | format, | ||
| std::uint32_t | width, | ||
| std::uint32_t | height ) |
Record Linux DMA-BUF parameters advertised for the frame.
| frame | Screencopy frame that advertised DMA-BUF data. |
| format | DRM pixel format for the DMA-BUF. |
| width | Frame width in pixels. |
| height | Frame height in pixels. |
| void wl::dmabuf_t::listen | ( | zwlr_screencopy_manager_v1 * | screencopy_manager, |
| zwp_linux_dmabuf_v1 * | dmabuf_interface, | ||
| const std::map< std::uint32_t, std::vector< std::uint64_t > > * | supported_modifiers, | ||
| wl_output * | output, | ||
| bool | blend_cursor = false, | ||
| const std::map< std::uint32_t, std::vector< std::uint64_t > > * | encoder_modifiers = nullptr ) |
Start a screencopy request and attach the DMA-BUF listener callbacks.
| screencopy_manager | Compositor screencopy manager used to request frames. |
| dmabuf_interface | Compositor DMA-BUF interface used to allocate buffers. |
| supported_modifiers | DMA-BUF format modifiers supported by the compositor. |
| output | Wayland output to capture. |
| blend_cursor | Whether the compositor should include the cursor in the frame. |
| encoder_modifiers | Optional modifiers supported by the encoder for format intersection. |
| void wl::dmabuf_t::ready | ( | zwlr_screencopy_frame_v1 * | frame, |
| std::uint32_t | tv_sec_hi, | ||
| std::uint32_t | tv_sec_lo, | ||
| std::uint32_t | tv_nsec ) |
Mark the current screencopy frame as ready and store its timestamp.
| frame | Screencopy frame that completed. |
| tv_sec_hi | High 32 bits of the compositor-provided seconds value. |
| tv_sec_lo | Low 32 bits of the compositor-provided seconds value. |
| tv_nsec | Nanosecond component of the compositor-provided timestamp. |