Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 15 April 2015 at 21:39, Chad Versace wrote: > On Wed 15 Apr 2015, Emil Velikov wrote: >> >> On 14 April 2015 at 17:22, Ian Romanick wrote: >>> >>> On 04/14/2015 08:36 AM, Emil Velikov wrote: On 14 April 2015 at 13:52, Jose Fonseca wrote: > > On 13/04/15 22:59, Ian Romanick wrote: >> >> >> On 04/10/2015 03:36 PM, Jose Fonseca wrote: >>> >>> >>> From: José Fonseca > > > diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c > index 8192c54..192525a 100644 > --- a/src/glx/dri2_glx.c > +++ b/src/glx/dri2_glx.c > @@ -1102,7 +1102,7 @@ dri2BindExtensions(struct dri2_screen *psc, > struct > glx_display * priv, >__glXEnableDirectExtension(&psc->base, > "GLX_ARB_create_context"); >__glXEnableDirectExtension(&psc->base, > "GLX_ARB_create_context_profile"); > > - if ((mask & (1 << __DRI_API_GLES2)) != 0) { > + if ((mask & ((1 << __DRI_API_GLES2) | (1 << __DRI_API_GLES3))) > != 0) >>> >>> >>> Since ES3 is a superset of ES2, this shouldn't be necessary. I can't >>> imagine a driver only setting __DRI_API_GLES3... and the common code may >>> not even make that possible. We could, however, enable >>> GLX_EXT_create_context_es2_profile if only __DRI_API_GLES is set. I >>> don't really feel like testing any drivers that only support ES 1.x, do >>> you? :) > > >> Think of it as allowing gles1 support via GLX (apart from gles2/3), >> rather than testing gles1 only drivers. I would assume that you >> already support gles1 via EGL so things should just work for GLX. >> Either way the decision is not mine to make ;-) > > > Drivers that support GLES1 but not GLES2 are easily created. All that's > needed is rebuilding i965 with --enable-gles1 --disable-gles2, right? > True, and it works by default via EGL. We'll need the __DRI_API_GLES check, as Ian mentioned, for GLX to make use of it. Considering GLES1 is tested (to a degree) over EGL, one might as well enable it via GLX. Some of the tests might not pass, but there won't be any regressions at least :-P > I also have no time to rebuild the xserver. I try that once in a blue > moon, and everytime it leads to broken input drivers and the need for > vodka. Hot potato ;-) I won't mind prepping and testing it over the next week or so, but I'm not sure when it will end up committed. My last xserver pull request (trivial fixes) is from 24th May, is not committed despite a couple of pings. Suspecting that it might have been redirected to /dev/null :-\ Cheers Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On Wed 15 Apr 2015, Emil Velikov wrote: On 14 April 2015 at 17:22, Ian Romanick wrote: On 04/14/2015 08:36 AM, Emil Velikov wrote: On 14 April 2015 at 13:52, Jose Fonseca wrote: On 13/04/15 22:59, Ian Romanick wrote: On 04/10/2015 03:36 PM, Jose Fonseca wrote: From: José Fonseca diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 8192c54..192525a 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -1102,7 +1102,7 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) { + if ((mask & ((1 << __DRI_API_GLES2) | (1 << __DRI_API_GLES3))) != 0) Since ES3 is a superset of ES2, this shouldn't be necessary. I can't imagine a driver only setting __DRI_API_GLES3... and the common code may not even make that possible. We could, however, enable GLX_EXT_create_context_es2_profile if only __DRI_API_GLES is set. I don't really feel like testing any drivers that only support ES 1.x, do you? :) Think of it as allowing gles1 support via GLX (apart from gles2/3), rather than testing gles1 only drivers. I would assume that you already support gles1 via EGL so things should just work for GLX. Either way the decision is not mine to make ;-) Drivers that support GLES1 but not GLES2 are easily created. All that's needed is rebuilding i965 with --enable-gles1 --disable-gles2, right? I also have no time to rebuild the xserver. I try that once in a blue moon, and everytime it leads to broken input drivers and the need for vodka. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 14/04/15 17:22, Ian Romanick wrote: On 04/14/2015 08:36 AM, Emil Velikov wrote: On 14 April 2015 at 13:52, Jose Fonseca wrote: On 13/04/15 22:59, Ian Romanick wrote: On 04/10/2015 03:36 PM, Jose Fonseca wrote: From: José Fonseca The latest version of GLX_EXT_create_context_es2_profile states: "If the version requested is a valid and supported OpenGL-ES version, and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context returned will implement the OpenGL ES version requested." We must also export EXT_create_context_es_profile too, as EXT_create_context_es2_profile specification is crystal clear: "NOTE: implementations of this extension must export BOTH extension strings, for backwards compatibility with applications written against version 1 of this extension." Totally untested. (Just happened to noticed this while implementing GLX_EXT_create_context_es2_profile for st/xlib.) Reviewed-by: Brian Paul Reviewed-by: Emil Velikov v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested by Emil Velikov. --- src/glx/dri2_glx.c | 5 - src/glx/dri3_glx.c | 5 - src/glx/dri_common.c | 32 src/glx/drisw_glx.c | 2 ++ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 462d560..8192c54 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -1102,9 +1102,12 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) + if ((mask & (1 << __DRI_API_GLES2)) != 0) { +__glXEnableDirectExtension(&psc->base, + "GLX_EXT_create_context_es_profile"); __glXEnableDirectExtension(&psc->base, "GLX_EXT_create_context_es2_profile"); + } } for (i = 0; extensions[i]; i++) { diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 1ddc723..6973ad1 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1825,9 +1825,12 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) + if ((mask & (1 << __DRI_API_GLES2)) != 0) { + __glXEnableDirectExtension(&psc->base, + "GLX_EXT_create_context_es_profile"); __glXEnableDirectExtension(&psc->base, "GLX_EXT_create_context_es2_profile"); + } for (i = 0; extensions[i]; i++) { /* when on a different gpu than the server, the server pixmaps diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 63c8de3..541abbb 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -544,9 +544,22 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: *api = __DRI_API_OPENGL; break; - case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: -*api = __DRI_API_GLES2; -break; + case GLX_CONTEXT_ES_PROFILE_BIT_EXT: + switch (*major_ver) { + case 3: +*api = __DRI_API_GLES3; +break; + case 2: +*api = __DRI_API_GLES2; +break; + case 1: +*api = __DRI_API_GLES; +break; + default: +*error = __DRI_CTX_ERROR_BAD_API; +return false; + } + break; default: *error = __DRI_CTX_ERROR_BAD_API; return false; @@ -577,19 +590,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, return false; } - /* The GLX_EXT_create_context_es2_profile spec says: -* -* "... If the version requested is 2.0, and the -* GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the -* GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context -* returned will implement OpenGL ES 2.0. This is the only way in which -* an implementation may request an OpenGL ES 2.0 context." -*/ - if (*api == __DRI_API_GLES2 && (*major_ver != 2 || *minor_ver != 0)) { - *error = __DRI_CTX_ERROR_BAD_API; - return false; - } I guess this text was removed from the extension spec, and now we rely on some other layer detecting invalid versions (like 2.1)? Yes, the spec replaced that with "... If the version requested is a valid and supported OpenGL-ES version, and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context returned will imple
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 14 April 2015 at 17:22, Ian Romanick wrote: > On 04/14/2015 08:36 AM, Emil Velikov wrote: >> On 14 April 2015 at 13:52, Jose Fonseca wrote: >>> On 13/04/15 22:59, Ian Romanick wrote: On 04/10/2015 03:36 PM, Jose Fonseca wrote: > > From: José Fonseca > > The latest version of GLX_EXT_create_context_es2_profile states: > >"If the version requested is a valid and supported OpenGL-ES version, >and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the >GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context >returned will implement the OpenGL ES version requested." > > We must also export EXT_create_context_es_profile too, as > EXT_create_context_es2_profile specification is crystal clear: > >"NOTE: implementations of this extension must export BOTH extension >strings, for backwards compatibility with applications written >against version 1 of this extension." > > Totally untested. (Just happened to noticed this while implementing > GLX_EXT_create_context_es2_profile for st/xlib.) > > Reviewed-by: Brian Paul > Reviewed-by: Emil Velikov > > v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested > by Emil Velikov. > --- > src/glx/dri2_glx.c | 5 - > src/glx/dri3_glx.c | 5 - > src/glx/dri_common.c | 32 > src/glx/drisw_glx.c | 2 ++ > 4 files changed, 26 insertions(+), 18 deletions(-) > > diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c > index 462d560..8192c54 100644 > --- a/src/glx/dri2_glx.c > +++ b/src/glx/dri2_glx.c > @@ -1102,9 +1102,12 @@ dri2BindExtensions(struct dri2_screen *psc, struct > glx_display * priv, > __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); > __glXEnableDirectExtension(&psc->base, > "GLX_ARB_create_context_profile"); > > - if ((mask & (1 << __DRI_API_GLES2)) != 0) > + if ((mask & (1 << __DRI_API_GLES2)) != 0) { > +__glXEnableDirectExtension(&psc->base, > + "GLX_EXT_create_context_es_profile"); > __glXEnableDirectExtension(&psc->base, > > "GLX_EXT_create_context_es2_profile"); > + } > } > > for (i = 0; extensions[i]; i++) { > diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c > index 1ddc723..6973ad1 100644 > --- a/src/glx/dri3_glx.c > +++ b/src/glx/dri3_glx.c > @@ -1825,9 +1825,12 @@ dri3_bind_extensions(struct dri3_screen *psc, > struct glx_display * priv, > __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); > __glXEnableDirectExtension(&psc->base, > "GLX_ARB_create_context_profile"); > > - if ((mask & (1 << __DRI_API_GLES2)) != 0) > + if ((mask & (1 << __DRI_API_GLES2)) != 0) { > + __glXEnableDirectExtension(&psc->base, > + "GLX_EXT_create_context_es_profile"); > __glXEnableDirectExtension(&psc->base, >"GLX_EXT_create_context_es2_profile"); > + } > > for (i = 0; extensions[i]; i++) { > /* when on a different gpu than the server, the server pixmaps > diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c > index 63c8de3..541abbb 100644 > --- a/src/glx/dri_common.c > +++ b/src/glx/dri_common.c > @@ -544,9 +544,22 @@ dri2_convert_glx_attribs(unsigned num_attribs, const > uint32_t *attribs, > case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: > *api = __DRI_API_OPENGL; > break; > - case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: > -*api = __DRI_API_GLES2; > -break; > + case GLX_CONTEXT_ES_PROFILE_BIT_EXT: > + switch (*major_ver) { > + case 3: > +*api = __DRI_API_GLES3; > +break; > + case 2: > +*api = __DRI_API_GLES2; > +break; > + case 1: > +*api = __DRI_API_GLES; > +break; > + default: > +*error = __DRI_CTX_ERROR_BAD_API; > +return false; > + } > + break; > default: > *error = __DRI_CTX_ERROR_BAD_API; > return false; > @@ -577,19 +590,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const > uint32_t *attribs, > return false; > } > > - /* The GLX_EXT_create_context_es2_profile spec says: > -* > -* "... If the version requested is 2.0, and the > -* GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the > -* GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the > context > -* returned will implement Op
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 04/14/2015 08:36 AM, Emil Velikov wrote: > On 14 April 2015 at 13:52, Jose Fonseca wrote: >> On 13/04/15 22:59, Ian Romanick wrote: >>> >>> On 04/10/2015 03:36 PM, Jose Fonseca wrote: From: José Fonseca The latest version of GLX_EXT_create_context_es2_profile states: "If the version requested is a valid and supported OpenGL-ES version, and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context returned will implement the OpenGL ES version requested." We must also export EXT_create_context_es_profile too, as EXT_create_context_es2_profile specification is crystal clear: "NOTE: implementations of this extension must export BOTH extension strings, for backwards compatibility with applications written against version 1 of this extension." Totally untested. (Just happened to noticed this while implementing GLX_EXT_create_context_es2_profile for st/xlib.) Reviewed-by: Brian Paul Reviewed-by: Emil Velikov v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested by Emil Velikov. --- src/glx/dri2_glx.c | 5 - src/glx/dri3_glx.c | 5 - src/glx/dri_common.c | 32 src/glx/drisw_glx.c | 2 ++ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 462d560..8192c54 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -1102,9 +1102,12 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) + if ((mask & (1 << __DRI_API_GLES2)) != 0) { +__glXEnableDirectExtension(&psc->base, + "GLX_EXT_create_context_es_profile"); __glXEnableDirectExtension(&psc->base, "GLX_EXT_create_context_es2_profile"); + } } for (i = 0; extensions[i]; i++) { diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 1ddc723..6973ad1 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1825,9 +1825,12 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) + if ((mask & (1 << __DRI_API_GLES2)) != 0) { + __glXEnableDirectExtension(&psc->base, + "GLX_EXT_create_context_es_profile"); __glXEnableDirectExtension(&psc->base, "GLX_EXT_create_context_es2_profile"); + } for (i = 0; extensions[i]; i++) { /* when on a different gpu than the server, the server pixmaps diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 63c8de3..541abbb 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -544,9 +544,22 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: *api = __DRI_API_OPENGL; break; - case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: -*api = __DRI_API_GLES2; -break; + case GLX_CONTEXT_ES_PROFILE_BIT_EXT: + switch (*major_ver) { + case 3: +*api = __DRI_API_GLES3; +break; + case 2: +*api = __DRI_API_GLES2; +break; + case 1: +*api = __DRI_API_GLES; +break; + default: +*error = __DRI_CTX_ERROR_BAD_API; +return false; + } + break; default: *error = __DRI_CTX_ERROR_BAD_API; return false; @@ -577,19 +590,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, return false; } - /* The GLX_EXT_create_context_es2_profile spec says: -* -* "... If the version requested is 2.0, and the -* GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the -* GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context -* returned will implement OpenGL ES 2.0. This is the only way in which -* an implementation may request an OpenGL ES 2.0 context." -*/ - if (*api == __DRI_API_GLES2
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 14 April 2015 at 13:52, Jose Fonseca wrote: > On 13/04/15 22:59, Ian Romanick wrote: >> >> On 04/10/2015 03:36 PM, Jose Fonseca wrote: >>> >>> From: José Fonseca >>> >>> The latest version of GLX_EXT_create_context_es2_profile states: >>> >>>"If the version requested is a valid and supported OpenGL-ES version, >>>and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the >>>GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context >>>returned will implement the OpenGL ES version requested." >>> >>> We must also export EXT_create_context_es_profile too, as >>> EXT_create_context_es2_profile specification is crystal clear: >>> >>>"NOTE: implementations of this extension must export BOTH extension >>>strings, for backwards compatibility with applications written >>>against version 1 of this extension." >>> >>> Totally untested. (Just happened to noticed this while implementing >>> GLX_EXT_create_context_es2_profile for st/xlib.) >>> >>> Reviewed-by: Brian Paul >>> Reviewed-by: Emil Velikov >>> >>> v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested >>> by Emil Velikov. >>> --- >>> src/glx/dri2_glx.c | 5 - >>> src/glx/dri3_glx.c | 5 - >>> src/glx/dri_common.c | 32 >>> src/glx/drisw_glx.c | 2 ++ >>> 4 files changed, 26 insertions(+), 18 deletions(-) >>> >>> diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c >>> index 462d560..8192c54 100644 >>> --- a/src/glx/dri2_glx.c >>> +++ b/src/glx/dri2_glx.c >>> @@ -1102,9 +1102,12 @@ dri2BindExtensions(struct dri2_screen *psc, struct >>> glx_display * priv, >>> __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); >>> __glXEnableDirectExtension(&psc->base, >>> "GLX_ARB_create_context_profile"); >>> >>> - if ((mask & (1 << __DRI_API_GLES2)) != 0) >>> + if ((mask & (1 << __DRI_API_GLES2)) != 0) { >>> +__glXEnableDirectExtension(&psc->base, >>> + "GLX_EXT_create_context_es_profile"); >>> __glXEnableDirectExtension(&psc->base, >>> >>> "GLX_EXT_create_context_es2_profile"); >>> + } >>> } >>> >>> for (i = 0; extensions[i]; i++) { >>> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c >>> index 1ddc723..6973ad1 100644 >>> --- a/src/glx/dri3_glx.c >>> +++ b/src/glx/dri3_glx.c >>> @@ -1825,9 +1825,12 @@ dri3_bind_extensions(struct dri3_screen *psc, >>> struct glx_display * priv, >>> __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); >>> __glXEnableDirectExtension(&psc->base, >>> "GLX_ARB_create_context_profile"); >>> >>> - if ((mask & (1 << __DRI_API_GLES2)) != 0) >>> + if ((mask & (1 << __DRI_API_GLES2)) != 0) { >>> + __glXEnableDirectExtension(&psc->base, >>> + "GLX_EXT_create_context_es_profile"); >>> __glXEnableDirectExtension(&psc->base, >>>"GLX_EXT_create_context_es2_profile"); >>> + } >>> >>> for (i = 0; extensions[i]; i++) { >>> /* when on a different gpu than the server, the server pixmaps >>> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c >>> index 63c8de3..541abbb 100644 >>> --- a/src/glx/dri_common.c >>> +++ b/src/glx/dri_common.c >>> @@ -544,9 +544,22 @@ dri2_convert_glx_attribs(unsigned num_attribs, const >>> uint32_t *attribs, >>> case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: >>> *api = __DRI_API_OPENGL; >>> break; >>> - case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: >>> -*api = __DRI_API_GLES2; >>> -break; >>> + case GLX_CONTEXT_ES_PROFILE_BIT_EXT: >>> + switch (*major_ver) { >>> + case 3: >>> +*api = __DRI_API_GLES3; >>> +break; >>> + case 2: >>> +*api = __DRI_API_GLES2; >>> +break; >>> + case 1: >>> +*api = __DRI_API_GLES; >>> +break; >>> + default: >>> +*error = __DRI_CTX_ERROR_BAD_API; >>> +return false; >>> + } >>> + break; >>> default: >>> *error = __DRI_CTX_ERROR_BAD_API; >>> return false; >>> @@ -577,19 +590,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const >>> uint32_t *attribs, >>> return false; >>> } >>> >>> - /* The GLX_EXT_create_context_es2_profile spec says: >>> -* >>> -* "... If the version requested is 2.0, and the >>> -* GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the >>> -* GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the >>> context >>> -* returned will implement OpenGL ES 2.0. This is the only way in >>> which >>> -* an implementation may request an OpenGL ES 2.0 context." >>> -*/ >>> - if (*api == __DRI_API_GLES2 && (*major_ver != 2 || *minor_ver != 0)) >>> { >>> - *error = __DRI_CTX_ERROR_BAD_API; >>> - return false; >>> - } >> >> >> I guess this text was removed fr
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 13/04/15 22:59, Ian Romanick wrote: On 04/10/2015 03:36 PM, Jose Fonseca wrote: From: José Fonseca The latest version of GLX_EXT_create_context_es2_profile states: "If the version requested is a valid and supported OpenGL-ES version, and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context returned will implement the OpenGL ES version requested." We must also export EXT_create_context_es_profile too, as EXT_create_context_es2_profile specification is crystal clear: "NOTE: implementations of this extension must export BOTH extension strings, for backwards compatibility with applications written against version 1 of this extension." Totally untested. (Just happened to noticed this while implementing GLX_EXT_create_context_es2_profile for st/xlib.) Reviewed-by: Brian Paul Reviewed-by: Emil Velikov v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested by Emil Velikov. --- src/glx/dri2_glx.c | 5 - src/glx/dri3_glx.c | 5 - src/glx/dri_common.c | 32 src/glx/drisw_glx.c | 2 ++ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 462d560..8192c54 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -1102,9 +1102,12 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) + if ((mask & (1 << __DRI_API_GLES2)) != 0) { +__glXEnableDirectExtension(&psc->base, + "GLX_EXT_create_context_es_profile"); __glXEnableDirectExtension(&psc->base, "GLX_EXT_create_context_es2_profile"); + } } for (i = 0; extensions[i]; i++) { diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 1ddc723..6973ad1 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1825,9 +1825,12 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv, __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); - if ((mask & (1 << __DRI_API_GLES2)) != 0) + if ((mask & (1 << __DRI_API_GLES2)) != 0) { + __glXEnableDirectExtension(&psc->base, + "GLX_EXT_create_context_es_profile"); __glXEnableDirectExtension(&psc->base, "GLX_EXT_create_context_es2_profile"); + } for (i = 0; extensions[i]; i++) { /* when on a different gpu than the server, the server pixmaps diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 63c8de3..541abbb 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -544,9 +544,22 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: *api = __DRI_API_OPENGL; break; - case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: -*api = __DRI_API_GLES2; -break; + case GLX_CONTEXT_ES_PROFILE_BIT_EXT: + switch (*major_ver) { + case 3: +*api = __DRI_API_GLES3; +break; + case 2: +*api = __DRI_API_GLES2; +break; + case 1: +*api = __DRI_API_GLES; +break; + default: +*error = __DRI_CTX_ERROR_BAD_API; +return false; + } + break; default: *error = __DRI_CTX_ERROR_BAD_API; return false; @@ -577,19 +590,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, return false; } - /* The GLX_EXT_create_context_es2_profile spec says: -* -* "... If the version requested is 2.0, and the -* GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the -* GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context -* returned will implement OpenGL ES 2.0. This is the only way in which -* an implementation may request an OpenGL ES 2.0 context." -*/ - if (*api == __DRI_API_GLES2 && (*major_ver != 2 || *minor_ver != 0)) { - *error = __DRI_CTX_ERROR_BAD_API; - return false; - } I guess this text was removed from the extension spec, and now we rely on some other layer detecting invalid versions (like 2.1)? Yes, the spec replaced that with "... If the version requested is a valid and supported OpenGL-ES version, and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context returned will implement the OpenGL ES version requested." That is, GLX_EXT_create_context_es_profile effectively allows to create any GLES version f
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 04/10/2015 03:36 PM, Jose Fonseca wrote: > From: José Fonseca > > The latest version of GLX_EXT_create_context_es2_profile states: > > "If the version requested is a valid and supported OpenGL-ES version, > and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the > GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context > returned will implement the OpenGL ES version requested." > > We must also export EXT_create_context_es_profile too, as > EXT_create_context_es2_profile specification is crystal clear: > > "NOTE: implementations of this extension must export BOTH extension > strings, for backwards compatibility with applications written > against version 1 of this extension." > > Totally untested. (Just happened to noticed this while implementing > GLX_EXT_create_context_es2_profile for st/xlib.) > > Reviewed-by: Brian Paul > Reviewed-by: Emil Velikov > > v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested > by Emil Velikov. > --- > src/glx/dri2_glx.c | 5 - > src/glx/dri3_glx.c | 5 - > src/glx/dri_common.c | 32 > src/glx/drisw_glx.c | 2 ++ > 4 files changed, 26 insertions(+), 18 deletions(-) > > diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c > index 462d560..8192c54 100644 > --- a/src/glx/dri2_glx.c > +++ b/src/glx/dri2_glx.c > @@ -1102,9 +1102,12 @@ dri2BindExtensions(struct dri2_screen *psc, struct > glx_display * priv, >__glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); >__glXEnableDirectExtension(&psc->base, > "GLX_ARB_create_context_profile"); > > - if ((mask & (1 << __DRI_API_GLES2)) != 0) > + if ((mask & (1 << __DRI_API_GLES2)) != 0) { > + __glXEnableDirectExtension(&psc->base, > + "GLX_EXT_create_context_es_profile"); >__glXEnableDirectExtension(&psc->base, > "GLX_EXT_create_context_es2_profile"); > + } > } > > for (i = 0; extensions[i]; i++) { > diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c > index 1ddc723..6973ad1 100644 > --- a/src/glx/dri3_glx.c > +++ b/src/glx/dri3_glx.c > @@ -1825,9 +1825,12 @@ dri3_bind_extensions(struct dri3_screen *psc, struct > glx_display * priv, > __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context"); > __glXEnableDirectExtension(&psc->base, "GLX_ARB_create_context_profile"); > > - if ((mask & (1 << __DRI_API_GLES2)) != 0) > + if ((mask & (1 << __DRI_API_GLES2)) != 0) { > + __glXEnableDirectExtension(&psc->base, > + "GLX_EXT_create_context_es_profile"); >__glXEnableDirectExtension(&psc->base, > "GLX_EXT_create_context_es2_profile"); > + } > > for (i = 0; extensions[i]; i++) { >/* when on a different gpu than the server, the server pixmaps > diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c > index 63c8de3..541abbb 100644 > --- a/src/glx/dri_common.c > +++ b/src/glx/dri_common.c > @@ -544,9 +544,22 @@ dri2_convert_glx_attribs(unsigned num_attribs, const > uint32_t *attribs, >case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: >*api = __DRI_API_OPENGL; >break; > - case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: > - *api = __DRI_API_GLES2; > - break; > + case GLX_CONTEXT_ES_PROFILE_BIT_EXT: > + switch (*major_ver) { > + case 3: > +*api = __DRI_API_GLES3; > +break; > + case 2: > +*api = __DRI_API_GLES2; > +break; > + case 1: > +*api = __DRI_API_GLES; > +break; > + default: > +*error = __DRI_CTX_ERROR_BAD_API; > +return false; > + } > + break; >default: >*error = __DRI_CTX_ERROR_BAD_API; >return false; > @@ -577,19 +590,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const > uint32_t *attribs, >return false; > } > > - /* The GLX_EXT_create_context_es2_profile spec says: > -* > -* "... If the version requested is 2.0, and the > -* GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the > -* GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the > context > -* returned will implement OpenGL ES 2.0. This is the only way in > which > -* an implementation may request an OpenGL ES 2.0 context." > -*/ > - if (*api == __DRI_API_GLES2 && (*major_ver != 2 || *minor_ver != 0)) { > - *error = __DRI_CTX_ERROR_BAD_API; > - return false; > - } I guess this text was removed from the extension spec, and now we rely on some other layer detecting invalid versions (like 2.1)? This patch combined with Chad's patch seems like it should work... I'm a little confused why Waffle doesn't like it. :( > - > *error = __DRI_CTX_ERROR_SUCCESS; > return true; > } > diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On 04/10/2015 04:57 PM, Chad Versace wrote: > On Fri 10 Apr 2015, Jose Fonseca wrote: >> From: José Fonseca >> >> The latest version of GLX_EXT_create_context_es2_profile states: >> >> "If the version requested is a valid and supported OpenGL-ES version, >> and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the >> GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context >> returned will implement the OpenGL ES version requested." >> >> We must also export EXT_create_context_es_profile too, as >> EXT_create_context_es2_profile specification is crystal clear: >> >> "NOTE: implementations of this extension must export BOTH extension >> strings, for backwards compatibility with applications written >> against version 1 of this extension." >> >> Totally untested. (Just happened to noticed this while implementing >> GLX_EXT_create_context_es2_profile for st/xlib.) >> >> Reviewed-by: Brian Paul >> Reviewed-by: Emil Velikov >> >> v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested >> by Emil Velikov. >> --- >> src/glx/dri2_glx.c | 5 - >> src/glx/dri3_glx.c | 5 - >> src/glx/dri_common.c | 32 >> src/glx/drisw_glx.c | 2 ++ >> 4 files changed, 26 insertions(+), 18 deletions(-) > > > Jose, you also need to add the extensions to the extension table in > glxextensions.c. Otherwise, __glXEnableDirectExtension() fails to find > and enable the extensions. > > Also, Ian has a strange hack for es2_profile > __glXCalculateUsableExtensions that I don't understand, but probably > needs replicating for es_profile. I tried to explain the situation in the cooment. :( In order to use GLX_EXT_create_context_es2_profile, you have to use functions that were added with GLX_ARB_create_context_profile. The ARB extension depends on both client and server support, but the EXT only depends on client support. So, if the client says it supports both the ARB and EXT but the server does not support the ARB, we would say that GLX_EXT_create_context_es2_profile, and that would be a lie. That bit of code just disables GLX_EXT_create_context_es2_profile when GLX_ARB_create_context_profile is not fully supported. Your assertion that a similar change is necessary for the new extension string is correct. Good catch. :) > I applied the diff below on top of your patch, and glxinfo began > correctly advertising your extensions. Even with that diff, it's still > broken though. I tested it with waffle 1.5.0 as below: > >[chadv@daring mesa]$ wflinfo -p glx -a gles1 >Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: glXCreateContextAttribsARB > failed >[chadv@daring mesa]$ wflinfo -p glx -a gles2 >Waffle platform: glx >Waffle api: gles2 >OpenGL vendor string: Intel Open Source Technology Center >OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell > GT2) >OpenGL version string: OpenGL ES 3.0 Mesa 10.6.0-devel (git-cd130b3) >[chadv@daring mesa]$ wflinfo -p glx -a gles3 >Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: glXCreateContextAttribsARB > failed > > > diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c > index ce5d66d..8f2f194 100644 > --- a/src/glx/glxextensions.c > +++ b/src/glx/glxextensions.c > @@ -84,6 +84,7 @@ static const struct extension_info > known_glx_extensions[] = { >{ GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N }, >{ GLX(EXT_fbconfig_packed_float), VER(0,0), Y, Y, N, N }, >{ GLX(EXT_framebuffer_sRGB),VER(0,0), Y, Y, N, N }, > + { GLX(EXT_create_context_es_profile), VER(0,0), Y, N, N, Y }, >{ GLX(EXT_create_context_es2_profile), VER(0,0), Y, N, N, Y }, >{ GLX(MESA_copy_sub_buffer),VER(0,0), Y, N, N, N }, >{ GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, Y, N }, > @@ -628,12 +629,13 @@ __glXCalculateUsableExtensions(struct glx_screen * > psc, >} > >/* This hack is necessary because GLX_ARB_create_context_profile > depends on > -* server support, but GLX_EXT_create_context_es2_profile is > direct-only. > -* Without this hack, it would be possible to advertise > -* GLX_EXT_create_context_es2_profile without > +* server support, but GLX_EXT_create_context_es2_profile and > es_profile is > +* direct-only. Without this hack, it would be possible to advertise > +* GLX_EXT_create_context_es2_profile and es_profile without > * GLX_ARB_create_context_profile. That would be a problem. > */ >if (!IS_SET(server_support, ARB_create_context_profile_bit)) { > + CLR_BIT(usable, EXT_create_context_es_profile_bit); > CLR_BIT(usable, EXT_create_context_es2_profile_bit); >} > > diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h > index 37e4ccc..3618127 100644 > --- a/src/glx/glxextensions.h > +++ b/src/glx/glxextensions.h > @@ -45,6 +45,7 @@ enum >EXT_import_context_bit, >EXT_framebuffer_sRGB_bit, >EXT_fbconfig_packed_float_bit, > + EXT_create_context_es_profile_
Re: [Mesa-dev] [PATCH] glx: Allow to create any OpenGL ES version.
On Fri 10 Apr 2015, Jose Fonseca wrote: From: José Fonseca The latest version of GLX_EXT_create_context_es2_profile states: "If the version requested is a valid and supported OpenGL-ES version, and the GLX_CONTEXT_ES_PROFILE_BIT_EXT bit is set in the GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the context returned will implement the OpenGL ES version requested." We must also export EXT_create_context_es_profile too, as EXT_create_context_es2_profile specification is crystal clear: "NOTE: implementations of this extension must export BOTH extension strings, for backwards compatibility with applications written against version 1 of this extension." Totally untested. (Just happened to noticed this while implementing GLX_EXT_create_context_es2_profile for st/xlib.) Reviewed-by: Brian Paul Reviewed-by: Emil Velikov v2: Replicate the drisw_glx.c to dri2_glx.c and dri3_glx.c as suggested by Emil Velikov. --- src/glx/dri2_glx.c | 5 - src/glx/dri3_glx.c | 5 - src/glx/dri_common.c | 32 src/glx/drisw_glx.c | 2 ++ 4 files changed, 26 insertions(+), 18 deletions(-) Jose, you also need to add the extensions to the extension table in glxextensions.c. Otherwise, __glXEnableDirectExtension() fails to find and enable the extensions. Also, Ian has a strange hack for es2_profile __glXCalculateUsableExtensions that I don't understand, but probably needs replicating for es_profile. I applied the diff below on top of your patch, and glxinfo began correctly advertising your extensions. Even with that diff, it's still broken though. I tested it with waffle 1.5.0 as below: [chadv@daring mesa]$ wflinfo -p glx -a gles1 Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: glXCreateContextAttribsARB failed [chadv@daring mesa]$ wflinfo -p glx -a gles2 Waffle platform: glx Waffle api: gles2 OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) OpenGL version string: OpenGL ES 3.0 Mesa 10.6.0-devel (git-cd130b3) [chadv@daring mesa]$ wflinfo -p glx -a gles3 Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: glXCreateContextAttribsARB failed diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c index ce5d66d..8f2f194 100644 --- a/src/glx/glxextensions.c +++ b/src/glx/glxextensions.c @@ -84,6 +84,7 @@ static const struct extension_info known_glx_extensions[] = { { GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N }, { GLX(EXT_fbconfig_packed_float), VER(0,0), Y, Y, N, N }, { GLX(EXT_framebuffer_sRGB),VER(0,0), Y, Y, N, N }, + { GLX(EXT_create_context_es_profile), VER(0,0), Y, N, N, Y }, { GLX(EXT_create_context_es2_profile), VER(0,0), Y, N, N, Y }, { GLX(MESA_copy_sub_buffer),VER(0,0), Y, N, N, N }, { GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, Y, N }, @@ -628,12 +629,13 @@ __glXCalculateUsableExtensions(struct glx_screen * psc, } /* This hack is necessary because GLX_ARB_create_context_profile depends on -* server support, but GLX_EXT_create_context_es2_profile is direct-only. -* Without this hack, it would be possible to advertise -* GLX_EXT_create_context_es2_profile without +* server support, but GLX_EXT_create_context_es2_profile and es_profile is +* direct-only. Without this hack, it would be possible to advertise +* GLX_EXT_create_context_es2_profile and es_profile without * GLX_ARB_create_context_profile. That would be a problem. */ if (!IS_SET(server_support, ARB_create_context_profile_bit)) { + CLR_BIT(usable, EXT_create_context_es_profile_bit); CLR_BIT(usable, EXT_create_context_es2_profile_bit); } diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h index 37e4ccc..3618127 100644 --- a/src/glx/glxextensions.h +++ b/src/glx/glxextensions.h @@ -45,6 +45,7 @@ enum EXT_import_context_bit, EXT_framebuffer_sRGB_bit, EXT_fbconfig_packed_float_bit, + EXT_create_context_es_profile_bit, EXT_create_context_es2_profile_bit, MESA_copy_sub_buffer_bit, MESA_depth_float_bit, -- 2.2.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev