aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-graphics/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-graphics/mesa')
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/files/0001-meson.build-check-for-all-linux-host_os-combinations.patch40
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/files/0001-radeonsi-disabling-the-displayable-DCC-on-Raven-Ridg.patch28
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/files/0002-meson.build-make-TLS-GLX-optional-again.patch51
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/files/0003-Allow-enable-DRI-without-DRI-drivers.patch46
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/libglu/0001-libglu-src-libutil-error.c-add-missing-include-stdde.patch27
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/libglu_9.0.0.bbappend3
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/mesa.inc249
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/mesa_git.bb19
-rw-r--r--meta-amd-bsp/recipes-graphics/mesa/mesa_git.bbappend60
9 files changed, 523 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-graphics/mesa/files/0001-meson.build-check-for-all-linux-host_os-combinations.patch b/meta-amd-bsp/recipes-graphics/mesa/files/0001-meson.build-check-for-all-linux-host_os-combinations.patch
new file mode 100644
index 00000000..6b85538f
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/files/0001-meson.build-check-for-all-linux-host_os-combinations.patch
@@ -0,0 +1,40 @@
+From d6630c48a1aed64ff1068524b3aae76fff7b3447 Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Mon, 19 Aug 2019 17:29:18 +0500
+Subject: [PATCH 1/3] meson.build: check for all linux host_os combinations
+
+Make sure that we are also looking for our host_os combinations like
+linux-musl etc. when assuming support for DRM/KMS.
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ meson.build | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 13b561f99de..78d0ea47790 100644
+--- a/meson.build
++++ b/meson.build
+@@ -106,7 +106,7 @@ with_any_opengl = with_opengl or with_gles1 or with_gles2
+ # Only build shared_glapi if at least one OpenGL API is enabled
+ with_shared_glapi = get_option('shared-glapi') and with_any_opengl
+
+-system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux'].contains(host_machine.system())
++system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly'].contains(host_machine.system()) or host_machine.system().startswith('linux')
+
+ dri_drivers = get_option('dri-drivers')
+ if dri_drivers.contains('auto')
+@@ -835,7 +835,7 @@ if cc.compiles('__uint128_t foo(void) { return 0; }',
+ endif
+
+ # TODO: this is very incomplete
+-if ['linux', 'cygwin', 'gnu', 'gnu/kfreebsd'].contains(host_machine.system())
++if ['cygwin', 'gnu', 'gnu/kfreebsd'].contains(host_machine.system()) or host_machine.system().startswith('linux')
+ pre_args += '-D_GNU_SOURCE'
+ endif
+
+--
+2.11.1
+
diff --git a/meta-amd-bsp/recipes-graphics/mesa/files/0001-radeonsi-disabling-the-displayable-DCC-on-Raven-Ridg.patch b/meta-amd-bsp/recipes-graphics/mesa/files/0001-radeonsi-disabling-the-displayable-DCC-on-Raven-Ridg.patch
new file mode 100644
index 00000000..67f140e5
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/files/0001-radeonsi-disabling-the-displayable-DCC-on-Raven-Ridg.patch
@@ -0,0 +1,28 @@
+From 19e44acaf9b1e2609e32ee46fec19dc278188918 Mon Sep 17 00:00:00 2001
+From: Pavan Kumar Ramayanam <pavan.ramayanam@amd.com>
+Date: Mon, 19 Aug 2019 14:31:42 +0530
+Subject: [PATCH] radeonsi: disabling the displayable DCC on Raven Ridge1 due
+ to Vaapi-vaapi fullscreen playback causing hard hang Signed-off-by:
+ Pavan Kumar Ramayanam <pavan.ramayanam@amd.com>
+
+---
+ src/amd/common/ac_gpu_info.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
+index a501d840b25..9fd792bb4b6 100644
+--- a/src/amd/common/ac_gpu_info.c
++++ b/src/amd/common/ac_gpu_info.c
+@@ -475,8 +475,7 @@ bool ac_query_gpu_info(int fd, void *dev_p,
+ info->ib_start_alignment = ib_align;
+
+ if (info->drm_minor >= 31 &&
+- (info->family == CHIP_RAVEN ||
+- info->family == CHIP_RAVEN2)) {
++ (info->family == CHIP_RAVEN2)) {
+ if (info->num_render_backends == 1)
+ info->use_display_dcc_unaligned = true;
+ else
+--
+2.17.1
+
diff --git a/meta-amd-bsp/recipes-graphics/mesa/files/0002-meson.build-make-TLS-GLX-optional-again.patch b/meta-amd-bsp/recipes-graphics/mesa/files/0002-meson.build-make-TLS-GLX-optional-again.patch
new file mode 100644
index 00000000..9433e450
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/files/0002-meson.build-make-TLS-GLX-optional-again.patch
@@ -0,0 +1,51 @@
+From d75beb97e470d1a9bd217004a4b0663da24a58bc Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Mon, 19 Aug 2019 17:32:48 +0500
+Subject: [PATCH 2/3] meson.build: make TLS GLX optional again
+
+This was optional with autotools, and needs to be disabled
+when using musl C library, for instance.
+
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ meson.build | 4 +++-
+ meson_options.txt | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 78d0ea47790..bb6e3083c20 100644
+--- a/meson.build
++++ b/meson.build
+@@ -365,7 +365,9 @@ if with_egl and not (with_platform_drm or with_platform_surfaceless or with_plat
+ endif
+ endif
+
+-pre_args += '-DGLX_USE_TLS'
++if get_option('glx-tls')
++ pre_args += '-DGLX_USE_TLS'
++endif
+ if with_glx != 'disabled'
+ if not (with_platform_x11 and with_any_opengl)
+ error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
+diff --git a/meson_options.txt b/meson_options.txt
+index 5cbb85658a2..c0ce8d8c8bf 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -334,6 +334,12 @@ option(
+ description : 'Enable direct rendering in GLX and EGL for DRI',
+ )
+ option(
++ 'glx-tls',
++ type : 'boolean',
++ value : true,
++ description : 'Enable TLS support in GLX',
++)
++option(
+ 'I-love-half-baked-turnips',
+ type : 'boolean',
+ value : false,
+--
+2.11.1
+
diff --git a/meta-amd-bsp/recipes-graphics/mesa/files/0003-Allow-enable-DRI-without-DRI-drivers.patch b/meta-amd-bsp/recipes-graphics/mesa/files/0003-Allow-enable-DRI-without-DRI-drivers.patch
new file mode 100644
index 00000000..dfdd778a
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/files/0003-Allow-enable-DRI-without-DRI-drivers.patch
@@ -0,0 +1,46 @@
+From 749880b5122f2cad82731cba6b3845ca364dcb29 Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Mon, 19 Aug 2019 17:35:19 +0500
+Subject: [PATCH 3/3] Allow enable DRI without DRI drivers
+
+Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ meson.build | 2 +-
+ meson_options.txt | 6 ++++++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index bb6e3083c20..7f4cfffc64a 100644
+--- a/meson.build
++++ b/meson.build
+@@ -136,7 +136,7 @@ with_dri_r200 = dri_drivers.contains('r200')
+ with_dri_nouveau = dri_drivers.contains('nouveau')
+ with_dri_swrast = dri_drivers.contains('swrast')
+
+-with_dri = dri_drivers.length() != 0 and dri_drivers != ['']
++with_dri = get_option('dri') or (_drivers.length() != 0 and _drivers != [''])
+
+ gallium_drivers = get_option('gallium-drivers')
+ if gallium_drivers.contains('auto')
+diff --git a/meson_options.txt b/meson_options.txt
+index c0ce8d8c8bf..29031134617 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -35,6 +35,12 @@ option(
+ description : 'enable support for dri3'
+ )
+ option(
++ 'dri',
++ type : 'boolean',
++ value : false,
++ description : 'enable support for dri'
++)
++option(
+ 'dri-drivers',
+ type : 'array',
+ value : ['auto'],
+--
+2.11.1
+
diff --git a/meta-amd-bsp/recipes-graphics/mesa/libglu/0001-libglu-src-libutil-error.c-add-missing-include-stdde.patch b/meta-amd-bsp/recipes-graphics/mesa/libglu/0001-libglu-src-libutil-error.c-add-missing-include-stdde.patch
new file mode 100644
index 00000000..c2e00de2
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/libglu/0001-libglu-src-libutil-error.c-add-missing-include-stdde.patch
@@ -0,0 +1,27 @@
+From e25ad2173b66d28519e1771dba30d0126d7d833e Mon Sep 17 00:00:00 2001
+From: "Arsalan H. Awan" <Arsalan_Awan@mentor.com>
+Date: Wed, 21 Aug 2019 17:03:26 +0500
+Subject: [PATCH] libglu/src/libutil/error.c: add missing include <stddef.h>
+ for NULL def
+
+Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
+---
+ src/libutil/error.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libutil/error.c b/src/libutil/error.c
+index 7212748..c71ffdf 100644
+--- a/src/libutil/error.c
++++ b/src/libutil/error.c
+@@ -31,7 +31,7 @@
+ #include "gluos.h"
+ #include "gluint.h"
+ #include <GL/glu.h>
+-
++#include <stddef.h>
+
+ struct token_string
+ {
+--
+2.11.1
+
diff --git a/meta-amd-bsp/recipes-graphics/mesa/libglu_9.0.0.bbappend b/meta-amd-bsp/recipes-graphics/mesa/libglu_9.0.0.bbappend
new file mode 100644
index 00000000..f8076b21
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/libglu_9.0.0.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://0001-libglu-src-libutil-error.c-add-missing-include-stdde.patch"
diff --git a/meta-amd-bsp/recipes-graphics/mesa/mesa.inc b/meta-amd-bsp/recipes-graphics/mesa/mesa.inc
new file mode 100644
index 00000000..50832b4a
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/mesa.inc
@@ -0,0 +1,249 @@
+SUMMARY = "A free implementation of the OpenGL API"
+DESCRIPTION = "Mesa is an open-source implementation of the OpenGL specification - \
+a system for rendering interactive 3D graphics. \
+A variety of device drivers allows Mesa to be used in many different environments \
+ranging from software emulation to complete hardware acceleration for modern GPUs. \
+Mesa is used as part of the overall Direct Rendering Infrastructure and X.org \
+environment."
+
+HOMEPAGE = "http://mesa3d.org"
+BUGTRACKER = "https://bugs.freedesktop.org"
+SECTION = "x11"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://docs/license.html;md5=3a4999caf82cc503ac8b9e37c235782e"
+
+PE = "2"
+
+DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native"
+EXTRANATIVEPATH += "chrpath-native"
+PROVIDES = " \
+ ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
+ virtual/mesa \
+ "
+
+inherit meson pkgconfig python3native gettext distro_features_check
+
+BBCLASSEXTEND = "native nativesdk"
+
+ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
+
+PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)} \
+ surfaceless"
+
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
+export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}"
+export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
+export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
+
+MESA_LLVM_RELEASE ?= "${LLVMVERSION}"
+
+EXTRA_OEMESON = " \
+ -Dshared-glapi=true \
+ -Dgallium-opencl=disabled \
+ -Dglx-read-only-text=true \
+ -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
+"
+
+PACKAGECONFIG_class-target ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri gallium', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
+ glx-tls \
+ "
+PACKAGECONFIG_class-native ?= "gbm dri egl opengl"
+PACKAGECONFIG_class-nativesdk ?= "gbm dri egl opengl"
+
+PACKAGECONFIG_remove_libc-musl = "glx-tls"
+
+# "gbm" requires "dri", "opengl"
+PACKAGECONFIG[gbm] = "-Dgbm=true,-Dgbm=false"
+
+X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr"
+# "x11" requires "opengl"
+PACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}"
+PACKAGECONFIG[glx-tls] = "-Dglx-tls=true, -Dglx-tls=false"
+PACKAGECONFIG[xvmc] = "-Dgallium-xvmc=true,-Dgallium-xvmc=false,libxvmc"
+PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
+
+DRIDRIVERS_class-native = "swrast"
+DRIDRIVERS_class-nativesdk = "swrast"
+DRIDRIVERS_append_x86_class-target = ",r100,r200,nouveau,i965,i915"
+DRIDRIVERS_append_x86-64_class-target = ",r100,r200,nouveau,i965,i915"
+# "dri" requires "opengl"
+PACKAGECONFIG[dri] = "-Ddri=true -Ddri-drivers=${DRIDRIVERS}, -Ddri=false -Ddri-drivers='', xorgproto libdrm"
+PACKAGECONFIG[dri3] = "-Ddri3=true, -Ddri3=false, xorgproto libxshmfence"
+
+# Vulkan drivers need dri3 enabled
+# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
+VULKAN_DRIVERS = ""
+VULKAN_DRIVERS_append_x86_class-target = ",intel"
+VULKAN_DRIVERS_append_x86-64_class-target = ",intel"
+PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${VULKAN_DRIVERS}, -Dvulkan-drivers='',"
+
+PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false"
+
+# "gles" requires "opengl"
+PACKAGECONFIG[gles] = "-Dgles1=true -Dgles2=true, -Dgles1=false -Dgles2=false"
+
+# "egl" requires "dri", "opengl"
+PACKAGECONFIG[egl] = "-Degl=true, -Degl=false"
+
+PACKAGECONFIG[etnaviv] = ""
+PACKAGECONFIG[kmsro] = ""
+
+GALLIUMDRIVERS = "swrast"
+GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
+GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}"
+
+# radeonsi requires LLVM
+GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
+GALLIUMDRIVERS_LLVM33_ENABLED = "${@oe.utils.version_less_or_equal('MESA_LLVM_RELEASE', '3.2', False, len('${GALLIUMDRIVERS_LLVM33}') > 0, d)}"
+GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
+
+PACKAGECONFIG[r600] = ""
+
+GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
+GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', '', d)}"
+GALLIUMDRIVERS_append = ",virgl"
+
+PACKAGECONFIG[gallium] = "-Dgallium-drivers=${GALLIUMDRIVERS}, -Dgallium-drivers=''"
+PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \
+ ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
+PACKAGECONFIG[xa] = "-Dgallium-xa=true, -Dgallium-xa=false"
+
+PACKAGECONFIG[lima] = ""
+GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
+
+OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium', 'classic', d)}"
+PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none"
+
+PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
+
+# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
+FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
+
+CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
+
+# Remove the mesa dependency on mesa-dev, as mesa is empty
+RDEPENDS_${PN}-dev = ""
+
+# Add dependency so that GLES3 header don't need to be added manually
+RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
+
+PACKAGES =+ "libegl-mesa libegl-mesa-dev \
+ libosmesa libosmesa-dev \
+ libgl-mesa libgl-mesa-dev \
+ libglapi libglapi-dev \
+ libgbm libgbm-dev \
+ libgles1-mesa libgles1-mesa-dev \
+ libgles2-mesa libgles2-mesa-dev \
+ libgles3-mesa libgles3-mesa-dev \
+ libxatracker libxatracker-dev \
+ mesa-megadriver mesa-vulkan-drivers \
+ "
+
+do_install_append () {
+ # Drivers never need libtool .la files
+ rm -f ${D}${libdir}/dri/*.la
+ rm -f ${D}${libdir}/egl/*.la
+ rm -f ${D}${libdir}/gallium-pipe/*.la
+ rm -f ${D}${libdir}/gbm/*.la
+
+ # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
+ chrpath --delete ${D}${libdir}/dri/*_dri.so || true
+
+ # libwayland-egl has been moved to wayland 1.15+
+ rm -f ${D}${libdir}/libwayland-egl*
+ rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
+}
+
+# For the packages that make up the OpenGL interfaces, inject variables so that
+# they don't get Debian-renamed (which would remove the -mesa suffix), and
+# RPROVIDEs/RCONFLICTs on the generic libgl name.
+python __anonymous() {
+ pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
+ for p in (("egl", "libegl", "libegl1"),
+ ("dri", "libgl", "libgl1"),
+ ("gles", "libgles1", "libglesv1-cm1"),
+ ("gles", "libgles2", "libglesv2-2"),
+ ("gles", "libgles3",)):
+ if not p[0] in pkgconfig:
+ continue
+ fullp = p[1] + "-mesa"
+ pkgs = " ".join(p[1:])
+ d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
+ d.appendVar("RREPLACES_" + fullp, pkgs)
+ d.appendVar("RPROVIDES_" + fullp, pkgs)
+ d.appendVar("RCONFLICTS_" + fullp, pkgs)
+
+ d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
+
+ # For -dev, the first element is both the Debian and original name
+ fullp += "-dev"
+ pkgs = p[1] + "-dev"
+ d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
+ d.appendVar("RREPLACES_" + fullp, pkgs)
+ d.appendVar("RPROVIDES_" + fullp, pkgs)
+ d.appendVar("RCONFLICTS_" + fullp, pkgs)
+}
+
+python mesa_populate_packages() {
+ pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
+ for pkg in pkgs:
+ d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
+ d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
+ d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
+
+ import re
+ dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
+ if os.path.isdir(dri_drivers_root):
+ dri_pkgs = os.listdir(dri_drivers_root)
+ lib_name = d.expand("${MLPREFIX}mesa-megadriver")
+ for p in dri_pkgs:
+ m = re.match(r'^(.*)_dri\.so$', p)
+ if m:
+ pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
+ d.appendVar("RPROVIDES_%s" % lib_name, pkg_name)
+ d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name)
+ d.appendVar("RREPLACES_%s" % lib_name, pkg_name)
+
+ pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
+ do_split_packages(d, pipe_drivers_root, r'^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='')
+}
+
+PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
+
+PACKAGES_DYNAMIC += "^mesa-driver-.*"
+
+FILES_mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d/00-mesa-defaults.conf"
+FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
+FILES_libegl-mesa = "${libdir}/libEGL.so.*"
+FILES_libgbm = "${libdir}/libgbm.so.*"
+FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
+FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
+FILES_libgl-mesa = "${libdir}/libGL.so.*"
+FILES_libglapi = "${libdir}/libglapi.so.*"
+FILES_libosmesa = "${libdir}/libOSMesa.so.*"
+FILES_libxatracker = "${libdir}/libxatracker.so.*"
+
+FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
+FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
+FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
+FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
+FILES_libglapi-dev = "${libdir}/libglapi.*"
+FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
+FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
+FILES_libgles3-mesa-dev = "${includedir}/GLES3"
+FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
+FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
+ ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
+ ${libdir}/pkgconfig/xatracker.pc"
+
+# Fix upgrade path from mesa to mesa-megadriver
+RREPLACES_mesa-megadriver = "mesa"
+RCONFLICTS_mesa-megadriver = "mesa"
+RPROVIDES_mesa-megadriver = "mesa"
diff --git a/meta-amd-bsp/recipes-graphics/mesa/mesa_git.bb b/meta-amd-bsp/recipes-graphics/mesa/mesa_git.bb
new file mode 100644
index 00000000..e0d71538
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/mesa_git.bb
@@ -0,0 +1,19 @@
+require ${BPN}.inc
+
+S = "${WORKDIR}/git"
+
+SRCREV = "e9cf8c1d3010e9eada5a7921239ad7895f249b5c"
+SRC_URI = "git://gitlab.freedesktop.org/mesa/mesa.git;branch=master;protocol=https \
+ file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
+ file://0002-meson.build-make-TLS-GLX-optional-again.patch \
+ file://0003-Allow-enable-DRI-without-DRI-drivers.patch \
+ file://0001-radeonsi-disabling-the-displayable-DCC-on-Raven-Ridg.patch \
+ "
+
+#because we cannot rely on the fact that all apps will use pkgconfig,
+#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
+do_install_append() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then
+ sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if defined(MESA_EGL_NO_X11_HEADERS) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h
+ fi
+}
diff --git a/meta-amd-bsp/recipes-graphics/mesa/mesa_git.bbappend b/meta-amd-bsp/recipes-graphics/mesa/mesa_git.bbappend
new file mode 100644
index 00000000..168a471a
--- /dev/null
+++ b/meta-amd-bsp/recipes-graphics/mesa/mesa_git.bbappend
@@ -0,0 +1,60 @@
+DEPENDS_append_amd = " libvdpau libomxil"
+
+PACKAGECONFIG[va] = "-Dgallium-va=true,-Dgallium-va=false,libva"
+PACKAGECONFIG_append_amd = " xvmc gallium r600 gallium-llvm xa osmesa"
+PACKAGECONFIG_append_radeon = " va"
+PACKAGECONFIG_append_amdgpu = " va"
+
+PACKAGECONFIG_remove_amd = "vulkan"
+PACKAGECONFIG_remove_amdfalconx86 = "xvmc"
+
+LIBVA_PLATFORMS = "libva"
+LIBVA_PLATFORMS .= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' libva-x11', '', d)}"
+LIBVA_PLATFORMS .= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', ' libva-wayland', '', d)}"
+RDEPENDS_mesa-megadriver += "${@bb.utils.contains('PACKAGECONFIG', 'va', '${LIBVA_PLATFORMS}', '', d)}"
+
+EXTRA_OEMESON_append_amd = " \
+ -Dgallium-vdpau=true \
+ -Dglx=dri \
+ -Dgallium-omx=bellagio \
+ -Domx-libs-path=${libdir}/bellagio"
+
+# Package all the libXvMC gallium extensions together
+# they provide the shared lib libXvMCGallium and splitting
+# them up creates trouble in rpm packaging
+#
+# libXvMC files are non-versioned so we put *.so directly in the
+# main package as opposed to the -dev package.
+#
+PACKAGES =+ "libxvmcgallium-${PN} libxvmcgallium-${PN}-dev"
+FILES_libxvmcgallium-${PN} = "${libdir}/libXvMC*.so"
+FILES_libxvmcgallium-${PN}-dev = "${libdir}/libXvMC*.la"
+
+
+PACKAGES =+ "libvdpau-${PN} libvdpau-${PN}-dev"
+FILES_libvdpau-${PN} = "${libdir}/vdpau/libvdpau*${SOLIBS}"
+FILES_libvdpau-${PN}-dev = "${libdir}/vdpau/libvdpau*${SOLIBSDEV} \
+ ${libdir}/vdpau/libvdpau*.la"
+FILES_${PN}-dbg += "${libdir}/vdpau/.debug"
+
+#
+# libomx files are non-versioned so we put *.so directly in the
+# main package as opposed to the -dev package.
+#
+PACKAGES =+ "libomx-${PN} libomx-${PN}-dev ${PN}-driconfigs"
+FILES_libomx-${PN} = "${libdir}/bellagio/libomx_*.so"
+FILES_libomx-${PN}-dev = "${libdir}/bellagio/libomx_*.la"
+FILES_${PN}-driconfigs = "${datadir}/drirc.d/*"
+FILES_${PN}-dbg += "${libdir}/bellagio/.debug"
+
+# Set GALLIUMDRIVERS with anonymous python so we can effectively
+# override the _append_x86-64 assignement from mesa.inc.
+python () {
+ d.setVar("GALLIUMDRIVERS", "swrast,r300,r600,radeonsi,svga")
+}
+
+# meta/classes/meson.bbclass hardcodes llvm-config version to "8.0.0"
+# lets set it to our MESA_LLVM_RELEASE that we set in amd-common-configurations.inc
+do_write_config_append() {
+ sed -i "/llvm-config/s/[0-9]\+\.[0-9]\+\.[0-9]\+/${MESA_LLVM_RELEASE}/" ${WORKDIR}/meson.cross
+}