Re: [Mesa-dev] [PATCH] egl: do not initialize w, h in dri2_query_surface
On 08/07/2017 04:33 PM, Emil Velikov wrote: On 7 August 2017 at 12:59, Tapani Pälli wrote: They always get initialized to zero by swrastGetDrawableInfo. Valid X11 Drawable minimum size is 1x1, so we can detect success/change by checking against 0. Signed-off-by: Tapani Pälli Reported-by: Emil Velikov --- src/egl/drivers/dri2/platform_x11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 61e700f..4917004 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -412,7 +412,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, { struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); - int x, y, w = -1, h = -1; + int x, y, w, h; __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf); @@ -420,7 +420,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, case EGL_WIDTH: case EGL_HEIGHT: swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf); - if (w != -1 && h != -1) { + if (w != 0 && h != 0) { Thanks Tapani. I'm wondering if it's not better to rename swrastGetDrawableInfo to a more generic one, which sets the output pointers only when it succeeds. This way we won't have this "hack", plus we won't be calling a "swrast" function from a non-swrast path. For swrastGetDrawableInfo we'will need a simple wrapper. I've sent now a proposal on this. // Tapani ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl: do not initialize w, h in dri2_query_surface
On Monday, 2017-08-07 14:59:32 +0300, Tapani Pälli wrote: > They always get initialized to zero by swrastGetDrawableInfo. Valid > X11 Drawable minimum size is 1x1, so we can detect success/change by > checking against 0. > > Signed-off-by: Tapani Pälli > Reported-by: Emil Velikov Reviewed-by: Eric Engestrom > --- > src/egl/drivers/dri2/platform_x11.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/egl/drivers/dri2/platform_x11.c > b/src/egl/drivers/dri2/platform_x11.c > index 61e700f..4917004 100644 > --- a/src/egl/drivers/dri2/platform_x11.c > +++ b/src/egl/drivers/dri2/platform_x11.c > @@ -412,7 +412,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, > { > struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); > struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); > - int x, y, w = -1, h = -1; > + int x, y, w, h; > > __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf); > > @@ -420,7 +420,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, > case EGL_WIDTH: > case EGL_HEIGHT: >swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf); > - if (w != -1 && h != -1) { > + if (w != 0 && h != 0) { > surf->Width = w; > surf->Height = h; >} > -- > 2.9.4 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl: do not initialize w, h in dri2_query_surface
On 7 August 2017 at 12:59, Tapani Pälli wrote: > They always get initialized to zero by swrastGetDrawableInfo. Valid > X11 Drawable minimum size is 1x1, so we can detect success/change by > checking against 0. > > Signed-off-by: Tapani Pälli > Reported-by: Emil Velikov > --- > src/egl/drivers/dri2/platform_x11.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/egl/drivers/dri2/platform_x11.c > b/src/egl/drivers/dri2/platform_x11.c > index 61e700f..4917004 100644 > --- a/src/egl/drivers/dri2/platform_x11.c > +++ b/src/egl/drivers/dri2/platform_x11.c > @@ -412,7 +412,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, > { > struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); > struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); > - int x, y, w = -1, h = -1; > + int x, y, w, h; > > __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf); > > @@ -420,7 +420,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, > case EGL_WIDTH: > case EGL_HEIGHT: >swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf); > - if (w != -1 && h != -1) { > + if (w != 0 && h != 0) { Thanks Tapani. I'm wondering if it's not better to rename swrastGetDrawableInfo to a more generic one, which sets the output pointers only when it succeeds. This way we won't have this "hack", plus we won't be calling a "swrast" function from a non-swrast path. For swrastGetDrawableInfo we'will need a simple wrapper. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] egl: do not initialize w, h in dri2_query_surface
They always get initialized to zero by swrastGetDrawableInfo. Valid X11 Drawable minimum size is 1x1, so we can detect success/change by checking against 0. Signed-off-by: Tapani Pälli Reported-by: Emil Velikov --- src/egl/drivers/dri2/platform_x11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 61e700f..4917004 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -412,7 +412,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, { struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); - int x, y, w = -1, h = -1; + int x, y, w, h; __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf); @@ -420,7 +420,7 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, case EGL_WIDTH: case EGL_HEIGHT: swrastGetDrawableInfo(drawable, &x, &y, &w, &h, dri2_surf); - if (w != -1 && h != -1) { + if (w != 0 && h != 0) { surf->Width = w; surf->Height = h; } -- 2.9.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev