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

Juan A. Suarez Romero jasuarez at igalia.com
Mon Jun 4 11:43:59 UTC 2018


On Fri, 2018-06-01 at 16:32 +0100, Daniel Stone wrote:
> Hi,
> 
> On 1 June 2018 at 15:35, Brendan King <brendan.king at imgtec.com> wrote:
> > IMG has a similar patch to the one you describe, but without the changes to
> > the resize_callback, so just this bit:
> > 
> > @@ -255,6 +257,12 @@ dri2_wl_create_window_surface(_EGLDriver *drv,
> > _EGLDisplay *disp,
> >        goto cleanup_surf;
> >     }
> > 
> > +   dri2_surf->base.Width = window->width;
> > +   dri2_surf->base.Height = window->height;
> > +
> > 
> > I don't think the resize_callback changes are necessary.
> 
> 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.


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?

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.

	J.A.



> It seems like the desired semantic for handling EGL surface-size
> queries, is that the query returns the size of the buffer that will be
> attached at the next eglSwapBuffers. For example, if you issue
> wl_egl_window_resize() in between eglSwapBuffers() and the first draw
> call, the surface-size query should reflect this new size immediately
> after the function returns. However, if you issue
> wl_egl_window_resize() after a frame's first draw call has been made,
> querying the surface size should return the old size until
> eglSwapBuffers() has been called, since the resize call has no effect
> on the buffer which will actually be attached when calling SwapBuffers
> in that frame.
> 
> Cheers,
> Daniel
> 


More information about the mesa-dev mailing list