[Mesa-dev] [PATCH] meson: Add Haiku platform support v4
Eric Engestrom
eric.engestrom at imgtec.com
Mon Feb 19 11:20:37 UTC 2018
On Friday, 2018-02-16 14:27:03 -0600, Alexander von Gluck IV wrote:
> ---
> include/meson.build | 8 +++++
> meson.build | 16 +++++++---
> src/egl/meson.build | 36 +++++++++++++++-------
> src/gallium/meson.build | 9 ++++++
> src/gallium/state_trackers/hgl/meson.build | 41 ++++++++++++++++++++++++++
> src/gallium/targets/haiku-softpipe/meson.build | 40 +++++++++++++++++++++++++
> src/gallium/winsys/sw/hgl/meson.build | 29 ++++++++++++++++++
> src/hgl/meson.build | 36 ++++++++++++++++++++++
> src/mapi/es1api/meson.build | 2 +-
> src/mapi/es2api/meson.build | 2 +-
> src/meson.build | 7 ++++-
> 11 files changed, 209 insertions(+), 17 deletions(-)
> create mode 100644 src/gallium/state_trackers/hgl/meson.build
> create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
> create mode 100644 src/gallium/winsys/sw/hgl/meson.build
> create mode 100644 src/hgl/meson.build
>
> diff --git a/include/meson.build b/include/meson.build
> index 1cbc68182c..28ffb33215 100644
> --- a/include/meson.build
> +++ b/include/meson.build
> @@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
> inc_vulkan = include_directories('vulkan')
> inc_d3d9 = include_directories('D3D9')
> inc_gl_internal = include_directories('GL/internal')
> +inc_haikugl = include_directories('HaikuGL')
>
> if with_gles1
> install_headers(
> @@ -80,6 +81,13 @@ if with_gallium_st_nine
> )
> endif
>
> +if with_platform_haiku
> + install_headers(
> + 'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
> + subdir : 'opengl',
> + )
> +endif
> +
> # Only install the headers if we are building a stand alone implementation and
> # not an ICD enabled implementation
> if with_gallium_opencl and not with_opencl_icd
> diff --git a/meson.build b/meson.build
> index d6ffa30d9e..120042fb24 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -99,7 +99,7 @@ if _drivers == 'auto'
> else
> error('Unknown architecture. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
> endif
> - elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
> + elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
> # only swrast would make sense here, but gallium swrast is a much better default
> _drivers = ''
> else
> @@ -144,7 +144,7 @@ if _drivers == 'auto'
> else
> error('Unknown architecture. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
> endif
> - elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
> + elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
> _drivers = 'swrast'
> else
> error('Unknown OS. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
> @@ -181,7 +181,7 @@ if _vulkan_drivers == 'auto'
> else
> error('Unknown architecture. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
> endif
> - elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
> + elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
> # No vulkan driver supports windows or macOS currently
> _vulkan_drivers = ''
> else
> @@ -242,6 +242,8 @@ if _platforms == 'auto'
> _platforms = 'x11,wayland,drm,surfaceless'
> elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
> _platforms = 'x11,surfaceless'
> + elif ['haiku'].contains(host_machine.system())
> + _platforms = 'haiku'
> else
> error('Unknown OS. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.')
> endif
> @@ -252,6 +254,7 @@ if _platforms != ''
> with_platform_x11 = _split.contains('x11')
> with_platform_wayland = _split.contains('wayland')
> with_platform_drm = _split.contains('drm')
> + with_platform_haiku = _split.contains('haiku')
> with_platform_surfaceless = _split.contains('surfaceless')
> egl_native_platform = _split[0]
> endif
> @@ -260,6 +263,8 @@ with_glx = get_option('glx')
> if with_glx == 'auto'
> if with_dri
> with_glx = 'dri'
> + elif with_platform_haiku
> + with_glx = 'disabled'
> elif with_gallium
> # Even when building just gallium drivers the user probably wants dri
> with_glx = 'dri'
> @@ -375,7 +380,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
> error('Vulkan drivers require dri3 for X11 support')
> endif
> if with_dri or with_gallium
> - if with_glx == 'disabled' and not with_egl
> + if with_glx == 'disabled' and not with_egl and not with_platform_haiku
> error('building dri or gallium drivers require at least one window system')
> endif
> endif
> @@ -642,6 +647,9 @@ if with_platform_android
> ]
> pre_args += '-DHAVE_ANDROID_PLATFORM'
> endif
> +if with_platform_haiku
> + pre_args += '-DHAVE_HAIKU_PLATFORM'
> +endif
>
> prog_python2 = find_program('python2')
> has_mako = run_command(prog_python2, '-c', 'import mako')
> diff --git a/src/egl/meson.build b/src/egl/meson.build
> index 6cd04567b0..113cdfa480 100644
> --- a/src/egl/meson.build
> +++ b/src/egl/meson.build
> @@ -21,9 +21,8 @@
> c_args_for_egl = []
> link_for_egl = []
> deps_for_egl = []
> -incs_for_egl = [
> - inc_include, inc_src, inc_loader, inc_gbm, include_directories('main'),
> -]
> +incs_for_egl = [inc_include, inc_src, include_directories('main')]
> +
> files_egl = files(
> 'main/eglapi.c',
> 'main/eglapi.h',
> @@ -53,9 +52,6 @@ files_egl = files(
> 'main/eglsync.h',
> 'main/eglentrypoint.h',
> 'main/egltypedefs.h',
> - 'drivers/dri2/egl_dri2.c',
> - 'drivers/dri2/egl_dri2.h',
> - 'drivers/dri2/egl_dri2_fallbacks.h',
> )
>
> linux_dmabuf_unstable_v1_protocol_c = custom_target(
> @@ -100,6 +96,18 @@ g_egldispatchstubs_h = custom_target(
> capture : true,
> )
>
> +if with_dri2
> + files_egl += files(
> + 'drivers/dri2/egl_dri2.c',
> + 'drivers/dri2/egl_dri2.h',
> + 'drivers/dri2/egl_dri2_fallbacks.h',
> + )
> + c_args_for_egl += [
> + '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
> + '-D_EGL_BUILT_IN_DRIVER_DRI2',
> + ]
> +endif
> +
> if with_platform_x11
> files_egl += files('drivers/dri2/platform_x11.c')
> if with_dri3
> @@ -110,8 +118,9 @@ if with_platform_x11
> endif
> if with_platform_drm
> files_egl += files('drivers/dri2/platform_drm.c')
> - link_for_egl += libgbm
> - incs_for_egl += include_directories('../gbm/main')
> + link_for_egl += [libloader, libgbm, libxmlconfig]
> + incs_for_egl += [inc_loader, inc_gbm, include_directories('../gbm/main')]
> + deps_for_egl += dep_libdrm
> endif
> if with_platform_surfaceless
> files_egl += files('drivers/dri2/platform_surfaceless.c')
> @@ -133,6 +142,15 @@ if with_platform_android
> deps_for_egl += dep_android
> files_egl += files('drivers/dri2/platform_android.c')
> endif
> +if with_platform_haiku
> + incs_for_egl += inc_haikugl
> + c_args_for_egl += [
> + '-D_EGL_BUILT_IN_DRIVER_HAIKU',
> + ]
> + files_egl += files('drivers/haiku/egl_haiku.cpp')
> + link_for_egl += libgl
> + deps_for_egl += cpp.find_library('be')
> +endif
>
> # TODO: glvnd
>
> @@ -160,8 +178,6 @@ libegl = shared_library(
> c_args : [
> c_vis_args,
> c_args_for_egl,
> - '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
> - '-D_EGL_BUILT_IN_DRIVER_DRI2',
> '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ at 0@'.format(egl_native_platform.to_upper()),
> ],
> include_directories : incs_for_egl,
> diff --git a/src/gallium/meson.build b/src/gallium/meson.build
> index 6330c7514a..ca3190502b 100644
> --- a/src/gallium/meson.build
> +++ b/src/gallium/meson.build
> @@ -32,6 +32,9 @@ subdir('winsys/sw/null')
> subdir('winsys/sw/dri')
> subdir('winsys/sw/kms-dri')
> subdir('winsys/sw/wrapper')
> +if with_platform_haiku
> + subdir('winsys/sw/hgl')
> +endif
> if with_gallium_swr
> if meson.version().version_compare('< 0.44.0')
> error('SWR requires meson 0.44.0 or greater.')
> @@ -145,6 +148,9 @@ endif
> if with_gallium_st_nine
> subdir('state_trackers/nine')
> endif
> +if with_platform_haiku
> + subdir('state_trackers/hgl')
> +endif
> if with_gallium_opencl
> # TODO: this isn't really clover specific, but ATM clover is the only
> # consumer
> @@ -184,6 +190,9 @@ endif
> if with_gallium_xa
> subdir('targets/xa')
> endif
> +if with_platform_haiku
> + subdir('targets/haiku-softpipe')
> +endif
> if with_gallium_st_nine
> subdir('targets/d3dadapter9')
> endif
> diff --git a/src/gallium/state_trackers/hgl/meson.build b/src/gallium/state_trackers/hgl/meson.build
> new file mode 100644
> index 0000000000..3c5870fe10
> --- /dev/null
> +++ b/src/gallium/state_trackers/hgl/meson.build
> @@ -0,0 +1,41 @@
> +# Copyright © 2017 Dylan Baker
> +
> +# 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.
> +
> +files_libsthgl = files(
> + 'bitmap_wrapper.cpp',
> + 'bitmap_wrapper.h',
> + 'hgl_context.h',
> + 'hgl.c',
> +)
> +
> +libsthgl_c_args = []
> +if with_gallium_softpipe
> + libsthgl_c_args += '-DGALLIUM_SOFTPIPE'
> +endif
> +
> +libsthgl = static_library(
> + 'sthgl',
> + files_libsthgl,
> + include_directories : [
> + inc_include, inc_haikugl, inc_util, inc_mesa, inc_mapi, inc_src,
> + inc_gallium, inc_gallium_aux
> + ],
> + c_args : [c_vis_args, libsthgl_c_args],
> +)
> diff --git a/src/gallium/targets/haiku-softpipe/meson.build b/src/gallium/targets/haiku-softpipe/meson.build
> new file mode 100644
> index 0000000000..84bcea4bbf
> --- /dev/null
> +++ b/src/gallium/targets/haiku-softpipe/meson.build
> @@ -0,0 +1,40 @@
> +# Copyright © 2017 Dylan Baker
> +
> +# 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.
> +
> +libswpipe = shared_library(
> + 'swpipe',
> + files('SoftwareRenderer.cpp', 'GalliumContext.cpp'),
> + include_directories : [
> + inc_common, inc_util, inc_haikugl, inc_gallium_drivers, inc_gallium_winsys,
> + include_directories('../../state_trackers/hgl'),
> + include_directories('/boot/system/develop/headers/private')
> + ],
> + c_args : [c_vis_args],
> + cpp_args : [cpp_vis_args],
> + link_args : [ld_args_bsymbolic, ld_args_gc_sections],
> + link_with : [
> + libglapi, libswhgl, libsthgl, libtrace, librbug, libmesa_util, libcompiler,
> + libmesa_gallium, libglsl, libnir, libgallium, libgl
> + ],
> + dependencies : [
> + driver_swrast, cpp.find_library('be'), cpp.find_library('translation'),
> + cpp.find_library('network'), dep_unwind
> + ]
> +)
> diff --git a/src/gallium/winsys/sw/hgl/meson.build b/src/gallium/winsys/sw/hgl/meson.build
> new file mode 100644
> index 0000000000..8901096bd1
> --- /dev/null
> +++ b/src/gallium/winsys/sw/hgl/meson.build
> @@ -0,0 +1,29 @@
> +# Copyright © 2017 Dylan Baker
> +
> +# 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.
> +
> +libswhgl = static_library(
> + 'swhgl',
> + files('hgl_sw_winsys.c'),
> + c_args : c_vis_args,
> + include_directories : [inc_gallium, inc_include, inc_src, inc_gallium_aux,
> + include_directories('../../../state_trackers/hgl')
> + ],
> + build_by_default : false,
> +)
> diff --git a/src/hgl/meson.build b/src/hgl/meson.build
> new file mode 100644
> index 0000000000..ec06272eda
> --- /dev/null
> +++ b/src/hgl/meson.build
> @@ -0,0 +1,36 @@
> +# 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.
> +
> +libgl = shared_library(
> + 'GL',
> + files(
> + 'GLView.cpp', 'GLRenderer.cpp', 'GLRendererRoster.cpp', 'GLDispatcher.cpp',
> + ),
> + link_args : [ld_args_bsymbolic, ld_args_gc_sections],
> + include_directories : [
> + inc_src, inc_mapi, inc_mesa, inc_include, inc_glapi, inc_haikugl,
> + inc_gl_internal, include_directories('/system/develop/headers/private')
> + ],
> + link_with : [libglapi_static, libglapi],
> + dependencies : cpp.find_library('be'),
> + install : true,
> +)
> +
> +# TODO: We need some tests here
Looks good to me:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Can make one request though? Split this into 4 patches:
- the gl_priv_libs and glx fixes in the hunks below; cc: stable on those
- the split out of the `if with_dri2` blocks from the common code
- the new `if with_platform_haiku` blocks and new meson.build files
> diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
> index ea14654d2c..38a5747e9a 100644
> --- a/src/mapi/es1api/meson.build
> +++ b/src/mapi/es1api/meson.build
> @@ -48,7 +48,7 @@ pkg.generate(
> description : 'Mesa OpenGL ES 1.1 CM library',
> version : meson.project_version(),
> libraries : libglesv1_cm,
> - libraries_private : '-lm -ldl -lpthread -pthread',
> + libraries_private : gl_priv_libs,
> )
>
> if with_tests
> diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
> index de8a29bb6b..9f4770a738 100644
> --- a/src/mapi/es2api/meson.build
> +++ b/src/mapi/es2api/meson.build
> @@ -48,7 +48,7 @@ pkg.generate(
> description : 'Mesa OpenGL ES 2.0 library',
> version : meson.project_version(),
> libraries : libgles2,
> - libraries_private : '-lm -ldl -lpthread -pthread',
> + libraries_private : gl_priv_libs,
> )
>
> if with_tests
> diff --git a/src/meson.build b/src/meson.build
> index 730b2ff6e4..4d5637f0aa 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -64,7 +64,12 @@ if with_dri_i965 or with_intel_vk
> endif
> subdir('mesa')
> subdir('loader')
> -subdir('glx')
> +if with_platform_haiku
> + subdir('hgl')
> +endif
> +if with_glx != 'disabled'
> + subdir('glx')
> +endif
> if with_gbm
> subdir('gbm')
> else
> --
> 2.14.3
>
More information about the mesa-dev
mailing list