gallium: use PIPE_CONTEXT_* flags instead of ST_CONTEXT_FLAG_*

where PIPE_CONTEXT_* flags are available

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20027>
This commit is contained in:
Marek Olšák 2022-11-27 15:00:57 -05:00 committed by Marge Bot
parent 0122a67c81
commit 9fdb0ce755
5 changed files with 21 additions and 33 deletions

View file

@ -113,11 +113,11 @@ dri_create_context(struct dri_screen *screen,
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if (ctx_config->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
attribs.context_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY)
if (ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION)
attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
attribs.context_flags |= PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET;
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_NO_ERROR)
attribs.flags |= ctx_config->no_error ? ST_CONTEXT_FLAG_NO_ERROR : 0;
@ -125,10 +125,10 @@ dri_create_context(struct dri_screen *screen,
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_PRIORITY) {
switch (ctx_config->priority) {
case __DRI_CTX_PRIORITY_LOW:
attribs.flags |= ST_CONTEXT_FLAG_LOW_PRIORITY;
attribs.context_flags |= PIPE_CONTEXT_LOW_PRIORITY;
break;
case __DRI_CTX_PRIORITY_HIGH:
attribs.flags |= ST_CONTEXT_FLAG_HIGH_PRIORITY;
attribs.context_flags |= PIPE_CONTEXT_HIGH_PRIORITY;
break;
default:
break;
@ -140,7 +140,7 @@ dri_create_context(struct dri_screen *screen,
attribs.flags |= ST_CONTEXT_FLAG_RELEASE_NONE;
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_PROTECTED)
attribs.flags |= ST_CONTEXT_FLAG_PROTECTED;
attribs.context_flags |= PIPE_CONTEXT_PROTECTED;
struct dri_context *share_ctx = NULL;
if (sharedContextPrivate) {

View file

@ -959,7 +959,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
if (contextFlags & GLX_CONTEXT_DEBUG_BIT_ARB)
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if (contextFlags & GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB)
attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
attribs.context_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
switch (profileMask) {
case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:

View file

@ -193,9 +193,9 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCt
if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB)
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if (contextFlags & WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB)
attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
attribs.context_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
if (resetStrategy != WGL_NO_RESET_NOTIFICATION_ARB)
attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
attribs.context_flags |= PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET;
switch (profileMask) {
case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:

View file

@ -68,13 +68,9 @@ enum st_profile_type
*/
#define ST_CONTEXT_FLAG_DEBUG (1 << 0)
#define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 1)
#define ST_CONTEXT_FLAG_ROBUST_ACCESS (1 << 2)
#define ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED (1 << 3)
#define ST_CONTEXT_FLAG_NO_ERROR (1 << 4)
#define ST_CONTEXT_FLAG_RELEASE_NONE (1 << 5)
#define ST_CONTEXT_FLAG_HIGH_PRIORITY (1 << 6)
#define ST_CONTEXT_FLAG_LOW_PRIORITY (1 << 7)
#define ST_CONTEXT_FLAG_PROTECTED (1 << 8)
#define ST_CONTEXT_FLAG_NO_ERROR (1 << 2)
#define ST_CONTEXT_FLAG_RELEASE_NONE (1 << 3)
/**
* Reasons that context creation might fail.
@ -252,6 +248,9 @@ struct st_context_attribs
/** Mask of ST_CONTEXT_FLAG_x bits */
unsigned flags;
/** Mask of PIPE_CONTEXT_x bits */
unsigned context_flags;
/**
* The visual of the framebuffers the context will be bound to.
*/

View file

@ -945,7 +945,6 @@ st_api_create_context(struct pipe_frontend_screen *fscreen,
struct gl_config mode, *mode_ptr = &mode;
gl_api api;
bool no_error = false;
unsigned ctx_flags = PIPE_CONTEXT_PREFER_THREADED;
if (!(ST_PROFILE_ALL_MASK & (1 << attribs->profile)))
return NULL;
@ -985,24 +984,12 @@ st_api_create_context(struct pipe_frontend_screen *fscreen,
fscreen->destroy = st_manager_destroy;
}
if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS)
ctx_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
if (attribs->flags & ST_CONTEXT_FLAG_NO_ERROR)
no_error = true;
if (attribs->flags & ST_CONTEXT_FLAG_LOW_PRIORITY)
ctx_flags |= PIPE_CONTEXT_LOW_PRIORITY;
else if (attribs->flags & ST_CONTEXT_FLAG_HIGH_PRIORITY)
ctx_flags |= PIPE_CONTEXT_HIGH_PRIORITY;
if (attribs->flags & ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED)
ctx_flags |= PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET;
if (attribs->flags & ST_CONTEXT_FLAG_PROTECTED)
ctx_flags |= PIPE_CONTEXT_PROTECTED;
pipe = fscreen->screen->context_create(fscreen->screen, NULL, ctx_flags);
pipe = fscreen->screen->context_create(fscreen->screen, NULL,
PIPE_CONTEXT_PREFER_THREADED |
attribs->context_flags);
if (!pipe) {
*error = ST_CONTEXT_ERROR_NO_MEMORY;
return NULL;
@ -1035,11 +1022,13 @@ st_api_create_context(struct pipe_frontend_screen *fscreen,
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS) {
if (attribs->context_flags & PIPE_CONTEXT_ROBUST_BUFFER_ACCESS) {
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
st->ctx->Const.RobustAccess = GL_TRUE;
}
if (attribs->flags & ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED) {
if (attribs->context_flags & PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET) {
st->ctx->Const.ResetStrategy = GL_LOSE_CONTEXT_ON_RESET_ARB;
st_install_device_reset_callback(st);
}