egl: Implement EGL_KHR_context_flush_control
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
ba7679f48d
commit
c0be3aae6c
|
@ -92,7 +92,7 @@
|
||||||
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
|
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_ATTRIBS 10
|
#define NUM_ATTRIBS 12
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dri_set_background_context(void *loaderPrivate)
|
dri_set_background_context(void *loaderPrivate)
|
||||||
|
@ -457,6 +457,7 @@ static const struct dri2_extension_match optional_core_extensions[] = {
|
||||||
{ __DRI2_RENDERER_QUERY, 1, offsetof(struct dri2_egl_display, rendererQuery) },
|
{ __DRI2_RENDERER_QUERY, 1, offsetof(struct dri2_egl_display, rendererQuery) },
|
||||||
{ __DRI2_INTEROP, 1, offsetof(struct dri2_egl_display, interop) },
|
{ __DRI2_INTEROP, 1, offsetof(struct dri2_egl_display, interop) },
|
||||||
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
|
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
|
||||||
|
{ __DRI2_FLUSH_CONTROL, 1, offsetof(struct dri2_egl_display, flush_control) },
|
||||||
{ NULL, 0, 0 }
|
{ NULL, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -766,6 +767,9 @@ dri2_setup_screen(_EGLDisplay *disp)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dri2_dpy->flush_control)
|
||||||
|
disp->Extensions.KHR_context_flush_control = EGL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1227,6 +1231,11 @@ dri2_fill_context_attribs(struct dri2_egl_context *dri2_ctx,
|
||||||
ctx_attribs[pos++] = val;
|
ctx_attribs[pos++] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dri2_ctx->base.ReleaseBehavior == EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR) {
|
||||||
|
ctx_attribs[pos++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
|
||||||
|
ctx_attribs[pos++] = __DRI_CTX_RELEASE_BEHAVIOR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
*num_attribs = pos;
|
*num_attribs = pos;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -164,6 +164,7 @@ struct dri2_egl_display
|
||||||
const __DRIdri2Extension *dri2;
|
const __DRIdri2Extension *dri2;
|
||||||
const __DRIswrastExtension *swrast;
|
const __DRIswrastExtension *swrast;
|
||||||
const __DRI2flushExtension *flush;
|
const __DRI2flushExtension *flush;
|
||||||
|
const __DRI2flushControlExtension *flush_control;
|
||||||
const __DRItexBufferExtension *tex_buffer;
|
const __DRItexBufferExtension *tex_buffer;
|
||||||
const __DRIimageExtension *image;
|
const __DRIimageExtension *image;
|
||||||
const __DRIrobustnessExtension *robustness;
|
const __DRIrobustnessExtension *robustness;
|
||||||
|
|
|
@ -494,6 +494,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
|
||||||
|
|
||||||
_EGL_CHECK_EXTENSION(KHR_cl_event2);
|
_EGL_CHECK_EXTENSION(KHR_cl_event2);
|
||||||
_EGL_CHECK_EXTENSION(KHR_config_attribs);
|
_EGL_CHECK_EXTENSION(KHR_config_attribs);
|
||||||
|
_EGL_CHECK_EXTENSION(KHR_context_flush_control);
|
||||||
_EGL_CHECK_EXTENSION(KHR_create_context);
|
_EGL_CHECK_EXTENSION(KHR_create_context);
|
||||||
_EGL_CHECK_EXTENSION(KHR_create_context_no_error);
|
_EGL_CHECK_EXTENSION(KHR_create_context_no_error);
|
||||||
_EGL_CHECK_EXTENSION(KHR_fence_sync);
|
_EGL_CHECK_EXTENSION(KHR_fence_sync);
|
||||||
|
|
|
@ -386,6 +386,15 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case EGL_CONTEXT_RELEASE_BEHAVIOR_KHR:
|
||||||
|
if (val == EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR ||
|
||||||
|
val == EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR) {
|
||||||
|
ctx->ReleaseBehavior = val;
|
||||||
|
} else {
|
||||||
|
err = EGL_BAD_ATTRIBUTE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err = EGL_BAD_ATTRIBUTE;
|
err = EGL_BAD_ATTRIBUTE;
|
||||||
break;
|
break;
|
||||||
|
@ -588,6 +597,7 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
|
||||||
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||||
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR;
|
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR;
|
||||||
ctx->ContextPriority = EGL_CONTEXT_PRIORITY_MEDIUM_IMG;
|
ctx->ContextPriority = EGL_CONTEXT_PRIORITY_MEDIUM_IMG;
|
||||||
|
ctx->ReleaseBehavior = EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR;
|
||||||
|
|
||||||
err = _eglParseContextAttribList(ctx, dpy, attrib_list);
|
err = _eglParseContextAttribList(ctx, dpy, attrib_list);
|
||||||
if (err == EGL_SUCCESS && ctx->Config) {
|
if (err == EGL_SUCCESS && ctx->Config) {
|
||||||
|
|
|
@ -64,6 +64,7 @@ struct _egl_context
|
||||||
EGLint ResetNotificationStrategy;
|
EGLint ResetNotificationStrategy;
|
||||||
EGLint ContextPriority;
|
EGLint ContextPriority;
|
||||||
EGLBoolean NoError;
|
EGLBoolean NoError;
|
||||||
|
EGLint ReleaseBehavior;
|
||||||
|
|
||||||
/* The real render buffer when a window surface is bound */
|
/* The real render buffer when a window surface is bound */
|
||||||
EGLint WindowRenderBuffer;
|
EGLint WindowRenderBuffer;
|
||||||
|
|
|
@ -112,6 +112,7 @@ struct _egl_extensions
|
||||||
|
|
||||||
EGLBoolean KHR_cl_event2;
|
EGLBoolean KHR_cl_event2;
|
||||||
EGLBoolean KHR_config_attribs;
|
EGLBoolean KHR_config_attribs;
|
||||||
|
EGLBoolean KHR_context_flush_control;
|
||||||
EGLBoolean KHR_create_context;
|
EGLBoolean KHR_create_context;
|
||||||
EGLBoolean KHR_fence_sync;
|
EGLBoolean KHR_fence_sync;
|
||||||
EGLBoolean KHR_get_all_proc_addresses;
|
EGLBoolean KHR_get_all_proc_addresses;
|
||||||
|
|
Loading…
Reference in New Issue