102f4aeb0Sopenharmony_ciName 202f4aeb0Sopenharmony_ci 302f4aeb0Sopenharmony_ci EXT_protected_content 402f4aeb0Sopenharmony_ci 502f4aeb0Sopenharmony_ciName Strings 602f4aeb0Sopenharmony_ci 702f4aeb0Sopenharmony_ci EGL_EXT_protected_content 802f4aeb0Sopenharmony_ci 902f4aeb0Sopenharmony_ciContributors 1002f4aeb0Sopenharmony_ci 1102f4aeb0Sopenharmony_ci Ramesh Viswanathan 1202f4aeb0Sopenharmony_ci Brian Ellis 1302f4aeb0Sopenharmony_ci Colin Sharp 1402f4aeb0Sopenharmony_ci Rajeev Kulkarni 1502f4aeb0Sopenharmony_ci Mohan Maiya 1602f4aeb0Sopenharmony_ci Maurice Ribble 1702f4aeb0Sopenharmony_ci Craig Donner 1802f4aeb0Sopenharmony_ci Jan-Harald Fredriksen 1902f4aeb0Sopenharmony_ci Daniel Koch 2002f4aeb0Sopenharmony_ci Michael Golds 2102f4aeb0Sopenharmony_ci Ray Smith 2202f4aeb0Sopenharmony_ci 2302f4aeb0Sopenharmony_ciContacts 2402f4aeb0Sopenharmony_ci 2502f4aeb0Sopenharmony_ci Maurice Ribble (mribble 'at' qti.qualcomm.com) 2602f4aeb0Sopenharmony_ci 2702f4aeb0Sopenharmony_ciIP Status 2802f4aeb0Sopenharmony_ci 2902f4aeb0Sopenharmony_ci No known IP claims. 3002f4aeb0Sopenharmony_ci 3102f4aeb0Sopenharmony_ciStatus 3202f4aeb0Sopenharmony_ci 3302f4aeb0Sopenharmony_ci Complete. 3402f4aeb0Sopenharmony_ci 3502f4aeb0Sopenharmony_ciVersion 3602f4aeb0Sopenharmony_ci 3702f4aeb0Sopenharmony_ci Version 12, April 14, 2016 3802f4aeb0Sopenharmony_ci 3902f4aeb0Sopenharmony_ciNumber 4002f4aeb0Sopenharmony_ci 4102f4aeb0Sopenharmony_ci EGL Extension #97 4202f4aeb0Sopenharmony_ci 4302f4aeb0Sopenharmony_ciDependencies 4402f4aeb0Sopenharmony_ci 4502f4aeb0Sopenharmony_ci Requires EGL 1.4. 4602f4aeb0Sopenharmony_ci 4702f4aeb0Sopenharmony_ci Interactions with EGL_KHR_image_base extension. 4802f4aeb0Sopenharmony_ci 4902f4aeb0Sopenharmony_ci This extension is written against the wording of the EGL 1.4. 5002f4aeb0Sopenharmony_ci Specification (12/04/2013) 5102f4aeb0Sopenharmony_ci 5202f4aeb0Sopenharmony_ci This extension has interactions with EGL_EXT_protected_surface if that 5302f4aeb0Sopenharmony_ci extension is supported. The interactions are described in the main text. 5402f4aeb0Sopenharmony_ci 5502f4aeb0Sopenharmony_ciOverview 5602f4aeb0Sopenharmony_ci 5702f4aeb0Sopenharmony_ci This extension introduces the concept of protected contexts and protected 5802f4aeb0Sopenharmony_ci resources, specifically surfaces and EGLImages. Applications can choose at 5902f4aeb0Sopenharmony_ci creation time whether a context, surface or EGLImage is protected or not. 6002f4aeb0Sopenharmony_ci 6102f4aeb0Sopenharmony_ci A protected context is required to allow the GPU to operate on protected 6202f4aeb0Sopenharmony_ci resources, including protected surfaces and protected EGLImages. 6302f4aeb0Sopenharmony_ci 6402f4aeb0Sopenharmony_ci An explanation of undefined behavior in this extension: Several places 6502f4aeb0Sopenharmony_ci in this extension mention undefined behavior can result, which can 6602f4aeb0Sopenharmony_ci include program termination. The reason for this is because one way 6702f4aeb0Sopenharmony_ci to handle protected content is by using a protected virtual to physical 6802f4aeb0Sopenharmony_ci memory translation layer. With this sort of solution a system may generate 6902f4aeb0Sopenharmony_ci read or write faults when a non-protected source tries to access a protected 7002f4aeb0Sopenharmony_ci buffer. Depending on the system these faults might be ignored or they might 7102f4aeb0Sopenharmony_ci cause process termination. This undefined behavior should not include 7202f4aeb0Sopenharmony_ci actually allowing a transfer of data from a protected surface to a 7302f4aeb0Sopenharmony_ci non-protected surface. 7402f4aeb0Sopenharmony_ci 7502f4aeb0Sopenharmony_ciNew Types 7602f4aeb0Sopenharmony_ci 7702f4aeb0Sopenharmony_ci None 7802f4aeb0Sopenharmony_ci 7902f4aeb0Sopenharmony_ciNew Procedures and Functions 8002f4aeb0Sopenharmony_ci 8102f4aeb0Sopenharmony_ci None 8202f4aeb0Sopenharmony_ci 8302f4aeb0Sopenharmony_ciNew Tokens 8402f4aeb0Sopenharmony_ci 8502f4aeb0Sopenharmony_ci New EGLSurface attribute name: 8602f4aeb0Sopenharmony_ci 8702f4aeb0Sopenharmony_ci EGL_PROTECTED_CONTENT_EXT 0x32C0 8802f4aeb0Sopenharmony_ci 8902f4aeb0Sopenharmony_ciAdd a new section 2.7 entitled "Protected Content" at the end of Chapter 2 (EGL 9002f4aeb0Sopenharmony_ciOperation) 9102f4aeb0Sopenharmony_ci 9202f4aeb0Sopenharmony_ci "The attribute EGL_PROTECTED_CONTENT_EXT can be applied to EGL contexts, 9302f4aeb0Sopenharmony_ci EGL surfaces and EGLImages. If the attribute EGL_PROTECTED_CONTENT_EXT 9402f4aeb0Sopenharmony_ci is set to EGL_TRUE by the application, then the newly created EGL object 9502f4aeb0Sopenharmony_ci is said to be protected. A protected context is required to allow the 9602f4aeb0Sopenharmony_ci GPU to operate on protected resources, including protected surfaces and 9702f4aeb0Sopenharmony_ci protected EGLImages. 9802f4aeb0Sopenharmony_ci 9902f4aeb0Sopenharmony_ci GPU operations are grouped into pipeline stages. Pipeline stages can be 10002f4aeb0Sopenharmony_ci defined to be protected or not protected. Each stage defines 10102f4aeb0Sopenharmony_ci restrictions on whether it can read or write protected and unprotected 10202f4aeb0Sopenharmony_ci resources, as follows: 10302f4aeb0Sopenharmony_ci 10402f4aeb0Sopenharmony_ci When a GPU stage is protected, it: 10502f4aeb0Sopenharmony_ci - Can read from protected resources 10602f4aeb0Sopenharmony_ci - Can read from unprotected resources 10702f4aeb0Sopenharmony_ci - Can write to protected resources 10802f4aeb0Sopenharmony_ci - Can NOT write to unprotected resources 10902f4aeb0Sopenharmony_ci 11002f4aeb0Sopenharmony_ci When a GPU stage is not protected, it: 11102f4aeb0Sopenharmony_ci - Can NOT read from protected resources 11202f4aeb0Sopenharmony_ci - Can read from unprotected resources 11302f4aeb0Sopenharmony_ci - Can NOT write to protected resources 11402f4aeb0Sopenharmony_ci - Can write to unprotected resources 11502f4aeb0Sopenharmony_ci 11602f4aeb0Sopenharmony_ci Any accesses not following these restrictions will result in undefined 11702f4aeb0Sopenharmony_ci behavior. 11802f4aeb0Sopenharmony_ci 11902f4aeb0Sopenharmony_ci This extension does not specify which pipeline stages of a protected 12002f4aeb0Sopenharmony_ci context are protected or not. This is left to a client API extension to 12102f4aeb0Sopenharmony_ci define. All stages in a regular (not protected) context are not 12202f4aeb0Sopenharmony_ci protected. However, if EGL_EXT_protected_surface is also supported, a 12302f4aeb0Sopenharmony_ci regular (not protected) context will execute stages where one or more 12402f4aeb0Sopenharmony_ci protected resources is accessed as if it were a protected context. 12502f4aeb0Sopenharmony_ci 12602f4aeb0Sopenharmony_ci Note that the protection state of a stage may be left implementation 12702f4aeb0Sopenharmony_ci defined by a client API extension. This means that no guarantees can be 12802f4aeb0Sopenharmony_ci made about whether the stage will be protected or not protected. 12902f4aeb0Sopenharmony_ci Practically this means that the permitted operations for such a stage 13002f4aeb0Sopenharmony_ci are the intersection of the allowed operations for protected and not 13102f4aeb0Sopenharmony_ci protected stages, i.e it: 13202f4aeb0Sopenharmony_ci 13302f4aeb0Sopenharmony_ci - Can NOT read from protected resources 13402f4aeb0Sopenharmony_ci - Can read from unprotected resources 13502f4aeb0Sopenharmony_ci - Can NOT write to protected resources 13602f4aeb0Sopenharmony_ci - Can NOT write to unprotected resources 13702f4aeb0Sopenharmony_ci 13802f4aeb0Sopenharmony_ci Since this is not a very useful set of operations refer to the client API 13902f4aeb0Sopenharmony_ci extension to see what operations are actually allowed. 14002f4aeb0Sopenharmony_ci 14102f4aeb0Sopenharmony_ci This extension does not guarantee the implementation abides by a 14202f4aeb0Sopenharmony_ci system's digital rights management requirements. It must be verified 14302f4aeb0Sopenharmony_ci beyond the existence of this extension that the implementation of this 14402f4aeb0Sopenharmony_ci extension is trustworthy according to the requirements of a content 14502f4aeb0Sopenharmony_ci protection system." 14602f4aeb0Sopenharmony_ci 14702f4aeb0Sopenharmony_ciAdditions to Chapter 3 of the EGL 1.4 Specification (Rendering Contexts) 14802f4aeb0Sopenharmony_ci 14902f4aeb0Sopenharmony_ci Change the fifth paragraph in section 3.7.1 Creating Rendering Contexts: 15002f4aeb0Sopenharmony_ci 15102f4aeb0Sopenharmony_ci "attrib list specifies a list of attributes for the context. The 15202f4aeb0Sopenharmony_ci list has the same structure as described for eglChooseConfig. 15302f4aeb0Sopenharmony_ci Attributes that can be specified in attrib list include 15402f4aeb0Sopenharmony_ci EGL_CONTEXT_CLIENT_VERSION and EGL_PROTECTED_CONTENT_EXT. The 15502f4aeb0Sopenharmony_ci EGL_CONTEXT_CLIENT_VERSION attribute may only be specified when 15602f4aeb0Sopenharmony_ci creating a OpenGL ES context (e.g. when the current rendering API is 15702f4aeb0Sopenharmony_ci EGL_OPENGL_ES_API)." 15802f4aeb0Sopenharmony_ci 15902f4aeb0Sopenharmony_ci Add the following paragraph in section 3.7.1 on p. 44 before "attrib list 16002f4aeb0Sopenharmony_ci may be NULL or empty (first attribute is EGL_NONE), in which case 16102f4aeb0Sopenharmony_ci attributes assume their default values as described below." 16202f4aeb0Sopenharmony_ci 16302f4aeb0Sopenharmony_ci "EGL_PROTECTED_CONTENT_EXT specifies the protected state of the new 16402f4aeb0Sopenharmony_ci context. If its value is EGL_TRUE, then the context is said to be 16502f4aeb0Sopenharmony_ci protected. If its value is EGL_FALSE, then the context is not 16602f4aeb0Sopenharmony_ci protected. See section 2.7 (Protected Content) for more information 16702f4aeb0Sopenharmony_ci about protected contexts. 16802f4aeb0Sopenharmony_ci 16902f4aeb0Sopenharmony_ci The default value of EGL_PROTECTED_CONTENT_EXT is EGL_FALSE." 17002f4aeb0Sopenharmony_ci 17102f4aeb0Sopenharmony_ciAdditions to Chapter 3 of the EGL 1.4 Specification (Rendering Surfaces) 17202f4aeb0Sopenharmony_ci 17302f4aeb0Sopenharmony_ci Change the second paragraph in section 3.5 on p. 28 (describing 17402f4aeb0Sopenharmony_ci eglCreateWindowSurface): 17502f4aeb0Sopenharmony_ci 17602f4aeb0Sopenharmony_ci "Attributes that can be specified in attrib list include 17702f4aeb0Sopenharmony_ci EGL_RENDER_BUFFER, EGL_PROTECTED_CONTENT_EXT, EGL_VG_COLORSPACE, and 17802f4aeb0Sopenharmony_ci EGL_VG_ALPHA_FORMAT." 17902f4aeb0Sopenharmony_ci 18002f4aeb0Sopenharmony_ci Add the following paragraph in section 3.5 on p. 28 before 18102f4aeb0Sopenharmony_ci "EGL_VG_COLORSPACE specifies the color space used by OpenVG" (describing 18202f4aeb0Sopenharmony_ci eglCreateWindowSurface(attrib_list): 18302f4aeb0Sopenharmony_ci 18402f4aeb0Sopenharmony_ci "EGL_PROTECTED_CONTENT_EXT specifies the protected state of the 18502f4aeb0Sopenharmony_ci window surface. If its value is EGL_TRUE, then the surface content 18602f4aeb0Sopenharmony_ci is said to be protected. If its value is EGL_FALSE, then the surface 18702f4aeb0Sopenharmony_ci content is not protected. See section 2.7 (Protected Content) for 18802f4aeb0Sopenharmony_ci more information about protected and non-protected surfaces. 18902f4aeb0Sopenharmony_ci 19002f4aeb0Sopenharmony_ci Client APIs will not allow contents of protected surfaces to be 19102f4aeb0Sopenharmony_ci accessed by non-protected contexts in the system (including 19202f4aeb0Sopenharmony_ci non-secure software running on the CPU). Such operations will result 19302f4aeb0Sopenharmony_ci in undefined behavior. 19402f4aeb0Sopenharmony_ci 19502f4aeb0Sopenharmony_ci Calling eglSwapBuffers on such a protected surface will succeed, but 19602f4aeb0Sopenharmony_ci the contents may or may not be posted successfully depending on 19702f4aeb0Sopenharmony_ci whether those parts of the pipeline are capable of handling 19802f4aeb0Sopenharmony_ci protected content. Any disallowed operation will fail and result in 19902f4aeb0Sopenharmony_ci undefined behavior. 20002f4aeb0Sopenharmony_ci 20102f4aeb0Sopenharmony_ci The default value of EGL_PROTECTED_CONTENT_EXT is EGL_FALSE." 20202f4aeb0Sopenharmony_ci 20302f4aeb0Sopenharmony_ciAdditions to EGL_KHR_image_base extension specification 20402f4aeb0Sopenharmony_ci 20502f4aeb0Sopenharmony_ci Add to section 2.5.1 Table bbb: 20602f4aeb0Sopenharmony_ci +-----------------------------+-------------------------+---------------+ 20702f4aeb0Sopenharmony_ci | Attribute | Description | Default Value | 20802f4aeb0Sopenharmony_ci +-----------------------------+-------------------------+---------------+ 20902f4aeb0Sopenharmony_ci | EGL_NONE | Marks the end of the | N/A | 21002f4aeb0Sopenharmony_ci | | attribute-value list | | 21102f4aeb0Sopenharmony_ci | EGL_IMAGE_PRESERVED_KHR | Whether to preserve | EGL_FALSE | 21202f4aeb0Sopenharmony_ci | | pixel data | | 21302f4aeb0Sopenharmony_ci | EGL_PROTECTED_CONTENT_EXT | Content protection | EGL_FALSE | 21402f4aeb0Sopenharmony_ci | | state | | 21502f4aeb0Sopenharmony_ci +-----------------------------+-------------------------+---------------+ 21602f4aeb0Sopenharmony_ci Table bbb. Legal attributes for eglCreateImageKHR <attrib_list> 21702f4aeb0Sopenharmony_ci parameter 21802f4aeb0Sopenharmony_ci 21902f4aeb0Sopenharmony_ci Add the following paragraph to section 2.5.1 before "Errors" (describing 22002f4aeb0Sopenharmony_ci eglCreateImageKHR): 22102f4aeb0Sopenharmony_ci 22202f4aeb0Sopenharmony_ci "If the value of attribute EGL_PROTECTED_CONTENT_EXT is EGL_TRUE 22302f4aeb0Sopenharmony_ci and the EGLImage sources can be guaranteed to be protected, then the 22402f4aeb0Sopenharmony_ci EGLImage is said to be protected. See section 2.7 (Protected Content) 22502f4aeb0Sopenharmony_ci for more information about protected resources including EGLImages. 22602f4aeb0Sopenharmony_ci 22702f4aeb0Sopenharmony_ci If the value of attribute EGL_PROTECTED_CONTENT_EXT is EGL_FALSE then: 22802f4aeb0Sopenharmony_ci 22902f4aeb0Sopenharmony_ci - If EGLImage sources are not protected, the EGLImage is said to be 23002f4aeb0Sopenharmony_ci not protected. See section 2.7 (Protected Content) for more 23102f4aeb0Sopenharmony_ci information about non-protected resources including EGLImages. 23202f4aeb0Sopenharmony_ci - If EGLImage sources are protected then the EGLImage content will 23302f4aeb0Sopenharmony_ci be inaccessible to any client context irrespective of whether the 23402f4aeb0Sopenharmony_ci context is protected or not. Trying to access such an EGLImage's 23502f4aeb0Sopenharmony_ci content will result in undefined behavior." 23602f4aeb0Sopenharmony_ci 23702f4aeb0Sopenharmony_ci Add the following to the Errors list in section 2.5.1 23802f4aeb0Sopenharmony_ci 23902f4aeb0Sopenharmony_ci "If the value specified in <attrib_list> for EGL_PROTECTED_CONTENT_EXT 24002f4aeb0Sopenharmony_ci is EGL_TRUE, and EGL and its client is unable to make guarantees 24102f4aeb0Sopenharmony_ci regarding the protected state of the EGLImage source, the error 24202f4aeb0Sopenharmony_ci EGL_BAD_ACCESS is generated." 24302f4aeb0Sopenharmony_ci 24402f4aeb0Sopenharmony_ciIssues 24502f4aeb0Sopenharmony_ci 1) Can a protected context be shared with a non-protected context? 24602f4aeb0Sopenharmony_ci 24702f4aeb0Sopenharmony_ci RESOLVED - Yes. The rule that protected surfaces can only be used by 24802f4aeb0Sopenharmony_ci protected contexts still applies. An example use case is where 24902f4aeb0Sopenharmony_ci someone wants to render to unprotected textures within an unprotected 25002f4aeb0Sopenharmony_ci context and then share it with a protected context to be used as a texture. 25102f4aeb0Sopenharmony_ci 25202f4aeb0Sopenharmony_ci 2) Should all surfaces within a protected context be protected by default? 25302f4aeb0Sopenharmony_ci 25402f4aeb0Sopenharmony_ci RESOLVED - No, several implementations have limited amounts of protected 25502f4aeb0Sopenharmony_ci memory, so the API will require opting into protected memory. 25602f4aeb0Sopenharmony_ci 25702f4aeb0Sopenharmony_ci 3) Can these protected surfaces be used by stages other than fragment 25802f4aeb0Sopenharmony_ci shader stage? 25902f4aeb0Sopenharmony_ci 26002f4aeb0Sopenharmony_ci RESOLVED - Some hardware can't handle this so this behavior is undefined 26102f4aeb0Sopenharmony_ci unless there is explicit working in some new spec saying the behavior is 26202f4aeb0Sopenharmony_ci defined. This is put as an issue because this is an EGL extension and 26302f4aeb0Sopenharmony_ci should not be controlling OpenGL functionality. 26402f4aeb0Sopenharmony_ci 26502f4aeb0Sopenharmony_ci 4) Why is EGL_PROTECTED_CONTENT_EXT flag needed for EGLImages? 26602f4aeb0Sopenharmony_ci 26702f4aeb0Sopenharmony_ci RESOLVED - A few reasons for having an explicit flag instead 26802f4aeb0Sopenharmony_ci of inferring the protected status from EGLImage sources - 26902f4aeb0Sopenharmony_ci 27002f4aeb0Sopenharmony_ci 1) There are multiple EGL image extensions (EGL QCOM image, EGL 27102f4aeb0Sopenharmony_ci android image and so on) that accept buffers from external modules 27202f4aeb0Sopenharmony_ci instead of client resources or allow internally allocated memory. 27302f4aeb0Sopenharmony_ci For these use cases a protected attribute is useful, so we want to 27402f4aeb0Sopenharmony_ci keep this flag. 27502f4aeb0Sopenharmony_ci 2) An implementation might have a few non-standard setup steps that 27602f4aeb0Sopenharmony_ci need to be completed before a protected EGL image can be accessed. 27702f4aeb0Sopenharmony_ci This attribute along with a corresponding protected buffer will act 27802f4aeb0Sopenharmony_ci as a signal for the graphics driver to initiate/complete any such 27902f4aeb0Sopenharmony_ci steps. 28002f4aeb0Sopenharmony_ci 3) An application creating an image from an external resource may not 28102f4aeb0Sopenharmony_ci be aware of the fact that the resource is protected or may be unable 28202f4aeb0Sopenharmony_ci to access its content. The successful mapping of and access to a 28302f4aeb0Sopenharmony_ci protected buffer through an EGLImage will be predicated on the 28402f4aeb0Sopenharmony_ci buffer being protected, having a protected context and the intent of 28502f4aeb0Sopenharmony_ci the application to access that buffer by passing in EGL_TRUE for the 28602f4aeb0Sopenharmony_ci attribute EGL_PROTECTED_CONTENT_EXT. 28702f4aeb0Sopenharmony_ci 28802f4aeb0Sopenharmony_ci 28902f4aeb0Sopenharmony_ciRevision History 29002f4aeb0Sopenharmony_ci 29102f4aeb0Sopenharmony_ci Rev. Date Author Changes 29202f4aeb0Sopenharmony_ci ---- -------- -------- ---------------------------------------------- 29302f4aeb0Sopenharmony_ci 1 09/24/14 Ramesh Initial draft. 29402f4aeb0Sopenharmony_ci 2 11/20/14 Rajeev Second draft. 29502f4aeb0Sopenharmony_ci 3 03/07/16 mribble Make EXT and clean up for release. 29602f4aeb0Sopenharmony_ci 4 03/10/16 mribble Cleanup. 29702f4aeb0Sopenharmony_ci 5 03/18/16 mribble Fix issues brought up by Khronos group. 29802f4aeb0Sopenharmony_ci 6 03/24/16 mribble Resolved some small issues found by Jan-Harald. 29902f4aeb0Sopenharmony_ci 7 03/25/16 mribble Fix createContext wording. 30002f4aeb0Sopenharmony_ci 8 03/30/16 mribble Added issue 5. 30102f4aeb0Sopenharmony_ci 9 04/05/16 mribble Added issue 6 and better defined eglImage case. 30202f4aeb0Sopenharmony_ci 10 04/08/16 rsmith - Added general section on protected content. 30302f4aeb0Sopenharmony_ci Protected context, surface and image creation now 30402f4aeb0Sopenharmony_ci refer to the general protected content principles. 30502f4aeb0Sopenharmony_ci - Added explicit definition of which stages are 30602f4aeb0Sopenharmony_ci protected, including allowing for the protected 30702f4aeb0Sopenharmony_ci state of a stage to be undefined. 30802f4aeb0Sopenharmony_ci - Formalised interactions with 30902f4aeb0Sopenharmony_ci EGL_EXT_protected_surface. 31002f4aeb0Sopenharmony_ci - Removed references to the GPU protected mode, 31102f4aeb0Sopenharmony_ci including issue 3. 31202f4aeb0Sopenharmony_ci 11 04/10/16 mribble Merge and cleanup. 31302f4aeb0Sopenharmony_ci 12 04/14/16 Jon Leech Cleanup formatting, reflow paragraphs and 31402f4aeb0Sopenharmony_ci quote additions consistently. Assign extension 31502f4aeb0Sopenharmony_ci number. 316