Re: [Mesa-dev] [PATCH v4 1/2] wayland/egl: initialize window surface size to window size

2018-10-25 Thread Olivier Fourdan
On Thu, Oct 25, 2018 at 12:05 PM Olivier Fourdan  wrote:
>
> Hi,
>
> On Tue, Aug 7, 2018 at 5:50 PM Juan A. Suarez Romero
>  wrote:
> >
> > When creating a windows surface with eglCreateWindowSurface(), the
> > width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
> > invalid until buffers are updated (like calling glClear()).
> >
> > But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):
> >
> >   "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
> >height, in pixels, of the surface. For a window or pixmap surface,
> >these values are initially equal to the width and height of the
> >native window or pixmap with respect to which the surface was
> >created"
> >
> > This fixes dEQP-EGL.functional.color_clears.* CTS tests
> >
> > v2:
> > - Do not modify attached_{width,height} (Daniel)
> > - Do not update size on resizing window (Brendan)
> >
> > CC: Daniel Stone 
> > CC: Brendan King 
> > CC: mesa-sta...@lists.freedesktop.org
> > Tested-by: Eric Engestrom 
> > ---
> >  src/egl/drivers/dri2/platform_wayland.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/src/egl/drivers/dri2/platform_wayland.c 
> > b/src/egl/drivers/dri2/platform_wayland.c
> > index dca099500a8..a5d43094cf3 100644
> > --- a/src/egl/drivers/dri2/platform_wayland.c
> > +++ b/src/egl/drivers/dri2/platform_wayland.c
> > @@ -258,6 +258,9 @@ dri2_wl_create_window_surface(_EGLDriver *drv, 
> > _EGLDisplay *disp,
> >goto cleanup_surf;
> > }
> >
> > +   dri2_surf->base.Width = window->width;
> > +   dri2_surf->base.Height = window->height;
> > +
> > visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config);
> > assert(visual_idx != -1);
> >
> > --
> > 2.17.1
>
> Just a quick heads up, this patch is causing a regression with
> "swrast" which does not have DRI2flushExtension.
>
> Easiest way to demonstrate the issue is to use totem with "swrast" on
> mesa-18.2.x (e.g. Fedora 29) under Wayland:
>
>   $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem
>
> Play a video and resize the totem toplevel window, the size of the EGL
> surface remains unchanged...
>
> Reverting that patch fixes the issue, as using a DRI driver which
> supports DRI2flushExtension. Nevertheless, that's a regression.

Sorry, wrong patch, the culprit is:

https://cgit.freedesktop.org/mesa/mesa/commit/src/egl/drivers/dri2/platform_wayland.c?id=a9fb331ea
(or 
https://cgit.freedesktop.org/mesa/mesa/commit/src/egl/drivers/dri2/platform_wayland.c?id=7af6be886
cherry-picked in 18.2)

And actually reverting just that part from the patch:

@@ -1635,8 +1646,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->base.Width != dri2_surf->wl_win->attached_width ||
+ dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
dri2_wl_release_buffers(dri2_surf);

Fixes the issue.

Cheers,
Olivier
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4 1/2] wayland/egl: initialize window surface size to window size

2018-10-25 Thread Olivier Fourdan
Hi,

On Tue, Aug 7, 2018 at 5:50 PM Juan A. Suarez Romero
 wrote:
>
> When creating a windows surface with eglCreateWindowSurface(), the
> width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
> invalid until buffers are updated (like calling glClear()).
>
> But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):
>
>   "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
>height, in pixels, of the surface. For a window or pixmap surface,
>these values are initially equal to the width and height of the
>native window or pixmap with respect to which the surface was
>created"
>
> This fixes dEQP-EGL.functional.color_clears.* CTS tests
>
> v2:
> - Do not modify attached_{width,height} (Daniel)
> - Do not update size on resizing window (Brendan)
>
> CC: Daniel Stone 
> CC: Brendan King 
> CC: mesa-sta...@lists.freedesktop.org
> Tested-by: Eric Engestrom 
> ---
>  src/egl/drivers/dri2/platform_wayland.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c 
> b/src/egl/drivers/dri2/platform_wayland.c
> index dca099500a8..a5d43094cf3 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -258,6 +258,9 @@ dri2_wl_create_window_surface(_EGLDriver *drv, 
> _EGLDisplay *disp,
>goto cleanup_surf;
> }
>
> +   dri2_surf->base.Width = window->width;
> +   dri2_surf->base.Height = window->height;
> +
> visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config);
> assert(visual_idx != -1);
>
> --
> 2.17.1

Just a quick heads up, this patch is causing a regression with
"swrast" which does not have DRI2flushExtension.

Easiest way to demonstrate the issue is to use totem with "swrast" on
mesa-18.2.x (e.g. Fedora 29) under Wayland:

  $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem

Play a video and resize the totem toplevel window, the size of the EGL
surface remains unchanged...

Reverting that patch fixes the issue, as using a DRI driver which
supports DRI2flushExtension. Nevertheless, that's a regression.

Cheers,
Olivier
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4 1/2] wayland/egl: initialize window surface size to window size

2018-08-07 Thread Chad Versace
On Tue 07 Aug 2018, Juan A. Suarez Romero wrote:
> When creating a windows surface with eglCreateWindowSurface(), the
> width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
> invalid until buffers are updated (like calling glClear()).
> 
> But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):
> 
>   "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
>height, in pixels, of the surface. For a window or pixmap surface,
>these values are initially equal to the width and height of the
>native window or pixmap with respect to which the surface was
>created"
> 
> This fixes dEQP-EGL.functional.color_clears.* CTS tests
> 
> v2:
> - Do not modify attached_{width,height} (Daniel)
> - Do not update size on resizing window (Brendan)
> 
> CC: Daniel Stone 
> CC: Brendan King 
> CC: mesa-sta...@lists.freedesktop.org
> Tested-by: Eric Engestrom 
> ---
>  src/egl/drivers/dri2/platform_wayland.c | 3 +++
>  1 file changed, 3 insertions(+)

Hah. I just sent an equivalent patch to the list. I'll drop my patch.

Just for patch 1,
Reviewed-by: Chad Versace 
Tested-by: Chad Versace 

I don't fully understand attached_width,height. So no rb on patch 2.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2018-08-07 Thread Juan A. Suarez Romero
When creating a windows surface with eglCreateWindowSurface(), the
width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
invalid until buffers are updated (like calling glClear()).

But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):

  "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
   height, in pixels, of the surface. For a window or pixmap surface,
   these values are initially equal to the width and height of the
   native window or pixmap with respect to which the surface was
   created"

This fixes dEQP-EGL.functional.color_clears.* CTS tests

v2:
- Do not modify attached_{width,height} (Daniel)
- Do not update size on resizing window (Brendan)

CC: Daniel Stone 
CC: Brendan King 
CC: mesa-sta...@lists.freedesktop.org
Tested-by: Eric Engestrom 
---
 src/egl/drivers/dri2/platform_wayland.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index dca099500a8..a5d43094cf3 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -258,6 +258,9 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
   goto cleanup_surf;
}
 
+   dri2_surf->base.Width = window->width;
+   dri2_surf->base.Height = window->height;
+
visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config);
assert(visual_idx != -1);
 
-- 
2.17.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev