render: introduce renderer_get_render_buffer_caps

master
Simon Zeni 4 years ago committed by Simon Ser
parent 144189674e
commit 982498fab3

@ -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( const struct wlr_drm_format_set *wlr_renderer_get_render_formats(
struct wlr_renderer *renderer); 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 #endif

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

@ -17,6 +17,7 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "render/gles2.h" #include "render/gles2.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "types/wlr_buffer.h"
static const GLfloat verts[] = { static const GLfloat verts[] = {
1, 0, // top right 1, 0, // top right
@ -526,6 +527,10 @@ static int gles2_get_drm_fd(struct wlr_renderer *wlr_renderer) {
return renderer->drm_fd; 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_egl *wlr_gles2_renderer_get_egl(struct wlr_renderer *wlr_renderer) {
struct wlr_gles2_renderer *renderer = struct wlr_gles2_renderer *renderer =
gles2_get_renderer(wlr_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, .texture_from_dmabuf = gles2_texture_from_dmabuf,
.init_wl_display = gles2_init_wl_display, .init_wl_display = gles2_init_wl_display,
.get_drm_fd = gles2_get_drm_fd, .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, void push_gles2_debug_(struct wlr_gles2_renderer *renderer,

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

@ -27,6 +27,7 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
assert(impl->render_quad_with_matrix); assert(impl->render_quad_with_matrix);
assert(impl->get_shm_texture_formats); assert(impl->get_shm_texture_formats);
assert(impl->texture_from_pixels); assert(impl->texture_from_pixels);
assert(impl->get_render_buffer_caps);
renderer->impl = impl; renderer->impl = impl;
wl_signal_init(&renderer->events.destroy); 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); 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, 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 *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, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,

Loading…
Cancel
Save