[Mesa-dev] [PATCH 2/2] egl: correct surface_type when add config

Tomasz Figa tfiga at chromium.org
Fri Jan 13 03:42:15 UTC 2017


On Fri, Jan 13, 2017 at 1:18 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> [Adding Tomasz]
>
> On 12 January 2017 at 07:14, Liu Zhiquan <zhiquan.liu at intel.com> wrote:
>> When add config, dri_config is double or single. Should only add
>> EGL_WINDOW_BIT to surface_type for double dri_config, Should only add
>> EGL_PBUFFER_BIT EGL_PIXMAP_BIT to surface_type for single dri_config.
>> This avoid crash when operate on wrong surface_type which
>> dri_double_config or dri_single_config is null.
>>
> Afaict you got it spot on - WINDOW are double, while PBUFFER and
> PIXMAP are single config.

I think this is not entirely true, at least according to EGL 1.4 spec [1].

PBUFFER and PIXMAP surfaces seems to be single buffered indeed,
although the wording used in section 2.2.2 is a bit fuzzy. It states
that WINDOW and PBUFFER surfaces are "back" buffered, while PIXMAP are
"single" buffered. This seems to be clarified reasonably enough by
section 3.9.1 that uses the "back-buffered" phrase only for WINDOW
surfaces.

However for WINDOW surfaces it seems to be a bit more complicated.
Section 3.9.1 mentions both "back-buffered" and "single-buffered"
modes for WINDOW surfaces. Moreover, in section 3.5.1, where
eglCreateWindowSurface is described, there is a mention of the
EGL_RENDER_BUFFER attribute that can be set to either EGL_BACK_BUFFER
or EGL_SINGLE_BUFFER. It also says that "some window systems may not
allow rendering directly to the front buffer of a window surface" and
that for such systems "when such windows are made current to a
context, the context will always have an EGL_RENDER_BUFFER attribute
value of EGL_BACK_BUFFER". So indeed, if none of our EGL platforms
(especially X11) relies on availability of single buffering for window
surfaces, we might just use that exception and always report
EGL_BACK_BUFFER for window surfaces (note that we don't do it
currently and we report what was given at surface creation time).

[1] https://www.khronos.org/registry/EGL/specs/eglspec.1.4.pdf

Best regards,
Tomasz


More information about the mesa-dev mailing list