egl: add EGL_WAYLAND_Y_INVERTED_WL attribute
[mesa.git] / docs / specs / WL_bind_wayland_display.spec
1 Name
2
3 WL_bind_wayland_display
4
5 Name Strings
6
7 EGL_WL_bind_wayland_display
8
9 Contact
10
11 Kristian Høgsberg <krh@bitplanet.net>
12 Benjamin Franzke <benjaminfranzke@googlemail.com>
13
14 Status
15
16 Proposal
17
18 Version
19
20 Version 5, July 16, 2013
21
22 Number
23
24 EGL Extension #not assigned
25
26 Dependencies
27
28 Requires EGL 1.4 or later. This extension is written against the
29 wording of the EGL 1.4 specification.
30
31 EGL_KHR_base_image is required.
32
33 Overview
34
35 This extension provides entry points for binding and unbinding the
36 wl_display of a Wayland compositor to an EGLDisplay. Binding a
37 wl_display means that the EGL implementation should provide one or
38 more interfaces in the Wayland protocol to allow clients to create
39 wl_buffer objects. On the server side, this extension also
40 provides a new target for eglCreateImageKHR, to create an EGLImage
41 from a wl_buffer
42
43 Adding an implementation specific wayland interface, allows the
44 EGL implementation to define specific wayland requests and events,
45 needed for buffer sharing in an EGL wayland platform.
46
47 IP Status
48
49 Open-source; freely implementable.
50
51 New Procedures and Functions
52
53 EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy,
54 struct wl_display *display);
55
56 EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
57 struct wl_display *display);
58
59 EGLBoolean eglQueryWaylandBufferWL(EGLDisplay dpy,
60 struct wl_resource *buffer,
61 EGLint attribute, EGLint *value);
62
63 New Tokens
64
65 Accepted as <target> in eglCreateImageKHR
66
67 EGL_WAYLAND_BUFFER_WL 0x31D5
68
69 Accepted in the <attrib_list> parameter of eglCreateImageKHR:
70
71 EGL_WAYLAND_PLANE_WL 0x31D6
72
73 Possible values for EGL_TEXTURE_FORMAT:
74
75 EGL_TEXTURE_Y_U_V_WL 0x31D7
76 EGL_TEXTURE_Y_UV_WL 0x31D8
77 EGL_TEXTURE_Y_XUXV_WL 0x31D9
78
79 Accepted in the <attribute> parameter of eglQueryWaylandBufferWL:
80
81 EGL_WAYLAND_Y_INVERTED_WL 0x31DB
82
83
84 Additions to the EGL 1.4 Specification:
85
86 To bind a server side wl_display to an EGLDisplay, call
87
88 EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy,
89 struct wl_display *display);
90
91 To unbind a server side wl_display from an EGLDisplay, call
92
93 EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
94 struct wl_display *display);
95
96 eglBindWaylandDisplayWL returns EGL_FALSE when there is already a
97 wl_display bound to EGLDisplay otherwise EGL_TRUE.
98
99 eglUnbindWaylandDisplayWL returns EGL_FALSE when there is no
100 wl_display bound to the EGLDisplay currently otherwise EGL_TRUE.
101
102 A wl_buffer can have several planes, typically in case of planar
103 YUV formats. Depending on the exact YUV format in use, the
104 compositor will have to create one or more EGLImages for the
105 various planes. The eglQueryWaylandBufferWL function should be
106 used to first query the wl_buffer texture format using
107 EGL_TEXTURE_FORMAT as the attribute. If the wl_buffer object is
108 not an EGL wl_buffer (wl_shm and other wayland extensions can
109 create wl_buffer objects of different types), this query will
110 return EGL_FALSE. In that case the wl_buffer can not be used with
111 EGL and the compositor should have another way to get the buffer
112 contents.
113
114 If eglQueryWaylandBufferWL succeeds, the returned value will be
115 one of EGL_TEXTURE_RGB, EGL_TEXTURE_RGBA, EGL_TEXTURE_Y_U_V_WL,
116 EGL_TEXTURE_Y_UV_WL, EGL_TEXTURE_Y_XUXV_WL. The value returned
117 describes how many EGLImages must be used, which components will
118 be sampled from each EGLImage and how they map to rgba components
119 in the shader. The naming conventions separates planes by _ and
120 within each plane, the order or R, G, B, A, Y, U, and V indicates
121 how those components map to the rgba value returned by the
122 sampler. X indicates that the corresponding component in the rgba
123 value isn't used.
124
125 RGB and RGBA buffer types:
126
127 EGL_TEXTURE_RGB
128 One plane, samples RGB from the texture to rgb in the
129 shader. Alpha channel is not valid.
130
131 EGL_TEXTURE_RGBA
132 One plane, samples RGBA from the texture to rgba in the
133 shader.
134
135 YUV buffer types:
136
137 EGL_TEXTURE_Y_U_V_WL
138 Three planes, samples Y from the first plane to r in
139 the shader, U from the second plane to r, and V from
140 the third plane to r.
141
142 EGL_TEXTURE_Y_UV_WL
143 Two planes, samples Y from the first plane to r in
144 the shader, U and V from the second plane to rg.
145
146 EGL_TEXTURE_Y_XUXV_WL
147 Two planes, samples Y from the first plane to r in
148 the shader, U and V from the second plane to g and a.
149
150 After querying the wl_buffer layout, create EGLImages for the
151 planes by calling eglCreateImageKHR with wl_buffer as
152 EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target, NULL
153 context. If no attributes are given, an EGLImage will be created
154 for the first plane. For multi-planar buffers, specify the plane
155 to create the EGLImage for by using the EGL_WAYLAND_PLANE_WL
156 attribute. The value of the attribute is the index of the plane,
157 as defined by the buffer format. Writing to an EGLImage created
158 from a wl_buffer in any way (such as glTexImage2D, binding the
159 EGLImage as a renderbuffer etc) will result in undefined behavior.
160
161 Further, eglQueryWaylandBufferWL accepts attributes EGL_WIDTH and
162 EGL_HEIGHT to query the width and height of the wl_buffer.
163
164 Also, eglQueryWaylandBufferWL may accept
165 EGL_WAYLAND_Y_INVERTED_WL attribute to query orientation of
166 wl_buffer. If EGL_WAYLAND_Y_INVERTED_WL is supported
167 eglQueryWaylandBufferWL returns EGL_TRUE and value is a boolean
168 that tells if wl_buffer is y-inverted or not. If
169 EGL_WAYLAND_Y_INVERTED_WL is not supported
170 eglQueryWaylandBufferWL returns EGL_FALSE, in that case
171 wl_buffer should be treated as if value of
172 EGL_WAYLAND_Y_INVERTED_WL was EGL_TRUE.
173
174 Issues
175
176 Revision History
177
178 Version 1, March 1, 2011
179 Initial draft (Benjamin Franzke)
180 Version 2, July 5, 2012
181 Add EGL_WAYLAND_PLANE_WL attribute to allow creating an EGLImage
182 for different planes of planar buffer. (Kristian Høgsberg)
183 Version 3, July 10, 2012
184 Add eglQueryWaylandBufferWL and the various buffer
185 formats. (Kristian Høgsberg)
186 Version 4, July 19, 2012
187 Use EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB, and EGL_TEXTURE_RGBA,
188 and just define the new YUV texture formats. Add support for
189 EGL_WIDTH and EGL_HEIGHT in the query attributes (Kristian Høgsberg)
190 Version 5, July 16, 2013
191 Change eglQueryWaylandBufferWL to take a resource pointer to the
192 buffer instead of a pointer to a struct wl_buffer, as the latter has
193 been deprecated. (Ander Conselvan de Oliveira)
194 Version 6, September 16, 2013
195 Add EGL_WAYLAND_Y_INVERTED_WL attribute to allow specifying
196 wl_buffer's orientation.