freedreno: C++ fixes for computerator to compile

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22148>
This commit is contained in:
Danylo Piliaiev
2023-03-27 18:48:47 +02:00
committed by Marge Bot
parent 6826a0ab14
commit 1ae595873f
5 changed files with 17 additions and 9 deletions
+2 -2
View File
@@ -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); \
+8
View File
@@ -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__ */
@@ -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]);
}
}
}
@@ -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);
@@ -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;