[Mesa-dev] [PATCH v3 2/2] meson: build freedreno

Rob Clark robdclark at gmail.com
Sun Oct 15 11:04:04 UTC 2017


On Sat, Oct 14, 2017 at 11:10 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
> Quoting Rob Clark (2017-10-14 11:41:49)
>> Signed-off-by: Rob Clark <robdclark at gmail.com>
>> ---
>> v1: actually build freedreno
>> v2: corrected installed ${driver}_dri.so name
>>
>>  meson.build                                  |   6 +
>>  meson_options.txt                            |   2 +-
>>  src/gallium/drivers/freedreno/meson.build    | 221 +++++++++++++++++++++++++++
>>  src/gallium/meson.build                      |   3 +-
>>  src/gallium/targets/dri/meson.build          |   6 +
>>  src/gallium/winsys/freedreno/drm/meson.build |  30 ++++
>>  6 files changed, 266 insertions(+), 2 deletions(-)
>>  create mode 100644 src/gallium/drivers/freedreno/meson.build
>>  create mode 100644 src/gallium/winsys/freedreno/drm/meson.build
>>
>> diff --git a/meson.build b/meson.build
>> index bc3bbf41a65..2554f7166cb 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -93,12 +93,14 @@ endif
>>  with_gallium = false
>>  with_gallium_radeonsi = false
>>  with_gallium_nouveau = false
>> +with_gallium_freedreno = false
>>  with_gallium_softpipe = false
>>  _drivers = get_option('gallium-drivers')
>>  if _drivers != ''
>>    _split = _drivers.split(',')
>>    with_gallium_radeonsi = _split.contains('radeonsi')
>>    with_gallium_nouveau = _split.contains('nouveau')
>> +  with_gallium_freedreno = _split.contains('freedreno')
>>    with_gallium_softpipe = _split.contains('swrast')
>>    with_gallium = true
>>    with_dri = true
>> @@ -558,6 +560,7 @@ dep_m = cc.find_library('m', required : false)
>>  dep_libdrm_amdgpu = []
>>  dep_libdrm_radeon = []
>>  dep_libdrm_nouveau = []
>> +dep_libdrm_freedreno = []
>>  if with_amd_vk or with_gallium_radeonsi
>>    dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.84')
>>  endif
>> @@ -567,6 +570,9 @@ endif
>>  if with_gallium_nouveau
>>    dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
>>  endif
>> +if with_gallium_freedreno
>> +  dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>= 2.4.74')
>> +endif
>>
>>  llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
>>  if with_amd_vk
>> diff --git a/meson_options.txt b/meson_options.txt
>> index 71e9ea63555..6b311ac2404 100644
>> --- a/meson_options.txt
>> +++ b/meson_options.txt
>> @@ -46,7 +46,7 @@ option(
>>  option(
>>    'gallium-drivers',
>>    type : 'string',
>> -  value : 'radeonsi,nouveau,swrast',
>> +  value : 'radeonsi,nouveau,freedreno,swrast',
>>    description : 'comma separated list of gallium drivers to build.'
>>  )
>>  option(
>> diff --git a/src/gallium/drivers/freedreno/meson.build b/src/gallium/drivers/freedreno/meson.build
>> new file mode 100644
>> index 00000000000..191fcffe80c
>> --- /dev/null
>> +++ b/src/gallium/drivers/freedreno/meson.build
>> @@ -0,0 +1,221 @@
>> +# Copyright © 2017 Dylan Baker
>
> While I appreciate this gesture, you should probable change this ;)

tbf, it was 90% copy-pasta from nouveau and bit of i965 ;-)

>> +
>> +# 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.
>> +
>> +ir3_nir_trig_c = custom_target(
>> +  'ir3_nir_trig.c',
>> +  input : 'ir3/ir3_nir_trig.py',
>> +  output : 'ir3_nir_trig.c',
>> +  command : [prog_python2, '@INPUT@', '-p',
>> +             join_paths(meson.source_root(), 'src/compiler/nir/')],
>> +  capture : true,
>> +  depend_files : files(
>> +    'ir3/ir3_nir_trig.py',
>> +    join_paths(meson.source_root(), 'src/compiler/nir/nir_algebraic.py'),
>
> Do we have a files() object for this? Since both freedreno and i965 need this,
> why don't we add a files_nir_algebraic_py (or whatever) in nir and use that for
> both drivers.

sure, just set it in toplevel meson.build?

BR,
-R

>> +  ),
>> +)
>> +
>> +files_libfreedreno = files(
>> +  'adreno_common.xml.h',
>> +  'adreno_pm4.xml.h',
>> +  'disasm.h',
>> +  'freedreno_batch.c',
>> +  'freedreno_batch.h',
>> +  'freedreno_batch_cache.c',
>> +  'freedreno_batch_cache.h',
>> +  'freedreno_context.c',
>> +  'freedreno_context.h',
>> +  'freedreno_draw.c',
>> +  'freedreno_draw.h',
>> +  'freedreno_fence.c',
>> +  'freedreno_fence.h',
>> +  'freedreno_gmem.c',
>> +  'freedreno_gmem.h',
>> +  'freedreno_program.c',
>> +  'freedreno_program.h',
>> +  'freedreno_query.c',
>> +  'freedreno_query.h',
>> +  'freedreno_query_acc.c',
>> +  'freedreno_query_acc.h',
>> +  'freedreno_query_hw.c',
>> +  'freedreno_query_hw.h',
>> +  'freedreno_query_sw.c',
>> +  'freedreno_query_sw.h',
>> +  'freedreno_resource.c',
>> +  'freedreno_resource.h',
>> +  'freedreno_screen.c',
>> +  'freedreno_screen.h',
>> +  'freedreno_state.c',
>> +  'freedreno_state.h',
>> +  'freedreno_surface.c',
>> +  'freedreno_surface.h',
>> +  'freedreno_texture.c',
>> +  'freedreno_texture.h',
>> +  'freedreno_util.c',
>> +  'freedreno_util.h',
>> +  'a2xx/a2xx.xml.h',
>> +  'a2xx/disasm-a2xx.c',
>> +  'a2xx/fd2_blend.c',
>> +  'a2xx/fd2_blend.h',
>> +  'a2xx/fd2_compiler.c',
>> +  'a2xx/fd2_compiler.h',
>> +  'a2xx/fd2_context.c',
>> +  'a2xx/fd2_context.h',
>> +  'a2xx/fd2_draw.c',
>> +  'a2xx/fd2_draw.h',
>> +  'a2xx/fd2_emit.c',
>> +  'a2xx/fd2_emit.h',
>> +  'a2xx/fd2_gmem.c',
>> +  'a2xx/fd2_gmem.h',
>> +  'a2xx/fd2_program.c',
>> +  'a2xx/fd2_program.h',
>> +  'a2xx/fd2_rasterizer.c',
>> +  'a2xx/fd2_rasterizer.h',
>> +  'a2xx/fd2_screen.c',
>> +  'a2xx/fd2_screen.h',
>> +  'a2xx/fd2_texture.c',
>> +  'a2xx/fd2_texture.h',
>> +  'a2xx/fd2_util.c',
>> +  'a2xx/fd2_util.h',
>> +  'a2xx/fd2_zsa.c',
>> +  'a2xx/fd2_zsa.h',
>> +  'a2xx/instr-a2xx.h',
>> +  'a2xx/ir-a2xx.c',
>> +  'a2xx/ir-a2xx.h',
>> +  'a3xx/a3xx.xml.h',
>> +  'a3xx/fd3_blend.c',
>> +  'a3xx/fd3_blend.h',
>> +  'a3xx/fd3_context.c',
>> +  'a3xx/fd3_context.h',
>> +  'a3xx/fd3_draw.c',
>> +  'a3xx/fd3_draw.h',
>> +  'a3xx/fd3_emit.c',
>> +  'a3xx/fd3_emit.h',
>> +  'a3xx/fd3_format.c',
>> +  'a3xx/fd3_format.h',
>> +  'a3xx/fd3_gmem.c',
>> +  'a3xx/fd3_gmem.h',
>> +  'a3xx/fd3_program.c',
>> +  'a3xx/fd3_program.h',
>> +  'a3xx/fd3_query.c',
>> +  'a3xx/fd3_query.h',
>> +  'a3xx/fd3_rasterizer.c',
>> +  'a3xx/fd3_rasterizer.h',
>> +  'a3xx/fd3_screen.c',
>> +  'a3xx/fd3_screen.h',
>> +  'a3xx/fd3_texture.c',
>> +  'a3xx/fd3_texture.h',
>> +  'a3xx/fd3_zsa.c',
>> +  'a3xx/fd3_zsa.h',
>> +  'a4xx/a4xx.xml.h',
>> +  'a4xx/fd4_blend.c',
>> +  'a4xx/fd4_blend.h',
>> +  'a4xx/fd4_context.c',
>> +  'a4xx/fd4_context.h',
>> +  'a4xx/fd4_draw.c',
>> +  'a4xx/fd4_draw.h',
>> +  'a4xx/fd4_emit.c',
>> +  'a4xx/fd4_emit.h',
>> +  'a4xx/fd4_format.c',
>> +  'a4xx/fd4_format.h',
>> +  'a4xx/fd4_gmem.c',
>> +  'a4xx/fd4_gmem.h',
>> +  'a4xx/fd4_program.c',
>> +  'a4xx/fd4_program.h',
>> +  'a4xx/fd4_query.c',
>> +  'a4xx/fd4_query.h',
>> +  'a4xx/fd4_rasterizer.c',
>> +  'a4xx/fd4_rasterizer.h',
>> +  'a4xx/fd4_screen.c',
>> +  'a4xx/fd4_screen.h',
>> +  'a4xx/fd4_texture.c',
>> +  'a4xx/fd4_texture.h',
>> +  'a4xx/fd4_zsa.c',
>> +  'a4xx/fd4_zsa.h',
>> +  'a5xx/a5xx.xml.h',
>> +  'a5xx/fd5_blend.c',
>> +  'a5xx/fd5_blend.h',
>> +  'a5xx/fd5_compute.c',
>> +  'a5xx/fd5_compute.h',
>> +  'a5xx/fd5_context.c',
>> +  'a5xx/fd5_context.h',
>> +  'a5xx/fd5_draw.c',
>> +  'a5xx/fd5_draw.h',
>> +  'a5xx/fd5_emit.c',
>> +  'a5xx/fd5_emit.h',
>> +  'a5xx/fd5_format.c',
>> +  'a5xx/fd5_format.h',
>> +  'a5xx/fd5_gmem.c',
>> +  'a5xx/fd5_gmem.h',
>> +  'a5xx/fd5_program.c',
>> +  'a5xx/fd5_program.h',
>> +  'a5xx/fd5_query.c',
>> +  'a5xx/fd5_query.h',
>> +  'a5xx/fd5_rasterizer.c',
>> +  'a5xx/fd5_rasterizer.h',
>> +  'a5xx/fd5_screen.c',
>> +  'a5xx/fd5_screen.h',
>> +  'a5xx/fd5_texture.c',
>> +  'a5xx/fd5_texture.h',
>> +  'a5xx/fd5_zsa.c',
>> +  'a5xx/fd5_zsa.h',
>> +  'ir3/disasm-a3xx.c',
>> +  'ir3/instr-a3xx.h',
>> +  'ir3/ir3.c',
>> +  'ir3/ir3_compiler_nir.c',
>> +  'ir3/ir3_compiler.c',
>> +  'ir3/ir3_compiler.h',
>> +  'ir3/ir3_cp.c',
>> +  'ir3/ir3_depth.c',
>> +  'ir3/ir3_group.c',
>> +  'ir3/ir3.h',
>> +  'ir3/ir3_legalize.c',
>> +  'ir3/ir3_nir.c',
>> +  'ir3/ir3_nir.h',
>> +  'ir3/ir3_nir_lower_if_else.c',
>> +  'ir3/ir3_print.c',
>> +  'ir3/ir3_ra.c',
>> +  'ir3/ir3_sched.c',
>> +  'ir3/ir3_shader.c',
>> +  'ir3/ir3_shader.h',
>> +)
>> +
>> +freedreno_includes = [
>> +  inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_nir,
>> +  include_directories('ir3')
>> +]
>> +
>> +libfreedreno = static_library(
>> +  'freedreno',
>> +  [files_libfreedreno, ir3_nir_trig_c],
>> +  include_directories : freedreno_includes,
>> +  c_args : [c_vis_args],
>> +  cpp_args : [cpp_vis_args],
>> +  dependencies : [dep_libdrm, dep_libdrm_freedreno],
>> +  build_by_default : false,
>> +)
>> +
>> +ir3_compiler = executable(
>> +  'ir3_compiler',
>> +  'ir3/ir3_cmdline.c',
>> +  include_directories : freedreno_includes,
>> +  dependencies : [dep_libdrm, dep_libdrm_freedreno],
>> +  link_with : [libfreedreno, libgallium, libmesa_util],
>> +  build_by_default : false,
>> +)
>> diff --git a/src/gallium/meson.build b/src/gallium/meson.build
>> index e7970e11638..8e528704230 100644
>> --- a/src/gallium/meson.build
>> +++ b/src/gallium/meson.build
>> @@ -31,6 +31,7 @@ subdir('drivers/rbug')
>>  subdir('drivers/radeon')
>>  subdir('drivers/radeonsi')
>>  subdir('drivers/nouveau')
>> +subdir('drivers/freedreno')
>>  subdir('drivers/softpipe')
>>  subdir('drivers/llvmpipe')
>>  subdir('winsys/sw/null')
>> @@ -40,8 +41,8 @@ subdir('winsys/sw/wrapper')
>>  subdir('winsys/radeon/drm')
>>  subdir('winsys/amdgpu/drm')
>>  subdir('winsys/nouveau/drm')
>> +subdir('winsys/freedreno/drm')
>>  subdir('state_trackers/dri')
>> -# TODO: freedreno
>>  # TODO: i915
>>  # TODO: SVGA
>>  # TODO: r300
>> diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build
>> index 2dc0de6a4d0..5e9fa06f4e2 100644
>> --- a/src/gallium/targets/dri/meson.build
>> +++ b/src/gallium/targets/dri/meson.build
>> @@ -64,6 +64,12 @@ if with_gallium_nouveau
>>    gallium_dri_link_with += [libnouveauwinsys, libnouveau]
>>    gallium_dri_drivers += 'nouveau_dri.so'
>>  endif
>> +if with_gallium_freedreno
>> +  gallium_dri_c_args += '-DGALLIUM_FREEDRENO'
>> +  gallium_dri_link_with += [libfreedrenowinsys, libfreedreno]
>> +  gallium_dri_drivers += 'msm_dri.so'
>> +  gallium_dri_drivers += 'kgsl_dri.so'
>> +endif
>>  if with_gallium_softpipe
>>    gallium_dri_c_args += '-DGALLIUM_SOFTPIPE'
>>    gallium_dri_link_with += libsoftpipe
>> diff --git a/src/gallium/winsys/freedreno/drm/meson.build b/src/gallium/winsys/freedreno/drm/meson.build
>> new file mode 100644
>> index 00000000000..2b9ac890c31
>> --- /dev/null
>> +++ b/src/gallium/winsys/freedreno/drm/meson.build
>> @@ -0,0 +1,30 @@
>> +# Copyright © 2017 Dylan Baker
>
> here too.
>
>> +
>> +# 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.
>> +
>> +libfreedrenowinsys = static_library(
>> +  'freedrenowinsys',
>> +  files('freedreno_drm_public.h', 'freedreno_drm_winsys.c'),
>> +  include_directories : [
>> +    inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
>> +  ],
>> +  c_args : [c_vis_args],
>> +  dependencies : [dep_libdrm_freedreno],
>> +  build_by_default : false,
>> +)
>> --
>> 2.13.6
>>
>
> Other than the copyrights, this looks good to me:
> Reviewed-by: Dylan Baker <dylan at pnwbakers.com>


More information about the mesa-dev mailing list