Commit 9a7d8509 authored by Daniel Vetter's avatar Daniel Vetter

meson: basic build system support

Why?

Because it's fast.

Like really, really fast.

Some data (from a snb laptop, so rather lower-powered):

- Incremental build after $ touch lib/igt_core.c with meson: 0.6s
  It notices that the symbol list of the libigt.so hasn't changed and
  doesn't bother re-linking the almost 300 binaries we have. make -j 6
  for the same scenario takes 44s.

- Incremental build with nothing changed: make: 0.7s, meson: 0.2s This
  means stuff like --disable-git-hash is entirely pointless with
  meson, it's faster than a make ever can be (with 0.6s).

- Reconfigure stage: ninja reconfigure 0.8s vs. ./configure 8.6s)

- Running tests, after a full build: ninja test 6s vs. make check 24s

- Full build (i.e. including ./autogen.sh respectively meson build),
  including tests, from a pristine git checkout. automake 2m49s vs.
  meson 44s.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Daniel Stone <daniel@fooishbar.org>
Acked-by: Jani Nikula's avatarJani Nikula <jani.nikula@intel.com>
Acked-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
Acked-by: Petri Latvala's avatarPetri Latvala <petri.latvala@intel.com>
Acked-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
Acked-by: Radosław's avatarRadoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@intel.com>
parent c3863e19
......@@ -93,3 +93,4 @@ intel-gpu-tools-*/
piglit
results
build
lib_brw_src = [
'brw_context.c',
'brw_disasm.c',
'brw_eu.c',
'brw_eu_compact.c',
'brw_eu_debug.c',
'brw_eu_emit.c',
'brw_eu_util.c',
'gen8_disasm.c',
'gen8_instruction.c',
'ralloc.c',
]
lib_brw = shared_library('brw', lib_brw_src,
dependencies : igt_deps)
flex = find_program('flex')
bison = find_program('bison')
lgen = generator(flex,
output : '@BASENAME@.c',
arguments : ['-o', '@OUTPUT@', '@INPUT@'])
lfiles = lgen.process('lex.l')
pgen = generator(bison,
output : ['@BASENAME@.c', '@BASENAME@.h'],
arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
pfiles = pgen.process('gram.y')
executable('intel-gen4asm', 'main.c', lfiles, pfiles, link_with : lib_brw)
executable('intel-gen4disasm', 'disasm-main.c', link_with : lib_brw)
gen4asm_testcases = [
'test/mov',
'test/frc',
'test/rndd',
'test/rndu',
'test/rnde',
'test/rnde-intsrc',
'test/rndz',
'test/lzd',
'test/not',
'test/immediate',
]
# Those tests were already failing when the assembler was imported from
# the intel-gen4asm git repository:
# http://cgit.freedesktop.org/xorg/app/intel-gen4asm/
# We disable them "for now" as a workaround to be able to release i-g-t
gen4asm_testcases_broken = [
'test/declare',
'test/jmpi',
'test/if',
'test/iff',
'test/while',
'test/else',
'test/break',
'test/cont',
'test/halt',
'test/wait',
'test/endif',
]
test_runner = find_program('test/run-test.sh')
foreach testcase : gen4asm_testcases
test('assembler: ' + testcase, test_runner,
args : testcase,
env : [ 'srcdir=' + meson.current_source_dir(),
'top_builddir=' + meson.current_build_dir()])
endforeach
benchmark_progs = [
'gem_blt',
'gem_busy',
'gem_create',
'gem_exec_ctx',
'gem_exec_fault',
'gem_exec_nop',
'gem_exec_reloc',
'gem_exec_trace',
'gem_latency',
'gem_mmap',
'gem_prw',
'gem_set_domain',
'gem_syslatency',
'gem_wsim',
'kms_vblank',
'prime_lookup',
'vgem_mmap',
]
if libdrm_intel.found()
benchmark_progs += [
'intel_upload_blit_large',
'intel_upload_blit_large_gtt',
'intel_upload_blit_large_map',
'intel_upload_blit_small',
'gem_userptr_benchmark',
]
endif
foreach prog : benchmark_progs
# FIXME meson doesn't like binaries with the same name
# meanwhile just suffix with _bench
executable(prog + '_bench', prog + '.c',
dependencies : test_deps)
endforeach
lib_headers = [
'debug.h',
'drmtest.h',
'i830_reg.h',
'i915_3d.h',
'i915_reg.h',
'i915_pciids.h',
'igt.h',
'igt_debugfs.h',
'igt_aux.h',
'igt_edid_template.h',
'igt_gt.h',
'igt_gvt.h',
'igt_primes.h',
'igt_rand.h',
'igt_stats.h',
'igt_sysfs.h',
'igt_x86.h',
'igt_vgem.h',
'instdone.h',
'intel_batchbuffer.h',
'intel_chipset.h',
'intel_io.h',
'intel_reg.h',
'ioctl_wrappers.h',
'media_fill.h',
'media_spin.h',
'gpgpu_fill.h',
'gen7_media.h',
'gen8_media.h',
'gen6_render.h',
'gen7_render.h',
'gen8_render.h',
'gen9_render.h',
'rendercopy.h',
'sw_sync.h',
'igt_kms.h',
'igt_fb.h',
'igt_core.h',
'igt_draw.h',
'igt_pm.h',
'igt_dummyload.h',
'uwildmat/uwildmat.h',
'igt_kmod.h',
]
lib_sources = [
'drmtest.c',
'igt_debugfs.c',
'igt_aux.c',
'igt_gt.c',
'igt_gvt.c',
'igt_primes.c',
'igt_rand.c',
'igt_stats.c',
'igt_sysfs.c',
'igt_x86.c',
'igt_vgem.c',
'instdone.c',
'intel_batchbuffer.c',
'intel_chipset.c',
'intel_device_info.c',
'intel_os.c',
'intel_mmio.c',
'ioctl_wrappers.c',
'media_fill_gen7.c',
'media_fill_gen8.c',
'media_fill_gen8lp.c',
'media_fill_gen9.c',
'media_spin.c',
'gpgpu_fill.c',
'rendercopy_i915.c',
'rendercopy_i830.c',
'rendercopy_gen6.c',
'rendercopy_gen7.c',
'rendercopy_gen8.c',
'rendercopy_gen9.c',
'sw_sync.c',
'intel_reg_map.c',
'intel_iosf.c',
'igt_kms.c',
'igt_fb.c',
'igt_core.c',
'igt_draw.c',
'igt_pm.c',
'igt_dummyload.c',
'uwildmat/uwildmat.c',
'igt_kmod.c',
]
lib_deps = [
cairo,
glib,
libdrm,
libkmod,
libprocps,
libudev,
libunwind,
pciaccess,
pthreads,
math,
realtime,
]
if libdrm_intel.found()
lib_deps += libdrm_intel
else
lib_headers += 'stubs/drm/intel_bufmgr.h'
lib_sources += 'stubs/drm/intel_bufmgr.c'
endif
if libdrm_vc4.found()
lib_headers += 'igt_vc4.h'
lib_sources += 'igt_vc4.c'
endif
if valgrind.found()
lib_deps += valgrind
endif
if gsl.found()
lib_deps += gsl
lib_headers += [ 'igt_frame.h', 'igt_audio.h' ]
lib_sources += [ 'igt_frame.c', 'igt_audio.c' ]
endif
if alsa.found()
lib_deps += alsa
lib_headers += 'igt_alsa.h'
lib_sources += 'igt_alsa.c'
endif
if chamelium.found()
lib_deps += chamelium
lib_headers += 'igt_chamelium.h'
lib_sources += 'igt_chamelium.c'
endif
install_headers(lib_headers)
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'intel-gpu-tools')
srcdir = join_paths(meson.source_root(), 'tests')
vcs_tag(input : 'version.h.in', output : 'version.h',
fallback : 'NO-GIT',
command : [ 'git', 'log', '-n1', '--pretty=format:g%h' ] )
# FIXME we don't regenerate when the script changes
prepend_log_domain = generator(find_program('prepend_log_domain.sh'),
arguments : [ '@INPUT@', '@OUTPUT@' ],
output : '@PLAINNAME@' + '.pre.c')
processed_src_dep = prepend_log_domain.process(lib_sources)
lib_igt_build = shared_library('igt',
processed_src_dep,
include_directories : inc,
dependencies : lib_deps,
c_args : [ '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
'-DIGT_SRCDIR="@0@"'.format(srcdir), ])
lib_igt = declare_dependency(link_with : lib_igt_build,
include_directories : inc)
igt_deps = [ lib_igt ] + lib_deps
subdir('tests')
#!/bin/bash
input=$1
output=$2
basename=$(basename $1 .c)
echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
cat $input >> $output
lib_tests = [
'igt_fork_helper',
'igt_list_only',
'igt_simulation',
'igt_stats',
'igt_segfault',
'igt_subtest_group',
'igt_assert',
'igt_exit_handler',
'igt_hdmi_inject',
'igt_can_fail',
'igt_can_fail_simple',
]
lib_fail_tests = [
'igt_no_exit',
'igt_no_exit_list_only',
'igt_no_subtest',
'igt_simple_test_subtests',
'igt_timeout',
'igt_invalid_subtest_name',
]
foreach lib_test : lib_tests
exec = executable(lib_test, lib_test + '.c', install : true,
dependencies : igt_deps)
test('lib: ' + lib_test, exec)
endforeach
foreach lib_test : lib_fail_tests
exec = executable(lib_test, lib_test + '.c', install : true,
dependencies : igt_deps)
test('lib: ' + lib_test, exec, should_fail : true)
endforeach
#define IGT_GIT_SHA1 "@VCS_TAG@"
project('IGT gpu tests', 'c',
version : '1.19',
default_options: [
'warning_level=2',
'c_std=gnu99',
],
license : 'MIT')
cc = meson.get_compiler('c')
inc = include_directories('lib', '.')
config_h = configuration_data()
libdrm = dependency('libdrm', version : '>=2.4.82')
libdrm_intel = dependency('libdrm_intel', required : false)
libdrm_vc4 = dependency('libdrm_vc4', required : false)
libdrm_nouveau = dependency('libdrm_nouveau', required : false)
libdrm_amdgpu = dependency('libdrm_amdgpu', required : false)
pciaccess = dependency('pciaccess', version : '>=0.10')
libkmod = dependency('libkmod')
libprocps = dependency('libprocps', required : false)
if libprocps.found()
config_h.set('HAVE_PROCPS', 1)
endif
valgrind = dependency('valgrind', required : false)
if valgrind.found()
config_h.set('HAVE_VALGRIND', 1)
endif
cairo = dependency('cairo', version : '>1.12.0', required : false)
libudev = dependency('libudev', required : false)
if libudev.found()
config_h.set('HAVE_UDEV', 1)
endif
glib = dependency('glib-2.0', required : false)
if glib.found()
config_h.set('HAVE_GLIB', 1)
endif
libunwind = dependency('libunwind')
gsl = dependency('gsl', required : false)
alsa = dependency('alsa', required : false)
pixman = dependency('pixman-1', required : false)
xmlrpc = dependency('xmlrpc', required : false)
xmlrpc_util = dependency('xmlrpc_util', required : false)
xmlrpc_client = dependency('xmlrpc_client', required : false)
if pixman.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
xmlrpc_util, xmlrpc_client])
else
chamelium = dependency('', required: false)
endif
pthreads = dependency('threads')
math = cc.find_library('m')
realtime = cc.find_library('rt')
dlsym = cc.find_library('dl')
zlib = cc.find_library('z')
if cc.has_header('linux/kd.h')
config_h.set('HAVE_LINUX_KD_H', 1)
endif
if cc.has_header('sys/kd.h')
config_h.set('HAVE_SYS_KD_H', 1)
endif
if cc.has_header('libgen.h')
config_h.set('HAVE_LIBGEN_H', 1)
endif
if cc.has_header('sys/io.h')
config_h.set('HAVE_SYS_IO_H', 1)
endif
if cc.has_header('cpuid.h')
# FIXME: Do we need the example link test from configure.ac?
config_h.set('HAVE_CPUID_H', 1)
endif
if cc.has_member('struct sysinfo', 'totalram',
prefix : '#include <sys/sysinfo.h>')
config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
endif
add_project_arguments('-D_GNU_SOURCE', language : 'c')
add_project_arguments('-include', 'config.h', language : 'c')
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('PACKAGE', meson.project_name())
config_h.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
configure_file(output: 'config.h', install: false, configuration: config_h)
subdir('lib')
subdir('tests')
subdir('benchmarks')
subdir('tools')
if libdrm_intel.found()
subdir('assembler')
subdir('overlay')
endif
gpu_overlay_src = [
'chart.c',
'config.c',
'cpu-top.c',
'debugfs.c',
'gem-interrupts.c',
'gem-objects.c',
'gpu-top.c',
'gpu-perf.c',
'gpu-freq.c',
'igfx.c',
'overlay.c',
'perf.c',
'power.c',
'rc6.c',
]
xv = dependency('xv', required : false)
x11 = dependency('x11', required : false)
xext = dependency('xext', required : false)
dri2proto = dependency('dri2proto', version : '>= 2.6', required : false)
cairo_xlib = dependency('cairo-xlib', required : false)
xrandr = dependency('xrandr', version : '>=1.3', required : false)
gpu_overlay_deps = [ realtime, cairo, pciaccess, libdrm, libdrm_intel ]
both_x11_src = ''
gpu_overlay_cflags = []
if xv.found() and x11.found() and xext.found() and dri2proto.found()
both_x11_src = 'x11/position.c'
gpu_overlay_src += [
'x11/dri2.c',
'x11/dri2.h',
'x11/rgb2yuv.c',
'x11/rgb2yuv.h',
'x11/x11-overlay.c',
]
gpu_overlay_deps += [ xv, x11, xext, dri2proto ]
gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XVLIB' ]
endif
if cairo_xlib.found() and xrandr.found() and dri2proto.found()
both_x11_src = 'x11/position.c'
gpu_overlay_src += 'x11/x11-window.c'
gpu_overlay_deps += [ cairo_xlib, dri2proto ]
gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XLIB' ]
endif
gpu_overlay_src += both_x11_src
gpu_overlay_src += 'kms/kms-overlay.c'
if xrandr.found() and cairo.found()
executable('intel_gpu_overlay', gpu_overlay_src,
include_directories : inc,
c_args : gpu_overlay_cflags,
dependencies : gpu_overlay_deps)
endif
#!/bin/bash
echo TESTLIST > $MESON_BUILD_ROOT/tests/test-list.txt
while [[ $# -gt 0 ]] ; do
echo $1 >> $MESON_BUILD_ROOT/tests/test-list.txt
shift
done
echo END TESTLIST >> $MESON_BUILD_ROOT/tests/test-list.txt
test_progs = [
'core_auth',
'core_get_client_auth',
'core_getclient',
'core_getstats',
'core_getversion',
'core_prop_blob',
'core_setmaster_vs_auth',
'debugfs_test',
'drm_import_export',
'drm_mm',
'drm_read',
'drm_vma_limiter',
'drm_vma_limiter_cached',
'drm_vma_limiter_cpu',
'drm_vma_limiter_gtt',
'drv_getparams_basic',
'drv_hangman',
'drv_missed_irq',
'drv_module_reload',
'drv_selftest',
'drv_suspend',
'gem_bad_length',
'gem_bad_reloc',
'gem_basic',
'gem_busy',
'gem_caching',
'gem_close',
'gem_close_race',
'gem_concurrent_blit',
'gem_cpu_reloc',
'gem_create',
'gem_cs_prefetch',
'gem_cs_tlb',
'gem_ctx_bad_destroy',
'gem_ctx_bad_exec',
'gem_ctx_basic',
'gem_ctx_create',
'gem_ctx_exec',
'gem_ctx_param',
'gem_ctx_switch',
'gem_ctx_thrash',
'gem_double_irq_loop',
'gem_eio',
'gem_evict_alignment',
'gem_evict_everything',
'gem_exec_alignment',
'gem_exec_async',
'gem_exec_await',
'gem_exec_bad_domains',
'gem_exec_basic',
'gem_exec_big',
'gem_exec_blt',
'gem_exec_capture',
'gem_exec_create',
'gem_exec_faulting_reloc',
'gem_exec_fence',
'gem_exec_flush',
'gem_exec_gttfill',
'gem_exec_latency',
'gem_exec_lut_handle',
'gem_exec_nop',
'gem_exec_parallel',
'gem_exec_params',
'gem_exec_parse',
'gem_exec_reloc',
'gem_exec_reuse',
'gem_exec_schedule',
'gem_exec_store',
'gem_exec_suspend',
'gem_exec_whisper',
'gem_fd_exhaustion',
'gem_fence_thrash',
'gem_fence_upload',
'gem_fenced_exec_thrash',
'gem_flink_basic',
'gem_flink_race',
'gem_gpgpu_fill',
'gem_gtt_cpu_tlb',
'gem_gtt_hog',
'gem_gtt_speed',
'gem_hangcheck_forcewake',
'gem_largeobject',
'gem_linear_blits',
'gem_lut_handle',
'gem_madvise',
'gem_media_fill',
'gem_mmap',
'gem_mmap_gtt',
'gem_mmap_offset_exhaustion',
'gem_mmap_wc',
'gem_mocs_settings',
'gem_partial_pwrite_pread',
'gem_persistent_relocs',
'gem_pin',
'gem_pipe_control_store_loop',
'gem_ppgtt',
'gem_pread',
'gem_pread_after_blit',
'gem_pwrite',
'gem_pwrite_pread',
'gem_pwrite_snooped',
'gem_read_read_speed',
'gem_readwrite',
'gem_reg_read',
'gem_reloc_overflow',
'gem_reloc_vs_gpu',
'gem_render_copy',
'gem_render_copy_redux',
'gem_render_linear_blits',
'gem_render_tiled_blits',
'gem_request_retire',
'gem_reset_stats',
'gem_ring_sync_copy',
'gem_ring_sync_loop',
'gem_ringfill',
'gem_seqno_wrap',
'gem_set_tiling_vs_blt',
'gem_set_tiling_vs_gtt',
'gem_set_tiling_vs_pwrite',
'gem_shrink',
'gem_softpin',
'gem_spin_batch',
'gem_stolen',
'gem_storedw_batches_loop',
'gem_storedw_loop',
'gem_streaming_writes',
'gem_sync',
'gem_threaded_access_tiled',
'gem_tiled_blits',
'gem_tiled_fence_blits',
'gem_tiled_partial_pwrite_pread',
'gem_tiled_pread_basic',
'gem_tiled_pread_pwrite',
'gem_tiled_swapping',
'gem_tiled_wb',
'gem_tiled_wc',
'gem_tiling_max_stride',
'gem_unfence_active_buffers',
'gem_unref_active_buffers',
'gem_userptr_blits',
'gem_wait',
'gem_workarounds',
'gem_write_read_ring_switch',
'gen3_mixed_blits',
'gen3_render_linear_blits',
'gen3_render_mixed_blits',
'gen3_render_tiledx_blits',
'gen3_render_tiledy_blits',
'gen7_forcewake_mt',
'gvt_basic',
'kms_3d',
'kms_addfb_basic',
'kms_atomic',
'kms_atomic_transition',
'kms_busy',
'kms_ccs',
'kms_chv_cursor_fail',
'kms_concurrent',
'kms_crtc_background_color',
'kms_cursor_crc',
'kms_cursor_legacy',
'kms_draw_crc',
'kms_fbc_crc',
'kms_fbcon_fbt',
'kms_fence_pin_leak',
'kms_flip',
'kms_flip_event_leak',
'kms_flip_tiling',
'kms_force_connector_basic',
'kms_frontbuffer_tracking',
'kms_hdmi_inject',
'kms_invalid_dotclock',
'kms_legacy_colorkey',
'kms_mmap_write_crc',
'kms_mmio_vs_cs_flip',
'kms_panel_fitting',
'kms_pipe_b_c_ivb',
'kms_pipe_color',
'kms_pipe_crc_basic',
'kms_plane',
'kms_plane_lowres',
'kms_plane_multiple',
'kms_plane_scaling',
'kms_properties',
'kms_psr_sink_crc',
'kms_pwrite_crc',
'kms_render',
'kms_rmfb',
'kms_rotation_crc',
'kms_setmode',
'kms_sink_crc_basic',
'kms_sysfs_edid_timing',
'kms_tv_load_detect',
'kms_universal_plane',
'kms_vblank',
'meta_test',
'perf',
'pm_backlight',
'pm_lpsp',
'pm_rc6_residency',
'pm_rpm',
'pm_rps',
'pm_sseu',
'prime_busy',
'prime_mmap',
'prime_mmap_coherency',
'prime_mmap_kms',
'prime_self_import',
'prime_udl',
'prime_vgem',
'sw_sync',
'syncobj_basic',
'template',
'tools_test',
'vgem_basic',
'vgem_slow',
]
test_deps = [ igt_deps ]
if libdrm_nouveau.found()
test_progs += [
'prime_nv_api',
'prime_nv_pcopy',
'prime_nv_test',
]
test_deps += libdrm_nouveau
endif
if libdrm_vc4.found()
test_progs += [
'vc4_create_bo',
'vc4_dmabuf_poll',
'vc4_lookup_fail',
'vc4_wait_bo',
'vc4_wait_seqno',
]
test_deps += libdrm_vc4
endif
if libdrm_amdgpu.found()
# FIXME meson/ninja really doesn't like build targets with paths in them
test_progs += [
'amdgpu/amd_basic',
'amdgpu/amd_cs_nop',
'amdgpu/amd_prime',
]
test_deps += libdrm_amdgpu
endif
if alsa.found()
test_progs += [
'audio',
]
test_deps += alsa
endif
foreach prog : test_progs
executable(prog, prog + '.c',
dependencies : test_deps)
endforeach
executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
dependencies : test_deps)
test_progs += 'testdisplay'
run_command('generate_testlist.sh', test_progs)
test_script = find_program('igt_command_line.sh')
foreach prog : test_progs
test('testcase check: ' + prog, test_script,
args : prog)
endforeach
executable('gem_stress', 'gem_stress.c', dependencies : igt_deps)
# IMPORTANT: These tests here are all disabled because the result in sometime
# unrecoverable gpu hangs. Don't put real testcases here.
hang_progs = [
'gem_bad_batch',
'gem_hang',
'gem_bad_blit',
'gem_bad_address',
'gem_non_secure_batch',
]
foreach prog : hang_progs
executable(prog, prog + '.c',
dependencies : igt_deps,