[Mesa-dev] [PATCH v2 8/14] anv: generate anv_entrypoints.{h, c} in one command

Emil Velikov emil.l.velikov at gmail.com
Fri Feb 24 14:42:00 UTC 2017


On 24 February 2017 at 11:10, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> On Thursday, 2017-02-23 10:46:21 -0800, Dylan Baker wrote:
>> This changes the python generator to write the files itself, rather than
>> piping them out. This has a couple of advantages: first, it encapsulates
>> the encoding. Second, it ensures that the header file and code file are
>> generated at the same time with the same data.
>>
>> v2: - Update Android.mk
>>
>> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
>> ---
>>  src/intel/vulkan/Android.mk             |  7 +-----
>>  src/intel/vulkan/Makefile.am            |  8 ++----
>>  src/intel/vulkan/anv_entrypoints_gen.py | 33 +++++++++++++-------------
>>  3 files changed, 22 insertions(+), 26 deletions(-)
>>
>> diff --git a/src/intel/vulkan/Android.mk b/src/intel/vulkan/Android.mk
>> index 9dabf1c..df10141 100644
>> --- a/src/intel/vulkan/Android.mk
>> +++ b/src/intel/vulkan/Android.mk
>> @@ -60,8 +60,8 @@ $(intermediates)/dummy.c:
>>       @echo "Gen Dummy: $(PRIVATE_MODULE) <= $(notdir $(@))"
>>       $(hide) touch $@
>>
>> -$(intermediates)/anv_entrypoints.h:
>> -     $(VK_ENTRYPOINTS_SCRIPT) header --xml $(MESA_TOP)/src/vulkan/registry/vk.xml > $@
>> +$(intermediates)/anv_entrypoints.h $(intermediates)/anv_entrypoints.c:
>> +     $(VK_ENTRYPOINTS_SCRIPT) --xml $(MESA_TOP)/src/vulkan/registry/vk.xml
>
> You forgot to add the new argument here.
>

>> -anv_entrypoints.h : anv_entrypoints_gen.py $(vulkan_api_xml)
>> -     $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py header --xml $(vulkan_api_xml) > $@
>> -
>> -anv_entrypoints.c : anv_entrypoints_gen.py $(vulkan_api_xml)
>> -     $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code --xml $(vulkan_api_xml) > $@
>> +anv_entrypoints.h anv_entrypoints.c: anv_entrypoints_gen.py $(vulkan_api_xml)
>
> This will run the script twice, once for anv_entrypoints.h and once for
> anv_entrypoints.c, but the script will write both, both times.
> This also introduces a race condition when using `make -j N`, as it will
> have two threads writing to both files, potentially at the same time.
>
Quick and easy fix is to split roughly like:

anv_entrypoints.h: anv_entrypoints.c
anv_entrypoints.c: anv_entrypoints_gen.py $(vulkan_api_xml)
    ...

Not 100% sure on the above suggestion - someone please correct me.

Yet again, we have this (bug?) rather often so feel free to address it
(and other comment from Eric) as follow-up ?
IMHO the only "blocker" is the missing --outdir in Android.mk

Thanks
Emil


More information about the mesa-dev mailing list