mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
st/gallium: plumb protected context creation
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8092>
This commit is contained in:
parent
9de1263842
commit
5d88ab63e2
9 changed files with 35 additions and 0 deletions
|
|
@ -634,6 +634,7 @@ The integer capabilities:
|
|||
* ``PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER``: TRUE if the driver allows the "draw out of order" optimization to be enabled. See _mesa_update_allow_draw_out_of_order for more details.
|
||||
* ``PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT``: Maximum bound constant buffer size in bytes. This is unsigned integer with the maximum of 4GB - 1. This applies to all constant buffers used by UBOs, unlike `PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE`, which is specifically for GLSL uniforms.
|
||||
* ``PIPE_CAP_HARDWARE_GL_SELECT``: Enable hardware accelerated GL_SELECT for this driver.
|
||||
* ``PIPE_CAP_DEVICE_PROTECTED_CONTEXT``: Whether the device supports protected / encrypted context which can manipulate protected / encrypted content (some devices might need protected contexts to access protected content, whereas ``PIPE_CAP_DEVICE_PROTECTED_SURFACE`` does not require any particular context to do so).
|
||||
|
||||
.. _pipe_capf:
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
|||
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY_COMPUTE_ONLY:
|
||||
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
|
||||
case PIPE_CAP_DEVICE_PROTECTED_SURFACE:
|
||||
case PIPE_CAP_DEVICE_PROTECTED_CONTEXT:
|
||||
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
|
||||
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
|
||||
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
|
||||
|
|
|
|||
|
|
@ -2513,6 +2513,9 @@ dri2_init_screen(__DRIscreen * sPriv)
|
|||
|
||||
dri2_init_screen_extensions(screen, pscreen, false);
|
||||
|
||||
if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_PROTECTED_CONTEXT))
|
||||
screen->has_protected_context = true;
|
||||
|
||||
configs = dri_init_screen_helper(screen, pscreen);
|
||||
if (!configs)
|
||||
goto destroy_screen;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ dri_create_context(gl_api api, const struct gl_config * visual,
|
|||
allowed_attribs |= __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;
|
||||
}
|
||||
|
||||
if (screen->has_protected_context)
|
||||
allowed_attribs |= __DRIVER_CONTEXT_ATTRIB_PROTECTED;
|
||||
|
||||
if (ctx_config->flags & ~allowed_flags) {
|
||||
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
|
||||
goto fail;
|
||||
|
|
@ -137,6 +140,9 @@ dri_create_context(gl_api api, const struct gl_config * visual,
|
|||
&& (ctx_config->release_behavior == __DRI_CTX_RELEASE_BEHAVIOR_NONE))
|
||||
attribs.flags |= ST_CONTEXT_FLAG_RELEASE_NONE;
|
||||
|
||||
if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_PROTECTED)
|
||||
attribs.flags |= ST_CONTEXT_FLAG_PROTECTED;
|
||||
|
||||
struct dri_context *share_ctx = NULL;
|
||||
if (sharedContextPrivate) {
|
||||
share_ctx = (struct dri_context *)sharedContextPrivate;
|
||||
|
|
|
|||
|
|
@ -150,6 +150,13 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param,
|
|||
screen->base.screen->get_param(screen->base.screen,
|
||||
PIPE_CAP_PREFER_BACK_BUFFER_REUSE);
|
||||
return 0;
|
||||
case __DRI2_RENDERER_HAS_PROTECTED_CONTEXT:
|
||||
value[0] =
|
||||
screen->base.screen->get_param(screen->base.screen,
|
||||
PIPE_CAP_DEVICE_PROTECTED_CONTEXT);
|
||||
if (!value[0])
|
||||
return -1;
|
||||
return 0;
|
||||
default:
|
||||
return driQueryRendererIntegerCommon(_screen, param, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ struct dri_screen
|
|||
boolean sd_depth_bits_last;
|
||||
boolean auto_fake_front;
|
||||
boolean has_reset_status_query;
|
||||
boolean has_protected_context;
|
||||
enum pipe_texture_target target;
|
||||
|
||||
boolean swrast_no_present;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ enum st_profile_type
|
|||
#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.
|
||||
|
|
|
|||
|
|
@ -442,6 +442,15 @@ enum pipe_flush_flags
|
|||
/** Stop execution if the device is reset. */
|
||||
#define PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET (1 << 6)
|
||||
|
||||
/**
|
||||
* Create a protected context to access protected content (surfaces,
|
||||
* textures, ...)
|
||||
*
|
||||
* This is required to access protected images and surfaces if
|
||||
* EGL_EXT_protected_surface is not supported.
|
||||
*/
|
||||
#define PIPE_CONTEXT_PROTECTED (1 << 7)
|
||||
|
||||
/**
|
||||
* Flags for pipe_context::memory_barrier.
|
||||
*/
|
||||
|
|
@ -974,6 +983,7 @@ enum pipe_cap
|
|||
PIPE_CAP_NO_CLIP_ON_COPY_TEX,
|
||||
PIPE_CAP_MAX_TEXTURE_MB,
|
||||
PIPE_CAP_SHADER_ATOMIC_INT64,
|
||||
/** For EGL_EXT_protected_surface */
|
||||
PIPE_CAP_DEVICE_PROTECTED_SURFACE,
|
||||
PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0,
|
||||
PIPE_CAP_GL_CLAMP,
|
||||
|
|
@ -1000,6 +1010,8 @@ enum pipe_cap
|
|||
PIPE_CAP_FBFETCH_ZS,
|
||||
PIPE_CAP_TIMELINE_SEMAPHORE_IMPORT,
|
||||
PIPE_CAP_QUERY_TIMESTAMP_BITS,
|
||||
/** For EGL_EXT_protected_content */
|
||||
PIPE_CAP_DEVICE_PROTECTED_CONTEXT,
|
||||
|
||||
PIPE_CAP_LAST,
|
||||
/* XXX do not add caps after PIPE_CAP_LAST! */
|
||||
|
|
|
|||
|
|
@ -1068,6 +1068,9 @@ st_api_create_context(struct st_manager *smapi,
|
|||
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 = smapi->screen->context_create(smapi->screen, NULL, ctx_flags);
|
||||
if (!pipe) {
|
||||
*error = ST_CONTEXT_ERROR_NO_MEMORY;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue