[Mesa-dev] [PATCH] i965: make emit_dwords non-static and reuse it in blorp

Emil Velikov emil.l.velikov at gmail.com
Fri May 5 17:10:54 UTC 2017


On 5 May 2017 at 17:20, Rafael Antognolli <rafael.antognolli at intel.com> wrote:
> On Fri, May 05, 2017 at 11:47:09AM +0100, Emil Velikov wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>> ---
>>  src/mesa/drivers/dri/i965/brw_state.h         |  1 +
>>  src/mesa/drivers/dri/i965/genX_blorp_exec.c   |  6 +----
>>  src/mesa/drivers/dri/i965/genX_state_upload.c | 32 +++++++++++++--------------
>>  3 files changed, 18 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
>> index d2d3d7c2c0d..06052fc9b02 100644
>> --- a/src/mesa/drivers/dri/i965/brw_state.h
>> +++ b/src/mesa/drivers/dri/i965/brw_state.h
>> @@ -357,6 +357,7 @@ void brw_copy_pipeline_atoms(struct brw_context *brw,
>>                               enum brw_pipeline pipeline,
>>                               const struct brw_tracked_state **atoms,
>>                               int num_atoms);
>> +void *brw_emit_dwords(struct brw_context *brw, unsigned n);
>>  void gen4_init_atoms(struct brw_context *brw);
>>  void gen45_init_atoms(struct brw_context *brw);
>>  void gen5_init_atoms(struct brw_context *brw);
>> diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
>> index 7157420328f..0a93c31334a 100644
>> --- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
>> +++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
>> @@ -40,11 +40,7 @@ blorp_emit_dwords(struct blorp_batch *batch, unsigned n)
>>     assert(batch->blorp->driver_ctx == batch->driver_batch);
>>     struct brw_context *brw = batch->driver_batch;
>>
>> -   intel_batchbuffer_begin(brw, n, RENDER_RING);
>> -   uint32_t *map = brw->batch.map_next;
>> -   brw->batch.map_next += n;
>> -   intel_batchbuffer_advance(brw);
>> -   return map;
>> +   return brw_emit_dwords(brw, n);
>>  }
>>
>>  static uint64_t
>> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
>> index ceeacfcdef7..4e8cf4f6b06 100644
>> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
>> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
>> @@ -55,8 +55,8 @@
>>  #include "main/transformfeedback.h"
>>  #include "main/viewport.h"
>>
>> -UNUSED static void *
>> -emit_dwords(struct brw_context *brw, unsigned n)
>> +void *
>> +brw_emit_dwords(struct brw_context *brw, unsigned n)
>>  {
>
> Hi Emil,
>
> This is going to cause several brw_emit_dwords() symbols to be exposed
> (one for gen4, one for gen45, one for gen5,... one for gen9). And
> consequently, the build fails because of the multiple definitions.
>
> Assuming you want to really expose this function several times, you
> should use genX(emit_dwords)(...), which would generate
> gen4_emit_dwords() and all the others.
>
> That said, imho it would be better to move this function outside of this
> file and have only one version of it.
>
Thanks Rafael - you're spot on. As-is there'll be multiple definitions
and moving the function is the right thing to do.
I'll move it to intel_batchbuffer.c some time next week. Barring any objections.

-Emil


More information about the mesa-dev mailing list