[PATCH weston] gl-renderer: fix EGL initialization steps

Pekka Paalanen ppaalanen at gmail.com
Wed Apr 8 06:20:23 PDT 2015


On Fri,  3 Apr 2015 07:05:23 +0200
Manuel Bachmann <manuel.bachmann at open.eurogiciel.org> wrote:

> From: Manuel Bachmann <manuel.bachmann at open.eurogiciel.org>
> 
> Some DRI drivers, including VMware vmwgfx, do not support
> calling eglQueryString() with a EGL_NO_DISPLAY parameter.
> Just as we do in gl_renderer_supports(), which returns 0
> but does not fail in this case, do not fail in
> gl_renderer_setup_egl_extensions().
> 
> With some versions of Mesa, EGL client extensions may
> very well be defined without the corresponding platform
> extensions ("EGL_EXT_platform_x11/wayland/gbm"). Do not
> fail in this case, but report lack of information.
> 
> Signed-off-by: Manuel Bachmann <manuel.bachmann at open.eurogiciel.org>
> ---
>  src/gl-renderer.c | 33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
> index b3b2364..d9b6a66 100644
> --- a/src/gl-renderer.c
> +++ b/src/gl-renderer.c
> @@ -2136,7 +2136,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
>  		(const char *) eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
>  	if (!extensions) {
>  		weston_log("Retrieving EGL client extension string failed.\n");
> -		return -1;
> +		return 0;

Hi,

I think this should be two different patches. This hunk is the first
patch.

>  	}
>  
>  	if (strstr(extensions, "EGL_EXT_platform_base"))
> @@ -2213,23 +2213,26 @@ gl_renderer_supports(struct weston_compositor *ec,
>  			       extensions);
>  	}
>  
> -	snprintf(s, sizeof s, "EGL_KHR_platform_%s", extension_suffix);
> -	if (strstr(extensions, s))
> -		return 1;
> +	if (strstr(extensions, "EGL_EXT_client_extensions")) {

Wasn't this supposed to be testing for EGL_EXT_platform_base?

Also, if platform_base is not there, just return 0 right away, no need
to add indentation levels to the rest of the code.

> +		snprintf(s, sizeof s, "EGL_KHR_platform_%s", extension_suffix);
> +		if (strstr(extensions, s))
> +			return 1;
>  
> -	snprintf(s, sizeof s, "EGL_EXT_platform_%s", extension_suffix);
> -	if (strstr(extensions, s))
> -		return 1;
> +		snprintf(s, sizeof s, "EGL_EXT_platform_%s", extension_suffix);
> +		if (strstr(extensions, s))
> +			return 1;
>  
> -	snprintf(s, sizeof s, "EGL_MESA_platform_%s", extension_suffix);
> -	if (strstr(extensions, s))
> -		return 1;
> +		snprintf(s, sizeof s, "EGL_MESA_platform_%s", extension_suffix);
> +		if (strstr(extensions, s))
> +			return 1;
>  
> -	/* at this point we definitely have some client extensions but
> -	 * haven't found the supplied client extension, so chances are it's
> -	 * not supported. */
> -
> -	return -1;
> +		/* at this point we definitely have some client extensions but
> +		 * haven't found the supplied client extension, so it may be
> +		 * supported or not. */
> +		return 0;
> +	} else {
> +		return -1;

For platform_base test, these conditionals are reversed.

> +	}
>  }
>  
>  static const char *

I think I'll make my own version of this for you, I need to fix some
other damage close by, too. Stay tuned.


Thanks,
pq


More information about the wayland-devel mailing list