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

Eric Engestrom eric.engestrom at intel.com
Thu May 31 16:13:55 UTC 2018


On Thursday, 2018-05-31 16:57:17 +0100, Daniel Stone wrote:
> Hi Juan,
> Thanks for picking this up!
> 
> On 31 May 2018 at 16:44, Juan A. Suarez Romero <jasuarez at igalia.com> wrote:
> > @@ -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;
> > +
> > +   window->attached_width = dri2_surf->base.Width;
> > +   window->attached_height = dri2_surf->base.Height;
> 
> We should definitely not initialise attached_{width,height} here,
> because no buffer has ever been attached.
> 
> > @@ -574,8 +582,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
> >     struct dri2_egl_display *dri2_dpy =
> >        dri2_egl_display(dri2_surf->base.Resource.Display);
> >
> > -   if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
> > -       dri2_surf->base.Height != dri2_surf->wl_win->height) {
> > +   if (dri2_surf->wl_win->attached_width != dri2_surf->wl_win->width ||
> > +       dri2_surf->wl_win->attached_height != dri2_surf->wl_win->height) {
> >
> >        dri2_wl_release_buffers(dri2_surf);
> >
> > @@ -1629,8 +1637,8 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
> >     if (dri2_surf->back)
> >        return 0;
> >
> > -   if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
> > -       dri2_surf->base.Height != dri2_surf->wl_win->height) {
> > +   if (dri2_surf->wl_win->attached_width != dri2_surf->wl_win->width ||
> > +       dri2_surf->wl_win->attached_height != dri2_surf->wl_win->height) {
> 
> Not initialising attached_{width,height} should not cause any problems
> with these checks. By definition there cannot have been any buffers
> allocated or attached between creation and the first draw call, so
> there are no old buffers to release.
> 
> So with that initialisation removed, this is (assuming dEQP still passes):

IMG has a similar patch locally (Cc'ed Frank), because (IIRC) dEQP
creates a window, and before attaching any surface to it, it reads back
the size and asserts out of most tests because it's 0 or -1 or something
like that, and I think this attached_width/height hack was needed
because of that.

> Reviewed-by: Daniel Stone <daniels at collabora.com>
> 
> Cheers,
> Daniel
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list