dri: Epoch how no-error context creation works

The bug here is that the DRI context "flags" are intended to alias the
GLX context flag values, and they don't, DRI's no-error flag is GLX's
reset-isolation flag. GLX (and EGL!) treat no-error as a context
attribute, and reset isolation predates Mesa's no-error implementation
by several years. The GL_KHR_no_error spec does describe it as a
"context flag", though, so maybe that's why we do it as a (DRI) context
flag.

In order to unalias these we need a new contract with the loader. We
remove the old __DRI_NO_ERROR extension, and add a new
__DRI_RENDERER_HAS_CONTEXT_NO_ERROR value to query. Loaders can key on
that to know to pass no-error-ness through as a context attribute,
matching the GLX/EGL calling convention. We go ahead and define
__DRI_CTX_FLAG_RESET_ISOLATION as well, and update the drivers to refuse
it since we don't support it yet.

This means mismatched drivers/loaders will not be able to create
no-error contexts. Too bad. If you want performance that badly you can
build both things at once.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12474>
This commit is contained in:
Adam Jackson
2021-10-04 17:46:46 -04:00
committed by Marge Bot
parent 5e994c5d98
commit 3e3d75d16a
7 changed files with 40 additions and 20 deletions

View File

@@ -1063,16 +1063,22 @@ struct __DRIdri2LoaderExtensionRec {
#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
#define __DRI_CTX_ATTRIB_MINOR_VERSION 1
/* These must alias the GLX/EGL values. */
#define __DRI_CTX_ATTRIB_FLAGS 2
#define __DRI_CTX_FLAG_DEBUG 0x00000001
#define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
#define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
#define __DRI_CTX_FLAG_NO_ERROR 0x00000008
#define __DRI_CTX_FLAG_NO_ERROR 0x00000008 /* Deprecated, do not use */
/* Not yet implemented but placed here to reserve the alias with GLX */
#define __DRI_CTX_FLAG_RESET_ISOLATION 0x00000008
#define __DRI_CTX_ATTRIB_RESET_STRATEGY 3
#define __DRI_CTX_RESET_NO_NOTIFICATION 0
#define __DRI_CTX_RESET_LOSE_CONTEXT 1
/**
* \name Context priority levels.
*/
#define __DRI_CTX_ATTRIB_PRIORITY 4
#define __DRI_CTX_PRIORITY_LOW 0
#define __DRI_CTX_PRIORITY_MEDIUM 1
@@ -1082,7 +1088,9 @@ struct __DRIdri2LoaderExtensionRec {
#define __DRI_CTX_RELEASE_BEHAVIOR_NONE 0
#define __DRI_CTX_RELEASE_BEHAVIOR_FLUSH 1
#define __DRI_CTX_NUM_ATTRIBS 6
#define __DRI_CTX_ATTRIB_NO_ERROR 6
#define __DRI_CTX_NUM_ATTRIBS 7
/**
* \name Reasons that __DRIdri2Extension::createContextAttribs might fail
@@ -1758,10 +1766,13 @@ struct __DRIrobustnessExtensionRec {
};
/**
* No-error context driver extension.
* No-error context driver extension (deprecated).
*
* Existence of this extension means the driver can accept the
* __DRI_CTX_FLAG_NO_ERROR flag.
*
* This extension is deprecated, and modern loaders will not use it. Please
* use __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT instead.
*/
#define __DRI2_NO_ERROR "DRI_NoError"
#define __DRI2_NO_ERROR_VERSION 1
@@ -1868,6 +1879,7 @@ typedef struct __DRIDriverVtableExtensionRec {
#define __DRI2_RENDERER_HAS_PROTECTED_CONTENT 0x000e
#define __DRI2_RENDERER_PREFER_BACK_BUFFER_REUSE 0x000f
#define __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT 0x0010
typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
struct __DRI2rendererQueryExtensionRec {