render: unify texture format enumeration

Instead of having separate get_shm_texture_formats and
get_dmabuf_texture_formats functions, have a single unified
get_texture_formats function. This brings the renderer API in line
with wlr_backend_impl.
This commit is contained in:
Simon Ser 2021-08-16 15:15:12 +02:00
parent 823476e76e
commit b47535f1a2
12 changed files with 55 additions and 74 deletions

View file

@ -73,6 +73,8 @@ struct wlr_gles2_renderer {
struct wlr_gles2_buffer *current_buffer;
uint32_t viewport_width, viewport_height;
struct wlr_drm_format_set data_ptr_texture_formats;
};
struct wlr_gles2_buffer {
@ -115,8 +117,7 @@ bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
const struct wlr_gles2_pixel_format *get_gles2_format_from_drm(uint32_t fmt);
const struct wlr_gles2_pixel_format *get_gles2_format_from_gl(
GLint gl_format, GLint gl_type, bool alpha);
const uint32_t *get_gles2_shm_formats(const struct wlr_gles2_renderer *renderer,
size_t *len);
void init_gles2_data_ptr_formats(struct wlr_gles2_renderer *renderer);
struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_renderer *wlr_renderer);

View file

@ -50,6 +50,6 @@ struct wlr_pixman_texture {
pixman_format_code_t get_pixman_format_from_drm(uint32_t fmt);
uint32_t get_drm_format_from_pixman(pixman_format_code_t fmt);
const uint32_t *get_pixman_drm_formats(size_t *len);
void init_pixman_formats(struct wlr_pixman_renderer *renderer);
#endif

View file

@ -32,10 +32,6 @@ struct wlr_renderer_impl {
const float matrix[static 9], float alpha);
void (*render_quad_with_matrix)(struct wlr_renderer *renderer,
const float color[static 4], const float matrix[static 9]);
const uint32_t *(*get_shm_texture_formats)(
struct wlr_renderer *renderer, size_t *len);
const struct wlr_drm_format_set *(*get_dmabuf_texture_formats)(
struct wlr_renderer *renderer);
const struct wlr_drm_format_set *(*get_render_formats)(
struct wlr_renderer *renderer);
uint32_t (*preferred_read_format)(struct wlr_renderer *renderer);
@ -46,6 +42,8 @@ struct wlr_renderer_impl {
void (*destroy)(struct wlr_renderer *renderer);
int (*get_drm_fd)(struct wlr_renderer *renderer);
uint32_t (*get_render_buffer_caps)(struct wlr_renderer *renderer);
const struct wlr_drm_format_set *(*get_texture_formats)(
struct wlr_renderer *renderer, uint32_t buffer_caps);
struct wlr_texture *(*texture_from_buffer)(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);
};

View file

@ -75,18 +75,12 @@ void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,
*/
void wlr_render_quad_with_matrix(struct wlr_renderer *r,
const float color[static 4], const float matrix[static 9]);
/**
* Get the shared-memory formats supporting import usage. Buffers allocated
* with a format from this list may be imported via wlr_texture_from_pixels.
*/
const uint32_t *wlr_renderer_get_shm_texture_formats(
struct wlr_renderer *r, size_t *len);
/**
* Get the DMA-BUF formats supporting sampling usage. Buffers allocated with
* a format from this list may be imported via wlr_texture_from_dmabuf.
* a format from this list may be imported via wlr_texture_from_buffer.
*/
const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
struct wlr_renderer *renderer);
const struct wlr_drm_format_set *wlr_renderer_get_texture_formats(
struct wlr_renderer *renderer, uint32_t buffer_caps);
/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.