summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2016-11-13 15:41:58 +0100
committerAxel Davy <[email protected]>2016-12-20 23:47:08 +0100
commit8a69343f1e8c59137d7b746e5ca8ef1e7944c7d6 (patch)
treeefaa5f4d793793a57d17e706211991f5f4b6af50 /src
parent884166a251ec45f2bfac0139f18b162d31db241e (diff)
st/nine: Add CSMT_NO_WAIT_WITH_COUNTER
Similar to the other macros, but introduces a counter, which enables to know when the instructions has been executed. Signed-off-by: Patrick Rudolph <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/nine/nine_csmt_helper.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/nine_csmt_helper.h b/src/gallium/state_trackers/nine/nine_csmt_helper.h
index 92e5a9f18c9..a4987253bc6 100644
--- a/src/gallium/state_trackers/nine/nine_csmt_helper.h
+++ b/src/gallium/state_trackers/nine/nine_csmt_helper.h
@@ -211,6 +211,60 @@ name( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) \
static void \
name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) )
+#define CSMT_ITEM_NO_WAIT_WITH_COUNTER(name, ...) \
+\
+struct s_##name##_private { \
+ struct csmt_instruction instr; \
+ unsigned *counter; \
+ ARGS_FOR_STRUCT( __VA_ARGS__ ) \
+}; \
+\
+static void \
+name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) ); \
+\
+static int \
+name##_rx( struct NineDevice9 *device, struct csmt_instruction *instr ) \
+{ \
+ struct csmt_context *ctx = device->csmt_ctx; \
+ struct s_##name##_private *args = (struct s_##name##_private *)instr; \
+ \
+ (void) args; \
+ (void) ctx; \
+ name##_priv( \
+ device ARGS_FOR_CALL( __VA_ARGS__ ) \
+ ); \
+ ARGS_FOR_UNBIND( __VA_ARGS__ ) \
+ p_atomic_dec(args->counter); \
+ return 0; \
+} \
+\
+void \
+name( struct NineDevice9 *device, unsigned *counter ARGS_FOR_DECLARATION( __VA_ARGS__ ) ) \
+{ \
+ struct csmt_context *ctx = device->csmt_ctx; \
+ struct s_##name##_private *args; \
+ unsigned memsize = sizeof(struct s_##name##_private); \
+ unsigned memsize2 = 0; \
+ \
+ if (!device->csmt_active) { \
+ name##_priv( \
+ device ARGS_FOR_BYPASS( __VA_ARGS__ ) \
+ ); \
+ return; \
+ } \
+ assert(counter); \
+ p_atomic_inc(counter); \
+ ARGS_FOR_MEM ( __VA_ARGS__ ) \
+ args = nine_queue_alloc(ctx->pool, memsize + memsize2); \
+ assert(args); \
+ args->instr.func = &name##_rx; \
+ args->counter = counter; \
+ ARGS_FOR_ASSIGN( __VA_ARGS__ ) \
+} \
+\
+static void \
+name##_priv( struct NineDevice9 *device ARGS_FOR_DECLARATION( __VA_ARGS__ ) )
+
#define CSMT_ITEM_DO_WAIT(name, ...) \
\
struct s_##name##_private { \