#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
#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;
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
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;
_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);
}
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;
EGLBoolean
_eglQueryContext(_EGLContext *c, EGLint attribute, EGLint *value)
{
+ _EGLDisplay *disp = c->Resource.Display;
+
if (!value)
return _eglError(EGL_BAD_PARAMETER, "eglQueryContext");
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");
}
EGLint ContextPriority;
EGLBoolean NoError;
EGLint ReleaseBehavior;
+ EGLBoolean Protected; /* EGL_EXT_protected_content */
};
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;
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;
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;
};
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;
}
*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;
~__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.
/* 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.