[PATCH xserver] Xwayland: Enable EGL backend automatically

Pekka Paalanen ppaalanen at gmail.com
Mon May 28 09:44:36 UTC 2018


On Mon, 28 May 2018 09:59:43 +0200
Olivier Fourdan <fourdan at gmail.com> wrote:

> Hi Pekka,
> 
> On 28 May 2018 at 09:24, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> 
> > do not use strstr() for matching extensions strings. It does a
> > sub-string match, which may not be what you want. What if there was an
> > extension called "platform_gbm_unixmem" or such?
> >  
> 
> The substring match is what we want though, as the extension is one of the
> multiple extensions in the string, and using strstr() seems to be a fairly
> common practice (in glamor, glx and elsewhere, this is what is in the
> documentation for EGL_MESA_platform_gbm [1]  for example)

Yes, it is very common to have a faulty extension string matching code,
because extension names that could be mismatched are fairly rare, and
even when they are susceptible, you would need to have the wrong one
and not the right one to actually notice.

The example in [1] is broken too.

https://cgit.freedesktop.org/wayland/weston/tree/shared/platform.h#n46
has an example of a better matching function.

For rationale, see:
https://cgit.freedesktop.org/wayland/weston/commit/?id=cc3a192b448153a7911d44aa0fa549099607911d

> 
> But yes, you're right, checking for the complete extension name
> "EGL_MESA_platform_gbm" might be preferable here.

That will still hit a false positive if an extension called, say,
EGL_MESA_platform_gbmeta is ever created and advertised.


Thanks,
pq

> 
> Cheers,
> Olivier.
> 
> [1]
> https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_platform_gbm.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180528/a6cb5745/attachment.sig>


More information about the xorg-devel mailing list