[PATCH weston] gl-renderer: Don't print GL error for EGLGetDisplay()

Pekka Paalanen ppaalanen at gmail.com
Fri Jun 12 01:19:01 PDT 2015


On Thu, 11 Jun 2015 12:14:45 -0500
Derek Foreman <derekf at osg.samsung.com> wrote:

> EGLGetDisplay() doesn't generate a GL error, so we shouldn't print one.

That's generally true, with one little exception:

https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_platform_base.txt

"An EGL_BAD_PARAMETER error is generated if <platform> has an invalid value.
    If <platform> is valid but no display matching <native_display> is
    available, then EGL_NO_DISPLAY is returned; no error condition is raised
    in this case."

Checking that would be quite inconvenient I think, so this patch is fine.

> I've also renamed the goto labels so it's a little clearer when to use them.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
>  src/gl-renderer.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
> index d18e124..2553b52 100644
> --- a/src/gl-renderer.c
> +++ b/src/gl-renderer.c
> @@ -2351,18 +2351,18 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
>  
>  	if (gr->egl_display == EGL_NO_DISPLAY) {
>  		weston_log("failed to create display\n");
> -		goto err_egl;
> +		goto fail;
>  	}
>  
>  	if (!eglInitialize(gr->egl_display, &major, &minor)) {
>  		weston_log("failed to initialize display\n");
> -		goto err_egl;
> +		goto fail_with_error;
>  	}
>  
>  	if (egl_choose_config(gr, attribs, visual_id,
>  			      n_ids, &gr->egl_config) < 0) {
>  		weston_log("failed to choose EGL config\n");
> -		goto err_config;
> +		goto fail;
>  	}
>  
>  	ec->renderer = &gr->base;
> @@ -2371,7 +2371,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
>  	ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK;
>  
>  	if (gl_renderer_setup_egl_extensions(ec) < 0)
> -		goto err_egl;
> +		goto fail_with_error;
>  
>  	wl_display_add_shm_format(ec->wl_display, WL_SHM_FORMAT_RGB565);
>  
> @@ -2379,9 +2379,9 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
>  
>  	return 0;
>  
> -err_egl:
> +fail_with_error:
>  	gl_renderer_print_egl_error_state();
> -err_config:
> +fail:
>  	free(gr);
>  	return -1;
>  }

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq


More information about the wayland-devel mailing list