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

View File

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

View File

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

View File

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

View File

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

View File

@@ -726,7 +726,7 @@ dri_get_egl_image(struct pipe_frontend_screen *fscreen,
}
if (!img)
return FALSE;
return false;
stimg->texture = NULL;
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_range = img->sample_range;
return TRUE;
return true;
}
static bool

View File

@@ -90,7 +90,7 @@ struct dri_screen
unsigned int api_mask;
boolean throttle;
bool throttle;
struct st_config_options options;
@@ -99,23 +99,23 @@ struct dri_screen
/* drm */
int fd;
boolean can_share_buffer;
bool can_share_buffer;
struct pipe_loader_device *dev;
/* gallium */
boolean d_depth_bits_last;
boolean sd_depth_bits_last;
boolean auto_fake_front;
boolean has_reset_status_query;
boolean has_protected_context;
bool d_depth_bits_last;
bool sd_depth_bits_last;
bool auto_fake_front;
bool has_reset_status_query;
bool has_protected_context;
enum pipe_texture_target target;
boolean swrast_no_present;
bool swrast_no_present;
/* hooks filled in by dri2 & drisw */
__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);
/* 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,
const struct gl_config *glVis,
GLboolean pixmapBuffer,
bool pixmapBuffer,
void *loaderPrivate);
__DRIbuffer *(*allocate_buffer)(struct dri_screen *screen,
@@ -188,7 +188,7 @@ struct __DRIimageRec {
void *loader_private;
boolean imported_dmabuf;
bool imported_dmabuf;
/**
* Provided by EGL_EXT_image_dma_buf_import.
*/
@@ -200,7 +200,7 @@ struct __DRIimageRec {
struct dri_screen *screen;
};
static inline boolean
static inline bool
dri_with_format(struct dri_screen *screen)
{
const __DRIdri2LoaderExtension *loader = screen->dri2.loader;

View File

@@ -43,7 +43,7 @@
#include "dri_helpers.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
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;
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))
return FALSE;
return false;
if (loader->base.version > 5 && loader->getImageShm2)
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);
return TRUE;
return true;
}
static void
@@ -350,7 +350,7 @@ drisw_allocate_textures(struct dri_context *stctx,
const __DRIswrastLoaderExtension *loader = drawable->screen->swrast_loader;
struct pipe_resource templ;
unsigned width, height;
boolean resized;
bool resized;
unsigned i;
/* 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 *
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,
loaderPrivate);

View File

@@ -59,7 +59,7 @@ extern const __DRIimageExtension driVkImageExtensionSw;
static struct dri_drawable *
kopper_create_drawable(struct dri_screen *screen, const struct gl_config *visual,
boolean isPixmap, void *loaderPrivate);
bool isPixmap, void *loaderPrivate);
static inline void
kopper_invalidate_drawable(__DRIdrawable *dPriv)
@@ -452,7 +452,7 @@ kopper_allocate_textures(struct dri_context *ctx,
struct dri_screen *screen = drawable->screen;
struct pipe_resource templ;
unsigned width, height;
boolean resized;
bool resized;
unsigned i;
struct __DRIimageList images;
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;
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))
return FALSE;
return false;
if (loader->base.version > 5 && loader->getImageShm2)
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);
return TRUE;
return true;
}
static void
@@ -809,7 +809,7 @@ kopper_swap_buffers(struct dri_drawable *drawable);
static struct dri_drawable *
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 */
struct dri_drawable *drawable = dri_create_drawable(screen, visual, false,