dri: Replace usage of boolean/TRUE/FALSE with bool/true/false

First do the find/replace in src/gallium/frontends/dri/ folder,
then fixes the compiling errors manually:
Because of this, the prototype of functions in include/GL/internal/dri_interface.h
are changed

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23582>
This commit is contained in:
Yonggang Luo
2023-06-12 13:58:00 +08:00
committed by Marge Bot
parent 7f3874981d
commit 94d827332f
10 changed files with 55 additions and 56 deletions

View File

@@ -40,6 +40,7 @@
#ifndef DRI_INTERFACE_H #ifndef DRI_INTERFACE_H
#define DRI_INTERFACE_H #define DRI_INTERFACE_H
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
/** /**
@@ -1634,8 +1635,8 @@ struct __DRIimageExtensionRec {
* *
* \since 15 * \since 15
*/ */
unsigned char (*queryDmaBufFormats)(__DRIscreen *screen, int max, bool (*queryDmaBufFormats)(__DRIscreen *screen, int max, int *formats,
int *formats, int *count); int *count);
/* /*
* dmabuf format modifier query for a given format to support * dmabuf format modifier query for a given format to support
@@ -1656,10 +1657,9 @@ struct __DRIimageExtensionRec {
* *
* \since 15 * \since 15
*/ */
unsigned char (*queryDmaBufModifiers)(__DRIscreen *screen, int fourcc, bool (*queryDmaBufModifiers)(__DRIscreen *screen, int fourcc, int max,
int max, uint64_t *modifiers, uint64_t *modifiers,
unsigned int *external_only, unsigned int *external_only, int *count);
int *count);
/** /**
* dmabuf format modifier attribute query for a given format and modifier. * dmabuf format modifier attribute query for a given format and modifier.
@@ -1675,11 +1675,9 @@ struct __DRIimageExtensionRec {
* *
* \since 16 * \since 16
*/ */
unsigned char (*queryDmaBufFormatModifierAttribs)(__DRIscreen *screen, bool (*queryDmaBufFormatModifierAttribs)(__DRIscreen *screen,
uint32_t fourcc, uint32_t fourcc, uint64_t modifier,
uint64_t modifier, int attrib, uint64_t *value);
int attrib,
uint64_t *value);
/** /**
* Create a DRI image from the given renderbuffer. * Create a DRI image from the given renderbuffer.

View File

@@ -119,7 +119,7 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
unsigned *count) unsigned *count)
{ {
const __DRIdri2LoaderExtension *loader = drawable->screen->dri2.loader; const __DRIdri2LoaderExtension *loader = drawable->screen->dri2.loader;
boolean with_format; bool with_format;
__DRIbuffer *buffers; __DRIbuffer *buffers;
int num_buffers; int num_buffers;
unsigned attachments[__DRI_BUFFER_COUNT]; unsigned attachments[__DRI_BUFFER_COUNT];
@@ -466,7 +466,7 @@ dri2_allocate_textures(struct dri_context *ctx,
{ {
struct dri_screen *screen = drawable->screen; struct dri_screen *screen = drawable->screen;
struct pipe_resource templ; struct pipe_resource templ;
boolean alloc_depthstencil = FALSE; bool alloc_depthstencil = false;
unsigned i, j, bind; unsigned i, j, bind;
const __DRIimageLoaderExtension *image = screen->image.loader; const __DRIimageLoaderExtension *image = screen->image.loader;
/* Image specific variables */ /* Image specific variables */
@@ -504,7 +504,7 @@ dri2_allocate_textures(struct dri_context *ctx,
/* See if we need a depth-stencil buffer. */ /* See if we need a depth-stencil buffer. */
for (i = 0; i < statts_count; i++) { for (i = 0; i < statts_count; i++) {
if (statts[i] == ST_ATTACHMENT_DEPTH_STENCIL) { if (statts[i] == ST_ATTACHMENT_DEPTH_STENCIL) {
alloc_depthstencil = TRUE; alloc_depthstencil = true;
break; break;
} }
} }
@@ -528,13 +528,13 @@ dri2_allocate_textures(struct dri_context *ctx,
if (drawable->stvis.samples > 1) { if (drawable->stvis.samples > 1) {
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) { for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
boolean del = TRUE; bool del = true;
/* Don't delete MSAA resources for the attachments which are enabled, /* Don't delete MSAA resources for the attachments which are enabled,
* we can reuse them. */ * we can reuse them. */
for (j = 0; j < statts_count; j++) { for (j = 0; j < statts_count; j++) {
if (i == statts[j]) { if (i == statts[j]) {
del = FALSE; del = false;
break; break;
} }
} }
@@ -1131,7 +1131,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
img->dri_components = map->dri_components; img->dri_components = map->dri_components;
img->dri_fourcc = fourcc; img->dri_fourcc = fourcc;
img->dri_format = map->dri_format; img->dri_format = map->dri_format;
img->imported_dmabuf = TRUE; img->imported_dmabuf = true;
exit: exit:
if (error) if (error)
@@ -1625,7 +1625,7 @@ dri2_from_fds2(__DRIscreen *screen, int width, int height, int fourcc,
strides, offsets, bind, NULL, loaderPrivate); strides, offsets, bind, NULL, loaderPrivate);
} }
static boolean static bool
dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max, dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
uint64_t *modifiers, unsigned int *external_only, uint64_t *modifiers, unsigned int *external_only,
int *count) int *count)
@@ -1663,7 +1663,7 @@ dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max,
return false; return false;
} }
static boolean static bool
dri2_query_dma_buf_format_modifier_attribs(__DRIscreen *_screen, dri2_query_dma_buf_format_modifier_attribs(__DRIscreen *_screen,
uint32_t fourcc, uint64_t modifier, uint32_t fourcc, uint64_t modifier,
int attrib, uint64_t *value) int attrib, uint64_t *value)
@@ -2257,7 +2257,7 @@ dri2_init_screen_extensions(struct dri_screen *screen,
static struct dri_drawable * static struct dri_drawable *
dri2_create_drawable(struct dri_screen *screen, const struct gl_config *visual, dri2_create_drawable(struct dri_screen *screen, const struct gl_config *visual,
boolean isPixmap, void *loaderPrivate) bool isPixmap, void *loaderPrivate)
{ {
struct dri_drawable *drawable = dri_create_drawable(screen, visual, isPixmap, struct dri_drawable *drawable = dri_create_drawable(screen, visual, isPixmap,
loaderPrivate); loaderPrivate);

View File

@@ -279,7 +279,7 @@ dri_destroy_context(struct dri_context *ctx)
} }
/* This is called inside MakeCurrent to unbind the context. */ /* This is called inside MakeCurrent to unbind the context. */
GLboolean bool
dri_unbind_context(struct dri_context *ctx) dri_unbind_context(struct dri_context *ctx)
{ {
/* dri_util.c ensures cPriv is not null */ /* dri_util.c ensures cPriv is not null */
@@ -310,7 +310,7 @@ dri_unbind_context(struct dri_context *ctx)
return GL_TRUE; return GL_TRUE;
} }
GLboolean bool
dri_make_current(struct dri_context *ctx, dri_make_current(struct dri_context *ctx,
struct dri_drawable *draw, struct dri_drawable *draw,
struct dri_drawable *read) struct dri_drawable *read)

View File

@@ -96,9 +96,10 @@ opaque_dri_context(struct dri_context *ctx)
*/ */
void dri_destroy_context(struct dri_context *ctx); void dri_destroy_context(struct dri_context *ctx);
boolean dri_unbind_context(struct dri_context *ctx); bool
dri_unbind_context(struct dri_context *ctx);
boolean bool
dri_make_current(struct dri_context *ctx, dri_make_current(struct dri_context *ctx,
struct dri_drawable *draw, struct dri_drawable *draw,
struct dri_drawable *read); struct dri_drawable *read);

View File

@@ -270,7 +270,7 @@ dri2_lookup_egl_image(struct dri_screen *screen, void *handle)
return img; return img;
} }
boolean bool
dri2_validate_egl_image(struct dri_screen *screen, void *handle) dri2_validate_egl_image(struct dri_screen *screen, void *handle)
{ {
const __DRIimageLookupExtension *loader = screen->dri2.image; const __DRIimageLookupExtension *loader = screen->dri2.image;
@@ -698,7 +698,7 @@ dri2_get_pipe_format_for_dri_format(int format)
return PIPE_FORMAT_NONE; return PIPE_FORMAT_NONE;
} }
boolean bool
dri2_yuv_dma_buf_supported(struct dri_screen *screen, dri2_yuv_dma_buf_supported(struct dri_screen *screen,
const struct dri2_format_mapping *map) const struct dri2_format_mapping *map)
{ {
@@ -713,7 +713,7 @@ dri2_yuv_dma_buf_supported(struct dri_screen *screen,
return true; return true;
} }
boolean bool
dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats, dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
int *count) int *count)
{ {

View File

@@ -52,17 +52,17 @@ dri2_get_mapping_by_format(int format);
enum pipe_format enum pipe_format
dri2_get_pipe_format_for_dri_format(int format); dri2_get_pipe_format_for_dri_format(int format);
boolean bool
dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats, dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats,
int *count); int *count);
boolean bool
dri2_yuv_dma_buf_supported(struct dri_screen *screen, dri2_yuv_dma_buf_supported(struct dri_screen *screen,
const struct dri2_format_mapping *map); const struct dri2_format_mapping *map);
__DRIimage * __DRIimage *
dri2_lookup_egl_image(struct dri_screen *screen, void *handle); dri2_lookup_egl_image(struct dri_screen *screen, void *handle);
boolean bool
dri2_validate_egl_image(struct dri_screen *screen, void *handle); dri2_validate_egl_image(struct dri_screen *screen, void *handle);
__DRIimage * __DRIimage *

View File

@@ -726,7 +726,7 @@ dri_get_egl_image(struct pipe_frontend_screen *fscreen,
} }
if (!img) if (!img)
return FALSE; return false;
stimg->texture = NULL; stimg->texture = NULL;
pipe_resource_reference(&stimg->texture, img->texture); pipe_resource_reference(&stimg->texture, img->texture);
@@ -749,7 +749,7 @@ dri_get_egl_image(struct pipe_frontend_screen *fscreen,
stimg->yuv_color_space = img->yuv_color_space; stimg->yuv_color_space = img->yuv_color_space;
stimg->yuv_range = img->sample_range; stimg->yuv_range = img->sample_range;
return TRUE; return true;
} }
static bool static bool

View File

@@ -90,7 +90,7 @@ struct dri_screen
unsigned int api_mask; unsigned int api_mask;
boolean throttle; bool throttle;
struct st_config_options options; struct st_config_options options;
@@ -99,23 +99,23 @@ struct dri_screen
/* drm */ /* drm */
int fd; int fd;
boolean can_share_buffer; bool can_share_buffer;
struct pipe_loader_device *dev; struct pipe_loader_device *dev;
/* gallium */ /* gallium */
boolean d_depth_bits_last; bool d_depth_bits_last;
boolean sd_depth_bits_last; bool sd_depth_bits_last;
boolean auto_fake_front; bool auto_fake_front;
boolean has_reset_status_query; bool has_reset_status_query;
boolean has_protected_context; bool has_protected_context;
enum pipe_texture_target target; enum pipe_texture_target target;
boolean swrast_no_present; bool swrast_no_present;
/* hooks filled in by dri2 & drisw */ /* hooks filled in by dri2 & drisw */
__DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle); __DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle);
boolean (*validate_egl_image)(struct dri_screen *ctx, void *handle); bool (*validate_egl_image)(struct dri_screen *ctx, void *handle);
__DRIimage * (*lookup_egl_image_validated)(struct dri_screen *ctx, void *handle); __DRIimage * (*lookup_egl_image_validated)(struct dri_screen *ctx, void *handle);
/* DRI exts that vary based on gallium pipe_screen caps. */ /* DRI exts that vary based on gallium pipe_screen caps. */
@@ -140,7 +140,7 @@ struct dri_screen
struct dri_drawable *(*create_drawable)(struct dri_screen *screen, struct dri_drawable *(*create_drawable)(struct dri_screen *screen,
const struct gl_config *glVis, const struct gl_config *glVis,
GLboolean pixmapBuffer, bool pixmapBuffer,
void *loaderPrivate); void *loaderPrivate);
__DRIbuffer *(*allocate_buffer)(struct dri_screen *screen, __DRIbuffer *(*allocate_buffer)(struct dri_screen *screen,
@@ -188,7 +188,7 @@ struct __DRIimageRec {
void *loader_private; void *loader_private;
boolean imported_dmabuf; bool imported_dmabuf;
/** /**
* Provided by EGL_EXT_image_dma_buf_import. * Provided by EGL_EXT_image_dma_buf_import.
*/ */
@@ -200,7 +200,7 @@ struct __DRIimageRec {
struct dri_screen *screen; struct dri_screen *screen;
}; };
static inline boolean static inline bool
dri_with_format(struct dri_screen *screen) dri_with_format(struct dri_screen *screen)
{ {
const __DRIdri2LoaderExtension *loader = screen->dri2.loader; const __DRIdri2LoaderExtension *loader = screen->dri2.loader;

View File

@@ -43,7 +43,7 @@
#include "dri_helpers.h" #include "dri_helpers.h"
#include "dri_query_renderer.h" #include "dri_query_renderer.h"
DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", FALSE); DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", false);
static inline void static inline void
get_drawable_info(struct dri_drawable *drawable, int *x, int *y, int *w, int *h) get_drawable_info(struct dri_drawable *drawable, int *x, int *y, int *w, int *h)
@@ -128,16 +128,16 @@ get_image_shm(struct dri_drawable *drawable, int x, int y, int width, int height
whandle.type = WINSYS_HANDLE_TYPE_SHMID; whandle.type = WINSYS_HANDLE_TYPE_SHMID;
if (loader->base.version < 4 || !loader->getImageShm) if (loader->base.version < 4 || !loader->getImageShm)
return FALSE; return false;
if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE)) if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE))
return FALSE; return false;
if (loader->base.version > 5 && loader->getImageShm2) if (loader->base.version > 5 && loader->getImageShm2)
return loader->getImageShm2(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate); return loader->getImageShm2(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
loader->getImageShm(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate); loader->getImageShm(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
return TRUE; return true;
} }
static void static void
@@ -350,7 +350,7 @@ drisw_allocate_textures(struct dri_context *stctx,
const __DRIswrastLoaderExtension *loader = drawable->screen->swrast_loader; const __DRIswrastLoaderExtension *loader = drawable->screen->swrast_loader;
struct pipe_resource templ; struct pipe_resource templ;
unsigned width, height; unsigned width, height;
boolean resized; bool resized;
unsigned i; unsigned i;
/* Wait for glthread to finish because we can't use pipe_context from /* Wait for glthread to finish because we can't use pipe_context from
@@ -522,7 +522,7 @@ static const struct drisw_loader_funcs drisw_shm_lf = {
static struct dri_drawable * static struct dri_drawable *
drisw_create_drawable(struct dri_screen *screen, const struct gl_config * visual, drisw_create_drawable(struct dri_screen *screen, const struct gl_config * visual,
boolean isPixmap, void *loaderPrivate) bool isPixmap, void *loaderPrivate)
{ {
struct dri_drawable *drawable = dri_create_drawable(screen, visual, isPixmap, struct dri_drawable *drawable = dri_create_drawable(screen, visual, isPixmap,
loaderPrivate); loaderPrivate);

View File

@@ -59,7 +59,7 @@ extern const __DRIimageExtension driVkImageExtensionSw;
static struct dri_drawable * static struct dri_drawable *
kopper_create_drawable(struct dri_screen *screen, const struct gl_config *visual, kopper_create_drawable(struct dri_screen *screen, const struct gl_config *visual,
boolean isPixmap, void *loaderPrivate); bool isPixmap, void *loaderPrivate);
static inline void static inline void
kopper_invalidate_drawable(__DRIdrawable *dPriv) kopper_invalidate_drawable(__DRIdrawable *dPriv)
@@ -452,7 +452,7 @@ kopper_allocate_textures(struct dri_context *ctx,
struct dri_screen *screen = drawable->screen; struct dri_screen *screen = drawable->screen;
struct pipe_resource templ; struct pipe_resource templ;
unsigned width, height; unsigned width, height;
boolean resized; bool resized;
unsigned i; unsigned i;
struct __DRIimageList images; struct __DRIimageList images;
const __DRIimageLoaderExtension *image = screen->image.loader; const __DRIimageLoaderExtension *image = screen->image.loader;
@@ -741,16 +741,16 @@ get_image_shm(struct dri_drawable *drawable, int x, int y, int width, int height
whandle.type = WINSYS_HANDLE_TYPE_SHMID; whandle.type = WINSYS_HANDLE_TYPE_SHMID;
if (loader->base.version < 4 || !loader->getImageShm) if (loader->base.version < 4 || !loader->getImageShm)
return FALSE; return false;
if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE)) if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE))
return FALSE; return false;
if (loader->base.version > 5 && loader->getImageShm2) if (loader->base.version > 5 && loader->getImageShm2)
return loader->getImageShm2(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate); return loader->getImageShm2(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
loader->getImageShm(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate); loader->getImageShm(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
return TRUE; return true;
} }
static void static void
@@ -809,7 +809,7 @@ kopper_swap_buffers(struct dri_drawable *drawable);
static struct dri_drawable * static struct dri_drawable *
kopper_create_drawable(struct dri_screen *screen, const struct gl_config *visual, kopper_create_drawable(struct dri_screen *screen, const struct gl_config *visual,
boolean isPixmap, void *loaderPrivate) bool isPixmap, void *loaderPrivate)
{ {
/* always pass !pixmap because it isn't "handled" or relevant */ /* always pass !pixmap because it isn't "handled" or relevant */
struct dri_drawable *drawable = dri_create_drawable(screen, visual, false, struct dri_drawable *drawable = dri_create_drawable(screen, visual, false,