<div dir="ltr"><div><div><div>Agreed !<br><br></div>I am going send the patch again, same name ("gl-renderer: fix EGL initialization steps") but modified in this sense and with another commit message,<br><br></div>Regards,<br></div>Manuel<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-02 11:51 GMT+02:00 Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, 30 Mar 2015 21:48:32 +0200<br>
Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>> wrote:<br>
<br>
> OK. Found it, thanks to your hint, Daniel.<br>
><br>
> This version of Mesa (10.1.3) does not feature these extensions.<br>
><br>
> They were added here :<br>
> <a href="http://cgit.freedesktop.org/mesa/mesa/commit/src/egl/main/eglglobals.c?id=468cc866b4b308cee40470f06b31002c6c56da96" target="_blank">http://cgit.freedesktop.org/mesa/mesa/commit/src/egl/main/eglglobals.c?id=468cc866b4b308cee40470f06b31002c6c56da96</a><br>
><br>
> Considering that recent distributions, such as Ubuntu 14.04 LTS (Debian,<br>
> RHEL.. are even older) may not package a sufficiently recent version of<br>
> Mesa, maybe it is wise to ignore the test if "extensions" is only<br>
> "EGL_EXT_client_extensions" (which should not happen with recent Mesa,<br>
> because at least one platform should be supported there) ?<br>
<br>
</span>Hi,<br>
<br>
I think the correct test is to check if the string contains<br>
"EGL_EXT_platform_base". If the client extensions string cannot be<br>
queried or does not contain "EGL_EXT_platform_base", then supports()<br>
should return 0 to indicate "maybe", which means we fall back to the old<br>
way.<br>
<br>
<br>
Thanks,<br>
pq<br>
<div class="HOEnZb"><div class="h5"><br>
> 2015-03-30 21:38 GMT+02:00 Manuel Bachmann <<br>
> <a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>>:<br>
><br>
> > Hi Daniel, and thanks,<br>
> ><br>
> > "What is the complete client extension string on that platform?"<br>
> ><br>
> > It is simply "EGL_EXT_client_extensions".<br>
> ><br>
> > Here are the details : kernel 3.13.0 - Mesa 10.1.3 (built with<br>
> > "with-egl-platforms=wayland,x11,drm") - kernel module is "i915" - EGL is :<br>
> > 1.4 (DRI2) - GL vendor is : Intel Open Source Technology Center - GL<br>
> > renderer is : Mesa DRI Intel(R) Ivybridge Model.<br>
> > GPU seems to be : Intel HP Graphics 4000 (core i7 CPU)<br>
> ><br>
> > 2015-03-30 20:52 GMT+02:00 Daniel Stone <<a href="mailto:daniel@fooishbar.org">daniel@fooishbar.org</a>>:<br>
> ><br>
> >> Hi,<br>
> >><br>
> >> On 30 March 2015 at 17:38, Manuel Bachmann<br>
> >> <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>> wrote:<br>
> >> > "You removed the early return here...<br>
> >> > ...which means this check may be accessing NULL extensions, no?"<br>
> >> ><br>
> >> > You are right ! Sorry for that, did not even look at the #ifdef, will<br>
> >> rework<br>
> >> > this part.<br>
> >><br>
> >> Apart from the configless_context damage, the rest (don't make lack of<br>
> >> client extensions query fatal) is very much correct. I think that got<br>
> >> lost in review. :\<br>
> >><br>
> >> > "You do want to keep the -1 return as fatal here. gl_renderer_supports()<br>
> >> > should already return 0 meaning "maybe" if client extensions cannot be<br>
> >> > queried. The supports function is very nicely documented."<br>
> >> ><br>
> >> > Well, I have here a pratical case of a Ubuntu 14.04 laptop (Intel GPU,<br>
> >> i915<br>
> >> > driver, will let you know the hardware, Mesa and libs versions soon<br>
> >> when I<br>
> >> > get my hands on it), where the supports() function is able to find an<br>
> >> > "*extensions" strings, but then fails to locate these precise<br>
> >> extensions,<br>
> >> > and thus returns -1. It prevents the X11 and DRM compositors to run,<br>
> >> but it<br>
> >> > works nicely when removing this check. Does it make sense to you ?<br>
> >> > (regarding the purpose of the function, is that when building EGL with<br>
> >> X11<br>
> >> > support, it will always report X11 as a supported platform ? Maybe<br>
> >> there are<br>
> >> > versions of Mesa which do not honor this. Will check.)<br>
> >><br>
> >> Weird - the only way I can see that happening is if Mesa advertises<br>
> >> support for platform_base, but not for platform_{x11,gbm}, which seems<br>
> >> very odd indeed. Ever since the addition of platform_base support[0],<br>
> >> Mesa has supported EXT variants of x11 and wayland, and a MESA variant<br>
> >> of gbm. So given the (fairly exhaustive) checks in<br>
> >> gl_renderer_supports, I can't see how we'd end up in this situation.<br>
> >> What is the complete client extension string on that platform?<br>
> >><br>
> >> Cheers,<br>
> >> Daniel<br>
> >><br>
> >> [0]:<br>
> >> <a href="http://cgit.freedesktop.org/mesa/mesa/commit/src/egl/main/eglglobals.c?id=468cc866b4b308cee40470f06b31002c6c56da96" target="_blank">http://cgit.freedesktop.org/mesa/mesa/commit/src/egl/main/eglglobals.c?id=468cc866b4b308cee40470f06b31002c6c56da96</a><br>
> >><br>
> >> > 2015-03-30 14:40 GMT+02:00 Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>>:<br>
> >> >><br>
> >> >> On Sun, 29 Mar 2015 05:03:09 +0200<br>
> >> >> Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>> wrote:<br>
> >> >><br>
> >> >> > From: Manuel Bachmann <<a href="mailto:manuel.bachmann@open.eurogiciel.org">manuel.bachmann@open.eurogiciel.org</a>><br>
> >> >> ><br>
> >> >> > We should not prevent gl-renderer to initalize if client<br>
> >> >> > extensions were not found. Practically, this prevented<br>
> >> >> > Weston from running with GL on i915 DRI platforms.<br>
> >> >> ><br>
> >> >> > Some DRI drivers, including VMware vmwgfx, do not support<br>
> >> >> > calling eglQueryString() with a EGL_NO_DISPLAY parameter.<br>
> >> >> > Just as we do in gl_renderer_supports(), which returns 0<br>
> >> >> > but does not fail in this case, do not fail in<br>
> >> >> > gl_renderer_setup_egl_extensions().<br>
> >> >> > ---<br>
> >> >> > src/gl-renderer.c | 18 +++++++-----------<br>
> >> >> > 1 file changed, 7 insertions(+), 11 deletions(-)<br>
> >> >> ><br>
> >> >> > diff --git a/src/gl-renderer.c b/src/gl-renderer.c<br>
> >> >> > index b3b2364..28ecc63 100644<br>
> >> >> > --- a/src/gl-renderer.c<br>
> >> >> > +++ b/src/gl-renderer.c<br>
> >> >> > @@ -2136,15 +2136,14 @@ gl_renderer_setup_egl_extensions(struct<br>
> >> >> > weston_compositor *ec)<br>
> >> >> > (const char *) eglQueryString(EGL_NO_DISPLAY,<br>
> >> >> > EGL_EXTENSIONS);<br>
> >> >> > if (!extensions) {<br>
> >> >> > weston_log("Retrieving EGL client extension string<br>
> >> >> > failed.\n");<br>
> >> >> > - return -1;<br>
> >> >> > + } else {<br>
> >> >> > + if (strstr(extensions, "EGL_EXT_platform_base"))<br>
> >> >> > + gr->create_platform_window =<br>
> >> >> > + (void *)<br>
> >> >> > eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");<br>
> >> >> > + else<br>
> >> >> > + weston_log("warning: EGL_EXT_platform_base not<br>
> >> >> > supported.\n");<br>
> >> >> > }<br>
> >> >><br>
> >> >> You removed the early return here...<br>
> >> >><br>
> >> >> ><br>
> >> >> > - if (strstr(extensions, "EGL_EXT_platform_base"))<br>
> >> >> > - gr->create_platform_window =<br>
> >> >> > - (void *)<br>
> >> >> > eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");<br>
> >> >> > - else<br>
> >> >> > - weston_log("warning: EGL_EXT_platform_base not<br>
> >> >> > supported.\n");<br>
> >> >> > -<br>
> >> >> > #ifdef EGL_MESA_configless_context<br>
> >> >> > if (strstr(extensions, "EGL_MESA_configless_context"))<br>
> >> >> > gr->has_configless_context = 1;<br>
> >> >><br>
> >> >> ...which means this check may be accessing NULL extensions, no?<br>
> >> >><br>
> >> >> Hmm, I wonder if the configless context check is looking at the right<br>
> >> >> extensions string here.<br>
> >> >><br>
> >> >> > @@ -2256,12 +2255,9 @@ gl_renderer_create(struct weston_compositor<br>
> >> *ec,<br>
> >> >> > EGLenum platform,<br>
> >> >> > EGLint major, minor;<br>
> >> >> > int supports = 0;<br>
> >> >> ><br>
> >> >> > - if (platform) {<br>
> >> >> > + if (platform)<br>
> >> >> > supports = gl_renderer_supports(<br>
> >> >> > ec, platform_to_extension(platform));<br>
> >> >> > - if (supports < 0)<br>
> >> >> > - return -1;<br>
> >> >> > - }<br>
> >> >><br>
> >> >> Just make sure that if EXT_platform_base exists, but the specific<br>
> >> >> platform we are looking for does not, we fail this function.<br>
> >> >><br>
> >> >> You do want to keep the -1 return as fatal here. gl_renderer_supports()<br>
> >> >> should already return 0 meaning "maybe" if client extensions cannot be<br>
> >> >> queried. The supports function is very nicely documented.<br>
> >> >><br>
> >> >> ><br>
> >> >> > gr = zalloc(sizeof *gr);<br>
> >> >> > if (gr == NULL)<br>
> >> >><br>
> >> >><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><font>Regards,<br>
<br>
<i><b>Manuel BACHMANN</b><br>
Tizen Project<br>
VANNES-FR</i><br>
</font></div></div>
</div>