gl-renderer: require GL_EXT_unpack_subimage

Require GL_EXT_unpack_subimage unconditionally in GL-renderer. Without
this extension, it would take considerable effort in GL-renderer to
handle correctly images that contain row padding, either as a temporary
copy to remove padding or doing SubImage updates row by row.

I would guess that this path has gone long completely untested, and if
it was exercised, the rows never had padding thanks to 32-bit pixel
formats. Instead of writing tests to poke the corner cases and fixing
it, remove it.

This will make it easier to fix other problems in GL-renderer in this
area in the future - one less path to consider and many restrictions in
GL API gone.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago committed by Daniel Stone
parent 2d738b856d
commit 593d5af43a
  1. 2
      libweston/renderer-gl/gl-renderer-internal.h
  2. 29
      libweston/renderer-gl/gl-renderer.c

@ -68,8 +68,6 @@ struct gl_renderer {
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
bool has_platform_base;
bool has_unpack_subimage;
PFNEGLBINDWAYLANDDISPLAYWL bind_display;
PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display;
PFNEGLQUERYWAYLANDBUFFERWL query_buffer;

@ -1569,7 +1569,6 @@ static GLenum gl_format_from_internal(GLenum internal_format)
static void
gl_renderer_flush_damage(struct weston_surface *surface)
{
struct gl_renderer *gr = get_renderer(surface->compositor);
struct gl_surface_state *gs = get_surface_state(surface);
struct weston_buffer *buffer = gs->buffer_ref.buffer;
struct weston_view *view;
@ -1605,24 +1604,6 @@ gl_renderer_flush_damage(struct weston_surface *surface)
data = wl_shm_buffer_get_data(buffer->shm_buffer);
if (!gr->has_unpack_subimage) {
wl_shm_buffer_begin_access(buffer->shm_buffer);
for (j = 0; j < gs->num_textures; j++) {
glBindTexture(GL_TEXTURE_2D, gs->textures[j]);
glTexImage2D(GL_TEXTURE_2D, 0,
gs->gl_format[j],
gs->pitch / gs->hsub[j],
buffer->height / gs->vsub[j],
0,
gl_format_from_internal(gs->gl_format[j]),
gs->gl_pixel_type,
data + gs->offset[j]);
}
wl_shm_buffer_end_access(buffer->shm_buffer);
goto done;
}
if (gs->needs_full_upload) {
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
@ -3763,9 +3744,11 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
else
ec->read_format = PIXMAN_a8b8g8r8;
if (gr->gl_version >= GR_GL_VERSION(3, 0) ||
weston_check_egl_extension(extensions, "GL_EXT_unpack_subimage"))
gr->has_unpack_subimage = true;
if (gr->gl_version < GR_GL_VERSION(3, 0) &&
!weston_check_egl_extension(extensions, "GL_EXT_unpack_subimage")) {
weston_log("GL_EXT_unpack_subimage not available.\n");
return -1;
}
if (gr->gl_version >= GR_GL_VERSION(3, 0) ||
weston_check_egl_extension(extensions, "GL_EXT_texture_rg"))
@ -3795,8 +3778,6 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
weston_log("GL ES 2 renderer features:\n");
weston_log_continue(STAMP_SPACE "read-back format: %s\n",
ec->read_format == PIXMAN_a8r8g8b8 ? "BGRA" : "RGBA");
weston_log_continue(STAMP_SPACE "wl_shm sub-image to texture: %s\n",
gr->has_unpack_subimage ? "yes" : "no");
weston_log_continue(STAMP_SPACE "EGL Wayland extension: %s\n",
gr->has_bind_display ? "yes" : "no");

Loading…
Cancel
Save