Re: [Mesa-dev] [PATCH 02/18] anv: Add a new block-based batch emit macro
Hi Jason, stupid optional nitpick , but could you go for anv_batch_emit_block? Normally abbreviations below 3 characters aren't really worth it. Michael Am 19/04/2016 um 02:10 schrieb Jason Ekstrand: > This new macro uses a for loop to create an actual code block in which to > place the macro setup code. One advantage of this is that you syntatically > use braces instead of parentheses. Another is that the code in the block > doesn't even get executed if anv_batch_emit_dwords fails. > --- > src/intel/vulkan/anv_private.h | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h > index ae2e08d..d59b7ed 100644 > --- a/src/intel/vulkan/anv_private.h > +++ b/src/intel/vulkan/anv_private.h > @@ -861,6 +861,15 @@ __gen_combine_address(struct anv_batch *batch, void > *location, >VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\ > } while (0) > > +#define anv_batch_emit_blk(batch, cmd, name)\ > + for (struct cmd name = { __anv_cmd_header(cmd) },\ > +*_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd));\ > +__builtin_expect(_dst != NULL, 1); \ > +({ __anv_cmd_pack(cmd)(batch, _dst, &name); \ > + VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) * > 4)); \ > + _dst = NULL; \ > + })) > + > #define anv_state_pool_emit(pool, cmd, align, ...) ({ \ >const uint32_t __size = __anv_cmd_length(cmd) * 4;\ >struct anv_state __state =\ > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/18] anv: Add a new block-based batch emit macro
On Mon, Apr 18, 2016 at 11:53 PM, Michael Schellenberger Costa < mschellenbergerco...@googlemail.com> wrote: > Hi Jason, > > stupid optional nitpick , but could you go for anv_batch_emit_block? > Normally abbreviations below 3 characters aren't really worth it. > Given that the last two patches delete the old one and rename the new one to anv_batch_emit, I don't think it matters. > Michael > > Am 19/04/2016 um 02:10 schrieb Jason Ekstrand: > > This new macro uses a for loop to create an actual code block in which to > > place the macro setup code. One advantage of this is that you > syntatically > > use braces instead of parentheses. Another is that the code in the block > > doesn't even get executed if anv_batch_emit_dwords fails. > > --- > > src/intel/vulkan/anv_private.h | 9 + > > 1 file changed, 9 insertions(+) > > > > diff --git a/src/intel/vulkan/anv_private.h > b/src/intel/vulkan/anv_private.h > > index ae2e08d..d59b7ed 100644 > > --- a/src/intel/vulkan/anv_private.h > > +++ b/src/intel/vulkan/anv_private.h > > @@ -861,6 +861,15 @@ __gen_combine_address(struct anv_batch *batch, void > *location, > >VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\ > > } while (0) > > > > +#define anv_batch_emit_blk(batch, cmd, name) > \ > > + for (struct cmd name = { __anv_cmd_header(cmd) }, > \ > > +*_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd)); > \ > > +__builtin_expect(_dst != NULL, 1); > \ > > +({ __anv_cmd_pack(cmd)(batch, _dst, &name); > \ > > + VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) > * 4)); \ > > + _dst = NULL; > \ > > + })) > > + > > #define anv_state_pool_emit(pool, cmd, align, ...) ({ > \ > >const uint32_t __size = __anv_cmd_length(cmd) * 4; > \ > >struct anv_state __state = > \ > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/18] anv: Add a new block-based batch emit macro
On 04/18/2016 05:19 PM, Ian Romanick wrote: > On 04/18/2016 05:10 PM, Jason Ekstrand wrote: >> This new macro uses a for loop to create an actual code block in which to >> place the macro setup code. One advantage of this is that you syntatically > syntactically > >> use braces instead of parentheses. Another is that the code in the block >> doesn't even get executed if anv_batch_emit_dwords fails. > > Is the old anv_batch_emit eventually removed? Yes, you fool. That's patch 17. >> --- >> src/intel/vulkan/anv_private.h | 9 + >> 1 file changed, 9 insertions(+) >> >> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h >> index ae2e08d..d59b7ed 100644 >> --- a/src/intel/vulkan/anv_private.h >> +++ b/src/intel/vulkan/anv_private.h >> @@ -861,6 +861,15 @@ __gen_combine_address(struct anv_batch *batch, void >> *location, >>VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\ >> } while (0) >> >> +#define anv_batch_emit_blk(batch, cmd, name)\ >> + for (struct cmd name = { __anv_cmd_header(cmd) },\ >> +*_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd));\ >> +__builtin_expect(_dst != NULL, 1); \ >> +({ __anv_cmd_pack(cmd)(batch, _dst, &name); \ >> + VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) * >> 4)); \ >> + _dst = NULL; \ >> + })) >> + >> #define anv_state_pool_emit(pool, cmd, align, ...) ({ \ >>const uint32_t __size = __anv_cmd_length(cmd) * 4;\ >>struct anv_state __state =\ >> > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/18] anv: Add a new block-based batch emit macro
On 04/18/2016 05:10 PM, Jason Ekstrand wrote: > This new macro uses a for loop to create an actual code block in which to > place the macro setup code. One advantage of this is that you syntatically syntactically > use braces instead of parentheses. Another is that the code in the block > doesn't even get executed if anv_batch_emit_dwords fails. Is the old anv_batch_emit eventually removed? > --- > src/intel/vulkan/anv_private.h | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h > index ae2e08d..d59b7ed 100644 > --- a/src/intel/vulkan/anv_private.h > +++ b/src/intel/vulkan/anv_private.h > @@ -861,6 +861,15 @@ __gen_combine_address(struct anv_batch *batch, void > *location, >VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\ > } while (0) > > +#define anv_batch_emit_blk(batch, cmd, name)\ > + for (struct cmd name = { __anv_cmd_header(cmd) },\ > +*_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd));\ > +__builtin_expect(_dst != NULL, 1); \ > +({ __anv_cmd_pack(cmd)(batch, _dst, &name); \ > + VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) * > 4)); \ > + _dst = NULL; \ > + })) > + > #define anv_state_pool_emit(pool, cmd, align, ...) ({ \ >const uint32_t __size = __anv_cmd_length(cmd) * 4;\ >struct anv_state __state =\ > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/18] anv: Add a new block-based batch emit macro
This new macro uses a for loop to create an actual code block in which to place the macro setup code. One advantage of this is that you syntatically use braces instead of parentheses. Another is that the code in the block doesn't even get executed if anv_batch_emit_dwords fails. --- src/intel/vulkan/anv_private.h | 9 + 1 file changed, 9 insertions(+) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index ae2e08d..d59b7ed 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -861,6 +861,15 @@ __gen_combine_address(struct anv_batch *batch, void *location, VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\ } while (0) +#define anv_batch_emit_blk(batch, cmd, name)\ + for (struct cmd name = { __anv_cmd_header(cmd) },\ +*_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd));\ +__builtin_expect(_dst != NULL, 1); \ +({ __anv_cmd_pack(cmd)(batch, _dst, &name); \ + VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) * 4)); \ + _dst = NULL; \ + })) + #define anv_state_pool_emit(pool, cmd, align, ...) ({ \ const uint32_t __size = __anv_cmd_length(cmd) * 4;\ struct anv_state __state =\ -- 2.5.0.400.gff86faf ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev