summaryrefslogtreecommitdiff
path: root/overlay/meson.build
blob: 46d2d4941c1a4b1f8b028707e3d0a3476c5d9378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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',
	'power.c',
	'rc6.c',
]

xv_backend_required = false
xlib_backend_required = false
build_xv_backend = overlay_backends.contains('xv') or overlay_backends.contains('auto')
build_xlib_backend = overlay_backends.contains('x') or overlay_backends.contains('auto')
if _overlay_required
	xv_backend_required = overlay_backends.contains('xv')
	xlib_backend_required = overlay_backends.contains('x')
endif

xv = dependency('xv', required : xv_backend_required)
x11 = dependency('x11', required : xv_backend_required)
xext = dependency('xext', required : xv_backend_required)
dri2proto = dependency('dri2proto',
		       version : '>= 2.6',
		       required : xv_backend_required or xlib_backend_required)
cairo_xlib = dependency('cairo-xlib', required : xlib_backend_required)
xrandr = dependency('xrandr', version : '>=1.3', required : _overlay_required)

gpu_overlay_deps = [ realtime, math, cairo, pciaccess, libdrm,
	libdrm_intel, lib_igt_perf ]

both_x11_src = ''

with_xv_backend = false
with_xlib_backend = false
backends_strings = []

gpu_overlay_cflags = []
if build_xv_backend and 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' ]
	with_xv_backend = true
	backends_strings += 'Xv'
endif

if build_xlib_backend and cairo_xlib.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' ]
	with_xlib_backend = true
	backends_strings += 'X'
endif

gpu_overlay_src += both_x11_src

gpu_overlay_src += 'kms/kms-overlay.c'

leg = find_program('leg', required : _overlay_required)
if leg.found()
	leg_file = custom_target('tracepoint_format',
		output: 'tracepoint_format.h',
		input: 'tracepoint_format.leg',
		command: [leg, '-P', '-o', '@OUTPUT@', '@INPUT@'])
	gpu_overlay_src += leg_file
else
	message('WARNING: leg command not found, disabling overlay; try : apt-get install peg')
endif

if _build_overlay and ['x86', 'x86_64'].contains(host_machine.cpu_family()) and libdrm_intel.found() and leg.found() and xrandr.found() and cairo.found() and (with_xlib_backend or with_xv_backend)
	executable('intel-gpu-overlay', gpu_overlay_src,
			include_directories : inc,
			c_args : gpu_overlay_cflags,
			dependencies : gpu_overlay_deps,
			install : true)
	build_info += 'Build overlay: Yes'
	build_info += 'Overlay backends: ' + ','.join(backends_strings)
else
	if _overlay_required
		error('Cannot build overlay due to missing dependencies')
	endif
	build_info += 'Build overlay: No'
endif