[Mesa-dev] [PATCH] wayland/egl: initialize window surface size to window size

Daniel Stone daniel at fooishbar.org
Mon Jun 4 12:22:50 UTC 2018


Hi Juan,

On 4 June 2018 at 12:43, Juan A. Suarez Romero <jasuarez at igalia.com> wrote:
> On Fri, 2018-06-01 at 16:32 +0100, Daniel Stone wrote:
>> I think you're right, and this needs more rework to be consistent.
>>
>> wl_egl_window_get_attached_size() always returns the size of the last
>> attached buffer (if there have been any); that is good and consistent.
>
> Let's focus now on this, as I already sent a V2 patch to properly initialize
> surface Width/Height values.

Right, but in doing so it introduces an inconsistency. As below:
wl_egl_create_window(w1, h1);
eglCreateSurface();
eglQuerySurface(EGL_{WIDTH,HEIGHT});
wl_egl_resize_window(w2, h2);
eglQuerySurface(EGL_{WIDTH,HEIGHT});
glClear();
eglSwapBuffers();
wl_egl_resize_window(w3, h3);
eglQuerySurface(EGL_{WIDTH,HEIGHT});
glClear();
eglQuerySurface(EGL_{WIDTH,HEIGHT});
eglSwapBuffers();

The first query will correctly return (w1,h1). The second query will
incorrectly also return (w1,h1), even though the surface will never
have that size. The third query will return (w2,h2) as the
last-attached size, even though the surface will be (w3,h3) on next
draw. The fourth query will correctly return (w3,h3).

I would like this to be consistent: my suggestion is that a query for
the surface size always returns the size that the surface will become
on the next eglSwapBuffers.

> In dEQP-EGL.functional.resize.surface_size.* , this is what the test does
> initially:
>
> wl_egl_window_create(w1, h1);
> eglCreateWindowSurface();
> egl.makeCurrent()
> wl_egl_window_get_attached_size();
>
> The failing part is the results for wl_egl_window_get_attached_size(): test
> assumes it will return (w1, h1) (and this is what Nvidia implementation seems to
> return), but Mesa returns (0, 0).
>
> If I understand correctly, Mesa returns (0, 0) because there is no buffer
> attached. If we call before eglSwapBuffers() (which internally calls
> wl_surface_attach()) and afterwards wl_egl_window_get_attached_size(), then Mesa
> would return (w1, h1) because now the buffer is attached to the window.
>
> Am I correct?

Yep, that is correct.

> Because it seems like NVidia implementation is returning (w1,h1) because at that
> moment it has an attached buffer. Wondering if eglMakeCurrent() is performing
> such attachment.

Yes, that's correct, and I believe eglMakeCurrent() does perform that
attachment. The NVIDIA/EGLStreams implementation is extremely broken
in that regard, in a way which does break genuine real-world
applications. We had a long discussion on wayland-devel@ when the
EGLStreams implementation was first posted, detailing the ways in
which their implementation causes genuine problems for real-world
users, and can provoke client deadlocks. I am very opposed to
supporting or codifying that behaviour.

Cheers,
Daniel


More information about the mesa-dev mailing list