Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread Michel Dänzer
On 09/08/16 05:59 AM, ⚛ wrote:
> On Mon, Aug 8, 2016 at 7:14 PM, Ian Romanick  wrote:
>> On 08/08/2016 09:38 AM, ⚛ wrote:
>>> On Mon, Aug 8, 2016 at 6:22 PM, Ian Romanick  wrote:
 I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
 with a patched *_dri.so (and vice-versa)?
>>>
>>> Can you be more specific?
>>
>> Eh... build Mesa.  Save the libGL and *_dri.so.  Apply patch.  Build
>> again.  Run applications with LD_PRELOAD and LIBGL_DRIVERS_PATH (or
>> EGL_DRIVERS_PATH) set to mix the old and new.
> 
> - The changes to the data structures in the patch do not necessarily
> imply that mixing-unpatched-patched libs will fail because the
> alignment of fields might stay the same.

Unless sizeof(bool) == sizeof(int), it would still break ABI at least on
big endian platforms.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread
On Mon, Aug 8, 2016 at 7:14 PM, Ian Romanick  wrote:
> On 08/08/2016 09:38 AM, ⚛ wrote:
>> On Mon, Aug 8, 2016 at 6:22 PM, Ian Romanick  wrote:
>>> I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
>>> with a patched *_dri.so (and vice-versa)?
>>
>> Can you be more specific?
>
> Eh... build Mesa.  Save the libGL and *_dri.so.  Apply patch.  Build
> again.  Run applications with LD_PRELOAD and LIBGL_DRIVERS_PATH (or
> EGL_DRIVERS_PATH) set to mix the old and new.

- The changes to the data structures in the patch do not necessarily
imply that mixing-unpatched-patched libs will fail because the
alignment of fields might stay the same.

- I looked into it a bit, but more time is required before I can send
the next version of the patch (if required). I marked the patch as
"deferred" at patchwork.freedesktop.org for now.

PS: Patches 10474 10427 10418 at patchwork aren't controversial so it
should be possible to review+merge them relatively quickly. It will
allow me to move on.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread Ian Romanick
On 08/08/2016 10:20 AM, Rob Clark wrote:
> how strict are we on that actually?  I think whenever we add new gl
> entry points (ie. implementing new extension, etc) we kinda sorta
> break ABI, don't we?  I thought mixing/matching libGL vs *_dri.so was
> at least not recommended..

No... we go to great lengths to make *_dri.so query libGL to know where
a new function goes in the dispatch table.  If libGL doesn't know a
location for the new function, it dynamically assigns one.  That's what
all the remap table stuff is.

> BR,
> -R
> 
> On Mon, Aug 8, 2016 at 12:22 PM, Ian Romanick  wrote:
>> I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
>> with a patched *_dri.so (and vice-versa)?
>>
>> On 08/01/2016 06:21 AM, Jan Ziak wrote:
>>> Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
>>> ---
>>>  src/egl/drivers/dri2/egl_dri2.h   | 19 ++-
>>>  src/gallium/auxiliary/vl/vl_winsys_dri3.c |  3 ++-
>>>  src/glx/dri3_priv.h   |  5 +++--
>>>  src/loader/loader.c   |  7 ---
>>>  src/loader/loader.h   |  4 +++-
>>>  5 files changed, 22 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/src/egl/drivers/dri2/egl_dri2.h 
>>> b/src/egl/drivers/dri2/egl_dri2.h
>>> index 4577875..e406443 100644
>>> --- a/src/egl/drivers/dri2/egl_dri2.h
>>> +++ b/src/egl/drivers/dri2/egl_dri2.h
>>> @@ -28,6 +28,7 @@
>>>  #ifndef EGL_DRI2_INCLUDED
>>>  #define EGL_DRI2_INCLUDED
>>>
>>> +#include 
>>>  #include 
>>>
>>>  #ifdef HAVE_X11_PLATFORM
>>> @@ -160,7 +161,7 @@ struct dri2_egl_display
>>> int   dri2_major;
>>> int   dri2_minor;
>>> __DRIscreen  *dri_screen;
>>> -   int   own_dri_screen;
>>> +   bool  own_dri_screen;
>>> const __DRIconfig   **driver_configs;
>>> void *driver;
>>> const __DRIcoreExtension   *core;
>>> @@ -181,8 +182,8 @@ struct dri2_egl_display
>>>  * dri2_make_current (tracks if there are active contexts/surfaces). */
>>> int   ref_count;
>>>
>>> -   int   own_device;
>>> -   int   invalidate_available;
>>> +   bool  own_device;
>>> +   bool  invalidate_available;
>>> int   min_swap_interval;
>>> int   max_swap_interval;
>>> int   default_swap_interval;
>>> @@ -201,7 +202,7 @@ struct dri2_egl_display
>>>  #ifdef HAVE_X11_PLATFORM
>>> xcb_connection_t *conn;
>>> int  screen;
>>> -   int  swap_available;
>>> +   bool swap_available;
>>>  #ifdef HAVE_DRI3
>>> struct loader_dri3_extensions loader_dri3_ext;
>>>  #endif
>>> @@ -214,13 +215,13 @@ struct dri2_egl_display
>>> struct wl_drm*wl_drm;
>>> struct wl_shm*wl_shm;
>>> struct wl_event_queue*wl_queue;
>>> -   intauthenticated;
>>> +   bool  authenticated;
>>> intformats;
>>> uint32_t  capabilities;
>>>  #endif
>>>
>>> -   int  is_render_node;
>>> -   intis_different_gpu;
>>> +   bool is_render_node;
>>> +   bool is_different_gpu;
>>>  };
>>>
>>>  struct dri2_egl_context
>>> @@ -244,7 +245,7 @@ struct dri2_egl_surface
>>> __DRIdrawable   *dri_drawable;
>>> __DRIbuffer  buffers[5];
>>> int  buffer_count;
>>> -   int  have_fake_front;
>>> +   bool have_fake_front;
>>>
>>>  #ifdef HAVE_X11_PLATFORM
>>> xcb_drawable_t   drawable;
>>> @@ -282,7 +283,7 @@ struct dri2_egl_surface
>>>  #ifdef HAVE_DRM_PLATFORM
>>>struct gbm_bo   *bo;
>>>  #endif
>>> -  int locked;
>>> +  boollocked;
>>>int age;
>>> } color_buffers[4], *back, *current;
>>>  #endif
>>> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
>>> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> index 493e645..7cb6c18 100644
>>> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> @@ -25,6 +25,7 @@
>>>   *
>>>   
>>> **/
>>>
>>> +#include 
>>>  #include 
>>>
>>>  #include 
>>> @@ -627,7 +628,7 @@ vl_dri3_screen_create(Display *display, int screen)
>>> xcb_dri3_open_reply_t *open_reply;
>>> xcb_get_geometry_cookie_t geom_cookie;
>>> xcb_get_geometry_reply_t *geom_reply;
>>> -   int is_different_gpu;
>>> +   bool is_different_gpu;
>>> int fd;
>>>
>>> assert(display);
>>> diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
>>> index 0822377..bfb0786 100644
>>> --- a/src/glx/dri3_priv.h
>>> +++ b/src/glx/dri3_priv.h
>

Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread Ian Romanick
On 08/08/2016 09:38 AM, ⚛ wrote:
> On Mon, Aug 8, 2016 at 6:22 PM, Ian Romanick  wrote:
>> I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
>> with a patched *_dri.so (and vice-versa)?
> 
> Can you be more specific?

Eh... build Mesa.  Save the libGL and *_dri.so.  Apply patch.  Build
again.  Run applications with LD_PRELOAD and LIBGL_DRIVERS_PATH (or
EGL_DRIVERS_PATH) set to mix the old and new.

> Where is the ABI documented?

I don't know this particular code that well, so this may be a non-issue.
 Generally, any structures that represent data that is accessed in both
libGL (or libEGL) and *_dri.so are ABI.  Usually these structures are
versioned so that fields can be added... you just don't ever get to
change or remove fields.  The .h file is the documentation.
include/GL/internal/dri_interface.h is the prime example
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread Rob Clark
how strict are we on that actually?  I think whenever we add new gl
entry points (ie. implementing new extension, etc) we kinda sorta
break ABI, don't we?  I thought mixing/matching libGL vs *_dri.so was
at least not recommended..

BR,
-R

On Mon, Aug 8, 2016 at 12:22 PM, Ian Romanick  wrote:
> I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
> with a patched *_dri.so (and vice-versa)?
>
> On 08/01/2016 06:21 AM, Jan Ziak wrote:
>> Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
>> ---
>>  src/egl/drivers/dri2/egl_dri2.h   | 19 ++-
>>  src/gallium/auxiliary/vl/vl_winsys_dri3.c |  3 ++-
>>  src/glx/dri3_priv.h   |  5 +++--
>>  src/loader/loader.c   |  7 ---
>>  src/loader/loader.h   |  4 +++-
>>  5 files changed, 22 insertions(+), 16 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/egl_dri2.h 
>> b/src/egl/drivers/dri2/egl_dri2.h
>> index 4577875..e406443 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.h
>> +++ b/src/egl/drivers/dri2/egl_dri2.h
>> @@ -28,6 +28,7 @@
>>  #ifndef EGL_DRI2_INCLUDED
>>  #define EGL_DRI2_INCLUDED
>>
>> +#include 
>>  #include 
>>
>>  #ifdef HAVE_X11_PLATFORM
>> @@ -160,7 +161,7 @@ struct dri2_egl_display
>> int   dri2_major;
>> int   dri2_minor;
>> __DRIscreen  *dri_screen;
>> -   int   own_dri_screen;
>> +   bool  own_dri_screen;
>> const __DRIconfig   **driver_configs;
>> void *driver;
>> const __DRIcoreExtension   *core;
>> @@ -181,8 +182,8 @@ struct dri2_egl_display
>>  * dri2_make_current (tracks if there are active contexts/surfaces). */
>> int   ref_count;
>>
>> -   int   own_device;
>> -   int   invalidate_available;
>> +   bool  own_device;
>> +   bool  invalidate_available;
>> int   min_swap_interval;
>> int   max_swap_interval;
>> int   default_swap_interval;
>> @@ -201,7 +202,7 @@ struct dri2_egl_display
>>  #ifdef HAVE_X11_PLATFORM
>> xcb_connection_t *conn;
>> int  screen;
>> -   int  swap_available;
>> +   bool swap_available;
>>  #ifdef HAVE_DRI3
>> struct loader_dri3_extensions loader_dri3_ext;
>>  #endif
>> @@ -214,13 +215,13 @@ struct dri2_egl_display
>> struct wl_drm*wl_drm;
>> struct wl_shm*wl_shm;
>> struct wl_event_queue*wl_queue;
>> -   intauthenticated;
>> +   bool  authenticated;
>> intformats;
>> uint32_t  capabilities;
>>  #endif
>>
>> -   int  is_render_node;
>> -   intis_different_gpu;
>> +   bool is_render_node;
>> +   bool is_different_gpu;
>>  };
>>
>>  struct dri2_egl_context
>> @@ -244,7 +245,7 @@ struct dri2_egl_surface
>> __DRIdrawable   *dri_drawable;
>> __DRIbuffer  buffers[5];
>> int  buffer_count;
>> -   int  have_fake_front;
>> +   bool have_fake_front;
>>
>>  #ifdef HAVE_X11_PLATFORM
>> xcb_drawable_t   drawable;
>> @@ -282,7 +283,7 @@ struct dri2_egl_surface
>>  #ifdef HAVE_DRM_PLATFORM
>>struct gbm_bo   *bo;
>>  #endif
>> -  int locked;
>> +  boollocked;
>>int age;
>> } color_buffers[4], *back, *current;
>>  #endif
>> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
>> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> index 493e645..7cb6c18 100644
>> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> @@ -25,6 +25,7 @@
>>   *
>>   **/
>>
>> +#include 
>>  #include 
>>
>>  #include 
>> @@ -627,7 +628,7 @@ vl_dri3_screen_create(Display *display, int screen)
>> xcb_dri3_open_reply_t *open_reply;
>> xcb_get_geometry_cookie_t geom_cookie;
>> xcb_get_geometry_reply_t *geom_reply;
>> -   int is_different_gpu;
>> +   bool is_different_gpu;
>> int fd;
>>
>> assert(display);
>> diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
>> index 0822377..bfb0786 100644
>> --- a/src/glx/dri3_priv.h
>> +++ b/src/glx/dri3_priv.h
>> @@ -54,6 +54,7 @@
>>   *   Kristian Høgsberg (k...@redhat.com)
>>   */
>>
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -78,7 +79,7 @@ struct dri3_display
>> int dri3Minor;
>>
>> /* Present bits */
>> -   int hasPresent;
>> +   bool hasPresent;
>> int presentMajor;
>> int presentMinor;
>>  };
>> @@ -101,7 +102,7 @@ struct dri3_screen {
>>
>> void *driver;
>> int fd;
>> -   int

Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread
On Mon, Aug 8, 2016 at 6:22 PM, Ian Romanick  wrote:
> I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
> with a patched *_dri.so (and vice-versa)?

Can you be more specific?

Where is the ABI documented?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-08 Thread Ian Romanick
I'm pretty sure this breaks ABI.  Did you try using an unpatched libGL
with a patched *_dri.so (and vice-versa)?

On 08/01/2016 06:21 AM, Jan Ziak wrote:
> Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.h   | 19 ++-
>  src/gallium/auxiliary/vl/vl_winsys_dri3.c |  3 ++-
>  src/glx/dri3_priv.h   |  5 +++--
>  src/loader/loader.c   |  7 ---
>  src/loader/loader.h   |  4 +++-
>  5 files changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
> index 4577875..e406443 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -28,6 +28,7 @@
>  #ifndef EGL_DRI2_INCLUDED
>  #define EGL_DRI2_INCLUDED
>  
> +#include 
>  #include 
>  
>  #ifdef HAVE_X11_PLATFORM
> @@ -160,7 +161,7 @@ struct dri2_egl_display
> int   dri2_major;
> int   dri2_minor;
> __DRIscreen  *dri_screen;
> -   int   own_dri_screen;
> +   bool  own_dri_screen;
> const __DRIconfig   **driver_configs;
> void *driver;
> const __DRIcoreExtension   *core;
> @@ -181,8 +182,8 @@ struct dri2_egl_display
>  * dri2_make_current (tracks if there are active contexts/surfaces). */
> int   ref_count;
>  
> -   int   own_device;
> -   int   invalidate_available;
> +   bool  own_device;
> +   bool  invalidate_available;
> int   min_swap_interval;
> int   max_swap_interval;
> int   default_swap_interval;
> @@ -201,7 +202,7 @@ struct dri2_egl_display
>  #ifdef HAVE_X11_PLATFORM
> xcb_connection_t *conn;
> int  screen;
> -   int  swap_available;
> +   bool swap_available;
>  #ifdef HAVE_DRI3
> struct loader_dri3_extensions loader_dri3_ext;
>  #endif
> @@ -214,13 +215,13 @@ struct dri2_egl_display
> struct wl_drm*wl_drm;
> struct wl_shm*wl_shm;
> struct wl_event_queue*wl_queue;
> -   intauthenticated;
> +   bool  authenticated;
> intformats;
> uint32_t  capabilities;
>  #endif
>  
> -   int  is_render_node;
> -   intis_different_gpu;
> +   bool is_render_node;
> +   bool is_different_gpu;
>  };
>  
>  struct dri2_egl_context
> @@ -244,7 +245,7 @@ struct dri2_egl_surface
> __DRIdrawable   *dri_drawable;
> __DRIbuffer  buffers[5];
> int  buffer_count;
> -   int  have_fake_front;
> +   bool have_fake_front;
>  
>  #ifdef HAVE_X11_PLATFORM
> xcb_drawable_t   drawable;
> @@ -282,7 +283,7 @@ struct dri2_egl_surface
>  #ifdef HAVE_DRM_PLATFORM
>struct gbm_bo   *bo;
>  #endif
> -  int locked;
> +  boollocked;
>int age;
> } color_buffers[4], *back, *current;
>  #endif
> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> index 493e645..7cb6c18 100644
> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> @@ -25,6 +25,7 @@
>   *
>   **/
>  
> +#include 
>  #include 
>  
>  #include 
> @@ -627,7 +628,7 @@ vl_dri3_screen_create(Display *display, int screen)
> xcb_dri3_open_reply_t *open_reply;
> xcb_get_geometry_cookie_t geom_cookie;
> xcb_get_geometry_reply_t *geom_reply;
> -   int is_different_gpu;
> +   bool is_different_gpu;
> int fd;
>  
> assert(display);
> diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
> index 0822377..bfb0786 100644
> --- a/src/glx/dri3_priv.h
> +++ b/src/glx/dri3_priv.h
> @@ -54,6 +54,7 @@
>   *   Kristian Høgsberg (k...@redhat.com)
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -78,7 +79,7 @@ struct dri3_display
> int dri3Minor;
>  
> /* Present bits */
> -   int hasPresent;
> +   bool hasPresent;
> int presentMajor;
> int presentMinor;
>  };
> @@ -101,7 +102,7 @@ struct dri3_screen {
>  
> void *driver;
> int fd;
> -   int is_different_gpu;
> +   bool is_different_gpu;
>  
> int show_fps_interval;
>  
> diff --git a/src/loader/loader.c b/src/loader/loader.c
> index 56ffc5d..a3b75c7 100644
> --- a/src/loader/loader.c
> +++ b/src/loader/loader.c
> @@ -356,7 +356,7 @@ DRI_CONF_BEGIN
>  DRI_CONF_END;
>  #endif
>  
> -int loader_get_user_preferred_fd(int default_fd, int *different_device)
> +int loader_get_user_preferred_fd(int 

Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-02 Thread Eric Engestrom
On Mon, Aug 01, 2016 at 03:43:17PM +0200, ⚛ wrote:
> On Mon, Aug 1, 2016 at 2:46 PM, Eric Engestrom
>  wrote:
> > On Sun, Jul 31, 2016 at 05:49:02PM +0200, Jan Ziak wrote:
> >> Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
> >
> > This is a good change, and with a couple things to fix below, it is:
> > Reviewed-by: Eric Engestrom 
> >
> >> +#include 
> >
> > You should add this include to all the files that need it, instead of
> > relying on it to be included by some other include.
> 
> Done.
> 
> >> +   pdp->hasPresent = true;
> >
> > This is a bugfix, unrelated to this refactoring. It should be its own patch.
> > However, I'm not positive it is correct, so it doesn't get my r-b (yet).
> 
> I removed the "pdp->hasPresent = true". The change from "int
> hasPresent" to "bool hasPresent" is still in the patch.
> 
> grep -R "\" shows that the field isn't used anywhere.

Indeed, I guess the field should be removed, but that should be another patch.
Your latest version looks good; I'll look at it again, and r-b it :)

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


Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-02 Thread Nicolai Hähnle

On 01.08.2016 15:21, Jan Ziak wrote:

Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
---
 src/egl/drivers/dri2/egl_dri2.h   | 19 ++-
 src/gallium/auxiliary/vl/vl_winsys_dri3.c |  3 ++-
 src/glx/dri3_priv.h   |  5 +++--
 src/loader/loader.c   |  7 ---
 src/loader/loader.h   |  4 +++-
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 4577875..e406443 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -28,6 +28,7 @@
 #ifndef EGL_DRI2_INCLUDED
 #define EGL_DRI2_INCLUDED

+#include 
 #include 

 #ifdef HAVE_X11_PLATFORM
@@ -160,7 +161,7 @@ struct dri2_egl_display
int   dri2_major;
int   dri2_minor;
__DRIscreen  *dri_screen;
-   int   own_dri_screen;
+   bool  own_dri_screen;
const __DRIconfig   **driver_configs;
void *driver;
const __DRIcoreExtension   *core;
@@ -181,8 +182,8 @@ struct dri2_egl_display
 * dri2_make_current (tracks if there are active contexts/surfaces). */
int   ref_count;

-   int   own_device;
-   int   invalidate_available;
+   bool  own_device;
+   bool  invalidate_available;
int   min_swap_interval;
int   max_swap_interval;
int   default_swap_interval;
@@ -201,7 +202,7 @@ struct dri2_egl_display
 #ifdef HAVE_X11_PLATFORM
xcb_connection_t *conn;
int  screen;
-   int  swap_available;
+   bool swap_available;
 #ifdef HAVE_DRI3
struct loader_dri3_extensions loader_dri3_ext;
 #endif
@@ -214,13 +215,13 @@ struct dri2_egl_display
struct wl_drm*wl_drm;
struct wl_shm*wl_shm;
struct wl_event_queue*wl_queue;
-   int  authenticated;
+   bool  authenticated;
int  formats;
uint32_t  capabilities;
 #endif

-   int  is_render_node;
-   int  is_different_gpu;
+   bool is_render_node;
+   bool is_different_gpu;
 };

 struct dri2_egl_context
@@ -244,7 +245,7 @@ struct dri2_egl_surface
__DRIdrawable   *dri_drawable;
__DRIbuffer  buffers[5];
int  buffer_count;
-   int  have_fake_front;
+   bool have_fake_front;

 #ifdef HAVE_X11_PLATFORM
xcb_drawable_t   drawable;
@@ -282,7 +283,7 @@ struct dri2_egl_surface
 #ifdef HAVE_DRM_PLATFORM
   struct gbm_bo   *bo;
 #endif
-  int locked;
+  boollocked;
   int age;
} color_buffers[4], *back, *current;
 #endif
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 493e645..7cb6c18 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -25,6 +25,7 @@
  *
  **/

+#include 
 #include 

 #include 
@@ -627,7 +628,7 @@ vl_dri3_screen_create(Display *display, int screen)
xcb_dri3_open_reply_t *open_reply;
xcb_get_geometry_cookie_t geom_cookie;
xcb_get_geometry_reply_t *geom_reply;
-   int is_different_gpu;
+   bool is_different_gpu;
int fd;

assert(display);
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index 0822377..bfb0786 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -54,6 +54,7 @@
  *   Kristian Høgsberg (k...@redhat.com)
  */

+#include 
 #include 
 #include 
 #include 
@@ -78,7 +79,7 @@ struct dri3_display
int dri3Minor;

/* Present bits */
-   int hasPresent;
+   bool hasPresent;
int presentMajor;
int presentMinor;
 };
@@ -101,7 +102,7 @@ struct dri3_screen {

void *driver;
int fd;
-   int is_different_gpu;
+   bool is_different_gpu;

int show_fps_interval;

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 56ffc5d..a3b75c7 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -356,7 +356,7 @@ DRI_CONF_BEGIN
 DRI_CONF_END;
 #endif

-int loader_get_user_preferred_fd(int default_fd, int *different_device)
+int loader_get_user_preferred_fd(int default_fd, bool *different_device)
 {
struct udev *udev;
 #ifdef USE_DRICONF
@@ -365,7 +365,8 @@ int loader_get_user_preferred_fd(int default_fd, int 
*different_device)
 #endif
const char *dri_prime = getenv("DRI_PRIME");
char *prime = NULL;
-   int is_different_device = 0, fd = default_fd;
+   bool is_different_device = 0;


It's a good change, but while you're at it, I'd change 0/1 to false/true 
as well where the affected

Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-01 Thread
On Mon, Aug 1, 2016 at 2:46 PM, Eric Engestrom
 wrote:
> On Sun, Jul 31, 2016 at 05:49:02PM +0200, Jan Ziak wrote:
>> Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
>
> This is a good change, and with a couple things to fix below, it is:
> Reviewed-by: Eric Engestrom 
>
>> +#include 
>
> You should add this include to all the files that need it, instead of
> relying on it to be included by some other include.

Done.

>> +   pdp->hasPresent = true;
>
> This is a bugfix, unrelated to this refactoring. It should be its own patch.
> However, I'm not positive it is correct, so it doesn't get my r-b (yet).

I removed the "pdp->hasPresent = true". The change from "int
hasPresent" to "bool hasPresent" is still in the patch.

grep -R "\" shows that the field isn't used anywhere.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-01 Thread Jan Ziak
Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
---
 src/egl/drivers/dri2/egl_dri2.h   | 19 ++-
 src/gallium/auxiliary/vl/vl_winsys_dri3.c |  3 ++-
 src/glx/dri3_priv.h   |  5 +++--
 src/loader/loader.c   |  7 ---
 src/loader/loader.h   |  4 +++-
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 4577875..e406443 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -28,6 +28,7 @@
 #ifndef EGL_DRI2_INCLUDED
 #define EGL_DRI2_INCLUDED
 
+#include 
 #include 
 
 #ifdef HAVE_X11_PLATFORM
@@ -160,7 +161,7 @@ struct dri2_egl_display
int   dri2_major;
int   dri2_minor;
__DRIscreen  *dri_screen;
-   int   own_dri_screen;
+   bool  own_dri_screen;
const __DRIconfig   **driver_configs;
void *driver;
const __DRIcoreExtension   *core;
@@ -181,8 +182,8 @@ struct dri2_egl_display
 * dri2_make_current (tracks if there are active contexts/surfaces). */
int   ref_count;
 
-   int   own_device;
-   int   invalidate_available;
+   bool  own_device;
+   bool  invalidate_available;
int   min_swap_interval;
int   max_swap_interval;
int   default_swap_interval;
@@ -201,7 +202,7 @@ struct dri2_egl_display
 #ifdef HAVE_X11_PLATFORM
xcb_connection_t *conn;
int  screen;
-   int  swap_available;
+   bool swap_available;
 #ifdef HAVE_DRI3
struct loader_dri3_extensions loader_dri3_ext;
 #endif
@@ -214,13 +215,13 @@ struct dri2_egl_display
struct wl_drm*wl_drm;
struct wl_shm*wl_shm;
struct wl_event_queue*wl_queue;
-   int  authenticated;
+   bool  authenticated;
int  formats;
uint32_t  capabilities;
 #endif
 
-   int  is_render_node;
-   int  is_different_gpu;
+   bool is_render_node;
+   bool is_different_gpu;
 };
 
 struct dri2_egl_context
@@ -244,7 +245,7 @@ struct dri2_egl_surface
__DRIdrawable   *dri_drawable;
__DRIbuffer  buffers[5];
int  buffer_count;
-   int  have_fake_front;
+   bool have_fake_front;
 
 #ifdef HAVE_X11_PLATFORM
xcb_drawable_t   drawable;
@@ -282,7 +283,7 @@ struct dri2_egl_surface
 #ifdef HAVE_DRM_PLATFORM
   struct gbm_bo   *bo;
 #endif
-  int locked;
+  boollocked;
   int age;
} color_buffers[4], *back, *current;
 #endif
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 493e645..7cb6c18 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -25,6 +25,7 @@
  *
  **/
 
+#include 
 #include 
 
 #include 
@@ -627,7 +628,7 @@ vl_dri3_screen_create(Display *display, int screen)
xcb_dri3_open_reply_t *open_reply;
xcb_get_geometry_cookie_t geom_cookie;
xcb_get_geometry_reply_t *geom_reply;
-   int is_different_gpu;
+   bool is_different_gpu;
int fd;
 
assert(display);
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index 0822377..bfb0786 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -54,6 +54,7 @@
  *   Kristian Høgsberg (k...@redhat.com)
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -78,7 +79,7 @@ struct dri3_display
int dri3Minor;
 
/* Present bits */
-   int hasPresent;
+   bool hasPresent;
int presentMajor;
int presentMinor;
 };
@@ -101,7 +102,7 @@ struct dri3_screen {
 
void *driver;
int fd;
-   int is_different_gpu;
+   bool is_different_gpu;
 
int show_fps_interval;
 
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 56ffc5d..a3b75c7 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -356,7 +356,7 @@ DRI_CONF_BEGIN
 DRI_CONF_END;
 #endif
 
-int loader_get_user_preferred_fd(int default_fd, int *different_device)
+int loader_get_user_preferred_fd(int default_fd, bool *different_device)
 {
struct udev *udev;
 #ifdef USE_DRICONF
@@ -365,7 +365,8 @@ int loader_get_user_preferred_fd(int default_fd, int 
*different_device)
 #endif
const char *dri_prime = getenv("DRI_PRIME");
char *prime = NULL;
-   int is_different_device = 0, fd = default_fd;
+   bool is_different_device = 0;
+   int fd = default_fd;
char *default_device_id_path_tag;
char *device_name = NULL;
char another_tag = 0;
@@ -441

Re: [Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-08-01 Thread Eric Engestrom
On Sun, Jul 31, 2016 at 05:49:02PM +0200, Jan Ziak wrote:
> Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>

This is a good change, and with a couple things to fix below, it is:
Reviewed-by: Eric Engestrom 

> ---
>  src/egl/drivers/dri2/egl_dri2.h| 19 ++-
>  src/gallium/auxiliary/vl/vl_winsys_dri3.c  |  2 +-
>  src/glx/dri3_glx.c |  1 +
>  src/glx/dri3_priv.h|  4 ++--
>  src/loader/loader.c|  7 ---
>  src/loader/loader.h|  4 +++-
>  6 files changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
> index 4577875..e406443 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -28,6 +28,7 @@
>  #ifndef EGL_DRI2_INCLUDED
>  #define EGL_DRI2_INCLUDED
>  
> +#include 

You should add this include to all the files that need it, instead of
relying on it to be included by some other include.

>  #include 
>  
>  #ifdef HAVE_X11_PLATFORM
> @@ -160,7 +161,7 @@ struct dri2_egl_display
> int   dri2_major;
> int   dri2_minor;
> __DRIscreen  *dri_screen;
> -   int   own_dri_screen;
> +   bool  own_dri_screen;
> const __DRIconfig   **driver_configs;
> void *driver;
> const __DRIcoreExtension   *core;
> @@ -181,8 +182,8 @@ struct dri2_egl_display
>  * dri2_make_current (tracks if there are active contexts/surfaces). */
> int   ref_count;
>  
> -   int   own_device;
> -   int   invalidate_available;
> +   bool  own_device;
> +   bool  invalidate_available;
> int   min_swap_interval;
> int   max_swap_interval;
> int   default_swap_interval;
> @@ -201,7 +202,7 @@ struct dri2_egl_display
>  #ifdef HAVE_X11_PLATFORM
> xcb_connection_t *conn;
> int  screen;
> -   int  swap_available;
> +   bool swap_available;
>  #ifdef HAVE_DRI3
> struct loader_dri3_extensions loader_dri3_ext;
>  #endif
> @@ -214,13 +215,13 @@ struct dri2_egl_display
> struct wl_drm*wl_drm;
> struct wl_shm*wl_shm;
> struct wl_event_queue*wl_queue;
> -   intauthenticated;
> +   bool  authenticated;
> intformats;
> uint32_t  capabilities;
>  #endif
>  
> -   int  is_render_node;
> -   intis_different_gpu;
> +   bool is_render_node;
> +   bool is_different_gpu;
>  };
>  
>  struct dri2_egl_context
> @@ -244,7 +245,7 @@ struct dri2_egl_surface
> __DRIdrawable   *dri_drawable;
> __DRIbuffer  buffers[5];
> int  buffer_count;
> -   int  have_fake_front;
> +   bool have_fake_front;
>  
>  #ifdef HAVE_X11_PLATFORM
> xcb_drawable_t   drawable;
> @@ -282,7 +283,7 @@ struct dri2_egl_surface
>  #ifdef HAVE_DRM_PLATFORM
>struct gbm_bo   *bo;
>  #endif
> -  int locked;
> +  boollocked;
>int age;
> } color_buffers[4], *back, *current;
>  #endif
> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> index 493e645..54a94e8 100644
> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> @@ -627,7 +627,7 @@ vl_dri3_screen_create(Display *display, int screen)
> xcb_dri3_open_reply_t *open_reply;
> xcb_get_geometry_cookie_t geom_cookie;
> xcb_get_geometry_reply_t *geom_reply;
> -   int is_different_gpu;
> +   bool is_different_gpu;
> int fd;
>  
> assert(display);
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index ff16fef..b3c39b1 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -989,6 +989,7 @@ dri3_create_display(Display * dpy)
>free(error);
>goto no_extension;
> }
> +   pdp->hasPresent = true;

This is a bugfix, unrelated to this refactoring. It should be its own patch.
However, I'm not positive it is correct, so it doesn't get my r-b (yet).

Cheers,
  Eric

> pdp->presentMajor = present_reply->major_version;
> pdp->presentMinor = present_reply->minor_version;
> free(present_reply);
> diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
> index 0822377..b4bd694 100644
> --- a/src/glx/dri3_priv.h
> +++ b/src/glx/dri3_priv.h
> @@ -78,7 +78,7 @@ struct dri3_display
> int dri3Minor;
>  
> /* Present bits */
> -   int hasPresent;
> +   bool hasPresent;
> int presentMajor;
> int presentMinor;
>  };
> @@ -

[Mesa-dev] [PATCH] dri: use 'bool' instead 'int' for boolean variables

2016-07-31 Thread Jan Ziak
Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0...@gmail.com>
---
 src/egl/drivers/dri2/egl_dri2.h| 19 ++-
 src/gallium/auxiliary/vl/vl_winsys_dri3.c  |  2 +-
 src/glx/dri3_glx.c |  1 +
 src/glx/dri3_priv.h|  4 ++--
 src/loader/loader.c|  7 ---
 src/loader/loader.h|  4 +++-
 6 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 4577875..e406443 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -28,6 +28,7 @@
 #ifndef EGL_DRI2_INCLUDED
 #define EGL_DRI2_INCLUDED
 
+#include 
 #include 
 
 #ifdef HAVE_X11_PLATFORM
@@ -160,7 +161,7 @@ struct dri2_egl_display
int   dri2_major;
int   dri2_minor;
__DRIscreen  *dri_screen;
-   int   own_dri_screen;
+   bool  own_dri_screen;
const __DRIconfig   **driver_configs;
void *driver;
const __DRIcoreExtension   *core;
@@ -181,8 +182,8 @@ struct dri2_egl_display
 * dri2_make_current (tracks if there are active contexts/surfaces). */
int   ref_count;
 
-   int   own_device;
-   int   invalidate_available;
+   bool  own_device;
+   bool  invalidate_available;
int   min_swap_interval;
int   max_swap_interval;
int   default_swap_interval;
@@ -201,7 +202,7 @@ struct dri2_egl_display
 #ifdef HAVE_X11_PLATFORM
xcb_connection_t *conn;
int  screen;
-   int  swap_available;
+   bool swap_available;
 #ifdef HAVE_DRI3
struct loader_dri3_extensions loader_dri3_ext;
 #endif
@@ -214,13 +215,13 @@ struct dri2_egl_display
struct wl_drm*wl_drm;
struct wl_shm*wl_shm;
struct wl_event_queue*wl_queue;
-   int  authenticated;
+   bool  authenticated;
int  formats;
uint32_t  capabilities;
 #endif
 
-   int  is_render_node;
-   int  is_different_gpu;
+   bool is_render_node;
+   bool is_different_gpu;
 };
 
 struct dri2_egl_context
@@ -244,7 +245,7 @@ struct dri2_egl_surface
__DRIdrawable   *dri_drawable;
__DRIbuffer  buffers[5];
int  buffer_count;
-   int  have_fake_front;
+   bool have_fake_front;
 
 #ifdef HAVE_X11_PLATFORM
xcb_drawable_t   drawable;
@@ -282,7 +283,7 @@ struct dri2_egl_surface
 #ifdef HAVE_DRM_PLATFORM
   struct gbm_bo   *bo;
 #endif
-  int locked;
+  boollocked;
   int age;
} color_buffers[4], *back, *current;
 #endif
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 493e645..54a94e8 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -627,7 +627,7 @@ vl_dri3_screen_create(Display *display, int screen)
xcb_dri3_open_reply_t *open_reply;
xcb_get_geometry_cookie_t geom_cookie;
xcb_get_geometry_reply_t *geom_reply;
-   int is_different_gpu;
+   bool is_different_gpu;
int fd;
 
assert(display);
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index ff16fef..b3c39b1 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -989,6 +989,7 @@ dri3_create_display(Display * dpy)
   free(error);
   goto no_extension;
}
+   pdp->hasPresent = true;
pdp->presentMajor = present_reply->major_version;
pdp->presentMinor = present_reply->minor_version;
free(present_reply);
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index 0822377..b4bd694 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -78,7 +78,7 @@ struct dri3_display
int dri3Minor;
 
/* Present bits */
-   int hasPresent;
+   bool hasPresent;
int presentMajor;
int presentMinor;
 };
@@ -101,7 +101,7 @@ struct dri3_screen {
 
void *driver;
int fd;
-   int is_different_gpu;
+   bool is_different_gpu;
 
int show_fps_interval;
 
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 56ffc5d..a3b75c7 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -356,7 +356,7 @@ DRI_CONF_BEGIN
 DRI_CONF_END;
 #endif
 
-int loader_get_user_preferred_fd(int default_fd, int *different_device)
+int loader_get_user_preferred_fd(int default_fd, bool *different_device)
 {
struct udev *udev;
 #ifdef USE_DRICONF
@@ -365,7 +365,8 @@ int loader_get_user_preferred_fd(int default_fd, int 
*different_device)
 #endif
const char *dri_prime = getenv("DRI_PRIME");
char *prime = NULL;
-