[Mesa-dev] [PATCH 16/20] meson: build nouveau (gallium) driver

Dylan Baker dylan at pnwbakers.com
Wed Oct 11 17:41:24 UTC 2017


Tested with a GK107.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 meson.build                                      |   6 +
 src/gallium/drivers/nouveau/meson.build          | 217 +++++++++++++++++++++++
 src/gallium/meson.build                          |   3 +-
 src/gallium/targets/dri/meson.build              |   5 +
 src/gallium/{ => winsys/nouveau/drm}/meson.build |  57 ++----
 5 files changed, 240 insertions(+), 48 deletions(-)
 create mode 100644 src/gallium/drivers/nouveau/meson.build
 copy src/gallium/{ => winsys/nouveau/drm}/meson.build (53%)

diff --git a/meson.build b/meson.build
index cb883b085b6..5684a5666d9 100644
--- a/meson.build
+++ b/meson.build
@@ -89,11 +89,13 @@ endif
 
 with_gallium = false
 with_gallium_radeonsi = false
+with_gallium_nouveau = 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 = true
   with_dri = true
 endif
@@ -543,12 +545,16 @@ dep_m = cc.find_library('m', required : false)
 
 dep_libdrm_amdgpu = []
 dep_libdrm_radeon = []
+dep_libdrm_nouveau = []
 if with_amd_vk or with_gallium_radeonsi
   dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82')
 endif
 if with_gallium_radeonsi # older radeon too
   dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.82')
 endif
+if with_gallium_nouveau
+  dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
+endif
 
 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
 if with_amd_vk
diff --git a/src/gallium/drivers/nouveau/meson.build b/src/gallium/drivers/nouveau/meson.build
new file mode 100644
index 00000000000..af3a8145fa5
--- /dev/null
+++ b/src/gallium/drivers/nouveau/meson.build
@@ -0,0 +1,217 @@
+# Copyright © 2017 Dylan Baker
+
+# 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_libnouveau = files(
+  'nouveau_buffer.c',
+  'nouveau_buffer.h',
+  'nouveau_context.h',
+  'nouveau_debug.h',
+  'nouveau_fence.c',
+  'nouveau_fence.h',
+  'nouveau_gldefs.h',
+  'nouveau_heap.c',
+  'nouveau_heap.h',
+  'nouveau_mm.c',
+  'nouveau_mm.h',
+  'nouveau_screen.c',
+  'nouveau_screen.h',
+  'nouveau_statebuf.h',
+  'nouveau_video.c',
+  'nouveau_video.h',
+  'nouveau_vp3_video_bsp.c',
+  'nouveau_vp3_video.c',
+  'nouveau_vp3_video.h',
+  'nouveau_vp3_video_vp.c',
+  'nouveau_winsys.h',
+  'nv17_mpeg.xml.h',
+  'nv31_mpeg.xml.h',
+  'nv_m2mf.xml.h',
+  'nv_object.xml.h',
+  'nv30/nv01_2d.xml.h',
+  'nv30/nv30-40_3d.xml.h',
+  'nv30/nv30_clear.c',
+  'nv30/nv30_context.c',
+  'nv30/nv30_context.h',
+  'nv30/nv30_draw.c',
+  'nv30/nv30_format.c',
+  'nv30/nv30_format.h',
+  'nv30/nv30_fragprog.c',
+  'nv30/nv30_fragtex.c',
+  'nv30/nv30_miptree.c',
+  'nv30/nv30_push.c',
+  'nv30/nv30_query.c',
+  'nv30/nv30_resource.c',
+  'nv30/nv30_resource.h',
+  'nv30/nv30_screen.c',
+  'nv30/nv30_screen.h',
+  'nv30/nv30_state.c',
+  'nv30/nv30_state.h',
+  'nv30/nv30_state_validate.c',
+  'nv30/nv30_texture.c',
+  'nv30/nv30_transfer.c',
+  'nv30/nv30_transfer.h',
+  'nv30/nv30_vbo.c',
+  'nv30/nv30_vertprog.c',
+  'nv30/nv30_vertprog.h',
+  'nv30/nv30_winsys.h',
+  'nv30/nv40_vertprog.h',
+  'nv30/nv40_verttex.c',
+  'nv30/nvfx_fragprog.c',
+  'nv30/nvfx_shader.h',
+  'nv30/nvfx_vertprog.c',
+  'nv50/g80_defs.xml.h',
+  'nv50/g80_texture.xml.h',
+  'nv50/nv50_2d.xml.h',
+  'nv50/nv50_3ddefs.xml.h',
+  'nv50/nv50_3d.xml.h',
+  'nv50/nv50_blit.h',
+  'nv50/nv50_compute.c',
+  'nv50/nv50_compute.xml.h',
+  'nv50/nv50_context.c',
+  'nv50/nv50_context.h',
+  'nv50/nv50_formats.c',
+  'nv50/nv50_miptree.c',
+  'nv50/nv50_program.c',
+  'nv50/nv50_program.h',
+  'nv50/nv50_push.c',
+  'nv50/nv50_query.c',
+  'nv50/nv50_query.h',
+  'nv50/nv50_query_hw.c',
+  'nv50/nv50_query_hw.h',
+  'nv50/nv50_query_hw_metric.c',
+  'nv50/nv50_query_hw_metric.h',
+  'nv50/nv50_query_hw_sm.c',
+  'nv50/nv50_query_hw_sm.h',
+  'nv50/nv50_resource.c',
+  'nv50/nv50_resource.h',
+  'nv50/nv50_screen.c',
+  'nv50/nv50_screen.h',
+  'nv50/nv50_shader_state.c',
+  'nv50/nv50_state.c',
+  'nv50/nv50_stateobj.h',
+  'nv50/nv50_stateobj_tex.h',
+  'nv50/nv50_state_validate.c',
+  'nv50/nv50_surface.c',
+  'nv50/nv50_tex.c',
+  'nv50/nv50_transfer.c',
+  'nv50/nv50_transfer.h',
+  'nv50/nv50_vbo.c',
+  'nv50/nv50_winsys.h',
+  'nv50/nv84_video_bsp.c',
+  'nv50/nv84_video.c',
+  'nv50/nv84_video.h',
+  'nv50/nv84_video_vp.c',
+  'nv50/nv98_video_bsp.c',
+  'nv50/nv98_video.c',
+  'nv50/nv98_video.h',
+  'nv50/nv98_video_ppp.c',
+  'nv50/nv98_video_vp.c',
+  'codegen/nv50_ir.cpp',
+  'codegen/nv50_ir_bb.cpp',
+  'codegen/nv50_ir_build_util.cpp',
+  'codegen/nv50_ir_build_util.h',
+  'codegen/nv50_ir_driver.h',
+  'codegen/nv50_ir_emit_nv50.cpp',
+  'codegen/nv50_ir_from_tgsi.cpp',
+  'codegen/nv50_ir_graph.cpp',
+  'codegen/nv50_ir_graph.h',
+  'codegen/nv50_ir.h',
+  'codegen/nv50_ir_inlines.h',
+  'codegen/nv50_ir_lowering_nv50.cpp',
+  'codegen/nv50_ir_peephole.cpp',
+  'codegen/nv50_ir_print.cpp',
+  'codegen/nv50_ir_ra.cpp',
+  'codegen/nv50_ir_ssa.cpp',
+  'codegen/nv50_ir_target.cpp',
+  'codegen/nv50_ir_target.h',
+  'codegen/nv50_ir_target_nv50.cpp',
+  'codegen/nv50_ir_target_nv50.h',
+  'codegen/nv50_ir_util.cpp',
+  'codegen/nv50_ir_util.h',
+  'codegen/unordered_set.h',
+  'codegen/nv50_ir_emit_gk110.cpp',
+  'codegen/nv50_ir_emit_gm107.cpp',
+  'codegen/nv50_ir_emit_nvc0.cpp',
+  'codegen/nv50_ir_lowering_gm107.cpp',
+  'codegen/nv50_ir_lowering_gm107.h',
+  'codegen/nv50_ir_lowering_nvc0.cpp',
+  'codegen/nv50_ir_lowering_nvc0.h',
+  'codegen/nv50_ir_target_gm107.cpp',
+  'codegen/nv50_ir_target_gm107.h',
+  'codegen/nv50_ir_target_nvc0.cpp',
+  'codegen/nv50_ir_target_nvc0.h',
+  'nvc0/gm107_texture.xml.h',
+  'nvc0/nvc0_3d.xml.h',
+  'nvc0/nvc0_compute.c',
+  'nvc0/nvc0_compute.xml.h',
+  'nvc0/nvc0_context.c',
+  'nvc0/nvc0_context.h',
+  'nvc0/nvc0_formats.c',
+  'nvc0/nvc0_m2mf.xml.h',
+  'nvc0/nvc0_macros.h',
+  'nvc0/nvc0_miptree.c',
+  'nvc0/nvc0_program.c',
+  'nvc0/nvc0_program.h',
+  'nvc0/nvc0_query.c',
+  'nvc0/nvc0_query.h',
+  'nvc0/nvc0_query_hw.c',
+  'nvc0/nvc0_query_hw.h',
+  'nvc0/nvc0_query_hw_metric.c',
+  'nvc0/nvc0_query_hw_metric.h',
+  'nvc0/nvc0_query_hw_sm.c',
+  'nvc0/nvc0_query_hw_sm.h',
+  'nvc0/nvc0_query_sw.c',
+  'nvc0/nvc0_query_sw.h',
+  'nvc0/nvc0_resource.c',
+  'nvc0/nvc0_resource.h',
+  'nvc0/nvc0_screen.c',
+  'nvc0/nvc0_screen.h',
+  'nvc0/nvc0_shader_state.c',
+  'nvc0/nvc0_state.c',
+  'nvc0/nvc0_stateobj.h',
+  'nvc0/nvc0_state_validate.c',
+  'nvc0/nvc0_surface.c',
+  'nvc0/nvc0_tex.c',
+  'nvc0/nvc0_transfer.c',
+  'nvc0/nvc0_vbo.c',
+  'nvc0/nvc0_vbo_translate.c',
+  'nvc0/nvc0_video_bsp.c',
+  'nvc0/nvc0_video.c',
+  'nvc0/nvc0_video.h',
+  'nvc0/nvc0_video_ppp.c',
+  'nvc0/nvc0_video_vp.c',
+  'nvc0/nvc0_winsys.h',
+  'nvc0/nve4_compute.c',
+  'nvc0/nve4_compute.h',
+  'nvc0/nve4_compute.xml.h',
+  'nvc0/nve4_p2mf.xml.h',
+)
+
+libnouveau = static_library(
+  'nouveau',
+  [files_libnouveau],
+  include_directories : [
+    inc_src, inc_include, inc_gallium, inc_gallium_aux,
+  ],
+  c_args : [c_vis_args],
+  cpp_args : [cpp_vis_args],
+  dependencies : [dep_libdrm, dep_libdrm_nouveau],
+  build_by_default : false,
+)
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 6c0e9782ae9..42c05824991 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -30,16 +30,17 @@ subdir('drivers/trace')
 subdir('drivers/rbug')
 subdir('drivers/radeon')
 subdir('drivers/radeonsi')
+subdir('drivers/nouveau')
 subdir('winsys/sw/null')
 subdir('winsys/sw/dri')
 subdir('winsys/sw/kms-dri')
 subdir('winsys/sw/wrapper')
 subdir('winsys/radeon/drm')
 subdir('winsys/amdgpu/drm')
+subdir('winsys/nouveau/drm')
 subdir('state_trackers/dri')
 # TODO: freedreno
 # TODO: i915
-# TODO: nouveau
 # TODO: SVGA
 # TODO: r300
 # TODO: r600
diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build
index 382b00db5dc..15da2459ecf 100644
--- a/src/gallium/targets/dri/meson.build
+++ b/src/gallium/targets/dri/meson.build
@@ -60,6 +60,11 @@ if with_gallium_radeonsi
   ]
   gallium_dri_drivers += 'radeonsi_dri.so'
 endif
+if with_gallium_nouveau
+  gallium_dri_c_args += '-DGALLIUM_NOUVEAU'
+  gallium_dri_link_with += [libnouveauwinsys, libnouveau]
+  gallium_dri_drivers += 'nouveau_dri.so'
+endif
 
 libgallium_dri = shared_library(
   'gallium_dri',
diff --git a/src/gallium/meson.build b/src/gallium/winsys/nouveau/drm/meson.build
similarity index 53%
copy from src/gallium/meson.build
copy to src/gallium/winsys/nouveau/drm/meson.build
index 6c0e9782ae9..b5ef0d7097f 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/winsys/nouveau/drm/meson.build
@@ -18,50 +18,13 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_drivers = include_directories('drivers')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
-subdir('drivers/ddebug')
-subdir('drivers/noop')
-subdir('drivers/trace')
-subdir('drivers/rbug')
-subdir('drivers/radeon')
-subdir('drivers/radeonsi')
-subdir('winsys/sw/null')
-subdir('winsys/sw/dri')
-subdir('winsys/sw/kms-dri')
-subdir('winsys/sw/wrapper')
-subdir('winsys/radeon/drm')
-subdir('winsys/amdgpu/drm')
-subdir('state_trackers/dri')
-# TODO: freedreno
-# TODO: i915
-# TODO: nouveau
-# TODO: SVGA
-# TODO: r300
-# TODO: r600
-# TODO: etnaviv
-# TODO: IMX
-# TODO: PL111
-# TODO: softpipe
-# TODO: llvmpipe
-# TODO: SWR
-# TODO: vc4
-# TODO: virgl
-# TODO: winsys/sw/xlib
-# TODO: clover
-if with_dri
-  subdir('targets/dri')
-endif
-# TODO: xlib-glx
-# TODO: OMX
-# TODO: osmesa
-# TODO: VA
-# TODO: vdpau
-# TODO: xa
-# TODO: xvmc
-# TODO: nine
-# TODO: tests
+libnouveauwinsys = static_library(
+  'nouveauwinsys',
+  files('nouveau_drm_public.h', 'nouveau_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_nouveau],
+  build_by_default : false,
+)
-- 
2.14.2



More information about the mesa-dev mailing list