[Mesa-dev] [PATCH mesa 2/2] egl: turn one more boolean `int` into a `bool`

Eric Engestrom eric at engestrom.ch
Sun Jun 18 23:49:11 UTC 2017


Same as the previous commit, but this one was split out because it's
a bit more complicated: this field is given as a pointer to a function,
so the function had to be changed as well, and the function was use in
a bunch of places, which needed updating as well.

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
 src/egl/drivers/dri2/egl_dri2.h           |  2 +-
 src/gallium/auxiliary/vl/vl_winsys_dri3.c |  2 +-
 src/gallium/targets/d3dadapter9/drm.c     |  6 +++---
 src/glx/dri3_priv.h                       |  2 +-
 src/loader/loader.c                       | 10 +++++-----
 src/loader/loader.h                       |  4 +++-
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index bffc63e1e9..3f29e64cdc 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -222,7 +222,7 @@ struct dri2_egl_display
 #endif
 
    bool                      is_render_node;
-   int                       is_different_gpu;
+   bool                      is_different_gpu;
 };
 
 struct dri2_egl_context
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index c7c615b395..8251087f3f 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -89,7 +89,7 @@ struct vl_dri3_screen
    int64_t last_ust, ns_frame, last_msc, next_msc;
 
    bool flushed;
-   int is_different_gpu;
+   bool is_different_gpu;
 };
 
 static void
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index 6163734185..0434d8e4c1 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -204,7 +204,7 @@ drm_create_adapter( int fd,
 {
     struct d3dadapter9drm_context *ctx = CALLOC_STRUCT(d3dadapter9drm_context);
     HRESULT hr;
-    int different_device;
+    bool different_device;
     const struct drm_conf_ret *throttle_ret = NULL;
     const struct drm_conf_ret *dmabuf_ret = NULL;
     driOptionCache defaultInitOptions;
@@ -220,7 +220,7 @@ drm_create_adapter( int fd,
      * takes ownership of it. */
     fd = loader_get_user_preferred_fd(fd, &different_device);
     ctx->fd = fd;
-    ctx->base.linear_framebuffer = !!different_device;
+    ctx->base.linear_framebuffer = different_device;
 
     if (!pipe_loader_drm_probe_fd(&ctx->dev, fd)) {
         ERR("Failed to probe drm fd %d.\n", fd);
@@ -271,7 +271,7 @@ drm_create_adapter( int fd,
     if (driCheckOption(&userInitOptions, "thread_submit", DRI_BOOL))
         ctx->base.thread_submit = driQueryOptionb(&userInitOptions, "thread_submit");
     else
-        ctx->base.thread_submit = !!different_device;
+        ctx->base.thread_submit = different_device;
 
     if (ctx->base.thread_submit && (throttling_value_user == -2 || throttling_value_user == 0)) {
         ctx->base.throttling_value = 0;
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index 082237781c..1d3c03f999 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -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 5541ccc2a7..c3fc961be5 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -153,7 +153,7 @@ static char *drm_get_id_path_tag_for_fd(int fd)
    return tag;
 }
 
-int loader_get_user_preferred_fd(int default_fd, int *different_device)
+int loader_get_user_preferred_fd(int default_fd, bool *different_device)
 {
 /* Arbitrary "maximum" value of drm devices. */
 #define MAX_DRM_DEVICES 32
@@ -171,7 +171,7 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device)
 #endif
 
    if (prime == NULL) {
-      *different_device = 0;
+      *different_device = false;
       return default_fd;
    }
 
@@ -230,16 +230,16 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device)
    return fd;
 
  err:
-   *different_device = 0;
+   *different_device = false;
 
    free(default_tag);
    free(prime);
    return default_fd;
 }
 #else
-int loader_get_user_preferred_fd(int default_fd, int *different_device)
+int loader_get_user_preferred_fd(int default_fd, bool *different_device)
 {
-   *different_device = 0;
+   *different_device = false;
    return default_fd;
 }
 #endif
diff --git a/src/loader/loader.h b/src/loader/loader.h
index 84314a4fc0..3859b45dc4 100644
--- a/src/loader/loader.h
+++ b/src/loader/loader.h
@@ -27,6 +27,8 @@
 #ifndef LOADER_H
 #define LOADER_H
 
+#include <stdbool.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -51,7 +53,7 @@ loader_get_device_name_for_fd(int fd);
  */
 
 int
-loader_get_user_preferred_fd(int default_fd, int *different_device);
+loader_get_user_preferred_fd(int default_fd, bool *different_device);
 
 /* for logging.. keep this aligned with egllog.h so we can just use
  * _eglLog directly.
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list