gl-renderer: Move EGL buffer error checks into attach_egl

Makes it more consistent with the others, and also easier to return
success/fail.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent 8f56743590
commit 4519461439
  1. 28
      libweston/renderer-gl/gl-renderer.c

@ -2244,14 +2244,14 @@ gl_renderer_fill_buffer_info(struct weston_compositor *ec,
}
static void
gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer,
uint32_t format)
gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer)
{
struct weston_compositor *ec = es->compositor;
struct gl_renderer *gr = get_renderer(ec);
struct gl_surface_state *gs = get_surface_state(es);
struct gl_buffer_state *gb = &gs->buffer;
EGLint attribs[5];
EGLint format;
GLenum target;
int i, num_planes;
@ -2260,6 +2260,15 @@ gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer,
gb->images[i] = NULL;
}
es->is_opaque = false;
if (!gr->has_bind_display ||
!gr->query_buffer(gr->egl_display, buffer->legacy_buffer,
EGL_TEXTURE_FORMAT, &format)) {
weston_log("eglQueryWaylandBufferWL failed\n");
gl_renderer_print_egl_error_state();
return;
}
switch (format) {
case EGL_TEXTURE_RGB:
es->is_opaque = true;
@ -3014,11 +3023,8 @@ gl_renderer_attach_solid(struct weston_surface *surface,
static void
gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
{
struct weston_compositor *ec = es->compositor;
struct gl_renderer *gr = get_renderer(ec);
struct gl_surface_state *gs = get_surface_state(es);
struct gl_buffer_state *gb = &gs->buffer;
EGLint format;
int i;
weston_buffer_reference(&gs->buffer_ref, buffer,
@ -3050,13 +3056,7 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
gl_renderer_attach_dmabuf(es, buffer, buffer->dmabuf);
return;
case WESTON_BUFFER_RENDERER_OPAQUE:
if (!gr->has_bind_display ||
!gr->query_buffer(gr->egl_display,
buffer->legacy_buffer,
EGL_TEXTURE_FORMAT, &format)) {
break;
}
gl_renderer_attach_egl(es, buffer, format);
gl_renderer_attach_egl(es, buffer);
return;
case WESTON_BUFFER_SOLID:
gl_renderer_attach_solid(es, buffer);
@ -3066,10 +3066,6 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
}
weston_log("unhandled buffer type!\n");
if (gr->has_bind_display) {
weston_log("eglQueryWaylandBufferWL failed\n");
gl_renderer_print_egl_error_state();
}
weston_buffer_reference(&gs->buffer_ref, NULL,
BUFFER_WILL_NOT_BE_ACCESSED);
weston_buffer_release_reference(&gs->buffer_release_ref, NULL);

Loading…
Cancel
Save