render: drop wlr_renderer_impl.texture_from_pixels

This commit is contained in:
Simon Ser 2021-06-29 20:39:19 +02:00 committed by Simon Zeni
parent 29c8df7e0a
commit 18adb43a44
6 changed files with 2 additions and 44 deletions

View File

@ -119,9 +119,6 @@ struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_gles2_texture *gles2_get_texture( struct wlr_gles2_texture *gles2_get_texture(
struct wlr_texture *wlr_texture); struct wlr_texture *wlr_texture);
struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
const void *data);
struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer, struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
struct wl_resource *data); struct wl_resource *data);
struct wlr_texture *gles2_texture_from_dmabuf(struct wlr_renderer *wlr_renderer, struct wlr_texture *gles2_texture_from_dmabuf(struct wlr_renderer *wlr_renderer,

View File

@ -45,9 +45,6 @@ struct wlr_renderer_impl {
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,
void *data); void *data);
struct wlr_texture *(*texture_from_pixels)(struct wlr_renderer *renderer,
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
const void *data);
struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer, struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer,
struct wl_resource *data); struct wl_resource *data);
struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer, struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer,

View File

@ -592,7 +592,6 @@ static const struct wlr_renderer_impl renderer_impl = {
.get_render_formats = gles2_get_render_formats, .get_render_formats = gles2_get_render_formats,
.preferred_read_format = gles2_preferred_read_format, .preferred_read_format = gles2_preferred_read_format,
.read_pixels = gles2_read_pixels, .read_pixels = gles2_read_pixels,
.texture_from_pixels = gles2_texture_from_pixels,
.texture_from_wl_drm = gles2_texture_from_wl_drm, .texture_from_wl_drm = gles2_texture_from_wl_drm,
.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,

View File

@ -179,7 +179,8 @@ static struct wlr_gles2_texture *gles2_texture_create(
return texture; return texture;
} }
struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer, static struct wlr_texture *gles2_texture_from_pixels(
struct wlr_renderer *wlr_renderer,
uint32_t drm_format, uint32_t stride, uint32_t width, uint32_t drm_format, uint32_t stride, uint32_t width,
uint32_t height, const void *data) { uint32_t height, const void *data) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);

View File

@ -368,40 +368,6 @@ static struct wlr_pixman_texture *pixman_texture_create(
return texture; return texture;
} }
static struct wlr_texture *pixman_texture_from_pixels(
struct wlr_renderer *wlr_renderer, uint32_t drm_format,
uint32_t stride, uint32_t width, uint32_t height, const void *data) {
struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
struct wlr_pixman_texture *texture =
pixman_texture_create(renderer, drm_format, width, height);
if (texture == NULL) {
return NULL;
}
// TODO: avoid this copy
texture->data = malloc(stride * height);
if (texture->data == NULL) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
wl_list_remove(&texture->link);
free(texture);
return NULL;
}
memcpy(texture->data, data, stride * height);
texture->image = pixman_image_create_bits_no_clear(texture->format,
width, height, texture->data, stride);
if (!texture->image) {
wlr_log(WLR_ERROR, "Failed to create pixman image");
wl_list_remove(&texture->link);
free(texture->data);
free(texture);
return NULL;
}
return &texture->wlr_texture;
}
static struct wlr_texture *pixman_texture_from_buffer( static struct wlr_texture *pixman_texture_from_buffer(
struct wlr_renderer *wlr_renderer, struct wlr_buffer *buffer) { struct wlr_renderer *wlr_renderer, struct wlr_buffer *buffer) {
struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer); struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
@ -531,7 +497,6 @@ static const struct wlr_renderer_impl renderer_impl = {
.render_quad_with_matrix = pixman_render_quad_with_matrix, .render_quad_with_matrix = pixman_render_quad_with_matrix,
.get_shm_texture_formats = pixman_get_shm_texture_formats, .get_shm_texture_formats = pixman_get_shm_texture_formats,
.get_render_formats = pixman_get_render_formats, .get_render_formats = pixman_get_render_formats,
.texture_from_pixels = pixman_texture_from_pixels,
.texture_from_buffer = pixman_texture_from_buffer, .texture_from_buffer = pixman_texture_from_buffer,
.bind_buffer = pixman_bind_buffer, .bind_buffer = pixman_bind_buffer,
.destroy = pixman_destroy, .destroy = pixman_destroy,

View File

@ -26,7 +26,6 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
assert(impl->render_subtexture_with_matrix); assert(impl->render_subtexture_with_matrix);
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->get_render_buffer_caps); assert(impl->get_render_buffer_caps);
renderer->impl = impl; renderer->impl = impl;