diff options
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/pixel_format.c | 5 | ||||
-rw-r--r-- | render/gles2/renderer.c | 3 | ||||
-rw-r--r-- | render/gles2/texture.c | 12 |
3 files changed, 11 insertions, 9 deletions
diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c index c3eaa8e6..d7711caa 100644 --- a/render/gles2/pixel_format.c +++ b/render/gles2/pixel_format.c @@ -45,10 +45,9 @@ static const struct wlr_gles2_pixel_format formats[] = { // TODO: more pixel formats -const struct wlr_gles2_pixel_format *get_gles2_format_from_wl( - enum wl_shm_format fmt) { +const struct wlr_gles2_pixel_format *get_gles2_format_from_drm(uint32_t fmt) { for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) { - if (convert_drm_format_to_wl_shm(formats[i].drm_format) == fmt) { + if (formats[i].drm_format == fmt) { return &formats[i]; } } diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index cdf2c8b2..fa7bc6c7 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -472,7 +472,8 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer, struct wlr_gles2_renderer *renderer = gles2_get_renderer_in_context(wlr_renderer); - const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); + const struct wlr_gles2_pixel_format *fmt = + get_gles2_format_from_drm(convert_wl_shm_format_to_drm(wl_fmt)); if (fmt == NULL) { wlr_log(WLR_ERROR, "Cannot read pixels: unsupported pixel format"); return false; diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 000333ce..e2d492f5 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -1,4 +1,5 @@ #include <assert.h> +#include <drm_fourcc.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #include <stdint.h> @@ -58,7 +59,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture, } const struct wlr_gles2_pixel_format *fmt = - get_gles2_format_from_wl(texture->wl_format); + get_gles2_format_from_drm(texture->drm_format); assert(fmt); if (!check_stride(fmt, stride, width)) { @@ -156,7 +157,8 @@ struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer, uint32_t height, const void *data) { struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); - const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt); + const struct wlr_gles2_pixel_format *fmt = + get_gles2_format_from_drm(convert_wl_shm_format_to_drm(wl_fmt)); if (fmt == NULL) { wlr_log(WLR_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt); return NULL; @@ -176,7 +178,7 @@ struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer, texture->renderer = renderer; texture->target = GL_TEXTURE_2D; texture->has_alpha = fmt->has_alpha; - texture->wl_format = convert_drm_format_to_wl_shm(fmt->drm_format); + texture->drm_format = fmt->drm_format; struct wlr_egl_context prev_ctx; wlr_egl_save_context(&prev_ctx); @@ -234,7 +236,7 @@ struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer, wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height); texture->renderer = renderer; - texture->wl_format = 0xFFFFFFFF; // texture can't be written anyways + texture->drm_format = DRM_FORMAT_INVALID; // texture can't be written anyways texture->image = image; texture->inverted_y = inverted_y; @@ -302,7 +304,7 @@ struct wlr_texture *gles2_texture_from_dmabuf(struct wlr_renderer *wlr_renderer, attribs->width, attribs->height); texture->renderer = renderer; texture->has_alpha = true; - texture->wl_format = 0xFFFFFFFF; // texture can't be written anyways + texture->drm_format = DRM_FORMAT_INVALID; // texture can't be written anyways texture->inverted_y = (attribs->flags & WLR_DMABUF_ATTRIBUTES_FLAGS_Y_INVERT) != 0; |