render: introduce renderer_get_render_buffer_caps

This commit is contained in:
Simon Zeni 2021-04-23 13:51:05 -04:00 committed by Simon Ser
parent 144189674e
commit 982498fab3
5 changed files with 23 additions and 0 deletions

View File

@ -21,5 +21,11 @@ bool wlr_renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer)
*/
const struct wlr_drm_format_set *wlr_renderer_get_render_formats(
struct wlr_renderer *renderer);
/**
* Get the supported buffer capabilities.
*
* This functions returns a bitfield of supported wlr_buffer_cap.
*/
uint32_t renderer_get_render_buffer_caps(struct wlr_renderer *renderer);
#endif

View File

@ -56,6 +56,7 @@ struct wlr_renderer_impl {
bool (*init_wl_display)(struct wlr_renderer *renderer,
struct wl_display *wl_display);
int (*get_drm_fd)(struct wlr_renderer *renderer);
uint32_t (*get_render_buffer_caps)(void);
};
void wlr_renderer_init(struct wlr_renderer *renderer,

View File

@ -17,6 +17,7 @@
#include <wlr/util/log.h>
#include "render/gles2.h"
#include "render/pixel_format.h"
#include "types/wlr_buffer.h"
static const GLfloat verts[] = {
1, 0, // top right
@ -526,6 +527,10 @@ static int gles2_get_drm_fd(struct wlr_renderer *wlr_renderer) {
return renderer->drm_fd;
}
static uint32_t gles2_get_render_buffer_caps(void) {
return WLR_BUFFER_CAP_DMABUF;
}
struct wlr_egl *wlr_gles2_renderer_get_egl(struct wlr_renderer *wlr_renderer) {
struct wlr_gles2_renderer *renderer =
gles2_get_renderer(wlr_renderer);
@ -590,6 +595,7 @@ static const struct wlr_renderer_impl renderer_impl = {
.texture_from_dmabuf = gles2_texture_from_dmabuf,
.init_wl_display = gles2_init_wl_display,
.get_drm_fd = gles2_get_drm_fd,
.get_render_buffer_caps = gles2_get_render_buffer_caps,
};
void push_gles2_debug_(struct wlr_gles2_renderer *renderer,

View File

@ -403,6 +403,10 @@ static bool pixman_read_pixels(struct wlr_renderer *wlr_renderer,
return true;
}
static uint32_t pixman_get_render_buffer_caps(void) {
return WLR_BUFFER_CAP_DATA_PTR;
}
static const struct wlr_renderer_impl renderer_impl = {
.begin = pixman_begin,
.clear = pixman_clear,
@ -416,6 +420,7 @@ static const struct wlr_renderer_impl renderer_impl = {
.destroy = pixman_destroy,
.preferred_read_format = pixman_preferred_read_format,
.read_pixels = pixman_read_pixels,
.get_render_buffer_caps = pixman_get_render_buffer_caps,
};
struct wlr_renderer *wlr_pixman_renderer_create(void) {

View File

@ -27,6 +27,7 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
assert(impl->render_quad_with_matrix);
assert(impl->get_shm_texture_formats);
assert(impl->texture_from_pixels);
assert(impl->get_render_buffer_caps);
renderer->impl = impl;
wl_signal_init(&renderer->events.destroy);
@ -174,6 +175,10 @@ const struct wlr_drm_format_set *wlr_renderer_get_render_formats(
return r->impl->get_render_formats(r);
}
uint32_t renderer_get_render_buffer_caps(struct wlr_renderer *r) {
return r->impl->get_render_buffer_caps();
}
bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt,
uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,