--- include/meson.build | 8 +++++ meson.build | 18 +++++++--- src/egl/meson.build | 33 +++++++++++++---- src/gallium/meson.build | 9 +++++ src/gallium/state_trackers/hgl/meson.build | 41 +++++++++++++++++++++ src/gallium/targets/haiku-softpipe/meson.build | 50 ++++++++++++++++++++++++++ src/gallium/winsys/sw/hgl/meson.build | 29 +++++++++++++++ src/hgl/GLDispatcher.h | 2 +- src/hgl/meson.build | 38 ++++++++++++++++++++ src/mapi/es1api/meson.build | 2 +- src/mapi/es2api/meson.build | 2 +- src/meson.build | 7 +++- 12 files changed, 224 insertions(+), 15 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 3925ec483e..d476f70bbe 100644 --- a/meson.build +++ b/meson.build @@ -103,7 +103,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 @@ -148,7 +148,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.') @@ -185,7 +185,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 @@ -246,6 +246,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 @@ -256,6 +258,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 @@ -264,6 +267,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' @@ -379,7 +384,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 @@ -640,6 +645,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') @@ -1236,7 +1244,7 @@ if with_dri_platform == 'drm' endif gl_priv_libs = [] -if dep_thread.found() +if dep_thread.found() and host_machine.system() != 'haiku' gl_priv_libs += ['-lpthread', '-pthread'] endif if dep_m.found() diff --git a/src/egl/meson.build b/src/egl/meson.build index 6cd04567b0..1fd2b241bb 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,14 @@ 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', + ) +endif + if with_platform_x11 files_egl += files('drivers/dri2/platform_x11.c') if with_dri3 @@ -133,6 +137,23 @@ 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') +else + incs_for_egl += [inc_loader, inc_gbm] + c_args_for_egl += [ + '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir), + '-D_EGL_BUILT_IN_DRIVER_DRI2', + ] + link_for_egl += [libloader, libxmlconfig] + deps_for_egl += dep_libdrm +endif # TODO: glvnd diff --git a/src/gallium/meson.build b/src/gallium/meson.build index d05e67630c..320fc0176e 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -40,6 +40,9 @@ else libswkmsdri = [] endif 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.') @@ -153,6 +156,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 @@ -192,6 +198,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..1309338678 --- /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..f805b2e69b --- /dev/null +++ b/src/gallium/targets/haiku-softpipe/meson.build @@ -0,0 +1,50 @@ +# 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. + +hsp_cpp_args = ['-DGALLIUM_SOFTPIPE', '-DGALLIUM_RBUG', '-DGALLIUM_TRACE'] +hsp_deps = [] +hsp_links = [libsoftpipe] + +if with_llvm + hsp_deps += dep_llvm + hsp_cpp_args += '-DGALLIUM_LLVMPIPE' + hsp_links += libllvmpipe +endif + +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 : [hsp_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, hsp_links, libgl + ], + dependencies : [ + hsp_deps, 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..8e096d1504 --- /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', 'hgl_sw_winsys.h'), + 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/GLDispatcher.h b/src/hgl/GLDispatcher.h index 8aaf58a623..7a4bcd3329 100644 --- a/src/hgl/GLDispatcher.h +++ b/src/hgl/GLDispatcher.h @@ -15,7 +15,7 @@ #include <GL/gl.h> #include <SupportDefs.h> -#include "glheader.h" +#include "main/glheader.h" #include "glapi/glapi.h" diff --git a/src/hgl/meson.build b/src/hgl/meson.build new file mode 100644 index 0000000000..5c6718fb8d --- /dev/null +++ b/src/hgl/meson.build @@ -0,0 +1,38 @@ +# 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, +) + +#if with_tests +# subdir('tests') +#endif 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 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev