[Mesa-dev] [PATCH] egl/gallium: implemlent EGL_KHR_create_context v3

Knut Andre Tidemann knut.tidemann at gmail.com
Thu Jul 24 23:43:21 PDT 2014


On 07/24/2014 07:16 PM, Matt Turner wrote:
> On Fri, Jun 27, 2014 at 1:59 AM, Knut Andre Tidemann
> <knut.tidemann at gmail.com> wrote:
>> v2: fix style and wrong major version comparison.
>> v3: fix version check in context creation.
>> ---
>>   src/gallium/state_trackers/egl/common/egl_g3d.c     |  1 +
>>   src/gallium/state_trackers/egl/common/egl_g3d_api.c | 12 ++++++++++++
>>   2 files changed, 13 insertions(+)
>>
>> diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
>> index d3f5e92..22b5e4a 100644
>> --- a/src/gallium/state_trackers/egl/common/egl_g3d.c
>> +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
>> @@ -584,6 +584,7 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
>>      dpy->Extensions.KHR_fence_sync = EGL_TRUE;
>>
>>      dpy->Extensions.KHR_surfaceless_context = EGL_TRUE;
>> +   dpy->Extensions.KHR_create_context = EGL_TRUE;
>>
>>      if (dpy->Platform == _EGL_PLATFORM_DRM) {
>>         dpy->Extensions.MESA_drm_display = EGL_TRUE;
>> diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
>> index b19d899..5e900cc 100644
>> --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
>> +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
>> @@ -72,6 +72,11 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
>>         break;
>>      case EGL_OPENGL_API:
>>         api = ST_API_OPENGL;
>> +      if (((ctx->ClientMajorVersion >= 4) ||
>> +            (ctx->ClientMajorVersion == 3 && ctx->ClientMinorVersion >= 2)) &&
>> +            ctx->Profile == EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR) {
>> +         *profile = ST_PROFILE_OPENGL_CORE;
>> +      }
>
>
> What if you only specify the core profile bit without specifying a version?
>
> I don't know that you're required to specify a version to get a core
> profile. The default major/minor versions are 1/0 and the default
> profile mask is core, so it seems like that should give you a core
> context by default. Maybe we're missing a test for this.

The core and compatibility profiles were only introduced in 3.2, and the 
spec says the PROFILE_MASK is ignored for earlier versions.

>
>>         break;
>>      default:
>>         _eglLog(_EGL_WARNING, "unknown client API 0x%04x", ctx->ClientAPI);
>> @@ -166,6 +171,12 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
>>      if (gconf)
>>         stattribs.visual = gconf->stvis;
>>
>> +   if (gctx->base.Flags & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR)
>> +      stattribs.flags = ST_CONTEXT_FLAG_DEBUG;
>
> Need to handle EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR and
> EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR here too?

The FORWARD_COMPATIBLE_BIT is handled by the main egl stack 
(_eglInitContext in egl/main/eglcontext.c) which is called by the called 
by the galluim code.

Handing of the ROBUST_ACCESS_BIT requires another extension 
(EXT_create_context_robustness) which I don't think is implemented, at 
least not in the gallium code. The bit is not set if this extension is 
not available. This is also handled in the main egl stack.

--
Knut Tidemann



More information about the mesa-dev mailing list