102f4aeb0Sopenharmony_ciName
202f4aeb0Sopenharmony_ci
302f4aeb0Sopenharmony_ci    EXT_device_drm
402f4aeb0Sopenharmony_ci    EXT_output_drm
502f4aeb0Sopenharmony_ci
602f4aeb0Sopenharmony_ciName Strings
702f4aeb0Sopenharmony_ci
802f4aeb0Sopenharmony_ci    EGL_EXT_device_drm
902f4aeb0Sopenharmony_ci    EGL_EXT_output_drm
1002f4aeb0Sopenharmony_ci
1102f4aeb0Sopenharmony_ciContributors
1202f4aeb0Sopenharmony_ci
1302f4aeb0Sopenharmony_ci    Daniel Kartch
1402f4aeb0Sopenharmony_ci    James Jones
1502f4aeb0Sopenharmony_ci    Christopher James Halse Rogers
1602f4aeb0Sopenharmony_ci
1702f4aeb0Sopenharmony_ciContacts
1802f4aeb0Sopenharmony_ci
1902f4aeb0Sopenharmony_ci    Daniel Kartch, NVIDIA (dkartch 'at' nvidia.com)
2002f4aeb0Sopenharmony_ci
2102f4aeb0Sopenharmony_ciStatus
2202f4aeb0Sopenharmony_ci
2302f4aeb0Sopenharmony_ci    Complete
2402f4aeb0Sopenharmony_ci
2502f4aeb0Sopenharmony_ciVersion
2602f4aeb0Sopenharmony_ci
2702f4aeb0Sopenharmony_ci    Version 5 - December 28th, 2015
2802f4aeb0Sopenharmony_ci
2902f4aeb0Sopenharmony_ciNumber
3002f4aeb0Sopenharmony_ci
3102f4aeb0Sopenharmony_ci    EGL Extension #79
3202f4aeb0Sopenharmony_ci
3302f4aeb0Sopenharmony_ciExtension Type
3402f4aeb0Sopenharmony_ci
3502f4aeb0Sopenharmony_ci    EGL device extension for EGL_EXT_device_drm
3602f4aeb0Sopenharmony_ci
3702f4aeb0Sopenharmony_ci    EGL display extension for EGL_EXT_output_drm
3802f4aeb0Sopenharmony_ci
3902f4aeb0Sopenharmony_ciDependencies
4002f4aeb0Sopenharmony_ci
4102f4aeb0Sopenharmony_ci    EGL_EXT_device_drm requires EGL_EXT_device_base.
4202f4aeb0Sopenharmony_ci
4302f4aeb0Sopenharmony_ci    EGL_EXT_device_drm interacts with EGL_EXT_platform_device
4402f4aeb0Sopenharmony_ci
4502f4aeb0Sopenharmony_ci    EGL_EXT_device_drm requires a DRM driver.
4602f4aeb0Sopenharmony_ci
4702f4aeb0Sopenharmony_ci    EGL_EXT_output_drm requires EGL_EXT_output_base.
4802f4aeb0Sopenharmony_ci
4902f4aeb0Sopenharmony_ci    EGL_EXT_output_drm requires a DRM driver which supports KMS.
5002f4aeb0Sopenharmony_ci
5102f4aeb0Sopenharmony_ci    An EGLDisplay supporting EGL_EXT_output_drm must be associated
5202f4aeb0Sopenharmony_ci    with an EGLDevice supporting EGL_EXT_device_drm.
5302f4aeb0Sopenharmony_ci
5402f4aeb0Sopenharmony_ciOverview
5502f4aeb0Sopenharmony_ci
5602f4aeb0Sopenharmony_ci    Increasingly, EGL and its client APIs are being used in place of
5702f4aeb0Sopenharmony_ci    "native" rendering APIs to implement the basic graphics
5802f4aeb0Sopenharmony_ci    functionality of native windowing systems.  This creates demand
5902f4aeb0Sopenharmony_ci    for a method to initialize EGL displays and surfaces directly on
6002f4aeb0Sopenharmony_ci    top of native GPU or device objects rather than native window
6102f4aeb0Sopenharmony_ci    system objects.  The mechanics of enumerating the underlying
6202f4aeb0Sopenharmony_ci    native devices and constructing EGL displays and surfaces from
6302f4aeb0Sopenharmony_ci    them have been solved in various platform and implementation-
6402f4aeb0Sopenharmony_ci    specific ways.  The EGL device family of extensions offers a
6502f4aeb0Sopenharmony_ci    standardized framework for bootstrapping EGL without the use of
6602f4aeb0Sopenharmony_ci    any underlying "native" APIs or functionality.
6702f4aeb0Sopenharmony_ci
6802f4aeb0Sopenharmony_ci    These extensions define how to map device and output handles between
6902f4aeb0Sopenharmony_ci    EGL and DRM/KMS. An EGL implementation which provides these
7002f4aeb0Sopenharmony_ci    extensions must have access to sufficient knowledge of the DRM
7102f4aeb0Sopenharmony_ci    implementation to be able to perform these mappings. No requirements
7202f4aeb0Sopenharmony_ci    are imposed on how this information is obtained, nor does this
7302f4aeb0Sopenharmony_ci    support have any implications for how EGL devices and outputs are
7402f4aeb0Sopenharmony_ci    implemented. Among the possibilities, support may be implemented in
7502f4aeb0Sopenharmony_ci    a generic fashion by layering on top of DRM, or EGL and DRM backends
7602f4aeb0Sopenharmony_ci    may be provided by the same vendor and share privileged lower level
7702f4aeb0Sopenharmony_ci    resources. An implementation which supports these extensions may
7802f4aeb0Sopenharmony_ci    support other low level device interfaces, such as OpenWF Display,
7902f4aeb0Sopenharmony_ci    as well.
8002f4aeb0Sopenharmony_ci
8102f4aeb0Sopenharmony_ciNew Types
8202f4aeb0Sopenharmony_ci
8302f4aeb0Sopenharmony_ci    None
8402f4aeb0Sopenharmony_ci
8502f4aeb0Sopenharmony_ciNew Procedures and Functions
8602f4aeb0Sopenharmony_ci
8702f4aeb0Sopenharmony_ci    None
8802f4aeb0Sopenharmony_ci
8902f4aeb0Sopenharmony_ciNew Tokens
9002f4aeb0Sopenharmony_ci
9102f4aeb0Sopenharmony_ci    Added by EXT_device_drm:
9202f4aeb0Sopenharmony_ci
9302f4aeb0Sopenharmony_ci        Accepted as the <name> parameter of eglQueryDeviceStringEXT
9402f4aeb0Sopenharmony_ci
9502f4aeb0Sopenharmony_ci        EGL_DRM_DEVICE_FILE_EXT                 0x3233
9602f4aeb0Sopenharmony_ci
9702f4aeb0Sopenharmony_ci        If EGL_EXT_platform_device is present, the following is accepted
9802f4aeb0Sopenharmony_ci        in the <attrib_list> of eglGetPlatformDisplayEXT().
9902f4aeb0Sopenharmony_ci
10002f4aeb0Sopenharmony_ci        EGL_DRM_MASTER_FD_EXT                   0x333C
10102f4aeb0Sopenharmony_ci
10202f4aeb0Sopenharmony_ci    Added by EXT_output_drm:
10302f4aeb0Sopenharmony_ci
10402f4aeb0Sopenharmony_ci        Accepted in the <attrib_list> of eglGetOutputLayersEXT and as
10502f4aeb0Sopenharmony_ci        the <attribute> parameter of eglQueryOutputLayerAttribEXT
10602f4aeb0Sopenharmony_ci
10702f4aeb0Sopenharmony_ci        EGL_DRM_CRTC_EXT                        0x3234
10802f4aeb0Sopenharmony_ci        EGL_DRM_PLANE_EXT                       0x3235
10902f4aeb0Sopenharmony_ci
11002f4aeb0Sopenharmony_ci        Accepted in the <attrib_list> of eglGetOutputPortsEXT and as
11102f4aeb0Sopenharmony_ci        the <attribute> parameter of eglQueryOutputPortAttribEXT
11202f4aeb0Sopenharmony_ci
11302f4aeb0Sopenharmony_ci        EGL_DRM_CONNECTOR_EXT                   0x3236
11402f4aeb0Sopenharmony_ci
11502f4aeb0Sopenharmony_ciNew Behavior for EXT_device_drm
11602f4aeb0Sopenharmony_ci
11702f4aeb0Sopenharmony_ci    EGLDeviceEXTs may be mapped to DRM device files.
11802f4aeb0Sopenharmony_ci
11902f4aeb0Sopenharmony_ci    To obtain a DRM device file for an EGLDeviceEXT, call
12002f4aeb0Sopenharmony_ci    eglQueryDeviceStringEXT with <name> set to EGL_DRM_DEVICE_FILE_EXT.
12102f4aeb0Sopenharmony_ci    The function will return a pointer to a string containing the name
12202f4aeb0Sopenharmony_ci    of the device file (e.g. "/dev/dri/cardN").
12302f4aeb0Sopenharmony_ci
12402f4aeb0Sopenharmony_ciIf EGL_EXT_platform_device is present, replace the last sentence of the
12502f4aeb0Sopenharmony_cithird paragraph in section 3.2 "Initialization" with the following:
12602f4aeb0Sopenharmony_ci
12702f4aeb0Sopenharmony_ci    When <platform> is EGL_PLATFORM_DEVICE_EXT, the only valid attribute
12802f4aeb0Sopenharmony_ci    name is EGL_DRM_MASTER_FD_EXT.  If specified, the value must be a file
12902f4aeb0Sopenharmony_ci    descriptor with DRM master permissions on the DRM device associated
13002f4aeb0Sopenharmony_ci    with the specified EGLDevice, as determined by EGL_DRM_DEVICE_FILE_EXT.
13102f4aeb0Sopenharmony_ci    If the file descriptor does not refer to the correct DRM device or
13202f4aeb0Sopenharmony_ci    does not have master permissions, the behavior is undefined.  Calls to
13302f4aeb0Sopenharmony_ci    eglGetPlatformDeviceEXT() with the same values for <platform> and
13402f4aeb0Sopenharmony_ci    <native_display> but distinct EGL_DRM_MASTER_FD_EXT values will return
13502f4aeb0Sopenharmony_ci    separate EGLDisplays.
13602f4aeb0Sopenharmony_ci
13702f4aeb0Sopenharmony_ci    If EGL requires the use of the DRM file descriptor beyond the duration
13802f4aeb0Sopenharmony_ci    of the call to eglGetPlatformDispay(), it will duplicate it.  If no
13902f4aeb0Sopenharmony_ci    file descriptor is specified and EGL requires one, it will attempt to
14002f4aeb0Sopenharmony_ci    open the device itself.  Applications should only need to specify a
14102f4aeb0Sopenharmony_ci    file descriptor in situations where EGL may fail to open a file
14202f4aeb0Sopenharmony_ci    descriptor itself, generally due to lack of permissions, or when EGL
14302f4aeb0Sopenharmony_ci    will fail to acquire DRM master permissions due to conflicts with an
14402f4aeb0Sopenharmony_ci    existing DRM client.  DRM master permissions are only required when EGL
14502f4aeb0Sopenharmony_ci    must modify output attributes.  This extension does not define any
14602f4aeb0Sopenharmony_ci    situations in which output attributes will be modified.
14702f4aeb0Sopenharmony_ci
14802f4aeb0Sopenharmony_ciNew Behavior for EXT_output_drm
14902f4aeb0Sopenharmony_ci
15002f4aeb0Sopenharmony_ci    KMS CRTC, plane, and connector IDs may be used to restrict EGL
15102f4aeb0Sopenharmony_ci    output handle searches and may be queried from EGL output handles.
15202f4aeb0Sopenharmony_ci
15302f4aeb0Sopenharmony_ci    Add to Table 3.10.3.1 in EGL_EXT_output_base:
15402f4aeb0Sopenharmony_ci
15502f4aeb0Sopenharmony_ci        Attribute               Type      Access
15602f4aeb0Sopenharmony_ci        ---------------------   -------   ------
15702f4aeb0Sopenharmony_ci        EGL_DRM_CRTC_EXT        integer   S|R
15802f4aeb0Sopenharmony_ci        EGL_DRM_PLANE_EXT       integer   S|R
15902f4aeb0Sopenharmony_ci
16002f4aeb0Sopenharmony_ci    Add to Table 3.10.3.2 in EGL_EXT_output_base:
16102f4aeb0Sopenharmony_ci
16202f4aeb0Sopenharmony_ci        Attribute               Type      Access
16302f4aeb0Sopenharmony_ci        ---------------------   -------   ------
16402f4aeb0Sopenharmony_ci        EGL_DRM_CONNECTOR_EXT   integer   S|R
16502f4aeb0Sopenharmony_ci
16602f4aeb0Sopenharmony_ci    Add to description of eglOutputLayerAttribEXT:
16702f4aeb0Sopenharmony_ci
16802f4aeb0Sopenharmony_ci        If <layer> corresponds to a KMS CRTC and <attribute> is
16902f4aeb0Sopenharmony_ci        EGL_DRM_PLANE_EXT, or if <layer> corresponds to a KMS plane and
17002f4aeb0Sopenharmony_ci        <attribute> is EGL_DRM_CRTC_EXT, an EGL_BAD_MATCH error is
17102f4aeb0Sopenharmony_ci        generated.
17202f4aeb0Sopenharmony_ci
17302f4aeb0Sopenharmony_ciIssues
17402f4aeb0Sopenharmony_ci
17502f4aeb0Sopenharmony_ci    1)  Should different values of EGL_DRM_MASTER_FD_EXT result in separate
17602f4aeb0Sopenharmony_ci        EGLDisplays?
17702f4aeb0Sopenharmony_ci
17802f4aeb0Sopenharmony_ci        RESOLVED: Yes.  Consider an application made up of two independent
17902f4aeb0Sopenharmony_ci        modules running in two independently scheduled threads.  Each
18002f4aeb0Sopenharmony_ci        module calls eglGetPlatformDisplayEXT():
18102f4aeb0Sopenharmony_ci
18202f4aeb0Sopenharmony_ci          int fd = open("/dev/dri/card0", O_RDWR);
18302f4aeb0Sopenharmony_ci          int attr1[] = { EGL_DRM_MASTER_FD_EXT, fd };
18402f4aeb0Sopenharmony_ci          dpy1 = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT,
18502f4aeb0Sopenharmony_ci                                          eglDev,
18602f4aeb0Sopenharmony_ci                                          attr1);
18702f4aeb0Sopenharmony_ci
18802f4aeb0Sopenharmony_ci        ...
18902f4aeb0Sopenharmony_ci                                
19002f4aeb0Sopenharmony_ci          dpy2 = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT,
19102f4aeb0Sopenharmony_ci                                          eglDev,
19202f4aeb0Sopenharmony_ci                                          NULL);
19302f4aeb0Sopenharmony_ci
19402f4aeb0Sopenharmony_ci        Presumably, if dpy1 == dpy2, they would both be using the same DRM
19502f4aeb0Sopenharmony_ci        fd for output operations internally.  That would mean display
19602f4aeb0Sopenharmony_ci        attribute updates would likely fail if dpy2 happened to be created
19702f4aeb0Sopenharmony_ci        before dpy1.  This would be painful to debug.  If dpy2 != dpy1,
19802f4aeb0Sopenharmony_ci        failure for dpy2 would be consistent and obvious.  The application
19902f4aeb0Sopenharmony_ci        author would be required to work out a scheme to share the master
20002f4aeb0Sopenharmony_ci        FD between modules before creating EGL displays.
20102f4aeb0Sopenharmony_ci   
20202f4aeb0Sopenharmony_ciRevision History:
20302f4aeb0Sopenharmony_ci
20402f4aeb0Sopenharmony_ci    #5  (December 28th, 2015) James Jones
20502f4aeb0Sopenharmony_ci        - Added EGL_DRM_MASTER_FD_EXT and associated
20602f4aeb0Sopenharmony_ci          language.
20702f4aeb0Sopenharmony_ci        - Added issue 1.
20802f4aeb0Sopenharmony_ci
20902f4aeb0Sopenharmony_ci    #4  (August 22nd, 2014) James Jones
21002f4aeb0Sopenharmony_ci        - Marked complete.
21102f4aeb0Sopenharmony_ci        - Listed Daniel as the contact.
21202f4aeb0Sopenharmony_ci
21302f4aeb0Sopenharmony_ci    #3  (June 5th, 2014) Daniel Kartch
21402f4aeb0Sopenharmony_ci        - Assigned enumerated values for constants.
21502f4aeb0Sopenharmony_ci
21602f4aeb0Sopenharmony_ci    #2  (May 28th, 2014) Daniel Kartch
21702f4aeb0Sopenharmony_ci        - Simplified description of new behavior based on refinements
21802f4aeb0Sopenharmony_ci          to EGL_EXT_output_base.
21902f4aeb0Sopenharmony_ci
22002f4aeb0Sopenharmony_ci    #1  (January 31st, 2014) Daniel Kartch
22102f4aeb0Sopenharmony_ci        - Initial draft, representing a signficant reworking of
22202f4aeb0Sopenharmony_ci          functionality previously proposed in
22302f4aeb0Sopenharmony_ci          EGL_EXT_native_device_drm.
224