mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 04:00:10 +01:00
egl: Add EGL_EXT_protected_content support
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
b30f1327f9
commit
9de1263842
11 changed files with 54 additions and 5 deletions
|
|
@ -1090,7 +1090,14 @@ struct __DRIdri2LoaderExtensionRec {
|
|||
|
||||
#define __DRI_CTX_ATTRIB_NO_ERROR 6
|
||||
|
||||
#define __DRI_CTX_NUM_ATTRIBS 7
|
||||
/**
|
||||
* \requires __DRI2_RENDER_HAS_PROTECTED_CONTEXT.
|
||||
*
|
||||
*/
|
||||
#define __DRI_CTX_ATTRIB_PROTECTED 7
|
||||
|
||||
|
||||
#define __DRI_CTX_NUM_ATTRIBS 8
|
||||
|
||||
/**
|
||||
* \name Reasons that __DRIdri2Extension::createContextAttribs might fail
|
||||
|
|
@ -1894,6 +1901,8 @@ typedef struct __DRIDriverVtableExtensionRec {
|
|||
#define __DRI2_RENDERER_PREFER_BACK_BUFFER_REUSE 0x000f
|
||||
#define __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT 0x0010
|
||||
|
||||
#define __DRI2_RENDERER_HAS_PROTECTED_CONTEXT 0x0020
|
||||
|
||||
typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
|
||||
struct __DRI2rendererQueryExtensionRec {
|
||||
__DRIextension base;
|
||||
|
|
|
|||
|
|
@ -1027,6 +1027,9 @@ dri2_setup_screen(_EGLDisplay *disp)
|
|||
disp->Extensions.EXT_protected_surface =
|
||||
dri2_renderer_query_integer(dri2_dpy,
|
||||
__DRI2_RENDERER_HAS_PROTECTED_SURFACE);
|
||||
disp->Extensions.EXT_protected_content =
|
||||
dri2_renderer_query_integer(dri2_dpy,
|
||||
__DRI2_RENDERER_HAS_PROTECTED_CONTEXT);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1480,6 +1483,11 @@ dri2_fill_context_attribs(struct dri2_egl_context *dri2_ctx,
|
|||
ctx_attribs[pos++] = true;
|
||||
}
|
||||
|
||||
if (dri2_ctx->base.Protected) {
|
||||
ctx_attribs[pos++] = __DRI_CTX_ATTRIB_PROTECTED;
|
||||
ctx_attribs[pos++] = true;
|
||||
}
|
||||
|
||||
*num_attribs = pos;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -563,6 +563,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
|
|||
_EGL_CHECK_EXTENSION(EXT_create_context_robustness);
|
||||
_EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
|
||||
_EGL_CHECK_EXTENSION(EXT_image_dma_buf_import_modifiers);
|
||||
_EGL_CHECK_EXTENSION(EXT_protected_content);
|
||||
_EGL_CHECK_EXTENSION(EXT_protected_surface);
|
||||
_EGL_CHECK_EXTENSION(EXT_present_opaque);
|
||||
_EGL_CHECK_EXTENSION(EXT_surface_CTA861_3_metadata);
|
||||
|
|
|
|||
|
|
@ -407,6 +407,14 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp,
|
|||
}
|
||||
break;
|
||||
|
||||
case EGL_PROTECTED_CONTENT_EXT:
|
||||
if (!disp->Extensions.EXT_protected_content) {
|
||||
err = EGL_BAD_ATTRIBUTE;
|
||||
break;
|
||||
}
|
||||
ctx->Protected = val == EGL_TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
err = EGL_BAD_ATTRIBUTE;
|
||||
break;
|
||||
|
|
@ -673,6 +681,8 @@ _eglQueryContextRenderBuffer(_EGLContext *ctx)
|
|||
EGLBoolean
|
||||
_eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value)
|
||||
{
|
||||
_EGLDisplay *disp = c->Resource.Display;
|
||||
|
||||
if (!value)
|
||||
return _eglError(EGL_BAD_PARAMETER, "eglQueryContext");
|
||||
|
||||
|
|
@ -699,6 +709,11 @@ _eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value)
|
|||
case EGL_CONTEXT_PRIORITY_LEVEL_IMG:
|
||||
*value = c->ContextPriority;
|
||||
break;
|
||||
case EGL_PROTECTED_CONTENT_EXT:
|
||||
if (!disp->Extensions.EXT_protected_content)
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
|
||||
*value = c->Protected;
|
||||
break;
|
||||
default:
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ struct _egl_context
|
|||
EGLint ContextPriority;
|
||||
EGLBoolean NoError;
|
||||
EGLint ReleaseBehavior;
|
||||
EGLBoolean Protected; /* EGL_EXT_protected_content */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ struct _egl_extensions
|
|||
EGLBoolean EXT_image_dma_buf_import;
|
||||
EGLBoolean EXT_image_dma_buf_import_modifiers;
|
||||
EGLBoolean EXT_pixel_format_float;
|
||||
EGLBoolean EXT_protected_content;
|
||||
EGLBoolean EXT_protected_surface;
|
||||
EGLBoolean EXT_present_opaque;
|
||||
EGLBoolean EXT_surface_CTA861_3_metadata;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ _eglParseKHRImageAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
|
|||
attrs->GLTextureZOffset = val;
|
||||
break;
|
||||
case EGL_PROTECTED_CONTENT_EXT:
|
||||
if (!disp->Extensions.EXT_protected_surface)
|
||||
if (!disp->Extensions.EXT_protected_content &&
|
||||
!disp->Extensions.EXT_protected_surface)
|
||||
return EGL_BAD_PARAMETER;
|
||||
|
||||
attrs->ProtectedContent = val;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ struct _egl_image_attribs
|
|||
struct _egl_image_attrib_int DMABufChromaHorizontalSiting;
|
||||
struct _egl_image_attrib_int DMABufChromaVerticalSiting;
|
||||
|
||||
/* EGL_EXT_protected_surface */
|
||||
/* EGL_EXT_protected_content || EGL_EXT_protected_surface */
|
||||
EGLBoolean ProtectedContent;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -319,7 +319,8 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
|
|||
surf->MipmapTexture = !!val;
|
||||
break;
|
||||
case EGL_PROTECTED_CONTENT_EXT:
|
||||
if (!disp->Extensions.EXT_protected_surface) {
|
||||
if (!disp->Extensions.EXT_protected_content &&
|
||||
!disp->Extensions.EXT_protected_surface) {
|
||||
err = EGL_BAD_ATTRIBUTE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -607,7 +608,8 @@ _eglQuerySurface(_EGLDisplay *disp, _EGLSurface *surface,
|
|||
*value = surface->HdrMetadata.max_fall;
|
||||
break;
|
||||
case EGL_PROTECTED_CONTENT_EXT:
|
||||
if (!disp->Extensions.EXT_protected_surface)
|
||||
if (!disp->Extensions.EXT_protected_content &&
|
||||
!disp->Extensions.EXT_protected_surface)
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
|
||||
*value = surface->ProtectedContent;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -534,6 +534,13 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
|
|||
~__DRIVER_CONTEXT_ATTRIB_NO_ERROR;
|
||||
}
|
||||
break;
|
||||
case __DRI_CTX_ATTRIB_PROTECTED:
|
||||
if (attribs[i * 2 + 1]) {
|
||||
ctx_config.attribute_mask |= __DRIVER_CONTEXT_ATTRIB_PROTECTED;
|
||||
} else {
|
||||
ctx_config.attribute_mask &= ~__DRIVER_CONTEXT_ATTRIB_PROTECTED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* We can't create a context that satisfies the requirements of an
|
||||
* attribute that we don't understand. Return failure.
|
||||
|
|
|
|||
|
|
@ -107,12 +107,16 @@ struct __DriverContextConfig {
|
|||
|
||||
/* Only valid if __DRIVER_CONTEXT_ATTRIB_NO_ERROR is set */
|
||||
int no_error;
|
||||
|
||||
/* Only valid if __DRIVER_CONTEXT_ATTRIB_PROTECTED is set */
|
||||
int protected_context;
|
||||
};
|
||||
|
||||
#define __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY (1 << 0)
|
||||
#define __DRIVER_CONTEXT_ATTRIB_PRIORITY (1 << 1)
|
||||
#define __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR (1 << 2)
|
||||
#define __DRIVER_CONTEXT_ATTRIB_NO_ERROR (1 << 3)
|
||||
#define __DRIVER_CONTEXT_ATTRIB_PROTECTED (1 << 4)
|
||||
|
||||
/**
|
||||
* Driver callback functions.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue