diff --git a/common/include/common/framebuffer.h b/common/include/common/framebuffer.h index 857fb058..efcdcb6d 100644 --- a/common/include/common/framebuffer.h +++ b/common/include/common/framebuffer.h @@ -61,4 +61,16 @@ void framebuffer_prepare(FrameBuffer * frame); */ bool framebuffer_write(FrameBuffer * frame, const void * src, size_t size); +/** + * Gets the underlying data buffer of the framebuffer. + * For custom write routines only. + */ +uint8_t * framebuffer_get_data(FrameBuffer * frame); + +/** + * Sets the write pointer of the framebuffer. + * For custom write routines only. + */ +void framebuffer_set_write_ptr(FrameBuffer * frame, size_t size); + #endif diff --git a/common/src/framebuffer.c b/common/src/framebuffer.c index b14b2cd7..351b721e 100644 --- a/common/src/framebuffer.c +++ b/common/src/framebuffer.c @@ -213,3 +213,13 @@ bool framebuffer_write(FrameBuffer * frame, const void * restrict src, size_t si return true; } + +uint8_t * framebuffer_get_data(FrameBuffer * frame) +{ + return frame->data; +} + +void framebuffer_set_write_ptr(FrameBuffer * frame, size_t size) +{ + atomic_store_explicit(&frame->wp, size, memory_order_release); +}