From 118a7f044191d4ab15ac99f7748a6d6d97e683d1 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 1 Nov 2017 17:42:41 -0700 Subject: [PATCH] meson: add support for xlib glx There is a bunch of churn in the main meson.build so that we can correctly set the auto tristate of GLX. In particular, don't build xlib-based glx when dri and gallium are disabled but vulkan is enabled, in that case just turn glx off. Signed-off-by: Dylan Baker Reviewed-by: Eric Anholt --- meson.build | 57 +++++++++++++++++++------------- src/mesa/drivers/x11/meson.build | 39 ++++++++++++++++++++++ src/mesa/meson.build | 8 ++--- 3 files changed, 76 insertions(+), 28 deletions(-) create mode 100644 src/mesa/drivers/x11/meson.build diff --git a/meson.build b/meson.build index 855c80ed658..3922733a073 100644 --- a/meson.build +++ b/meson.build @@ -155,14 +155,6 @@ if _drivers != '' with_dri = true endif -if not (with_dri or with_gallium) - with_gles1 = false - with_gles2 = false - with_opengl = false - with_any_opengl = false - with_shared_glapi = false -endif - if with_dri_swrast and with_gallium_softpipe error('Only one swrast provider can be built') endif @@ -195,6 +187,29 @@ if _platforms != '' egl_native_platform = _split[0] endif +with_glx = get_option('glx') +if with_glx == 'auto' + if with_dri + with_glx = 'dri' + elif with_gallium + with_glx = 'gallium-xlib' + elif with_platform_x11 and with_any_opengl and not with_any_vk + # The automatic behavior should not be to turn on xlib based glx when + # building only vulkan drivers + with_glx = 'xlib' + else + with_glx = 'disabled' + endif +endif + +if not (with_dri or with_gallium or with_glx == 'xlib') + with_gles1 = false + with_gles2 = false + with_opengl = false + with_any_opengl = false + with_shared_glapi = false +endif + with_gbm = get_option('gbm') if with_gbm == 'auto' and with_dri # TODO: or gallium with_gbm = host_machine.system() == 'linux' @@ -229,7 +244,6 @@ if with_egl and with_gallium_radeonsi and not (with_platform_drm or with_platfor endif pre_args += '-DGLX_USE_TLS' -with_glx = get_option('glx') if with_glx != 'disabled' if not (with_platform_x11 and with_any_opengl) if with_glx == 'auto' @@ -243,18 +257,12 @@ if with_glx != 'disabled' elif with_dri error('gallium-xlib conflicts with any dri driver') endif - elif with_glx == 'dri' and not with_dri - error('dri based GLX requires at least one DRI driver') - elif with_glx == 'auto' + elif with_glx == 'xlib' if with_dri - with_glx = 'dri' - elif with_gallium - with_glx = 'gallium-xlib' - elif with_platform_x11 and with_any_opengl - with_glx = 'xlib' - else - with_glx = 'disabled' + error('xlib conflicts with any dri driver') endif + elif with_glx == 'dri' and not with_dri + error('dri based GLX requires at least one DRI driver') endif endif @@ -346,8 +354,7 @@ if with_platform_x11 pre_args += '-DHAVE_X11_PLATFORM' endif if with_glx == 'xlib' - # TODO - error('TODO') + pre_args += '-DUSE_XSHM' elif with_glx == 'gallium-xlib' # TODO error('TODO') @@ -830,7 +837,11 @@ dep_xcb_sync = [] dep_xcb_xfixes = [] dep_xshmfence = [] if with_platform_x11 - if with_glx == 'dri' and with_dri_platform == 'drm' + if with_glx == 'xlib' + dep_x11 = dependency('x11') + dep_xext = dependency('xext') + dep_xcb = dependency('xcb') + elif with_glx == 'dri' and with_dri_platform == 'drm' dep_x11 = dependency('x11') dep_xext = dependency('xext') dep_xdamage = dependency('xdamage', version : '>= 1.1') @@ -851,7 +862,7 @@ if with_platform_x11 dep_xshmfence = dependency('xshmfence', version : '>= 1.1') endif endif - if with_glx != 'disabled' + if with_glx == 'dri' dep_dri2proto = dependency('dri2proto', version : '>= 2.8') dep_glproto = dependency('glproto', version : '>= 1.4.14') endif diff --git a/src/mesa/drivers/x11/meson.build b/src/mesa/drivers/x11/meson.build new file mode 100644 index 00000000000..bb4fda14cb8 --- /dev/null +++ b/src/mesa/drivers/x11/meson.build @@ -0,0 +1,39 @@ +# Copyright © 2017 Intel Corporation + +# 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. + +gl_link_with = [] +if with_shared_glapi + gl_link_with += libglapi +endif + +libgl = shared_library( + 'GL', + files( + 'fakeglx.c', 'glxapi.c', 'xfonts.c', 'xm_api.c', 'xm_buffer.c', 'xm_dd.c', + 'xm_line.c', 'xm_tri.c', + ), + include_directories : [ + inc_include, inc_src, inc_mesa, inc_mapi, inc_gallium, inc_gallium_aux + ], + link_with : [libmesa_classic, libglapi_static, gl_link_with], + dependencies : [dep_x11, dep_xext, dep_xcb, dep_thread], + version : '1.6.0', + install : true, +) diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 20d06aad4dd..b839fd02981 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -19,15 +19,10 @@ # SOFTWARE. # TODO: main/tests -# TODO: xlib_glx -# TODO: osmesa -# TODO: asm_offsets subdir('program') subdir('main') -# program files -# program nir files # files shared between classic mesa and gallium mesa files_libmesa_common = files( 'program/arbprogparse.c', @@ -721,6 +716,9 @@ subdir('drivers/dri') if with_osmesa == 'classic' subdir('drivers/osmesa') endif +if with_glx == 'xlib' + subdir('drivers/x11') +endif if with_tests subdir('main/tests') endif -- 2.30.2