diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 992f0e3d46d..64d654f7e0b 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -892,6 +892,8 @@ dri2_setup_screen(_EGLDisplay *disp) disp->Extensions.EXT_create_context_robustness = get_screen_param(disp, PIPE_CAP_DEVICE_RESET_STATUS_QUERY); + disp->RobustBufferAccess = + get_screen_param(disp, PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR); /* EXT_query_reset_notification_strategy complements and requires * EXT_create_context_robustness. */ diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index fa14bdf3943..c0e5f97bb38 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -288,6 +288,18 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp, break; } + /* The EGL_EXT_create_context_robustness spec says: + * + * "EGL_BAD_CONFIG is generated if + * [EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT] is set to EGL_TRUE and + * no GL context supporting the GL_EXT_robustness extension and + * robust access as described therein can be created." + */ + if (val == EGL_TRUE && !disp->RobustBufferAccess) { + err = EGL_BAD_CONFIG; + break; + } + if (val == EGL_TRUE) ctx->Flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; break; diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index b3510ae7a1d..86a0ef521e7 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -208,6 +208,7 @@ struct _egl_display { EGLint Version; /**< EGL version major*10+minor */ EGLint ClientAPIs; /**< Bitmask of APIs supported (EGL_xxx_BIT) */ _EGLExtensions Extensions; /**< Extensions supported */ + EGLBoolean RobustBufferAccess; /**< Supports robust buffer access behavior */ /* these fields are derived from above */ char VersionString[100]; /**< EGL_VERSION */