From 60f984262c4d4c3c3828eb2eec3dc07c63922ece Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 19 Jun 2017 00:16:21 +0100 Subject: [PATCH 1/1] egl: turn boolean `int`s into `bool`s Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov --- src/egl/drivers/dri2/egl_dri2.c | 2 +- src/egl/drivers/dri2/egl_dri2.h | 17 +++++++++-------- src/egl/drivers/dri2/platform_drm.c | 6 +++--- src/egl/drivers/dri2/platform_wayland.c | 20 ++++++++++---------- src/egl/drivers/dri2/platform_x11.c | 4 ++-- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 020a0bc6394..fd7584f7ab6 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -783,7 +783,7 @@ dri2_create_screen(_EGLDisplay *disp) return EGL_FALSE; } - dri2_dpy->own_dri_screen = 1; + dri2_dpy->own_dri_screen = true; return EGL_TRUE; } diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index f8c26a9d45e..bffc63e1e94 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 @@ -158,7 +159,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; @@ -179,8 +180,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; @@ -196,7 +197,7 @@ struct dri2_egl_display #ifdef HAVE_X11_PLATFORM xcb_connection_t *conn; xcb_screen_t *screen; - int swap_available; + bool swap_available; #ifdef HAVE_DRI3 struct loader_dri3_extensions loader_dri3_ext; #endif @@ -210,7 +211,7 @@ 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; char *device_name; @@ -220,7 +221,7 @@ struct dri2_egl_display const gralloc_module_t *gralloc; #endif - int is_render_node; + bool is_render_node; int is_different_gpu; }; @@ -245,7 +246,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; @@ -287,7 +288,7 @@ struct dri2_egl_surface #ifdef HAVE_DRM_PLATFORM struct gbm_bo *bo; #endif - int locked; + bool locked; int age; } color_buffers[4], *back, *current; #endif diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 8b0562c75d2..2cf7106255f 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -56,7 +56,7 @@ lock_front_buffer(struct gbm_surface *_surf) bo = dri2_surf->current->bo; if (device->dri2) { - dri2_surf->current->locked = 1; + dri2_surf->current->locked = true; dri2_surf->current = NULL; } @@ -72,7 +72,7 @@ release_buffer(struct gbm_surface *_surf, struct gbm_bo *bo) for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { if (dri2_surf->color_buffers[i].bo == bo) { - dri2_surf->color_buffers[i].locked = 0; + dri2_surf->color_buffers[i].locked = false; } } } @@ -696,7 +696,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) err = "DRI2: failed to create gbm device"; goto cleanup; } - dri2_dpy->own_device = 1; + dri2_dpy->own_device = true; } else { dri2_dpy->fd = fcntl(gbm_device_get_fd(gbm), F_DUPFD_CLOEXEC, 3); if (dri2_dpy->fd < 0) { diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index f746f0bfd1c..1444449e8c5 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -76,7 +76,7 @@ wl_buffer_release(void *data, struct wl_buffer *buffer) return; } - dri2_surf->color_buffers[i].locked = 0; + dri2_surf->color_buffers[i].locked = false; } static const struct wl_buffer_listener wl_buffer_listener = { @@ -314,7 +314,7 @@ dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf) dri2_surf->color_buffers[i].dri_image = NULL; dri2_surf->color_buffers[i].linear_copy = NULL; dri2_surf->color_buffers[i].data = NULL; - dri2_surf->color_buffers[i].locked = 0; + dri2_surf->color_buffers[i].locked = false; } if (dri2_dpy->dri2) { @@ -410,7 +410,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) if (dri2_surf->back->dri_image == NULL) return -1; - dri2_surf->back->locked = 1; + dri2_surf->back->locked = true; return 0; } @@ -908,7 +908,7 @@ dri2_wl_authenticate(_EGLDisplay *disp, uint32_t id) "authenticate for render-nodes"); return 0; } - dri2_dpy->authenticated = 0; + dri2_dpy->authenticated = false; wl_drm_authenticate(dri2_dpy->wl_drm, id); if (roundtrip(dri2_dpy) < 0) @@ -918,7 +918,7 @@ dri2_wl_authenticate(_EGLDisplay *disp, uint32_t id) ret = -1; /* reset authenticated */ - dri2_dpy->authenticated = 1; + dri2_dpy->authenticated = true; return ret; } @@ -941,7 +941,7 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device) } if (drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER) { - dri2_dpy->authenticated = 1; + dri2_dpy->authenticated = true; } else { drmGetMagic(dri2_dpy->fd, &magic); wl_drm_authenticate(dri2_dpy->wl_drm, magic); @@ -979,7 +979,7 @@ drm_handle_authenticated(void *data, struct wl_drm *drm) { struct dri2_egl_display *dri2_dpy = data; - dri2_dpy->authenticated = 1; + dri2_dpy->authenticated = true; } static const struct wl_drm_listener drm_listener = { @@ -1164,7 +1164,7 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp) dri2_dpy->wl_dpy = wl_display_connect(NULL); if (dri2_dpy->wl_dpy == NULL) goto cleanup; - dri2_dpy->own_device = 1; + dri2_dpy->own_device = true; } else { dri2_dpy->wl_dpy = disp->PlatformDisplay; } @@ -1526,7 +1526,7 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf) return -1; } - dri2_surf->back->locked = 1; + dri2_surf->back->locked = true; /* If we have an extra unlocked buffer at this point, we had to do triple * buffering for a while, but now can go back to just double buffering. @@ -1814,7 +1814,7 @@ dri2_initialize_wayland_swrast(_EGLDriver *drv, _EGLDisplay *disp) dri2_dpy->wl_dpy = wl_display_connect(NULL); if (dri2_dpy->wl_dpy == NULL) goto cleanup; - dri2_dpy->own_device = 1; + dri2_dpy->own_device = true; } else { dri2_dpy->wl_dpy = disp->PlatformDisplay; } diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 74d3a164b6a..95e560a32a6 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -445,7 +445,7 @@ dri2_x11_process_buffers(struct dri2_egl_surface *dri2_surf, unsigned i; dri2_surf->buffer_count = count; - dri2_surf->have_fake_front = 0; + dri2_surf->have_fake_front = false; /* This assumes the DRI2 buffer attachment tokens matches the * __DRIbuffer tokens. */ @@ -462,7 +462,7 @@ dri2_x11_process_buffers(struct dri2_egl_surface *dri2_surf, * Note that EGL doesn't require that several clients rendering * to the same window must see the same aux buffers. */ if (dri2_surf->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) - dri2_surf->have_fake_front = 1; + dri2_surf->have_fake_front = true; } if (dri2_surf->region != XCB_NONE) -- 2.30.2