Re: [Mesa-dev] [PATCH] wayland/egl: Resize EGL surface on update buffer for swrast
Hi On Thu, Oct 25, 2018 at 5:51 PM Juan A. Suarez Romero wrote: > > On Thu, 2018-10-25 at 14:48 +0200, Olivier Fourdan wrote: > > After commit a9fb331ea ("wayland/egl: update surface size on window > > resize"), the surface size is updated as soon as the resize is done, and > > `update_buffers()` would resize only if the surface size differs from > > the attached size. > > > > However, in the case of swrast, there is no resize callback and the > > attached size is updated in `dri2_wl_swrast_commit_backbuffer()` prior > > to the `swrast_update_buffers()` so the attached size is always up to > > date when it reaches `swrast_update_buffers()` and the surface is never > > resized. > > > > This can be observed with "totem" using the GDK backend on Wayland (the > > default) when running on software rendering: > > > > $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem > > > > Resizing the window would leave the EGL surface size unchanged. > > > > To avoid the issue, partially revert the part of commit a9fb331ea for > > `swrast_update_buffers()` and resize on the win size and not the > > attached size. > > > > Fixes: a9fb331ea - wayland/egl: update surface size on window resize > > Signed-off-by: Olivier Fourdan > > CC: Daniel Stone > > CC: Juan A. Suarez Romero > > CC: mesa-sta...@lists.freedesktop.org > > --- > > I've been checking why this happened. Turns out that in the original patch, we > update the size in the resize_callback(), so we need to do the changes in > update_buffers() accordingly. > > But turns out that with swrast we are not invoking resize_callback(), so we > need > to keep the old code in swrast_update_buffers(). Yeap, that's what I tried to explain in the commit message. > Thanks for finding this. > > Reviewed-by: Juan A. Suarez Thanks Juan! Could someone with commit access push that for me? Would be great to have it fixed in the stable and forthcoming 18.3 branches as well. > > > Resending because I got the "mesa-dev" address wrong! And a reply to the > > previous email won't fly with patchwork... Sorry! > > > > src/egl/drivers/dri2/platform_wayland.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/src/egl/drivers/dri2/platform_wayland.c > > b/src/egl/drivers/dri2/platform_wayland.c > > index 03a3e0993b..69a51e64fd 100644 > > --- a/src/egl/drivers/dri2/platform_wayland.c > > +++ b/src/egl/drivers/dri2/platform_wayland.c > > @@ -1652,8 +1652,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->attached_width || > > - dri2_surf->base.Height != dri2_surf->wl_win->attached_height) { > > + if (dri2_surf->base.Width != dri2_surf->wl_win->width || > > + dri2_surf->base.Height != dri2_surf->wl_win->height) { > > > >dri2_wl_release_buffers(dri2_surf); > > > Cheers, Olivier ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] wayland/egl: Resize EGL surface on update buffer for swrast
On Thu, 2018-10-25 at 14:48 +0200, Olivier Fourdan wrote: > After commit a9fb331ea ("wayland/egl: update surface size on window > resize"), the surface size is updated as soon as the resize is done, and > `update_buffers()` would resize only if the surface size differs from > the attached size. > > However, in the case of swrast, there is no resize callback and the > attached size is updated in `dri2_wl_swrast_commit_backbuffer()` prior > to the `swrast_update_buffers()` so the attached size is always up to > date when it reaches `swrast_update_buffers()` and the surface is never > resized. > > This can be observed with "totem" using the GDK backend on Wayland (the > default) when running on software rendering: > > $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem > > Resizing the window would leave the EGL surface size unchanged. > > To avoid the issue, partially revert the part of commit a9fb331ea for > `swrast_update_buffers()` and resize on the win size and not the > attached size. > > Fixes: a9fb331ea - wayland/egl: update surface size on window resize > Signed-off-by: Olivier Fourdan > CC: Daniel Stone > CC: Juan A. Suarez Romero > CC: mesa-sta...@lists.freedesktop.org > --- I've been checking why this happened. Turns out that in the original patch, we update the size in the resize_callback(), so we need to do the changes in update_buffers() accordingly. But turns out that with swrast we are not invoking resize_callback(), so we need to keep the old code in swrast_update_buffers(). Thanks for finding this. Reviewed-by: Juan A. Suarez > Resending because I got the "mesa-dev" address wrong! And a reply to the > previous email won't fly with patchwork... Sorry! > > src/egl/drivers/dri2/platform_wayland.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/egl/drivers/dri2/platform_wayland.c > b/src/egl/drivers/dri2/platform_wayland.c > index 03a3e0993b..69a51e64fd 100644 > --- a/src/egl/drivers/dri2/platform_wayland.c > +++ b/src/egl/drivers/dri2/platform_wayland.c > @@ -1652,8 +1652,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->attached_width || > - dri2_surf->base.Height != dri2_surf->wl_win->attached_height) { > + if (dri2_surf->base.Width != dri2_surf->wl_win->width || > + dri2_surf->base.Height != dri2_surf->wl_win->height) { > >dri2_wl_release_buffers(dri2_surf); > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] wayland/egl: Resize EGL surface on update buffer for swrast
After commit a9fb331ea ("wayland/egl: update surface size on window resize"), the surface size is updated as soon as the resize is done, and `update_buffers()` would resize only if the surface size differs from the attached size. However, in the case of swrast, there is no resize callback and the attached size is updated in `dri2_wl_swrast_commit_backbuffer()` prior to the `swrast_update_buffers()` so the attached size is always up to date when it reaches `swrast_update_buffers()` and the surface is never resized. This can be observed with "totem" using the GDK backend on Wayland (the default) when running on software rendering: $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem Resizing the window would leave the EGL surface size unchanged. To avoid the issue, partially revert the part of commit a9fb331ea for `swrast_update_buffers()` and resize on the win size and not the attached size. Fixes: a9fb331ea - wayland/egl: update surface size on window resize Signed-off-by: Olivier Fourdan CC: Daniel Stone CC: Juan A. Suarez Romero CC: mesa-sta...@lists.freedesktop.org --- Resending because I got the "mesa-dev" address wrong! And a reply to the previous email won't fly with patchwork... Sorry! src/egl/drivers/dri2/platform_wayland.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 03a3e0993b..69a51e64fd 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1652,8 +1652,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->attached_width || - dri2_surf->base.Height != dri2_surf->wl_win->attached_height) { + if (dri2_surf->base.Width != dri2_surf->wl_win->width || + dri2_surf->base.Height != dri2_surf->wl_win->height) { dri2_wl_release_buffers(dri2_surf); -- 2.19.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] wayland/egl: Resize EGL surface on update buffer for swrast
Oops got the mesa-dev address wrong... On Thu, Oct 25, 2018 at 2:40 PM Olivier Fourdan wrote: > > After commit a9fb331ea ("wayland/egl: update surface size on window > resize"), the surface size is updated as soon as the resize is done, and > `update_buffers()` would resize only if the surface size differs from > the attached size. > > However, in the case of swrast, there is no resize callback and the > attached size is updated in `dri2_wl_swrast_commit_backbuffer()` prior > to the `swrast_update_buffers()` so the attached size is always up to > date when it reaches `swrast_update_buffers()` and the surface is never > resized. > > This can be observed with "totem" using the GDK backend on Wayland (the > default) when running on software rendering: > > $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem > > Resizing the window would leave the EGL surface size unchanged. > > To avoid the issue, partially revert the part of commit a9fb331ea for > `swrast_update_buffers()` and resize on the win size and not the > attached size. > > Fixes: a9fb331ea - wayland/egl: update surface size on window resize > Signed-off-by: Olivier Fourdan > CC: Daniel Stone > CC: Juan A. Suarez Romero > CC: mesa-sta...@lists.freedesktop.org > --- > src/egl/drivers/dri2/platform_wayland.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/egl/drivers/dri2/platform_wayland.c > b/src/egl/drivers/dri2/platform_wayland.c > index 03a3e0993b..69a51e64fd 100644 > --- a/src/egl/drivers/dri2/platform_wayland.c > +++ b/src/egl/drivers/dri2/platform_wayland.c > @@ -1652,8 +1652,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->attached_width || > - dri2_surf->base.Height != dri2_surf->wl_win->attached_height) { > + if (dri2_surf->base.Width != dri2_surf->wl_win->width || > + dri2_surf->base.Height != dri2_surf->wl_win->height) { > >dri2_wl_release_buffers(dri2_surf); > > -- > 2.19.1 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev