mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
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:
parent
0122a67c81
commit
9fdb0ce755
5 changed files with 21 additions and 33 deletions
|
|
@ -113,11 +113,11 @@ dri_create_context(struct dri_screen *screen,
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
||||||
|
|
||||||
if (ctx_config->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
|
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->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY)
|
||||||
if (ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION)
|
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)
|
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_NO_ERROR)
|
||||||
attribs.flags |= ctx_config->no_error ? ST_CONTEXT_FLAG_NO_ERROR : 0;
|
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) {
|
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_PRIORITY) {
|
||||||
switch (ctx_config->priority) {
|
switch (ctx_config->priority) {
|
||||||
case __DRI_CTX_PRIORITY_LOW:
|
case __DRI_CTX_PRIORITY_LOW:
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_LOW_PRIORITY;
|
attribs.context_flags |= PIPE_CONTEXT_LOW_PRIORITY;
|
||||||
break;
|
break;
|
||||||
case __DRI_CTX_PRIORITY_HIGH:
|
case __DRI_CTX_PRIORITY_HIGH:
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_HIGH_PRIORITY;
|
attribs.context_flags |= PIPE_CONTEXT_HIGH_PRIORITY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -140,7 +140,7 @@ dri_create_context(struct dri_screen *screen,
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_RELEASE_NONE;
|
attribs.flags |= ST_CONTEXT_FLAG_RELEASE_NONE;
|
||||||
|
|
||||||
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_PROTECTED)
|
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;
|
struct dri_context *share_ctx = NULL;
|
||||||
if (sharedContextPrivate) {
|
if (sharedContextPrivate) {
|
||||||
|
|
|
||||||
|
|
@ -959,7 +959,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
|
||||||
if (contextFlags & GLX_CONTEXT_DEBUG_BIT_ARB)
|
if (contextFlags & GLX_CONTEXT_DEBUG_BIT_ARB)
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
||||||
if (contextFlags & GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB)
|
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) {
|
switch (profileMask) {
|
||||||
case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
|
case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
|
||||||
|
|
|
||||||
|
|
@ -193,9 +193,9 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCt
|
||||||
if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB)
|
if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB)
|
||||||
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
||||||
if (contextFlags & WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB)
|
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)
|
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) {
|
switch (profileMask) {
|
||||||
case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:
|
case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,9 @@ enum st_profile_type
|
||||||
*/
|
*/
|
||||||
#define ST_CONTEXT_FLAG_DEBUG (1 << 0)
|
#define ST_CONTEXT_FLAG_DEBUG (1 << 0)
|
||||||
#define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 1)
|
#define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 1)
|
||||||
#define ST_CONTEXT_FLAG_ROBUST_ACCESS (1 << 2)
|
#define ST_CONTEXT_FLAG_NO_ERROR (1 << 2)
|
||||||
#define ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED (1 << 3)
|
#define ST_CONTEXT_FLAG_RELEASE_NONE (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)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reasons that context creation might fail.
|
* Reasons that context creation might fail.
|
||||||
|
|
@ -252,6 +248,9 @@ struct st_context_attribs
|
||||||
/** Mask of ST_CONTEXT_FLAG_x bits */
|
/** Mask of ST_CONTEXT_FLAG_x bits */
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
||||||
|
/** Mask of PIPE_CONTEXT_x bits */
|
||||||
|
unsigned context_flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The visual of the framebuffers the context will be bound to.
|
* The visual of the framebuffers the context will be bound to.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -945,7 +945,6 @@ st_api_create_context(struct pipe_frontend_screen *fscreen,
|
||||||
struct gl_config mode, *mode_ptr = &mode;
|
struct gl_config mode, *mode_ptr = &mode;
|
||||||
gl_api api;
|
gl_api api;
|
||||||
bool no_error = false;
|
bool no_error = false;
|
||||||
unsigned ctx_flags = PIPE_CONTEXT_PREFER_THREADED;
|
|
||||||
|
|
||||||
if (!(ST_PROFILE_ALL_MASK & (1 << attribs->profile)))
|
if (!(ST_PROFILE_ALL_MASK & (1 << attribs->profile)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -985,24 +984,12 @@ st_api_create_context(struct pipe_frontend_screen *fscreen,
|
||||||
fscreen->destroy = st_manager_destroy;
|
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)
|
if (attribs->flags & ST_CONTEXT_FLAG_NO_ERROR)
|
||||||
no_error = true;
|
no_error = true;
|
||||||
|
|
||||||
if (attribs->flags & ST_CONTEXT_FLAG_LOW_PRIORITY)
|
pipe = fscreen->screen->context_create(fscreen->screen, NULL,
|
||||||
ctx_flags |= PIPE_CONTEXT_LOW_PRIORITY;
|
PIPE_CONTEXT_PREFER_THREADED |
|
||||||
else if (attribs->flags & ST_CONTEXT_FLAG_HIGH_PRIORITY)
|
attribs->context_flags);
|
||||||
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);
|
|
||||||
if (!pipe) {
|
if (!pipe) {
|
||||||
*error = ST_CONTEXT_ERROR_NO_MEMORY;
|
*error = ST_CONTEXT_ERROR_NO_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -1035,11 +1022,13 @@ st_api_create_context(struct pipe_frontend_screen *fscreen,
|
||||||
|
|
||||||
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
|
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
|
||||||
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
|
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.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
|
||||||
st->ctx->Const.RobustAccess = GL_TRUE;
|
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->ctx->Const.ResetStrategy = GL_LOSE_CONTEXT_ON_RESET_ARB;
|
||||||
st_install_device_reset_callback(st);
|
st_install_device_reset_callback(st);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue