diff --git a/src/freedreno/common/freedreno_common.h b/src/freedreno/common/freedreno_common.h index a95d23dce6f..0be4745c3b2 100644 --- a/src/freedreno/common/freedreno_common.h +++ b/src/freedreno/common/freedreno_common.h @@ -116,9 +116,9 @@ struct BitmaskEnum { #endif /* - * swap - swap value of @a and @b + * SWAP - swap value of @a and @b */ -#define swap(a, b) \ +#define SWAP(a, b) \ do { \ __typeof(a) __tmp = (a); \ (a) = (b); \ diff --git a/src/freedreno/ir3/ir3_assembler.h b/src/freedreno/ir3/ir3_assembler.h index 328915e1ae9..6f8e4dde366 100644 --- a/src/freedreno/ir3/ir3_assembler.h +++ b/src/freedreno/ir3/ir3_assembler.h @@ -29,6 +29,10 @@ #define MAX_BUFS 4 +#ifdef __cplusplus +extern "C" { +#endif + struct ir3_kernel_info { uint32_t num_bufs; uint32_t buf_sizes[MAX_BUFS]; /* size in dwords */ @@ -46,4 +50,8 @@ struct ir3_compiler; struct ir3_shader *ir3_parse_asm(struct ir3_compiler *c, struct ir3_kernel_info *info, FILE *in); +#ifdef __cplusplus +} +#endif + #endif /* __IR3_ASSEMBLER_H__ */ diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 20b169869a1..7b579649bd6 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -435,7 +435,7 @@ gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key) for (i = 0; i < gmem->nbins_y; i+=2) { unsigned col0 = gmem->nbins_x * i; for (j = 0; j < gmem->nbins_x/2; j++) { - swap(gmem->tile[col0 + j], gmem->tile[col0 + gmem->nbins_x - j - 1]); + SWAP(gmem->tile[col0 + j], gmem->tile[col0 + gmem->nbins_x - j - 1]); } } } diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index d3baf49407b..2cdadabd2ed 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -452,15 +452,15 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc, DBG("shadow: %p (%d, %p) -> %p (%d, %p)", rsc, rsc->b.b.reference.count, rsc->track, shadow, shadow->b.b.reference.count, shadow->track); - swap(rsc->bo, shadow->bo); - swap(rsc->valid, shadow->valid); + SWAP(rsc->bo, shadow->bo); + SWAP(rsc->valid, shadow->valid); /* swap() doesn't work because you can't typeof() the bitfield. */ bool temp = shadow->needs_ubwc_clear; shadow->needs_ubwc_clear = rsc->needs_ubwc_clear; rsc->needs_ubwc_clear = temp; - swap(rsc->layout, shadow->layout); + SWAP(rsc->layout, shadow->layout); rsc->seqno = seqno_next_u16(&ctx->screen->rsc_seqno); /* at this point, the newly created shadow buffer is not referenced @@ -473,7 +473,7 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc, _mesa_set_remove(batch->resources, entry); _mesa_set_add_pre_hashed(batch->resources, shadow->hash, shadow); } - swap(rsc->track, shadow->track); + SWAP(rsc->track, shadow->track); fd_screen_unlock(ctx->screen); diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index 268b521fa78..295be5a93b8 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -412,10 +412,10 @@ fd_set_viewport_states(struct pipe_context *pctx, unsigned start_slot, /* Handle inverted viewports. */ if (minx > maxx) { - swap(minx, maxx); + SWAP(minx, maxx); } if (miny > maxy) { - swap(miny, maxy); + SWAP(miny, maxy); } const float max_dims = ctx->screen->gen >= 4 ? 16384.f : 4096.f;