[Mesa-dev] [PATCH] egl: do not initialize w, h in dri2_query_surface

Tapani Pälli tapani.palli at intel.com
Tue Aug 8 08:32:36 UTC 2017



On 08/07/2017 04:33 PM, Emil Velikov wrote:
> On 7 August 2017 at 12:59, Tapani Pälli <tapani.palli at intel.com> 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 <tapani.palli at intel.com>
>> Reported-by: Emil Velikov <emil.velikov at collabora.com>
>> ---
>>   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


More information about the mesa-dev mailing list