diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h index 179f0378bc9..dc3a3ff8527 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.h +++ b/src/gallium/drivers/freedreno/freedreno_batch.h @@ -37,6 +37,10 @@ #include "freedreno_fence.h" #include "freedreno_util.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef DEBUG #define BATCH_DEBUG FD_DBG(MSGS) #else @@ -416,12 +420,18 @@ fd_event_write(struct fd_batch *batch, struct fd_ringbuffer *ring, static inline struct fd_ringbuffer * fd_batch_get_epilogue(struct fd_batch *batch) { - if (batch->epilogue == NULL) - batch->epilogue = fd_submit_new_ringbuffer(batch->submit, 0x1000, 0); + if (batch->epilogue == NULL) { + batch->epilogue = fd_submit_new_ringbuffer(batch->submit, 0x1000, + (enum fd_ringbuffer_flags)0); + } return batch->epilogue; } struct fd_ringbuffer *fd_batch_get_prologue(struct fd_batch *batch); +#ifdef __cplusplus +} +#endif + #endif /* FREEDRENO_BATCH_H_ */ diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index e1ce39afcc3..2b0aca64001 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -42,6 +42,10 @@ #include "freedreno_screen.h" #include "freedreno_util.h" +#ifdef __cplusplus +extern "C" { +#endif + #define BORDER_COLOR_UPLOAD_SIZE (2 * PIPE_MAX_SAMPLERS * BORDERCOLOR_SIZE) struct fd_vertex_stateobj; @@ -576,6 +580,19 @@ fd_context_dirty_resource(enum fd_dirty_3d_state dirty) FD_DIRTY_TEX | FD_DIRTY_STREAMOUT); } +#ifdef __cplusplus +#define or_dirty(d, mask) \ + do { \ + decltype(mask) _d = (d); \ + d = (decltype(mask))(_d | (mask)); \ + } while (0) +#else +#define or_dirty(d, mask) \ + do { \ + d |= (mask); \ + } while (0) +#endif + /* Mark specified non-shader-stage related state as dirty: */ static inline void fd_context_dirty(struct fd_context *ctx, enum fd_dirty_3d_state dirty) assert_dt @@ -586,9 +603,9 @@ fd_context_dirty(struct fd_context *ctx, enum fd_dirty_3d_state dirty) assert_dt ctx->gen_dirty |= ctx->gen_dirty_map[ffs(dirty) - 1]; if (fd_context_dirty_resource(dirty)) - dirty |= FD_DIRTY_RESOURCE; + or_dirty(dirty, FD_DIRTY_RESOURCE); - ctx->dirty |= dirty; + or_dirty(ctx->dirty, dirty); } static inline void @@ -612,7 +629,7 @@ fd_context_dirty_shader(struct fd_context *ctx, enum pipe_shader_type shader, ctx->gen_dirty |= ctx->gen_dirty_shader_map[shader][ffs(dirty) - 1]; - ctx->dirty_shader[shader] |= dirty; + or_dirty(ctx->dirty_shader[shader], dirty); fd_context_dirty(ctx, map[ffs(dirty) - 1]); } @@ -621,7 +638,7 @@ static inline void fd_context_all_dirty(struct fd_context *ctx) assert_dt { ctx->last.dirty = true; - ctx->dirty = ~0; + ctx->dirty = (enum fd_dirty_3d_state) ~0; /* NOTE: don't use ~0 for gen_dirty, because the gen specific * emit code will loop over all the bits: @@ -629,14 +646,14 @@ fd_context_all_dirty(struct fd_context *ctx) assert_dt ctx->gen_dirty = ctx->gen_all_dirty; for (unsigned i = 0; i < PIPE_SHADER_TYPES; i++) - ctx->dirty_shader[i] = ~0; + ctx->dirty_shader[i] = (enum fd_dirty_shader_state) ~0; } static inline void fd_context_all_clean(struct fd_context *ctx) assert_dt { ctx->last.dirty = false; - ctx->dirty = 0; + ctx->dirty = (enum fd_dirty_3d_state)0; ctx->gen_dirty = 0; for (unsigned i = 0; i < PIPE_SHADER_TYPES; i++) { /* don't mark compute state as clean, since it is not emitted @@ -646,7 +663,7 @@ fd_context_all_clean(struct fd_context *ctx) assert_dt */ if (i == PIPE_SHADER_COMPUTE) continue; - ctx->dirty_shader[i] = 0; + ctx->dirty_shader[i] = (enum fd_dirty_shader_state)0; } } @@ -710,4 +727,8 @@ struct pipe_context *fd_context_init_tc(struct pipe_context *pctx, void fd_context_destroy(struct pipe_context *pctx) assert_dt; +#ifdef __cplusplus +} +#endif + #endif /* FREEDRENO_CONTEXT_H_ */ diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 064987265c2..66d7f31435f 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -44,6 +44,10 @@ #include "adreno_pm4.xml.h" #include "disasm.h" +#ifdef __cplusplus +extern "C" { +#endif + enum adreno_rb_depth_format fd_pipe2depth(enum pipe_format format); enum pc_di_index_size fd_pipe2index(enum pipe_format format); enum pipe_format fd_gmem_restore_format(enum pipe_format format); @@ -458,7 +462,7 @@ fd4_stage2shadersb(gl_shader_stage type) return SB4_CS_SHADER; default: unreachable("bad shader type"); - return ~0; + return (enum a4xx_state_block) ~0; } } @@ -478,4 +482,8 @@ fd4_size2indextype(unsigned index_size) return INDEX4_SIZE_32_BIT; } +#ifdef __cplusplus +} +#endif + #endif /* FREEDRENO_UTIL_H_ */