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

Matt Turner mattst88 at gmail.com
Thu Jul 24 10:07:14 PDT 2014


On Thu, Jul 24, 2014 at 5:37 AM, Knut Andre Tidemann
<knut.tidemann at gmail.com> wrote:
> On 06/27/2014 10:59 AM, Knut Andre Tidemann 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;
>> +      }
>>         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;
>> +
>> +   stattribs.major = gctx->base.ClientMajorVersion;
>> +   stattribs.minor = gctx->base.ClientMinorVersion;
>> +
>>      gctx->stapi = egl_g3d_choose_st(drv, &gctx->base,
>> &stattribs.profile);
>>      if (!gctx->stapi) {
>>         FREE(gctx);
>> @@ -175,6 +186,7 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay
>> *dpy, _EGLConfig *conf,
>>      gctx->stctxi = gctx->stapi->create_context(gctx->stapi, gdpy->smapi,
>>            &stattribs, &ctx_err, (gshare) ? gshare->stctxi : NULL);
>>      if (!gctx->stctxi) {
>> +      _eglError(EGL_BAD_MATCH, "eglCreateContext");
>>         FREE(gctx);
>>         return NULL;
>>      }
>>
>
>
> Is there any interest in this? If not I would like to make a feature request
> as it is the only way to create a core context with EGL at the moment.

Yes, unfortunately I don't know the gallium code. I've been hoping a
gallium person would review this, since we really want to tell people
to switch to EGL, but with features like this missing from other
drivers I don't think we can do it with a straight face.

I'll review it as best I can.


More information about the mesa-dev mailing list