[Mesa-dev] [PATCH 2/6] meson: build glx

Eric Anholt eric at anholt.net
Wed Oct 4 21:57:23 UTC 2017


Dylan Baker <dylan at pnwbakers.com> writes:

> This gets GLX and the loader building. The resulting GLX and i965 have
> been tested on piglit and seem to work fine. This patch leaves a lot of
> todo's in it's wake, GLX is quite complicated, and the build options
> involved are many, and the goal at the moment is to get dri and gallium
> drivers building.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>

> diff --git a/meson.build b/meson.build
> index 1824a7ea184..52ac24f59ca 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -21,7 +21,18 @@
>  project('mesa', ['c', 'cpp'], version : '17.3.0-devel', license : 'MIT',
>          default_options : ['c_std=c99', 'cpp_std=c++11'])
>  
> -with_dri3 = true  # XXX: need a switch for this
> +# Arguments for the preprocessor, put these in a separate array from the C and
> +# C++ (cpp in meson terminology) arguments since they need to be added to the
> +# default arguments for both C and C++.
> +pre_args = [
> +  '-D__STDC_CONSTANT_MACROS',
> +  '-D__STDC_FORMAT_MACROS',
> +  '-D__STDC_LIMIT_MACROS',
> +  '-DVERSION="@0@"'.format(meson.project_version()),
> +  '-DPACKAGE_VERSION=VERSION',
> +  '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa"',
> +]
> +

It would be nice if this hunk appeared in its end position in patch 1.

> diff --git a/meson_options.txt b/meson_options.txt
> index 568903f1a0a..62d6b593f88 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -20,6 +20,8 @@
>  
>  option('platforms',      type : 'string',  value : 'x11,wayland',
>         description : 'comma separated list of window systems to support. wayland, x11, surfaceless, drm, etc.')
> +option('dri3',           type : 'combo',   value : 'auto', choices : ['auto', 'yes', 'no'],
> +       description : 'comma separated list of window systems to support. wayland, x11, surfaceless, drm, etc.')

Update the description.

> diff --git a/src/glx/meson.build b/src/glx/meson.build
> new file mode 100644
> index 00000000000..821623dc263
> --- /dev/null
> +++ b/src/glx/meson.build

> +dri_driver_dir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
> +if not with_glvnd
> +  gl_lib_name = 'GL'
> +  gl_lib_version = '1.2'
> +else
> +  gl_lib_name = 'GLX_mesa'
> +  gl_lib_version = '0'
> +  files_libglx += files(
> +    'g_glxglvnddispatchfuncs.c',
> +    'g_glxglvnddispatchindices.h',
> +    'glxglvnd.c',
> +    'glxglvnd.h',
> +    'glxglvnddispatchfuncs.h',
> +  )
> +endif
> +
> +gl_lib_cargs = [
> +  '-D_RENTRANT', '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir),

"_REENTRANT"

We probably actually don't need _REENTRANT at all -- if it's needed
here, it's surely needed across the tree, but _GNU_SOURCE should have us
covered.

> +]
> +
> +if dep_xf86vm != [] and dep_xf86vm.found()
> +  gl_lib_cargs += '-DHAVE_XF86VIDMODE'
> +endif
> +
> +libglx = static_library(
> +  'glx',
> +  [files_libglx, glx_indirect_c, glx_indirect_h, glx_indirect_init_c,
> +   glx_indirect_size_c, glx_indirect_size_h],
> +  include_directories : [
> +    inc_common, inc_glapi,
> +    include_directories('../loader', '../../include/GL/internal')
> +  ],
> +  c_args : [c_vis_args, gl_lib_cargs,
> +            '-DGL_LIB_NAME="lib at 0@.so. at 1@"'.format(gl_lib_name, gl_lib_version)],

GL_LIB_NAME looks like it was libGL.so.1 on !glvnd in automake, not
libGL.so.1.2.

> +  link_with : [libloader, libloader_dri3_helper, libmesa_util, libxmlconfig],
> +  dependencies : [dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd],
> +  build_by_default : false,
> +)
> +
> +# workaround for bug #2180
> +dummy_c = custom_target(
> +  'dummy_c',
> +  output : 'dummy.c',
> +  command : [prog_touch, '@OUTPUT@'],
> +)
> +
> +if with_glx == 'dri'
> +  libgl = shared_library(
> +    gl_lib_name,
> +    dummy_c,  # workaround for bug #2180
> +    include_directories : [
> +      inc_common, inc_glapi, 
> +      include_directories('../loader', '../../include/GL/internal')
> +    ],
> +    link_with : [libglapi_static, libglapi],
> +    link_whole : libglx,

It's not clear to me why we're building a static libglx above if it's
only used in one place.

> +    link_args : [ld_args_bsymbolic, ld_args_gc_sections],

Missing -no-undefined?

> diff --git a/src/mapi/glapi/gen/meson.build b/src/mapi/glapi/gen/meson.build
> index f4c1343202c..cf1f014b4f0 100644
> --- a/src/mapi/glapi/gen/meson.build
> +++ b/src/mapi/glapi/gen/meson.build
> @@ -247,7 +247,7 @@ glx_indirect_size_h = custom_target(
>    input : ['glX_proto_size.py', 'gl_API.xml'],
>    output : 'indirect_size.h',
>    command : [prog_python2, '@INPUT0@', '-f', '@INPUT1@', '-m', 'size_h',
> -             '--header-tag', '_INDIRECT_SIZE_H_'],
> +             '--header-tag', '_INDIRECT_SIZE_H_', '--only-set'],
>    depend_files : glx_gen_depends,
>    capture : true,
>  )
> @@ -256,7 +256,8 @@ glx_indirect_size_c = custom_target(
>    'indirect_size.c',
>    input : ['glX_proto_size.py', 'gl_API.xml'],
>    output : 'indirect_size.c',
> -  command : [prog_python2, '@INPUT0@', '-f', '@INPUT1@', '-m', 'size_c'],
> +  command : [prog_python2, '@INPUT0@', '-f', '@INPUT1@', '-m', 'size_c',
> +             '--only-set'],
>    depend_files : glx_gen_depends,
>    capture : true,
>  )

This should be in the previous patch, it looks like.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171004/23cfff2d/attachment.sig>


More information about the mesa-dev mailing list