Skip to content

Commit

Permalink
Add EXT_config_drm_format_query extension
Browse files Browse the repository at this point in the history
  • Loading branch information
amshafer committed Aug 9, 2022
1 parent 1b240eb commit f159cbd
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/egl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3528,5 +3528,10 @@
<enum name="EGL_DEVICE_EXT"/>
</require>
</extension>
<extension name="EGL_EXT_config_drm_format_query" supported="egl">
<require>
<enum name="EGL_LINUX_DRM_FOURCC_EXT"/>
</require>
</extension>
</extensions>
</registry>
107 changes: 107 additions & 0 deletions extensions/EXT/EGL_EXT_config_drm_format_query.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
Name

EXT_config_drm_format_query

Name Strings

EGL_EXT_config_drm_format_query

Contributors

Contacts

Austin Shafer, NVIDIA (ashafer 'at' nvidia.com)

Status

Complete.

Version

Version 1 - July 5th, 2022

Number

EGL Extension #149

Extension Type

EGL client extension

Dependencies

Written based on the wording of the EGL 1.5 specification.

This extension inlcudes the enum EGL_LINUX_DRM_FOURCC_EXT as defined in
EGL_EXT_image_dma_buf_import and requires the EGL_KHR_stream extension.

Overview

This extension adds an EGLConfig attribute for stream surface
configurations that specifies a DRM format, as defined in drm_fourcc.h. If
an application needs to share buffers with other libraries or processes
that require specific formats, then this allows an application to select a
matching EGLConfig accordingly. EGLStream applications may need to know
what DRM format a surface is using so that they can pass the format and any
modifiers to other APIs or other stream consumers.

This extension allows passing EGL_LINUX_DRM_FOURCC_EXT to
eglGetConfigAttrib, allowing the application to forward the format code
as needed. This is only valid on EGLConfigs which have the EGL_STREAM_BIT_KHR
appear in the EGL_SURFACE_TYPE attribute.

New Types

None

New Functions

None

New Tokens

Accepted as an attribute in the <attribute> parameter of
eglGetConfigAttrib:

EGL_LINUX_DRM_FOURCC_EXT 0x3271

Changes in section 3.4.3 "Querying Configuration Attributes"

Add EGL_LINUX_DRM_FOURCC_EXT to the attributes accepted by
eglGetConfigAttrib. EGL_LINUX_DRM_FOURCC_EXT specifices a DRM format code
as declared in the Linux drm_fourcc.h header. This is only valid on
EGLConfigs which have the EGL_STREAM_BIT_KHR appear in the EGL_SURFACE_TYPE
attribute.

If EGL_LINUX_DRM_FOURCC_EXT is the attribute being requested and the
EGLConfig does not have a corresponding DRM format, then DRM_FORMAT_INVALID
is returned.

Changes in section 3.4.1 "Querying Configurations"

If EGL_LINUX_DRM_FOURCC_EXT is specified as an attribute in the attrib_list
argument of eglChooseConfig, then it will be ignored when choosing a
config.

Issues

1. Should EGL_LINUX_DRM_FOURCC_EXT be usable as an attribute in eglChooseConfig?

RESOLVED: No, eglChooseConfig should ignore EGL_LINUX_DRM_FOURCC_EXT. We can't
appropriately handle EGL_DONT_CARE due to possible collisions with DRM format
values. Currently there is no DRM format that aliases with EGL_DONT_CARE, but
there is no guarantee that it cannot happen in the future.

2. Should this be limited to stream surface configs?

RESOLVED: Yes, considering the only use case for this right now is interactions
with EGLStream applications it doesn't make sense to support it in all cases
and open the door to unintended consequences. If more use cases for this
query operation appear then this restriction can be lifted.


Revision History

#1 (July 5th, 2022) Austin Shafer

- Initial draft
7 changes: 6 additions & 1 deletion registry.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -767,4 +767,9 @@ extension EGL_EXT_explicit_device {
flags public
filename extensions/EXT/EGL_EXT_explicit_device.txt
}
# Next free extension number: 149
extension EGL_EXT_config_drm_format_query {
number 149
flags public
filename extensions/EXT/EGL_EXT_config_drm_format_query
}
# Next free extension number: 150

0 comments on commit f159cbd

Please sign in to comment.