• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1build_overlay = get_option('overlay')
2overlay_backends = get_option('overlay_backends')
3
4gpu_overlay_src = [
5	'chart.c',
6	'config.c',
7	'cpu-top.c',
8	'debugfs.c',
9	'gem-interrupts.c',
10	'gem-objects.c',
11	'gpu-top.c',
12	'gpu-perf.c',
13	'gpu-freq.c',
14	'overlay.c',
15	'power.c',
16	'rc6.c',
17]
18
19xv_backend_required = false
20xlib_backend_required = false
21build_xv_backend = overlay_backends.contains('xv') or overlay_backends.contains('auto')
22build_xlib_backend = overlay_backends.contains('x') or overlay_backends.contains('auto')
23if build_overlay.enabled()
24	xv_backend_required = overlay_backends.contains('xv')
25	xlib_backend_required = overlay_backends.contains('x')
26endif
27
28xv = dependency('xv', required : xv_backend_required)
29x11 = dependency('x11', required : xv_backend_required)
30xext = dependency('xext', required : xv_backend_required)
31dri2proto = dependency('dri2proto',
32		       version : '>= 2.6',
33		       required : xv_backend_required or xlib_backend_required)
34cairo_xlib = dependency('cairo-xlib', required : xlib_backend_required)
35xrandr = dependency('xrandr', version : '>=1.3', required : build_overlay)
36
37gpu_overlay_deps = [ realtime, math, cairo, pciaccess, libdrm,
38	libdrm_intel, lib_igt_perf ]
39
40both_x11_src = ''
41
42with_xv_backend = false
43with_xlib_backend = false
44backends_strings = []
45
46gpu_overlay_cflags = []
47if build_xv_backend and xv.found() and x11.found() and xext.found() and dri2proto.found()
48	both_x11_src = 'x11/position.c'
49	gpu_overlay_src += [
50		'x11/dri2.c',
51		'x11/dri2.h',
52		'x11/rgb2yuv.c',
53		'x11/rgb2yuv.h',
54		'x11/x11-overlay.c',
55	]
56	gpu_overlay_deps += [ xv, x11, xext, dri2proto ]
57	gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XVLIB' ]
58	with_xv_backend = true
59	backends_strings += 'Xv'
60endif
61
62if build_xlib_backend and cairo_xlib.found() and dri2proto.found()
63	both_x11_src = 'x11/position.c'
64	gpu_overlay_src += 'x11/x11-window.c'
65	gpu_overlay_deps += [ cairo_xlib, dri2proto ]
66	gpu_overlay_cflags += [ '-DHAVE_OVERLAY_XLIB' ]
67	with_xlib_backend = true
68	backends_strings += 'X'
69endif
70
71gpu_overlay_src += both_x11_src
72
73gpu_overlay_src += 'kms/kms-overlay.c'
74
75leg = find_program('leg', required : build_overlay)
76if leg.found()
77	leg_file = custom_target('tracepoint_format',
78		output: 'tracepoint_format.h',
79		input: 'tracepoint_format.leg',
80		command: [leg, '-P', '-o', '@OUTPUT@', '@INPUT@'])
81	gpu_overlay_src += leg_file
82else
83	message('WARNING: leg command not found, disabling overlay; try : apt-get install peg')
84endif
85
86if not build_overlay.disabled() 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)
87	executable('intel-gpu-overlay', gpu_overlay_src,
88			include_directories : inc,
89			c_args : gpu_overlay_cflags,
90			dependencies : gpu_overlay_deps,
91			install : true)
92	build_info += 'Build overlay: true'
93	build_info += 'Overlay backends: ' + ','.join(backends_strings)
94else
95	if build_overlay.enabled()
96		error('Cannot build overlay due to missing dependencies')
97	endif
98	build_info += 'Build overlay: false'
99endif
100