From 2abbf3d4b005fafd2b8f9f6f0da2136f557d5eaf Mon Sep 17 00:00:00 2001 From: Mark Pryor Date: Fri, 12 Aug 2022 18:13:05 -0700 Subject: [PATCH 1106/1110] move opengl to meson --- configure | 40 ----------------------------------- meson.build | 16 +++++++++----- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ ui/meson.build | 17 ++++++++------- 5 files changed, 25 insertions(+), 53 deletions(-) diff --git a/tools/qemu-xen/configure b/tools/qemu-xen/configure index 7c08c18358..2a1eb8a76e 100755 --- a/tools/qemu-xen/configure +++ b/tools/qemu-xen/configure @@ -322,7 +322,6 @@ pkgversion="" pie="" trace_backends="log" trace_file="trace" -opengl="$default_feature" coroutine="" tls_priority="NORMAL" plugins="$default_feature" @@ -966,10 +965,6 @@ for opt do ;; --enable-vhost-user-fs) vhost_user_fs="yes" ;; - --disable-opengl) opengl="no" - ;; - --enable-opengl) opengl="yes" - ;; --disable-zlib-test) ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) @@ -1264,7 +1259,6 @@ cat << EOF vhost-kernel vhost kernel backend support vhost-user vhost-user backend support vhost-vdpa vhost-vdpa kernel backend support - opengl opengl support gio libgio support NOTE: The object files are built at the place where configure is launched @@ -2284,34 +2278,6 @@ case "$fdt" in esac ########################################## -# opengl probe (for sdl2, gtk) - -if test "$opengl" != "no" ; then - epoxy=no - if $pkg_config epoxy; then - cat > $TMPC << EOF -#include -int main(void) { return 0; } -EOF - if compile_prog "" "" ; then - epoxy=yes - fi - fi - - if test "$epoxy" = "yes" ; then - opengl_cflags="$($pkg_config --cflags epoxy)" - opengl_libs="$($pkg_config --libs epoxy)" - opengl=yes - else - if test "$opengl" = "yes" ; then - feature_not_found "opengl" "Please install epoxy with EGL" - fi - opengl_cflags="" - opengl_libs="" - opengl=no - fi -fi - # check for usbfs have_usbfs=no if test "$linux_user" = "yes"; then @@ -2885,12 +2851,6 @@ if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak fi -if test "$opengl" = "yes" ; then - echo "CONFIG_OPENGL=y" >> $config_host_mak - echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak - echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak -fi - # XXX: suppress that if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak diff --git a/tools/qemu-xen/meson.build b/tools/qemu-xen/meson.build index 861de93c4f..67a2cad95c 100644 --- a/tools/qemu-xen/meson.build +++ b/tools/qemu-xen/meson.build @@ -1000,9 +1000,14 @@ if not get_option('coreaudio').auto() or (targetos == 'darwin' and have_system) endif opengl = not_found -if 'CONFIG_OPENGL' in config_host - opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(), - link_args: config_host['OPENGL_LIBS'].split()) +if not get_option('opengl').auto() or have_system or have_vhost_user_gpu + epoxy = dependency('epoxy', method: 'pkg-config', + required: get_option('opengl'), kwargs: static_kwargs) + if cc.has_header('epoxy/egl.h', dependencies: epoxy) + opengl = epoxy + elif get_option('opengl').enabled() + error('epoxy/egl.h not found') + endif endif gbm = not_found if (have_system or have_tools) and (virgl.found() or opengl.found()) @@ -1544,6 +1549,7 @@ config_host_data.set('CONFIG_LINUX_AIO', libaio.found()) config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found()) config_host_data.set('CONFIG_LIBPMEM', libpmem.found()) config_host_data.set('CONFIG_NUMA', numa.found()) +config_host_data.set('CONFIG_OPENGL', opengl.found()) config_host_data.set('CONFIG_PROFILER', get_option('profiler')) config_host_data.set('CONFIG_RBD', rbd.found()) config_host_data.set('CONFIG_SDL', sdl.found()) @@ -2103,7 +2109,7 @@ host_kconfig = \ (have_tpm ? ['CONFIG_TPM=y'] : []) + \ (spice.found() ? ['CONFIG_SPICE=y'] : []) + \ (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \ - ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ + (opengl.found() ? ['CONFIG_OPENGL=y'] : []) + \ (x11.found() ? ['CONFIG_X11=y'] : []) + \ ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \ ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \ @@ -3713,7 +3719,7 @@ summary_info += {'smartcard support': cacard} summary_info += {'U2F support': u2f} summary_info += {'libusb': libusb} summary_info += {'usb net redir': usbredir} -summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} +summary_info += {'OpenGL support (epoxy)': opengl} summary_info += {'GBM': gbm} summary_info += {'libiscsi support': libiscsi} summary_info += {'libnfs support': libnfs} diff --git a/tools/qemu-xen/meson_options.txt b/tools/qemu-xen/meson_options.txt index 52b11cead4..bd8efe4fbf 100644 --- a/tools/qemu-xen/meson_options.txt +++ b/tools/qemu-xen/meson_options.txt @@ -149,6 +149,8 @@ option('lzo', type : 'feature', value : 'auto', description: 'lzo compression support') option('rbd', type : 'feature', value : 'auto', description: 'Ceph block device driver') +option('opengl', type : 'feature', value : 'auto', + description: 'OpenGL support') option('gtk', type : 'feature', value : 'auto', description: 'GTK+ user interface') option('sdl', type : 'feature', value : 'auto', diff --git a/tools/qemu-xen/scripts/meson-buildoptions.sh b/tools/qemu-xen/scripts/meson-buildoptions.sh index 1e26f4571e..f91bd9231b 100644 --- a/tools/qemu-xen/scripts/meson-buildoptions.sh +++ b/tools/qemu-xen/scripts/meson-buildoptions.sh @@ -91,6 +91,7 @@ meson_options_help() { printf "%s\n" ' nettle nettle cryptography support' printf "%s\n" ' numa libnuma support' printf "%s\n" ' nvmm NVMM acceleration support' + printf "%s\n" ' opengl OpenGL support' printf "%s\n" ' oss OSS sound support' printf "%s\n" ' pa PulseAudio sound support' printf "%s\n" ' parallels parallels image format support' @@ -271,6 +272,8 @@ _meson_option_parse() { --disable-numa) printf "%s" -Dnuma=disabled ;; --enable-nvmm) printf "%s" -Dnvmm=enabled ;; --disable-nvmm) printf "%s" -Dnvmm=disabled ;; + --enable-opengl) printf "%s" -Dopengl=enabled ;; + --disable-opengl) printf "%s" -Dopengl=disabled ;; --enable-oss) printf "%s" -Doss=enabled ;; --disable-oss) printf "%s" -Doss=disabled ;; --enable-pa) printf "%s" -Dpa=enabled ;; diff --git a/tools/qemu-xen/ui/meson.build b/tools/qemu-xen/ui/meson.build index 64286ba150..b21d3d1534 100644 --- a/tools/qemu-xen/ui/meson.build +++ b/tools/qemu-xen/ui/meson.build @@ -1,5 +1,6 @@ softmmu_ss.add(pixman) specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: pixman) # for the include path +specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl) # for the include path softmmu_ss.add(files( 'clipboard.c', @@ -43,7 +44,6 @@ vnc_ss.add(zlib, png, jpeg, gnutls) vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c')) softmmu_ss.add_all(when: vnc, if_true: vnc_ss) softmmu_ss.add(when: vnc, if_false: files('vnc-stubs.c')) -specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl) ui_modules = {} @@ -53,17 +53,18 @@ if curses.found() ui_modules += {'curses' : curses_ss} endif -if config_host.has_key('CONFIG_OPENGL') +softmmu_ss.add(opengl) +if opengl.found() opengl_ss = ss.source_set() opengl_ss.add(gbm) - opengl_ss.add(when: [opengl, pixman, 'CONFIG_OPENGL'], + opengl_ss.add(when: [opengl, pixman], if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c', 'egl-context.c')) ui_modules += {'opengl' : opengl_ss} endif -if config_host.has_key('CONFIG_OPENGL') and gbm.found() +if opengl.found() and gbm.found() egl_headless_ss = ss.source_set() - egl_headless_ss.add(when: [opengl, gbm, pixman, 'CONFIG_OPENGL'], + egl_headless_ss.add(when: [opengl, gbm, pixman], if_true: files('egl-headless.c')) ui_modules += {'egl-headless' : egl_headless_ss} endif @@ -98,8 +99,8 @@ if gtk.found() gtk_ss = ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c', 'gtk-clipboard.c')) gtk_ss.add(when: x11, if_true: files('x_keymap.c')) - gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-gl-area.c')) - gtk_ss.add(when: [x11, opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c')) + gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c')) + gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c')) ui_modules += {'gtk' : gtk_ss} endif @@ -112,7 +113,7 @@ if sdl.found() 'sdl2-input.c', 'sdl2.c', )) - sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c')) + sdl_ss.add(when: opengl, if_true: files('sdl2-gl.c')) sdl_ss.add(when: x11, if_true: files('x_keymap.c')) ui_modules += {'sdl' : sdl_ss} endif -- 2.37.1