summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_cl.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-12-11 14:59:17 -0800
committerEric Anholt <[email protected]>2017-06-30 12:25:45 -0700
commit8d36bd3d086f2a3ab76b06ca21f3b1b2d12f7277 (patch)
treef5fbc0cfbadeb6d2ea4ff4f9abbe4f232da7b41c /src/gallium/drivers/vc4/vc4_cl.h
parent4cef255872e8467aabce52938038a9d2bf27d9b2 (diff)
vc4: Simplify pack header usage
Take the CL pointer in, which will be useful for enabling relocs. However, our code expands a bit more: before: 4449 0 0 4449 1161 src/gallium/drivers/vc4/.libs/vc4_draw.o 988 0 0 988 3dc src/gallium/drivers/vc4/.libs/vc4_emit.o after: 4481 0 0 4481 1181 src/gallium/drivers/vc4/.libs/vc4_draw.o 1020 0 0 1020 3fc src/gallium/drivers/vc4/.libs/vc4_emit.o
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_cl.h')
-rw-r--r--src/gallium/drivers/vc4/vc4_cl.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_cl.h b/src/gallium/drivers/vc4/vc4_cl.h
index bec177cd03b..966756f5038 100644
--- a/src/gallium/drivers/vc4/vc4_cl.h
+++ b/src/gallium/drivers/vc4/vc4_cl.h
@@ -255,17 +255,20 @@ cl_get_emit_space(struct vc4_cl_out **cl, size_t size)
* Also, *dst is actually of the wrong type, it's the
* uint8_t[cl_packet_length()] in the CL, not a cl_packet_struct(packet).
*/
-#define cl_emit(cl_out, packet, name) \
+#define cl_emit(cl, packet, name) \
for (struct cl_packet_struct(packet) name = { \
cl_packet_header(packet) \
}, \
- *_dst = cl_get_emit_space(cl_out, cl_packet_length(packet)); \
- __builtin_expect(_dst != NULL, 1); \
+ *_loop_terminate = &name; \
+ __builtin_expect(_loop_terminate != NULL, 1); \
({ \
- cl_packet_pack(packet)(NULL, (uint8_t *)_dst, &name); \
- VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, \
+ struct vc4_cl_out *cl_out = cl_start(cl); \
+ cl_packet_pack(packet)(cl, (uint8_t *)cl_out, &name); \
+ VG(VALGRIND_CHECK_MEM_IS_DEFINED(cl_out, \
cl_packet_length(packet))); \
- _dst = NULL; \
+ cl_advance(&cl_out, cl_packet_length(packet)); \
+ cl_end(cl, cl_out); \
+ _loop_terminate = NULL; \
})) \
#endif /* VC4_CL_H */