[Mesa-dev] [Mesa-stable] [PATCH 1/2] meson/swr: re-shuffle generated files

Dylan Baker dylan at pnwbakers.com
Thu Feb 1 17:33:06 UTC 2018


With the below nits fixed, for the series:
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

Quoting George Kyriazis (2018-02-01 08:54:14)
> Move generated files from codegen/meson.build to other directories, in order
> to satisfy generated include file dependencies
> 
> Add correct file lists for architecture-specific libraries.
> 
> cc: mesa-stable at lists.freedesktop.org
> cc: dylan at pnwbakers.com
> ---
>  src/gallium/drivers/swr/meson.build                | 10 +--
>  .../drivers/swr/rasterizer/codegen/meson.build     | 76 ----------------------
>  .../swr/rasterizer/core/backends/meson.build       | 63 ++++++++++++++++++
>  .../drivers/swr/rasterizer/jitter/meson.build      | 56 ++++++++++++++++
>  4 files changed, 125 insertions(+), 80 deletions(-)
>  create mode 100644 src/gallium/drivers/swr/rasterizer/core/backends/meson.build
>  create mode 100644 src/gallium/drivers/swr/rasterizer/jitter/meson.build
> 
> diff --git a/src/gallium/drivers/swr/meson.build b/src/gallium/drivers/swr/meson.build
> index ae86c8e..c61fd73 100644
> --- a/src/gallium/drivers/swr/meson.build
> +++ b/src/gallium/drivers/swr/meson.build
> @@ -151,7 +151,9 @@ files_swr_arch = files(
>  swr_context_files = files('swr_context.h')
>  swr_state_files = files('rasterizer/core/state.h')
>  swr_event_proto_files = files('rasterizer/archrast/events.proto')
> +subdir('rasterizer/jitter')
>  subdir('rasterizer/codegen')
> +subdir('rasterizer/core/backends')
>  
>  swr_incs = include_directories(
>    'rasterizer/codegen', 'rasterizer/core', 'rasterizer/jitter',
> @@ -180,7 +182,7 @@ if with_swr_arches.contains('avx')
>    swr_arch_defines += '-DHAVE_SWR_AVX'
>    swr_arch_libs += shared_library(
>      'swrAVX',
> -    files_swr_common,
> +    [files_swr_common, files_swr_arch],
>      cpp_args : [swr_cpp_args, swr_avx_args, '-DKNOB_ARCH=KNOB_ARCH_AVX'],
>      link_args : [ld_args_gc_sections],
>      include_directories : [swr_incs],
> @@ -212,7 +214,7 @@ if with_swr_arches.contains('avx2')
>    swr_arch_defines += '-DHAVE_SWR_AVX2'
>    swr_arch_libs += shared_library(
>      'swrAVX2',
> -    files_swr_common,
> +    [files_swr_common, files_swr_arch],
>      cpp_args : [swr_cpp_args, swr_avx2_args, '-DKNOB_ARCH=KNOB_ARCH_AVX2'],
>      link_args : [ld_args_gc_sections],
>      include_directories : [swr_incs],
> @@ -236,7 +238,7 @@ if with_swr_arches.contains('knl')
>    swr_arch_defines += '-DHAVE_SWR_KNL'
>    swr_arch_libs += shared_library(
>      'swrKNL',
> -    files_swr_common,
> +    [files_swr_common, files_swr_arch],
>      cpp_args : [
>        swr_cpp_args, swr_knl_args, '-DKNOB_ARCH=KNOB_ARCH_AVX512',
>        '-DKNOB_ARCH_KNIGHTS',
> @@ -263,7 +265,7 @@ if with_swr_arches.contains('skx')
>    swr_arch_defines += '-DHAVE_SWR_SKX'
>    swr_arch_libs += shared_library(
>      'swrSKX',
> -    files_swr_common,
> +    [files_swr_common, files_swr_arch],
>      cpp_args : [swr_cpp_args, swr_skx_args, '-DKNOB_ARCH=KNOB_ARCH_AVX512'],
>      link_args : [ld_args_gc_sections],
>      include_directories : [swr_incs],
> diff --git a/src/gallium/drivers/swr/rasterizer/codegen/meson.build b/src/gallium/drivers/swr/rasterizer/codegen/meson.build
> index a21f405..2cef0d3 100644
> --- a/src/gallium/drivers/swr/rasterizer/codegen/meson.build
> +++ b/src/gallium/drivers/swr/rasterizer/codegen/meson.build
> @@ -40,40 +40,6 @@ gen_knobs_h = custom_target(
>    ),
>  )
>  
> -gen_builder_hpp = custom_target(
> -  'gen_builder.hpp',
> -  input : [
> -    'gen_llvm_ir_macros.py',
> -    join_paths(
> -      dep_llvm.get_configtool_variable('includedir'), 'llvm', 'IR',
> -      'IRBuilder.h'
> -    )
> -  ],
> -  output : 'gen_builder.hpp',
> -  command : [
> -    prog_python2, '@INPUT0@', '--input', '@INPUT1@', '--output', '@OUTPUT@',
> -    '--gen_h', '--output-dir', meson.current_build_dir()
> -  ],
> -  depend_files : files(
> -    'templates/gen_builder.hpp',
> -    'gen_common.py',
> -  ),
> -  build_by_default : true,
> -)
> -
> -gen_builder_x86_hpp = custom_target(
> -  'gen_builder_x86.hpp',
> -  input : 'gen_llvm_ir_macros.py',
> -  output : 'gen_builder_x86.hpp',
> -  command : [
> -    prog_python2, '@INPUT0@', '--gen_x86_h', '--output', '@OUTPUT@',
> -    '--output-dir', meson.current_build_dir()
> -  ],
> -  depend_files : files(
> -    'templates/gen_builder.hpp',
> -    'gen_common.py',
> -  ),
> -)
>  
>  # The generators above this are needed individually, while the below generators
>  # are all inputs to the same lib, so they don't need unique names.
> @@ -114,45 +80,3 @@ foreach x : [['gen_ar_event.hpp', '--gen_event_hpp'],
>    )
>  endforeach
>  
> -files_swr_common += custom_target(
> -  'gen_backend_pixel',
> -  input : 'gen_backends.py',
> -  output : [
> -    'gen_BackendPixelRate0.cpp', 'gen_BackendPixelRate1.cpp',
> -    'gen_BackendPixelRate2.cpp', 'gen_BackendPixelRate3.cpp',
> -    'gen_BackendPixelRate.hpp',
> -  ],
> -  command : [
> -    prog_python2, '@INPUT@',
> -    '--outdir', meson.current_build_dir(),
> -    '--dim', '5', '2', '3', '2', '2', '2',
> -    '--numfiles', '4',
> -    '--cpp', '--hpp',
> -  ],
> -  depend_files : files(
> -    'templates/gen_backend.cpp',
> -    'templates/gen_header_init.hpp',
> -  ),
> -)
> -
> -files_swr_common += custom_target(
> -  'gen_backend_raster',
> -  input : 'gen_backends.py',
> -  output : [
> -    'gen_rasterizer0.cpp', 'gen_rasterizer1.cpp',
> -    'gen_rasterizer2.cpp', 'gen_rasterizer3.cpp',
> -    'gen_rasterizer.hpp',
> -  ],
> -  command : [
> -    prog_python2, '@INPUT@',
> -    '--outdir', meson.current_build_dir(),
> -    '--rast',
> -    '--dim', '5', '2', '2', '3', '5', '2',
> -    '--numfiles', '4',
> -    '--cpp', '--hpp',
> -  ],
> -  depend_files : files(
> -    'templates/gen_rasterizer.cpp',
> -    'templates/gen_header_init.hpp',
> -  ),
> -)
> diff --git a/src/gallium/drivers/swr/rasterizer/core/backends/meson.build b/src/gallium/drivers/swr/rasterizer/core/backends/meson.build
> new file mode 100644
> index 0000000..0576212
> --- /dev/null
> +++ b/src/gallium/drivers/swr/rasterizer/core/backends/meson.build
> @@ -0,0 +1,63 @@
> +#jitter/ Copyright © 2017 Intel Corporation
   ^^^^^^^^^ stray change
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +files_swr_common += custom_target(
> +  'gen_backend_pixel',
> +  input : '../../codegen/gen_backends.py',

We try not to recurse back up the tree for files, could you defined a variable
for this up a couple of levels, something like:

gen_backends_py = files('gen_backends.py')

> +  output : [
> +    'gen_BackendPixelRate0.cpp', 'gen_BackendPixelRate1.cpp',
> +    'gen_BackendPixelRate2.cpp', 'gen_BackendPixelRate3.cpp',
> +    'gen_BackendPixelRate.hpp',
> +  ],
> +  command : [
> +    prog_python2, '@INPUT@',
> +    '--outdir', '@OUTDIR@',
> +    '--dim', '5', '2', '3', '2', '2', '2',
> +    '--numfiles', '4',
> +    '--cpp', '--hpp',
> +  ],
> +  depend_files : files(
> +    '../../codegen/templates/gen_backend.cpp',
> +    '../../codegen/templates/gen_header_init.hpp',

same for this,
gen_backed_depends = files(
    'codegen/templates/gen_backend.cpp',
    'codegen/templates/gen_header_init.hpp',
)

Especially since these are both reused

> +  ),
> +)
> +
> +files_swr_common += custom_target(
> +  'gen_backend_raster',
> +  input : '../../codegen/gen_backends.py',
> +  output : [
> +    'gen_rasterizer0.cpp', 'gen_rasterizer1.cpp',
> +    'gen_rasterizer2.cpp', 'gen_rasterizer3.cpp',
> +    'gen_rasterizer.hpp',
> +  ],
> +  command : [
> +    prog_python2, '@INPUT@',
> +    '--outdir', '@OUTDIR@',
> +    '--rast',
> +    '--dim', '5', '2', '2', '3', '5', '2',
> +    '--numfiles', '4',
> +    '--cpp', '--hpp',
> +  ],
> +  depend_files : files(
> +    '../../codegen/templates/gen_rasterizer.cpp',
> +    '../../codegen/templates/gen_header_init.hpp',
> +  ),
> +)
> diff --git a/src/gallium/drivers/swr/rasterizer/jitter/meson.build b/src/gallium/drivers/swr/rasterizer/jitter/meson.build
> new file mode 100644
> index 0000000..4930007
> --- /dev/null
> +++ b/src/gallium/drivers/swr/rasterizer/jitter/meson.build
> @@ -0,0 +1,56 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a copy
> +# of this software and associated documentation files (the "Software"), to deal
> +# in the Software without restriction, including without limitation the rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +# SOFTWARE.
> +
> +
> +gen_builder_hpp = custom_target(
> +  'gen_builder.hpp',
> +  input : [
> +    '../codegen/gen_llvm_ir_macros.py',

Can you do the same for this file?

> +    join_paths(
> +      dep_llvm.get_configtool_variable('includedir'), 'llvm', 'IR',
> +      'IRBuilder.h'
> +    )
> +  ],
> +  output : 'gen_builder.hpp',
> +  command : [
> +    prog_python2, '@INPUT0@', '--input', '@INPUT1@', '--output', '@OUTPUT@',
> +    '--gen_h', '--output-dir', '@OUTDIR@'
> +  ],
> +  depend_files : files(
> +    '../codegen/templates/gen_builder.hpp',
> +    '../codegen/gen_common.py',
> +  ),
> +  build_by_default : true,
> +)
> +
> +gen_builder_x86_hpp = custom_target(
> +  'gen_builder_x86.hpp',
> +  input : '../codegen/gen_llvm_ir_macros.py',
> +  output : 'gen_builder_x86.hpp',
> +  command : [
> +    prog_python2, '@INPUT0@', '--gen_x86_h', '--output', '@OUTPUT@',
> +    '--output-dir', '@OUTDIR@'
> +  ],
> +  depend_files : files(
> +    '../codegen/templates/gen_builder.hpp',
> +    '../codegen/gen_common.py',
> +  ),
> +)
> +
> -- 
> 2.7.4
> 
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-stable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180201/06038dd9/attachment-0001.sig>


More information about the mesa-dev mailing list