diff --git a/my-ostree-os/mesa.spec b/mesa-24/mesa.spec similarity index 100% rename from my-ostree-os/mesa.spec rename to mesa-24/mesa.spec diff --git a/my-ostree-os/firefox/firefox.spec b/my-ostree-os/firefox/firefox.spec index 05ae922..3c33a46 100644 --- a/my-ostree-os/firefox/firefox.spec +++ b/my-ostree-os/firefox/firefox.spec @@ -193,7 +193,7 @@ ExcludeArch: i686 Summary: Mozilla Firefox Web browser Name: firefox Version: 135.0.1 -Release: 10.skylake%{?pre_tag}%{?dist} +Release: 11.skylake%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ # Automatically converted from old format: MPLv1.1 or GPLv2+ or LGPLv2+ - review is highly recommended. License: LicenseRef-Callaway-MPLv1.1 OR GPL-2.0-or-later OR LicenseRef-Callaway-LGPLv2+ @@ -631,7 +631,7 @@ echo "ac_add_options --disable-webrtc" >> .mozconfig echo "ac_add_options --enable-debug" >> .mozconfig echo "ac_add_options --disable-optimize" >> .mozconfig %else -%global optimize_flags "-O3 -march=skylake -mtune=skylake" +%global optimize_flags "-O3 -march=skylake -mtune=skylake -flto" %ifarch ppc64le aarch64 %global optimize_flags "-g -O2" %endif diff --git a/my-ostree-os/kernel-cachyos-lts-lto-skylake.spec b/my-ostree-os/kernel-cachyos-lts-lto-skylake.spec index 020090b..b4fef4d 100644 --- a/my-ostree-os/kernel-cachyos-lts-lto-skylake.spec +++ b/my-ostree-os/kernel-cachyos-lts-lto-skylake.spec @@ -1,4 +1,4 @@ -# Maintainer: Eric Naim +# Maintainer: Anders Rytter Hansen # Fedora bits %define __spec_install_post %{__os_install_post} @@ -13,7 +13,7 @@ # Linux Kernel Versions %define _basekver 6.12 -%define _stablekver 16 +%define _stablekver 32 %define _rpmver %{version}-%{release} %define _kver %{_rpmver}.%{_arch} @@ -73,7 +73,7 @@ Name: kernel-cachyos-lts%{?_lto_args:-lto}-skylake Summary: Linux BORE %{?_lto_args:+ LTO }Cachy Sauce Kernel by CachyOS with other patches and improvements. Version: %{_basekver}.%{_stablekver} -Release: cachylts1%{?_lto_args:.lto}.skylake%{?dist} +Release: cachylts4%{?_lto_args:.lto}.skylake%{?dist} License: GPL-2.0-only URL: https://cachyos.org @@ -107,6 +107,7 @@ BuildRequires: python-srpm-macros BuildRequires: clang BuildRequires: lld BuildRequires: llvm +BuildRequires: polly %endif %if %{_build_nv} @@ -121,7 +122,7 @@ Source1: https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/l # The default modprobed.db provided is used for linux-cachyos CI. # This should not be used for production and ideally should only be used for compile tests. # Note that any modprobed.db file is accepted -Source2: https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/modprobed.db +Source2: https://raw.githubusercontent.com/Frogging-Family/linux-tkg/master/linux-tkg-config/%{_basekver}/minimal-modprobed.db %endif %if %{_build_nv} @@ -133,6 +134,7 @@ Patch1: %{_patch_src}/sched/0001-bore-cachy.patch %if %{_build_lto} Patch2: %{_patch_src}/misc/dkms-clang.patch +Patch3: %{_patch_src}/misc/0001-clang-polly.patch %endif %if %{_build_nv} @@ -185,6 +187,7 @@ Patch13: %{_patch_src}/misc/nvidia/565/0005-nvkms-Sanitize-trim-ELD-produ %if %{_build_lto} scripts/config -e LTO_CLANG_THIN + scripts/config -e POLLY_CLANG %endif %if %{_build_minimal} @@ -377,7 +380,8 @@ Recommends: linux-firmware %files core %license COPYING - %ghost /boot/initramfs-%{_kver}.img + %ghost %attr(0600, root, root) /boot/initramfs-%{_kver}.img + %ghost %attr(0644, root, root) /boot/symvers-%{_kver}.zst %{_kernel_dir}/vmlinuz %{_kernel_dir}/modules.builtin %{_kernel_dir}/modules.builtin.modinfo diff --git a/my-ostree-os/kernel-cachyos-lts-skylake.spec b/my-ostree-os/kernel-cachyos-lts-skylake.spec new file mode 100644 index 0000000..dbf7c6c --- /dev/null +++ b/my-ostree-os/kernel-cachyos-lts-skylake.spec @@ -0,0 +1,498 @@ +# Maintainer: Anders Rytter Hansen + +# Fedora bits +%define __spec_install_post %{__os_install_post} +%define _build_id_links none +%define _default_patch_fuzz 2 +%define _disable_source_fetch 0 +%define debug_package %{nil} +%define make_build make %{?_lto_args} %{?_smp_mflags} +%undefine __brp_mangle_shebangs +%undefine _auto_set_build_flags +%undefine _include_frame_pointers + +# Linux Kernel Versions +%define _basekver 6.12 +%define _stablekver 32 +%define _rpmver %{version}-%{release} +%define _kver %{_rpmver}.%{_arch} + +%if %{_stablekver} == 0 + %define _tarkver %{_basekver} +%else + %define _tarkver %{version} +%endif + +# Build a minimal a kernel via modprobed.db +# file to reduce build times +%define _build_minimal 0 + +# Builds the kernel with clang and enables +# ThinLTO +%define _build_lto 0 + +# Builds nvidia-open kernel modules with +# the kernel +%define _nv_pkg open-gpu-kernel-modules-%{_nv_ver} +%if 0%{?fedora} >= 42 + %define _build_nv 0 + %define _nv_ver 570.86.16 +%else + %define _build_nv 0 + %define _nv_ver 565.77 + %define _nv_old 1 +%endif + +# Define the tickrate used by the kernel +# Valid values: 100, 250, 300, 500, 600, 750 and 1000 +# An invalid value will not fail and continue to use +# 1000Hz tickrate +%define _hz_tick 1000 + +# Defines the x86_64 ISA level used +# to compile the kernel +# Valid values are 1-4 +# An invalid value will continue and use +# x86_64_v3 +%define _x86_64_lvl 3 + +# Define variables for directory paths +# to be used during packaging +%define _kernel_dir /lib/modules/%{_kver} +%define _devel_dir %{_usrsrc}/kernels/%{_kver} + +%define _patch_src https://raw.githubusercontent.com/CachyOS/kernel-patches/master/%{_basekver} + +%if %{_build_lto} + # Define build environment variables to build the kernel with clang + %define _lto_args CC=clang CXX=clang++ LD=ld.lld LLVM=1 LLVM_IAS=1 +%endif + +%define _module_args KERNEL_UNAME=%{_kver} IGNORE_PREEMPT_RT_PRESENCE=1 SYSSRC=%{_builddir}/linux-%{_tarkver} SYSOUT=%{_builddir}/linux-%{_tarkver} + +Name: kernel-cachyos-lts%{?_lto_args:-lto}-skylake +Summary: Linux BORE %{?_lto_args:+ LTO }Cachy Sauce Kernel by CachyOS with other patches and improvements. +Version: %{_basekver}.%{_stablekver} +Release: cachylts1%{?_lto_args:.lto}.skylake%{?dist} +License: GPL-2.0-only +URL: https://cachyos.org + +Requires: kernel-core-uname-r = %{_kver} +Requires: kernel-modules-uname-r = %{_kver} +Requires: kernel-modules-core-uname-r = %{_kver} +Provides: kernel-cachyos-lts%{?_lto_args:-lto}-skylake > 6.6.71-clts1.0%{?_lto_args:.lto}.skylake%{?dist} +Provides: installonlypkg(kernel) +Obsoletes: kernel-cachyos-lts%{?_lto_args:-lto}-skylake <= 6.6.71-clts1.0%{?_lto_args:.lto}.skylake%{?dist} + +BuildRequires: bc +BuildRequires: bison +BuildRequires: dwarves +BuildRequires: elfutils-devel +BuildRequires: flex +BuildRequires: gcc +BuildRequires: gettext-devel +BuildRequires: kmod +BuildRequires: make +BuildRequires: openssl +BuildRequires: openssl-devel +BuildRequires: perl-Carp +BuildRequires: perl-devel +BuildRequires: perl-generators +BuildRequires: perl-interpreter +BuildRequires: python3-devel +BuildRequires: python3-pyyaml +BuildRequires: python-srpm-macros + +%if %{_build_lto} +BuildRequires: clang +BuildRequires: lld +BuildRequires: llvm +%endif + +%if %{_build_nv} +BuildRequires: gcc-c++ +%endif + +# Indexes 0-9 are reserved for the kernel. 10-19 will be reserved for NVIDIA +Source0: https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-%{_tarkver}.tar.xz +Source1: https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos-lts/config + +%if %{_build_minimal} +# The default modprobed.db provided is used for linux-cachyos CI. +# This should not be used for production and ideally should only be used for compile tests. +# Note that any modprobed.db file is accepted +Source2: https://raw.githubusercontent.com/Frogging-Family/linux-tkg/master/linux-tkg-config/%{_basekver}/minimal-modprobed.db +%endif + +%if %{_build_nv} +Source10: https://github.com/NVIDIA/open-gpu-kernel-modules/archive/%{_nv_ver}/%{_nv_pkg}.tar.gz +%endif + +Patch0: %{_patch_src}/all/0001-cachyos-base-all.patch +Patch1: %{_patch_src}/sched/0001-bore-cachy.patch + +%if %{_build_lto} +Patch2: %{_patch_src}/misc/dkms-clang.patch +%endif + +%if %{_build_nv} +Patch10: %{_patch_src}/misc/nvidia/%{?_nv_old:565}/0001-Make-modeset-and-fbdev-default-enabled.patch +%if 0%{?fedora} < 42 +Patch11: %{_patch_src}/misc/nvidia/565/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch +Patch12: %{_patch_src}/misc/nvidia/565/0004-silence-event-assert-until-570.patch +Patch13: %{_patch_src}/misc/nvidia/565/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch +%endif +%endif + +%description + The meta package for %{name}. + +%prep +%setup -q %{?SOURCE10:-b 10} -n linux-%{_tarkver} +%autopatch -p1 -v -M 9 + + cp %{SOURCE1} .config + + # Default configs to always enable + # Enable CACHY sauce and the scheduler + # used in the default linux-cachyos kernel + scripts/config -e CACHY -e SCHED_BORE + + # Use SElinux by default + # https://github.com/sirlucjan/copr-linux-cachyos/pull/1 + scripts/config --set-str CONFIG_LSM lockdown,yama,integrity,selinux,bpf,landlock + + # Do not change the system's hostname + scripts/config -u DEFAULT_HOSTNAME + + case %{_hz_tick} in + 100|250|300|500|600|750|1000) + scripts/config -e HZ_%{_hz_tick} --set-val HZ %{_hz_tick};; + *) + echo "Invalid tickrate value, using default 1000" + scripts/config -e HZ_1000 --set-val HZ 1000;; + esac + + %if %{_x86_64_lvl} < 5 && %{_x86_64_lvl} > 0 + scripts/config --set-val X86_64_VERSION %{_x86_64_lvl} + %else + echo "Invalid x86_64 ISA Level. Using x86_64_v3" + scripts/config --set-val X86_64_VERSION 3 + %endif + + scripts/config -d GENERIC_CPU + scripts/config -e MSKYLAKE + + %if %{_build_lto} + scripts/config -e LTO_CLANG_THIN + %endif + + %if %{_build_minimal} + %make_build LSMOD=%{SOURCE2} localmodconfig + %else + %make_build olddefconfig + %endif + + diff -u %{SOURCE1} .config || : + +%if %{_build_nv} +cd %{_builddir}/%{_nv_pkg}/kernel-open +%patch -P 10 -p1 +cd .. +%autopatch -p1 -v -m 11 -M 19 +%endif + +%build + %make_build EXTRAVERSION=-%{release}.%{_arch} all + %make_build -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1 + + %if %{_build_nv} + cd %{_builddir}/%{_nv_pkg} + CFLAGS= CXXFLAGS= LDFLAGS= %make_build %{_module_args} IGNORE_CC_MISMATCH=yes modules + %endif + +%install + echo "Installing the kernel image..." + install -Dm644 "$(%make_build -s image_name)" "%{buildroot}%{_kernel_dir}/vmlinuz" + zstdmt -19 < Module.symvers > %{buildroot}%{_kernel_dir}/symvers.zst + + echo "Installing kernel modules..." + ZSTD_CLEVEL=19 %make_build INSTALL_MOD_PATH="%{buildroot}" INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install + + echo "Installing files for the development package..." + install -Dt %{buildroot}%{_devel_dir} -m644 .config Makefile Module.symvers System.map tools/bpf/bpftool/vmlinux.h + cp .config %{buildroot}%{_kernel_dir}/config + cp System.map %{buildroot}%{_kernel_dir}/System.map + cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %{buildroot}%{_devel_dir} + rm -rf %{buildroot}%{_devel_dir}/scripts + rm -rf %{buildroot}%{_devel_dir}/include + cp -a scripts %{buildroot}%{_devel_dir} + rm -rf %{buildroot}%{_devel_dir}/scripts/tracing + rm -f %{buildroot}%{_devel_dir}/scripts/spdxcheck.py + + # The cp commands below are needed for parity with Fedora's packaging + # Install files that are needed for `make scripts` to succeed + cp -a --parents security/selinux/include/classmap.h %{buildroot}%{_devel_dir} + cp -a --parents security/selinux/include/initial_sid_to_string.h %{buildroot}%{_devel_dir} + cp -a --parents tools/include/tools/be_byteshift.h %{buildroot}%{_devel_dir} + cp -a --parents tools/include/tools/le_byteshift.h %{buildroot}%{_devel_dir} + + # Install files that are needed for `make prepare` to succeed -- Generic + cp -a --parents tools/include/linux/compiler* %{buildroot}%{_devel_dir} + cp -a --parents tools/include/linux/types.h %{buildroot}%{_devel_dir} + cp -a --parents tools/build/Build.include %{buildroot}%{_devel_dir} + cp --parents tools/build/fixdep.c %{buildroot}%{_devel_dir} + cp --parents tools/objtool/sync-check.sh %{buildroot}%{_devel_dir} + cp -a --parents tools/bpf/resolve_btfids %{buildroot}%{_devel_dir} + + cp --parents security/selinux/include/policycap_names.h %{buildroot}%{_devel_dir} + cp --parents security/selinux/include/policycap.h %{buildroot}%{_devel_dir} + + cp -a --parents tools/include/asm %{buildroot}%{_devel_dir} + cp -a --parents tools/include/asm-generic %{buildroot}%{_devel_dir} + cp -a --parents tools/include/linux %{buildroot}%{_devel_dir} + cp -a --parents tools/include/uapi/asm %{buildroot}%{_devel_dir} + cp -a --parents tools/include/uapi/asm-generic %{buildroot}%{_devel_dir} + cp -a --parents tools/include/uapi/linux %{buildroot}%{_devel_dir} + cp -a --parents tools/include/vdso %{buildroot}%{_devel_dir} + cp --parents tools/scripts/utilities.mak %{buildroot}%{_devel_dir} + cp -a --parents tools/lib/subcmd %{buildroot}%{_devel_dir} + cp --parents tools/lib/*.c %{buildroot}%{_devel_dir} + cp --parents tools/objtool/*.[ch] %{buildroot}%{_devel_dir} + cp --parents tools/objtool/Build %{buildroot}%{_devel_dir} + cp --parents tools/objtool/include/objtool/*.h %{buildroot}%{_devel_dir} + cp -a --parents tools/lib/bpf %{buildroot}%{_devel_dir} + cp --parents tools/lib/bpf/Build %{buildroot}%{_devel_dir} + + # Misc headers + cp -a --parents arch/x86/include %{buildroot}%{_devel_dir} + cp -a --parents tools/arch/x86/include %{buildroot}%{_devel_dir} + cp -a include %{buildroot}%{_devel_dir}/include + cp -a sound/soc/sof/sof-audio.h %{buildroot}%{_devel_dir}/sound/soc/sof + cp -a tools/objtool/objtool %{buildroot}%{_devel_dir}/tools/objtool/ + cp -a tools/objtool/fixdep %{buildroot}%{_devel_dir}/tools/objtool/ + + # Install files that are needed for `make prepare` to succeed -- for x86_64 + cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/tools/relocs_32.c %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/tools/relocs_64.c %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/tools/relocs.c %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/tools/relocs_common.c %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/tools/relocs.h %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/purgatory/purgatory.c %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/purgatory/stack.S %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/purgatory/setup-x86_64.S %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/purgatory/entry64.S %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/boot/string.h %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/boot/string.c %{buildroot}%{_devel_dir} + cp -a --parents arch/x86/boot/ctype.h %{buildroot}%{_devel_dir} + + cp -a --parents scripts/syscalltbl.sh %{buildroot}%{_devel_dir} + cp -a --parents scripts/syscallhdr.sh %{buildroot}%{_devel_dir} + + cp -a --parents tools/arch/x86/include/asm %{buildroot}%{_devel_dir} + cp -a --parents tools/arch/x86/include/uapi/asm %{buildroot}%{_devel_dir} + cp -a --parents tools/objtool/arch/x86/lib %{buildroot}%{_devel_dir} + cp -a --parents tools/arch/x86/lib/ %{buildroot}%{_devel_dir} + cp -a --parents tools/arch/x86/tools/gen-insn-attr-x86.awk %{buildroot}%{_devel_dir} + cp -a --parents tools/objtool/arch/x86/ %{buildroot}%{_devel_dir} + + # Final cleanups ala Fedora + echo "Cleaning up development files..." + find %{buildroot}%{_devel_dir}/scripts \( -iname "*.o" -o -iname "*.cmd" \) -exec rm -f {} + + find %{buildroot}%{_devel_dir}/tools \( -iname "*.o" -o -iname "*.cmd" \) -exec rm -f {} + + touch -r %{buildroot}%{_devel_dir}/Makefile \ + %{buildroot}%{_devel_dir}/include/generated/uapi/linux/version.h \ + %{buildroot}%{_devel_dir}/include/config/auto.conf + + # These links will be owned by the modules package, creating a broken + # link unless the -devel package is installed. why?? + rm -rf %{buildroot}%{_kernel_dir}/build + ln -s %{_devel_dir} %{buildroot}%{_kernel_dir}/build + ln -s %{_kernel_dir}/build %{buildroot}%{_kernel_dir}/source + + # Create stub initramfs to inflate disk space requirements. + # This should hopefully prevent some initramfs failures due to + # insufficient space in /boot (#bz #530778) + # 90 seems to be a safe value nowadays. It is slightly inflated than the + # measured average to also account for installed vmlinuz in /boot + echo "Creating stub initramfs..." + install -dm755 %{buildroot}/boot + dd if=/dev/zero of=%{buildroot}/boot/initramfs-%{_kver}.img bs=1M count=90 + + %if %{_build_nv} + cd %{_builddir}/%{_nv_pkg} + echo "Installing NVIDIA open kernel modules..." + install -Dt %{buildroot}%{_kernel_dir}/nvidia -m644 kernel-open/*.ko + find %{buildroot}%{_kernel_dir}/nvidia -name '*.ko' -exec zstd --rm -19 {} + + install -Dt %{buildroot}/%{_defaultlicensedir}/%{name}-nvidia-open -m644 COPYING + %endif + +%package core +Summary: Linux BORE Cachy Sauce Kernel by CachyOS with other patches and improvements +AutoReq: no +Conflicts: xfsprogs < 4.3.0-1 +Conflicts: xorg-x11-drv-vmmouse < 13.0.99 +Provides: kernel = %{_rpmver} +Provides: kernel-core-uname-r = %{_kver} +Provides: kernel-uname-r = %{_kver} +Provides: installonlypkg(kernel) +Requires: kernel-modules-uname-r = %{_kver} +Requires(pre): /usr/bin/kernel-install +Requires(pre): coreutils +Requires(pre): dracut >= 027 +Requires(pre): systemd >= 203-2 +Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware) +Requires(preun):systemd >= 200 +Recommends: linux-firmware + +%description core + The kernel package contains the Linux kernel (vmlinuz), the core of any + Linux operating system. The kernel handles the basic functions + of the operating system: memory allocation, process allocation, device + input and output, etc. + +%post core + mkdir -p %{_localstatedir}/lib/rpm-state/%{name} + touch %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} + +%posttrans core + rm -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} + if [ ! -e /run/ostree-booted ]; then + /bin/kernel-install add %{_kver} %{_kernel_dir}/vmlinuz || exit $? + if [[ ! -e "/boot/symvers-%{_kver}.zst" ]]; then + cp "%{_kernel_dir}/symvers.zst" "/boot/symvers-%{_kver}.zst" + if command -v restorecon &>/dev/null; then + restorecon "/boot/symvers-%{_kver}.zst" + fi + fi + fi + +%preun core + /bin/kernel-install remove %{_kver} || exit $? + if [ -x /usr/sbin/weak-modules ]; then + /usr/sbin/weak-modules --remove-kernel %{_kver} || exit $? + fi + +%files core + %license COPYING + %ghost %attr(0600, root, root) /boot/initramfs-%{_kver}.img + %ghost %attr(0644, root, root) /boot/symvers-%{_kver}.zst + %{_kernel_dir}/vmlinuz + %{_kernel_dir}/modules.builtin + %{_kernel_dir}/modules.builtin.modinfo + %{_kernel_dir}/symvers.zst + %{_kernel_dir}/config + %{_kernel_dir}/System.map + +%package modules +Summary: Kernel modules package for %{name} +Provides: kernel-modules = %{_rpmver} +Provides: kernel-modules-core = %{_rpmver} +Provides: kernel-modules-extra = %{_rpmver} +Provides: kernel-modules-uname-r = %{_kver} +Provides: kernel-modules-core-uname-r = %{_kver} +Provides: kernel-modules-extra-uname-r = %{_kver} +Provides: installonlypkg(kernel-module) +Requires: kernel-uname-r = %{_kver} + +%description modules + This package provides kernel modules for the %{name}-core kernel package. + +%post modules + if [ ! -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} ]; then + mkdir -p %{_localstatedir}/lib/rpm-state/%{name} + touch %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} + fi + +%posttrans modules + rm -f %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} + /sbin/depmod -a %{_kver} + if [ ! -e /run/ostree-booted ]; then + if [ -f %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} ]; then + echo "Running: dracut -f --kver %{_kver}" + dracut -f --kver "%{_kver}" || exit $? + fi + fi + +%files modules + %dir %{_kernel_dir} + %{_kernel_dir}/modules.order + %{_kernel_dir}/build + %{_kernel_dir}/source + %{_kernel_dir}/kernel + +%package devel +Summary: Development package for building kernel modules to match %{name} +Provides: kernel-devel = %{_rpmver} +Provides: kernel-devel-uname-r = %{_kver} +Provides: installonlypkg(kernel) +AutoReqProv: no +Requires(pre): findutils +Requires: findutils +Requires: perl-interpreter +Requires: openssl-devel +Requires: elfutils-libelf-devel +Requires: bison +Requires: flex +Requires: make + +%if %{_build_lto} +Requires: clang +Requires: lld +Requires: llvm +%else +Requires: gcc +%endif + +%description devel + This package provides kernel headers and makefiles sufficient to build modules against %{name}. + +%post devel + if [ -f /etc/sysconfig/kernel ]; then + . /etc/sysconfig/kernel || exit $? + fi + if [ "$HARDLINK" != "no" -a -x /usr/bin/hardlink -a ! -e /run/ostree-booted ]; then + (cd /usr/src/kernels/%{_kver} && + /usr/bin/find . -type f | while read f; do + hardlink -c /usr/src/kernels/*%{?dist}.*/$f $f > /dev/null + done; + ) + fi + +%files devel + %{_devel_dir} + +%package devel-matched +Summary: Meta package to install matching core and devel packages for %{name} +Provides: kernel-devel-matched = %{_rpmver} +Requires: %{name}-core = %{_rpmver} +Requires: %{name}-devel = %{_rpmver} + +%description devel-matched + This meta package is used to install matching core and devel packages for %{name}. + +%files devel-matched + +%if %{_build_nv} +%package nvidia-open +Summary: nvidia-open %{_nv_ver} kernel modules for %{name} +Provides: nvidia-kmod >= %{_nv_ver} +Provides: installonlypkg(kernel-module) +Requires: kernel-uname-r = %{_kver} +Conflicts: akmod-nvidia +Recommends: xorg-x11-drv-nvidia >= %{_nv_ver} + +%description nvidia-open + This package provides nvidia-open %{_nv_ver} kernel modules for %{name}. + +%post nvidia-open + /sbin/depmod -a %{_kver} + +%files nvidia-open + %license %{_defaultlicensedir}/%{name}-nvidia-open/COPYING + %{_kernel_dir}/nvidia +%endif + +%files diff --git a/my-ostree-os/mesa/0001-Revert-kopper-Explicitly-choose-zink.patch b/my-ostree-os/mesa/0001-Revert-kopper-Explicitly-choose-zink.patch new file mode 100644 index 0000000..954389e --- /dev/null +++ b/my-ostree-os/mesa/0001-Revert-kopper-Explicitly-choose-zink.patch @@ -0,0 +1,46 @@ +From 24f85c06c28736b73c14208a0ffa6657d2aee9cd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Mon, 21 Apr 2025 13:52:14 +0200 +Subject: [PATCH] Revert "kopper: Explicitly choose zink" + +On QEMU (virtio driver), without 3D acceleration enabled and without +mesa-vulkan-drivers installed, this commit prevents Mutter to start. + +This reverts commit c0bc957c5d8c7edd57626284b712dd6ea1e375fc. + +Related: https://bugzilla.redhat.com/show_bug.cgi?id=2360851 +Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13009 +--- + .pick_status.json | 2 +- + src/gallium/frontends/dri/kopper.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/.pick_status.json b/.pick_status.json +index 99df2fb30c2..cdf3965678c 100644 +--- a/.pick_status.json ++++ b/.pick_status.json +@@ -16204,7 +16204,7 @@ + "description": "kopper: Explicitly choose zink", + "nominated": false, + "nomination_type": 0, +- "resolution": 1, ++ "resolution": 4, + "main_sha": null, + "because_sha": null, + "notes": null +diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c +index a1d7dcb79b4..3bdb56022a9 100644 +--- a/src/gallium/frontends/dri/kopper.c ++++ b/src/gallium/frontends/dri/kopper.c +@@ -73,7 +73,7 @@ kopper_init_screen(struct dri_screen *screen, bool driver_name_is_inferred) + bool success; + #ifdef HAVE_LIBDRM + if (screen->fd != -1) +- success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, true); ++ success = pipe_loader_drm_probe_fd(&screen->dev, screen->fd, false); + else + success = pipe_loader_vk_probe_dri(&screen->dev); + #else +-- +2.49.0 + diff --git a/my-ostree-os/mesa/0001-docs-features-add-VK_EXT_hdr_metadata.patch b/my-ostree-os/mesa/0001-docs-features-add-VK_EXT_hdr_metadata.patch new file mode 100644 index 0000000..235dfb6 --- /dev/null +++ b/my-ostree-os/mesa/0001-docs-features-add-VK_EXT_hdr_metadata.patch @@ -0,0 +1,28 @@ +From b97a4dc4caf609975ba9e80336e63ebc9545a91b Mon Sep 17 00:00:00 2001 +From: Erik Faye-Lund +Date: Thu, 6 Mar 2025 13:53:07 +0100 +Subject: [PATCH] docs/features: add VK_EXT_hdr_metadata + +This was missed when it was recently added. + +Fixes: 4b663d561b8 ("vulkan/wsi: implement support for VK_EXT_hdr_metadata on Wayland") +Part-of: +--- + docs/features.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/docs/features.txt b/docs/features.txt +index 6e789b3ed29..53395bfee2a 100644 +--- a/docs/features.txt ++++ b/docs/features.txt +@@ -612,6 +612,7 @@ Khronos extensions that are not part of any Vulkan version: + VK_EXT_global_priority DONE (anv, hasvk, panvk, radv, tu) + VK_EXT_global_priority_query DONE (anv, hasvk, panvk, radv, tu) + VK_EXT_graphics_pipeline_library DONE (anv, lvp, nvk, panvk, radv, tu, vn) ++ VK_EXT_hdr_metadata DONE (anv, lvp, nvk, panvk, radv, tu) + VK_EXT_headless_surface DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) + VK_EXT_image_2d_view_of_3d DONE (anv, hasvk, lvp, nvk, radv, tu, vn) + VK_EXT_image_compression_control DONE (radv) +-- +2.49.0 + diff --git a/my-ostree-os/mesa/0001-increase-required-wayland-protocols-version-to-1.41.patch b/my-ostree-os/mesa/0001-increase-required-wayland-protocols-version-to-1.41.patch new file mode 100644 index 0000000..f5f36a5 --- /dev/null +++ b/my-ostree-os/mesa/0001-increase-required-wayland-protocols-version-to-1.41.patch @@ -0,0 +1,116 @@ +From c15c45c54bb2fd03b41416c6628efcb095eec4b6 Mon Sep 17 00:00:00 2001 +From: Xaver Hugl +Date: Mon, 17 Feb 2025 16:25:09 +0100 +Subject: [PATCH 1/4] increase required wayland-protocols version to 1.41 + +This version contains the color management protocol. + +This commit also adjusts the build-wayland script to mention +that the DEBIAN_BASE_TAG also has to be bumped. + +Signed-off-by: Xaver Hugl +Reviewed-by: Eric Engestrom +Reviewed-by: Sebastian Wick +Acked-by: Daniel Stone +Part-of: +--- + .gitlab-ci/container/build-wayland.sh | 4 +++- + .gitlab-ci/image-tags.yml | 16 ++++++++-------- + meson.build | 2 +- + subprojects/wayland-protocols.wrap | 6 +++--- + 4 files changed, 15 insertions(+), 13 deletions(-) + +diff --git a/.gitlab-ci/container/build-wayland.sh b/.gitlab-ci/container/build-wayland.sh +index d6117254e87..551edcfe7db 100644 +--- a/.gitlab-ci/container/build-wayland.sh ++++ b/.gitlab-ci/container/build-wayland.sh +@@ -7,6 +7,8 @@ uncollapsed_section_start wayland "Building Wayland" + + # When changing this file, you need to bump the following + # .gitlab-ci/image-tags.yml tags: ++# ALPINE_X86_64_BUILD_TAG ++# DEBIAN_BASE_TAG + # DEBIAN_BUILD_TAG + # DEBIAN_TEST_ANDROID_TAG + # DEBIAN_TEST_GL_TAG +@@ -15,7 +17,7 @@ uncollapsed_section_start wayland "Building Wayland" + # KERNEL_ROOTFS_TAG + + export LIBWAYLAND_VERSION="1.21.0" +-export WAYLAND_PROTOCOLS_VERSION="1.38" ++export WAYLAND_PROTOCOLS_VERSION="1.41" + + git clone https://gitlab.freedesktop.org/wayland/wayland + cd wayland +diff --git a/.gitlab-ci/image-tags.yml b/.gitlab-ci/image-tags.yml +index 89909ed7912..b8423ef3d4f 100644 +--- a/.gitlab-ci/image-tags.yml ++++ b/.gitlab-ci/image-tags.yml +@@ -13,10 +13,10 @@ + + variables: + DEBIAN_X86_64_BUILD_BASE_IMAGE: "debian/x86_64_build-base" +- DEBIAN_BASE_TAG: "20250130-vvless" ++ DEBIAN_BASE_TAG: "20250223-way-prot" + + DEBIAN_X86_64_BUILD_IMAGE_PATH: "debian/x86_64_build" +- DEBIAN_BUILD_TAG: "20250128-llvm19-up" ++ DEBIAN_BUILD_TAG: "20250223-way-prot" + + DEBIAN_X86_64_TEST_BASE_IMAGE: "debian/x86_64_test-base" + DEBIAN_ARM64_TEST_BASE_IMAGE: "debian/arm64_test-base" +@@ -27,17 +27,17 @@ variables: + DEBIAN_ARM64_TEST_IMAGE_VK_PATH: "debian/arm64_test-vk" + DEBIAN_X86_64_TEST_ANDROID_IMAGE_PATH: "debian/x86_64_test-android" + +- DEBIAN_TEST_ANDROID_TAG: "20250130-vvless" +- DEBIAN_TEST_GL_TAG: "20250327-piglit-250" +- DEBIAN_TEST_VK_TAG: "20250327-piglit-250" +- KERNEL_ROOTFS_TAG: "20250327-trace-250" ++ DEBIAN_TEST_ANDROID_TAG: "20250223-way-prot" ++ DEBIAN_TEST_GL_TAG: "20250223-way-prot" ++ DEBIAN_TEST_VK_TAG: "20250223-way-prot" ++ KERNEL_ROOTFS_TAG: "20250223-way-prot" + + DEBIAN_PYUTILS_IMAGE: "debian/x86_64_pyutils" + DEBIAN_PYUTILS_TAG: "20250129-lavacli" + +- ALPINE_X86_64_BUILD_TAG: "20250128-llversionm" ++ ALPINE_X86_64_BUILD_TAG: "20250223-way-prot" + ALPINE_X86_64_LAVA_SSH_TAG: "20250124-spirv-tools" +- FEDORA_X86_64_BUILD_TAG: "20250128-llversionm" ++ FEDORA_X86_64_BUILD_TAG: "20250223-way-prot" + + KERNEL_TAG: "v6.13-rc4-mesa-5e77" + KERNEL_REPO: "gfx-ci/linux" +diff --git a/meson.build b/meson.build +index 095aec5d9ea..ddde02c1755 100644 +--- a/meson.build ++++ b/meson.build +@@ -2058,7 +2058,7 @@ if with_platform_wayland + else + wl_scanner_arg = 'code' + endif +- dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.38', default_options: [ 'tests=false' ]) ++ dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.41', default_options: [ 'tests=false' ]) + dep_wayland_client = dependency('wayland-client', version : '>=1.18') + dep_wayland_server = dependency('wayland-server', version : '>=1.18') + if with_egl +diff --git a/subprojects/wayland-protocols.wrap b/subprojects/wayland-protocols.wrap +index 61f306bdffd..c82fece01e3 100644 +--- a/subprojects/wayland-protocols.wrap ++++ b/subprojects/wayland-protocols.wrap +@@ -1,7 +1,7 @@ + [wrap-file] +-directory = wayland-protocols-1.38 +-source_url = https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.38/downloads/wayland-protocols-1.38.tar.xz +-source_filename = wayland-protocols-1.38.tar.xz ++directory = wayland-protocols-1.41 ++source_url = https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.41/downloads/wayland-protocols-1.41.tar.xz ++source_filename = wayland-protocols-1.41.tar.xz + source_hash = ff17292c05159d2b20ce6cacfe42d7e31a28198fa1429a769b03af7c38581dbe + + [provide] +-- +2.47.0 + diff --git a/my-ostree-os/mesa/0001-meson-update-wayland-protocols-source_hash.patch b/my-ostree-os/mesa/0001-meson-update-wayland-protocols-source_hash.patch new file mode 100644 index 0000000..424f76e --- /dev/null +++ b/my-ostree-os/mesa/0001-meson-update-wayland-protocols-source_hash.patch @@ -0,0 +1,34 @@ +From 7f749c41ba8d9918251c00eeb86d453cda5fbb7b Mon Sep 17 00:00:00 2001 +From: Benjamin Lee +Date: Tue, 25 Feb 2025 22:03:25 -0800 +Subject: [PATCH] meson: update wayland-protocols source_hash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This was missed when updating to 1.41. + +Signed-off-by: Benjamin Lee +Fixes: 53b40a40f46 ("increase required wayland-protocols version to 1.41") +Reviewed-by: Tapani Pälli +Part-of: +--- + subprojects/wayland-protocols.wrap | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/subprojects/wayland-protocols.wrap b/subprojects/wayland-protocols.wrap +index c82fece01e3..c6686b4ae4a 100644 +--- a/subprojects/wayland-protocols.wrap ++++ b/subprojects/wayland-protocols.wrap +@@ -2,7 +2,7 @@ + directory = wayland-protocols-1.41 + source_url = https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/1.41/downloads/wayland-protocols-1.41.tar.xz + source_filename = wayland-protocols-1.41.tar.xz +-source_hash = ff17292c05159d2b20ce6cacfe42d7e31a28198fa1429a769b03af7c38581dbe ++source_hash = 2786b6b1b79965e313f2c289c12075b9ed700d41844810c51afda10ee329576b + + [provide] + wayland-protocols = wayland_protocols +-- +2.49.0 + diff --git a/my-ostree-os/mesa/0001-vulkan-wsi-dont-use-srgb-if-the-compositor.patch b/my-ostree-os/mesa/0001-vulkan-wsi-dont-use-srgb-if-the-compositor.patch new file mode 100644 index 0000000..805e9bf --- /dev/null +++ b/my-ostree-os/mesa/0001-vulkan-wsi-dont-use-srgb-if-the-compositor.patch @@ -0,0 +1,59 @@ +From 779c8d1669fa74b31e296519f6920e5479c19973 Mon Sep 17 00:00:00 2001 +From: Xaver Hugl +Date: Thu, 27 Feb 2025 14:56:06 +0100 +Subject: [PATCH] vulkan/wsi: don't use sRGB if the compositor doesn't support + it + +This could realistically happen if the compositor doesn't support parametric image +descriptions at all, in which case we'd get a protocol error for trying to use it. + +Signed-off-by: Xaver Hugl +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index 098ba9c80928e..3f636a5aad1a0 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -1139,8 +1139,14 @@ static const struct wp_image_description_v1_listener image_description_listener + }; + + static bool +-needs_color_surface(VkColorSpaceKHR colorspace) ++needs_color_surface(struct wsi_wl_display *display, VkColorSpaceKHR colorspace) + { ++ if (colorspace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { ++ /* we want to use a color surface to set sRGB if possible, but ++ * only if the compositor actually supports sRGB */ ++ return vector_contains(&display->color_primaries, WP_COLOR_MANAGER_V1_PRIMARIES_SRGB) ++ && vector_contains(&display->color_transfer_funcs, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB); ++ } + return colorspace != VK_COLOR_SPACE_PASS_THROUGH_EXT; + } + +@@ -1199,8 +1205,8 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + } + + bool new_color_surface = !surface->color.color_surface; +- bool needs_color_surface_new = needs_color_surface(chain->color.colorspace); +- bool needs_color_surface_old = needs_color_surface(surface->color.colorspace); ++ bool needs_color_surface_new = needs_color_surface(display, chain->color.colorspace); ++ bool needs_color_surface_old = needs_color_surface(display, surface->color.colorspace); + if ((new_color_surface || !needs_color_surface_old) && needs_color_surface_new) { + wsi_wl_surface_add_color_refcount(surface); + } else if (needs_color_surface_old && !needs_color_surface_new) { +@@ -3293,7 +3299,8 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, + wl_callback_destroy(chain->frame); + if (chain->tearing_control) + wp_tearing_control_v1_destroy(chain->tearing_control); +- if (needs_color_surface(chain->color.colorspace) && wsi_wl_surface->color.color_surface) { ++ if (needs_color_surface(wsi_wl_surface->display, chain->color.colorspace) && ++ wsi_wl_surface->color.color_surface) { + wsi_wl_surface_remove_color_refcount(wsi_wl_surface); + } + +-- +GitLab + diff --git a/my-ostree-os/mesa/0001-vulkan-wsi-validate-hdr-metadata.patch b/my-ostree-os/mesa/0001-vulkan-wsi-validate-hdr-metadata.patch new file mode 100644 index 0000000..9424d8a --- /dev/null +++ b/my-ostree-os/mesa/0001-vulkan-wsi-validate-hdr-metadata.patch @@ -0,0 +1,100 @@ +From cb7726bb2cf7e25661c1401dbef2a6a597748ecd Mon Sep 17 00:00:00 2001 +From: Xaver Hugl +Date: Tue, 11 Mar 2025 13:48:31 +0100 +Subject: [PATCH] vulkan/wsi: validate HDR metadata to not cause protocol + errors + +If it would trigger a protocol error, we must not use it. + +Signed-off-by: Xaver Hugl +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 51 ++++++++++++++++++++++++----- + 1 file changed, 43 insertions(+), 8 deletions(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index ddfbd863c94b0..68254dc8610dc 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -1172,6 +1172,36 @@ wsi_wl_surface_remove_color_refcount(struct wsi_wl_surface *wsi_surface) + } + } + ++struct wayland_hdr_metadata { ++ uint32_t min_luminance; ++ uint32_t max_luminance; ++ uint32_t max_fall; ++ uint32_t max_cll; ++}; ++ ++#define MIN_LUM_FACTOR 10000 ++ ++static bool ++is_hdr_metadata_legal(struct wayland_hdr_metadata *l) ++{ ++ if (l->max_cll != 0) { ++ if (l->max_cll * MIN_LUM_FACTOR < l->min_luminance) ++ return false; ++ if (l->max_cll > l->max_luminance) ++ return false; ++ } ++ if (l->max_fall != 0) { ++ if (l->max_fall * MIN_LUM_FACTOR < l->min_luminance) ++ return false; ++ if (l->max_fall > l->max_luminance) ++ return false; ++ if (l->max_cll != 0 && l->max_fall > l->max_cll) { ++ return false; ++ } ++ } ++ return l->max_luminance * MIN_LUM_FACTOR > l->min_luminance; ++} ++ + static bool + compare_hdr_metadata(struct VkHdrMetadataEXT *l, struct VkHdrMetadataEXT *r) + { +@@ -1215,7 +1245,14 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + wsi_wl_surface_remove_color_refcount(surface); + } + +- bool should_use_hdr_metadata = chain->color.has_hdr_metadata; ++ struct wayland_hdr_metadata wayland_hdr_metadata = { ++ .min_luminance = round(MIN_LUM_FACTOR * chain->color.hdr_metadata.minLuminance), ++ .max_luminance = round(chain->color.hdr_metadata.maxLuminance), ++ .max_fall = round(chain->color.hdr_metadata.maxFrameAverageLightLevel), ++ .max_cll = round(chain->color.hdr_metadata.maxContentLightLevel), ++ }; ++ bool should_use_hdr_metadata = chain->color.has_hdr_metadata ++ && is_hdr_metadata_legal(&wayland_hdr_metadata); + for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { + if (colorspace_mapping[i].colorspace == chain->color.colorspace) { + should_use_hdr_metadata &= colorspace_mapping[i].should_use_hdr_metadata; +@@ -1259,10 +1296,8 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + wp_image_description_creator_params_v1_set_primaries_named(creator, primaries); + wp_image_description_creator_params_v1_set_tf_named(creator, tf); + if (should_use_hdr_metadata) { +- uint32_t max_cll = round(chain->color.hdr_metadata.maxContentLightLevel); +- uint32_t max_fall = round(chain->color.hdr_metadata.maxFrameAverageLightLevel); +- wp_image_description_creator_params_v1_set_max_cll(creator, max_cll); +- wp_image_description_creator_params_v1_set_max_fall(creator, max_fall); ++ wp_image_description_creator_params_v1_set_max_cll(creator, wayland_hdr_metadata.max_cll); ++ wp_image_description_creator_params_v1_set_max_fall(creator, wayland_hdr_metadata.max_fall); + if (display->color_features.mastering_display_primaries) { + uint32_t red_x = round(chain->color.hdr_metadata.displayPrimaryRed.x * 1000000); + uint32_t red_y = round(chain->color.hdr_metadata.displayPrimaryRed.y * 1000000); +@@ -1276,9 +1311,9 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + green_x, green_y, + blue_x, blue_y, + white_x, white_y); +- uint32_t min_lum = round(chain->color.hdr_metadata.minLuminance * 10000); +- uint32_t max_lum = round(chain->color.hdr_metadata.maxLuminance); +- wp_image_description_creator_params_v1_set_mastering_luminance(creator, min_lum, max_lum); ++ wp_image_description_creator_params_v1_set_mastering_luminance(creator, ++ wayland_hdr_metadata.min_luminance, ++ wayland_hdr_metadata.max_luminance); + } + } + +-- +GitLab + diff --git a/my-ostree-os/mesa/0001-vulkan-wsi-wayland-avoid-duplicate-colorspace-entry.patch b/my-ostree-os/mesa/0001-vulkan-wsi-wayland-avoid-duplicate-colorspace-entry.patch new file mode 100644 index 0000000..092a66b --- /dev/null +++ b/my-ostree-os/mesa/0001-vulkan-wsi-wayland-avoid-duplicate-colorspace-entry.patch @@ -0,0 +1,33 @@ +From c2570055d5b45df6f2c10c2c1f2235c77db5641f Mon Sep 17 00:00:00 2001 +From: Lars-Ivar Hesselberg Simonsen +Date: Mon, 7 Apr 2025 16:29:25 +0200 +Subject: [PATCH] vulkan/wsi/wayland: Avoid duplicate colorspace entry + +The colorspace SRGB_NONLINEAR could be added twice when querying +available formats, leading to duplicate entries and VulkanCTS WSI test +failures. + +Fixes: 789507c99c6 ("vulkan/wsi: implement the Wayland color management protocol") +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index 6632522292798..ddfbd863c94b0 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -1033,7 +1033,9 @@ wsi_wl_display_determine_colorspaces(struct wsi_wl_display *display) + + struct u_vector *tfs = &display->color_transfer_funcs; + struct u_vector *primaries = &display->color_primaries; +- for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { ++ /* Skip SRGB_NONLINEAR (i = 0), which has already been added above. */ ++ assert(colorspace_mapping[0].colorspace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR); ++ for (int i = 1; i < ARRAY_SIZE(colorspace_mapping); i++) { + if (!vector_contains(primaries, colorspace_mapping[i].primaries)) + continue; + if (!vector_contains(tfs, colorspace_mapping[i].tf)) +-- +GitLab + diff --git a/my-ostree-os/mesa/0001-vulkan-wsi-wayland-initialize-surface-colorspace.patch b/my-ostree-os/mesa/0001-vulkan-wsi-wayland-initialize-surface-colorspace.patch new file mode 100644 index 0000000..40c7f36 --- /dev/null +++ b/my-ostree-os/mesa/0001-vulkan-wsi-wayland-initialize-surface-colorspace.patch @@ -0,0 +1,38 @@ +From dc90e33ad2b693b1b97ba844a79d709d15c45a2d Mon Sep 17 00:00:00 2001 +From: llyyr +Date: Thu, 3 Apr 2025 09:19:42 +0530 +Subject: [PATCH] vulkan/wsi/wayland: initialize surface colorspace with + PASS_THROUGH_EXT + +Starting with sRGB meant we would refcount to -1 if an application +chooses PASS_THROUGH. Instead, just initialize with PASS_THROUGH so the +initial refcount of 0 reflects reality. + +Previously, we would segfault if an application chose PASS_THROUGH at +swapchain initialization then switched to a color managed colorspace +later in the runtime, because we would increment refcount from -1 -> 0 +and this would result in not creating a new color managed surface. + +Fixes: 789507c99c67 ("vulkan/wsi: implement the Wayland color management protocol") +Signed-off-by: llyyr +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index 3f636a5aad1a0..57436b12a9efc 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -2315,7 +2315,7 @@ wsi_CreateWaylandSurfaceKHR(VkInstance _instance, + surface->surface = pCreateInfo->surface; + + wsi_wl_surface->instance = instance; +- wsi_wl_surface->color.colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; ++ wsi_wl_surface->color.colorspace = VK_COLOR_SPACE_PASS_THROUGH_EXT; + + *pSurface = VkIcdSurfaceBase_to_handle(&surface->base); + +-- +GitLab + diff --git a/my-ostree-os/mesa/0001-vulkan-wsi-wayland-make-needs_color_surface_old_check_if.patch b/my-ostree-os/mesa/0001-vulkan-wsi-wayland-make-needs_color_surface_old_check_if.patch new file mode 100644 index 0000000..9791498 --- /dev/null +++ b/my-ostree-os/mesa/0001-vulkan-wsi-wayland-make-needs_color_surface_old_check_if.patch @@ -0,0 +1,38 @@ +From 033ce1bae1505467fb69bf727377318421cb7731 Mon Sep 17 00:00:00 2001 +From: llyyr +Date: Fri, 25 Apr 2025 10:41:06 +0530 +Subject: [PATCH] vulkan/wsi/wayland: make needs_color_surface_old check if + surface exists + +Otherwise we end up removing refcount even when we don't have a color +surface already for applications going from SRGB_NONLINEAR to +PASS_THROUGH dring runtime. + +To reproduce the bug, start mpv with "--target-colorspace-hint=yes" then +set it to "no" during runtime with a keybind + +Fixes: 789507c99c67 ("vulkan/wsi: implement the Wayland color management protocol") +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index 7c1efda1f274e..938a9cd7c181b 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -1238,8 +1238,9 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + + bool new_color_surface = !surface->color.color_surface; + bool needs_color_surface_new = needs_color_surface(display, chain->color.colorspace); +- bool needs_color_surface_old = needs_color_surface(display, surface->color.colorspace); +- if ((new_color_surface || !needs_color_surface_old) && needs_color_surface_new) { ++ bool needs_color_surface_old = surface->color.color_surface && ++ needs_color_surface(display, surface->color.colorspace); ++ if (!needs_color_surface_old && needs_color_surface_new) { + wsi_wl_surface_add_color_refcount(surface); + } else if (needs_color_surface_old && !needs_color_surface_new) { + wsi_wl_surface_remove_color_refcount(surface); +-- +GitLab + diff --git a/my-ostree-os/mesa/0002-vulkan-wsi-implement-the-Wayland-color-management-pr.patch b/my-ostree-os/mesa/0002-vulkan-wsi-implement-the-Wayland-color-management-pr.patch new file mode 100644 index 0000000..cfab19a --- /dev/null +++ b/my-ostree-os/mesa/0002-vulkan-wsi-implement-the-Wayland-color-management-pr.patch @@ -0,0 +1,614 @@ +From 5dd0635b31fcb6b12e9dcb3b908e501f153e7e8b Mon Sep 17 00:00:00 2001 +From: Colin Marc +Date: Tue, 26 Mar 2024 11:12:28 +0100 +Subject: [PATCH 2/4] vulkan/wsi: implement the Wayland color management + protocol + +This allows applications to use color spaces other than sRGB, if the compositor +supports them. + +The color management surface is only created if a non-sRGB and non-passthrough +colorspace is set on the surface, so applications can still use the protocol +directly if they prefer. + +Co-authored-by: Xaver Hugl +Reviewed-by: Sebastian Wick +Acked-by: Daniel Stone +Part-of: +--- + src/egl/wayland/wayland-drm/meson.build | 1 + + src/vulkan/wsi/meson.build | 1 + + src/vulkan/wsi/wsi_common_wayland.c | 421 ++++++++++++++++++++++-- + 3 files changed, 400 insertions(+), 23 deletions(-) + +diff --git a/src/egl/wayland/wayland-drm/meson.build b/src/egl/wayland/wayland-drm/meson.build +index 59ce3442499..d3b6c15ddd2 100644 +--- a/src/egl/wayland/wayland-drm/meson.build ++++ b/src/egl/wayland/wayland-drm/meson.build +@@ -48,6 +48,7 @@ wp_protos = { + 'presentation-time': 'stable/presentation-time/presentation-time.xml', + 'tearing-control-v1': 'staging/tearing-control/tearing-control-v1.xml', + 'linux-drm-syncobj-v1': 'staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml', ++ 'color-management-v1': 'staging/color-management/color-management-v1.xml', + } + wp_files = {} + foreach name, xml : wp_protos +diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build +index 6933eb780c4..ba609ab3151 100644 +--- a/src/vulkan/wsi/meson.build ++++ b/src/vulkan/wsi/meson.build +@@ -22,6 +22,7 @@ if with_platform_wayland + files_vulkan_wsi += wp_files['tearing-control-v1'] + links_vulkan_wsi += libloader_wayland_helper + files_vulkan_wsi += wp_files['linux-drm-syncobj-v1'] ++ files_vulkan_wsi += wp_files['color-management-v1'] + endif + + if with_platform_windows +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index d6c1b862324..d4b47c1f1b8 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -47,6 +47,7 @@ + #include "presentation-time-client-protocol.h" + #include "linux-drm-syncobj-v1-client-protocol.h" + #include "tearing-control-v1-client-protocol.h" ++#include "color-management-v1-client-protocol.h" + + #include + #include +@@ -110,8 +111,13 @@ struct wsi_wl_display { + struct wp_tearing_control_manager_v1 *tearing_control_manager; + struct wp_linux_drm_syncobj_manager_v1 *wl_syncobj; + ++ struct wp_color_manager_v1 *color_manager; ++ + struct dmabuf_feedback_format_table format_table; + ++ struct u_vector color_primaries; ++ struct u_vector color_transfer_funcs; ++ + /* users want per-chain wsi_wl_swapchain->present_ids.wp_presentation */ + struct wp_presentation *wp_presentation_notwrapped; + uint32_t wp_presentation_version; +@@ -125,6 +131,9 @@ struct wsi_wl_display { + /* Formats populated by zwp_linux_dmabuf_v1 or wl_shm interfaces */ + struct u_vector formats; + ++ /* Additional colorspaces returned by wp_color_management_v1. */ ++ struct u_vector colorspaces; ++ + bool sw; + + dev_t main_device; +@@ -180,6 +189,11 @@ struct wsi_wl_surface { + struct dmabuf_feedback dmabuf_feedback, pending_dmabuf_feedback; + + struct wp_linux_drm_syncobj_surface_v1 *wl_syncobj_surface; ++ ++ struct vk_instance *instance; ++ struct wp_color_management_surface_v1 *color_surface; ++ int color_surface_refcount; ++ VkColorSpaceKHR colorspace; + }; + + struct wsi_wl_swapchain { +@@ -230,6 +244,8 @@ struct wsi_wl_swapchain { + unsigned int refresh_nsec; + } present_ids; + ++ VkColorSpaceKHR colorspace; ++ + struct wsi_wl_image images[0]; + }; + VK_DEFINE_NONDISP_HANDLE_CASTS(wsi_wl_swapchain, base.base, VkSwapchainKHR, +@@ -885,6 +901,316 @@ static const struct wl_shm_listener shm_listener = { + .format = shm_handle_format + }; + ++static bool ++vector_contains(struct u_vector *vec, unsigned int val) ++{ ++ unsigned int *ptr; ++ ++ u_vector_foreach(ptr, vec) ++ if (*ptr == val) ++ return true; ++ ++ return false; ++} ++ ++struct Colorspace { ++ VkColorSpaceKHR colorspace; ++ enum wp_color_manager_v1_primaries primaries; ++ enum wp_color_manager_v1_transfer_function tf; ++}; ++struct Colorspace colorspace_mapping[] = { ++ { ++ .colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_DISPLAY_P3, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_DISPLAY_P3, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_BT709_LINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_BT709_NONLINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_BT2020_LINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_HDR10_ST2084_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ, ++ }, ++ /* VK_COLOR_SPACE_DOLBYVISION_EXT is left out because it's deprecated */ ++ { ++ .colorspace = VK_COLOR_SPACE_HDR10_HLG_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_HLG, ++ }, ++ { ++ .colorspace = VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_ADOBE_RGB, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ }, ++ /* VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT is left out because there's no ++ * exactly matching transfer function in the Wayland protocol */ ++ /* VK_COLOR_SPACE_PASS_THROUGH_EXT is handled elsewhere */ ++ { ++ .colorspace = VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT, ++ .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, ++ .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_SRGB, ++ }, ++ /* VK_COLOR_SPACE_DISPLAY_NATIVE_AMD isn't supported */ ++ /* VK_COLORSPACE_SRGB_NONLINEAR_KHR is just an alias */ ++ /* VK_COLOR_SPACE_DCI_P3_LINEAR_EXT is just an alias */ ++}; ++ ++static int ++wsi_wl_display_determine_colorspaces(struct wsi_wl_display *display) ++{ ++ u_vector_finish(&display->colorspaces); ++ if (!u_vector_init(&display->colorspaces, 8, sizeof(VkColorSpaceKHR))) ++ return -1; ++ ++ /* SRGB_NONLINEAR is always supported. */ ++ VkColorSpaceKHR *new_cs = u_vector_add(&display->colorspaces); ++ if (!new_cs) ++ return -1; ++ *new_cs = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; ++ ++ /* as is PASS_THROUGH */ ++ new_cs = u_vector_add(&display->colorspaces); ++ if (!new_cs) ++ return -1; ++ *new_cs = VK_COLOR_SPACE_PASS_THROUGH_EXT; ++ ++ if (!display->color_manager) ++ return 0; ++ ++ struct u_vector *tfs = &display->color_transfer_funcs; ++ struct u_vector *primaries = &display->color_primaries; ++ for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { ++ if (!vector_contains(primaries, colorspace_mapping[i].primaries)) ++ continue; ++ if (!vector_contains(tfs, colorspace_mapping[i].tf)) ++ continue; ++ VkColorSpaceKHR *new_cs = u_vector_add(&display->colorspaces); ++ if (!new_cs) ++ return -1; ++ *new_cs = colorspace_mapping[i].colorspace; ++ } ++ return 0; ++} ++ ++static void ++color_management_handle_supported_intent(void *data, ++ struct wp_color_manager_v1 *color_manager, ++ unsigned int intent) ++{ ++ /* We only use the perceptual rendering intent, which is always supported. */ ++} ++ ++static void ++color_management_handle_supported_features(void *data, ++ struct wp_color_manager_v1 *color_manager, ++ unsigned int feature) ++{ ++ /* We don't use any non-default features yet. */ ++} ++ ++static void ++color_management_handle_supported_tf_named(void *data, ++ struct wp_color_manager_v1 *color_manager, ++ unsigned int tf) ++{ ++ struct wsi_wl_display *display = data; ++ unsigned int *new_tf = u_vector_add(&display->color_transfer_funcs); ++ if (new_tf) ++ *new_tf = tf; ++} ++ ++static void ++color_management_handle_supported_primaries_named(void *data, ++ struct wp_color_manager_v1 *color_manager, ++ unsigned int primaries) ++{ ++ struct wsi_wl_display *display = data; ++ unsigned int *new_primaries = u_vector_add(&display->color_primaries); ++ if (new_primaries) ++ *new_primaries = primaries; ++} ++ ++static void ++color_management_handle_done(void *data, struct wp_color_manager_v1 *color_manager) ++{ ++ /* Intentionally left blank */ ++} ++ ++static const struct wp_color_manager_v1_listener color_manager_listener = { ++ .supported_intent = color_management_handle_supported_intent, ++ .supported_feature = color_management_handle_supported_features, ++ .supported_tf_named = color_management_handle_supported_tf_named, ++ .supported_primaries_named = color_management_handle_supported_primaries_named, ++ .done = color_management_handle_done, ++}; ++ ++enum image_description_status { ++ undefined, ++ ready, ++ failed, ++}; ++ ++static void ++color_management_handle_image_desc_failed(void *data, ++ struct wp_image_description_v1 *desc, ++ unsigned int cause, ++ const char *msg) ++{ ++ enum image_description_status *status = data; ++ *status = failed; ++} ++ ++static void ++color_management_handle_image_desc_ready(void *data, ++ struct wp_image_description_v1 *desc, ++ unsigned int id) ++{ ++ enum image_description_status *status = data; ++ *status = ready; ++} ++ ++static const struct wp_image_description_v1_listener image_description_listener = { ++ .failed = color_management_handle_image_desc_failed, ++ .ready = color_management_handle_image_desc_ready, ++}; ++ ++static bool ++needs_color_surface(VkColorSpaceKHR colorspace) ++{ ++ return colorspace != VK_COLOR_SPACE_PASS_THROUGH_EXT; ++} ++ ++static void ++wsi_wl_surface_add_color_refcount(struct wsi_wl_surface *wsi_surface) ++{ ++ wsi_surface->color_surface_refcount++; ++ if (wsi_surface->color_surface_refcount == 1) { ++ wsi_surface->color_surface = ++ wp_color_manager_v1_get_surface(wsi_surface->display->color_manager, wsi_surface->surface); ++ } ++} ++ ++static void ++wsi_wl_surface_remove_color_refcount(struct wsi_wl_surface *wsi_surface) ++{ ++ wsi_surface->color_surface_refcount--; ++ if (wsi_surface->color_surface_refcount == 0) { ++ wp_color_management_surface_v1_destroy(wsi_surface->color_surface); ++ wsi_surface->color_surface = NULL; ++ } ++} ++ ++static VkResult ++wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) ++{ ++ struct wsi_wl_surface *surface = chain->wsi_wl_surface; ++ struct wsi_wl_display *display = surface->display; ++ ++ /* we need the color management extension for ++ * everything except sRGB and PASS_THROUGH */ ++ if (!display->color_manager) { ++ if (chain->colorspace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR || ++ chain->colorspace == VK_COLOR_SPACE_PASS_THROUGH_EXT) { ++ return VK_SUCCESS; ++ } else { ++ return VK_ERROR_SURFACE_LOST_KHR; ++ } ++ } ++ ++ bool new_color_surface = !surface->color_surface; ++ bool needs_color_surface_new = needs_color_surface(chain->colorspace); ++ bool needs_color_surface_old = needs_color_surface(surface->colorspace); ++ if ((new_color_surface || !needs_color_surface_old) && needs_color_surface_new) { ++ wsi_wl_surface_add_color_refcount(surface); ++ } else if (needs_color_surface_old && !needs_color_surface_new) { ++ wsi_wl_surface_remove_color_refcount(surface); ++ } ++ ++ if (!new_color_surface && surface->colorspace == chain->colorspace) ++ return VK_SUCCESS; ++ ++ /* failure is fatal, so this potentially being wrong ++ in that case doesn't matter */ ++ surface->colorspace = chain->colorspace; ++ if (!needs_color_surface_new) ++ return VK_SUCCESS; ++ ++ struct wp_image_description_creator_params_v1 *creator = ++ wp_color_manager_v1_create_parametric_creator(display->color_manager); ++ ++ if (!creator) ++ return VK_ERROR_SURFACE_LOST_KHR; ++ ++ unsigned int primaries = 0; ++ unsigned int tf = 0; ++ for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { ++ if (colorspace_mapping[i].colorspace == chain->colorspace) { ++ primaries = colorspace_mapping[i].primaries; ++ tf = colorspace_mapping[i].tf; ++ } ++ } ++ ++ if (!primaries) ++ return VK_ERROR_SURFACE_LOST_KHR; ++ ++ wp_image_description_creator_params_v1_set_primaries_named(creator, primaries); ++ wp_image_description_creator_params_v1_set_tf_named(creator, tf); ++ ++ wl_proxy_set_queue((struct wl_proxy *) creator, display->queue); ++ ++ struct wp_image_description_v1 *image_desc = ++ wp_image_description_creator_params_v1_create(creator); ++ if (!image_desc) ++ return VK_ERROR_SURFACE_LOST_KHR; ++ ++ enum image_description_status status = undefined; ++ wp_image_description_v1_add_listener(image_desc, &image_description_listener, &status); ++ ++ while (status == undefined) { ++ int ret = wl_display_dispatch_queue(display->wl_display, display->queue); ++ if (ret < 0) ++ return VK_ERROR_OUT_OF_DATE_KHR; ++ } ++ if (status == failed) ++ return VK_ERROR_SURFACE_LOST_KHR; ++ ++ wp_color_management_surface_v1_set_image_description(chain->wsi_wl_surface->color_surface, ++ image_desc, ++ WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL); ++ wp_image_description_v1_destroy(image_desc); ++ ++ return VK_SUCCESS; ++} ++ ++ + static void + presentation_handle_clock_id(void* data, struct wp_presentation *wp_presentation, uint32_t clk_id) + { +@@ -942,6 +1268,17 @@ registry_handle_global(void *data, struct wl_registry *registry, + display->commit_timing_manager = + wl_registry_bind(registry, name, &wp_commit_timing_manager_v1_interface, 1); + } ++ ++ if (strcmp(interface, wp_color_manager_v1_interface.name) == 0) { ++ display->color_manager = ++ wl_registry_bind(registry, name, &wp_color_manager_v1_interface, 1); ++ ++ u_vector_init(&display->color_primaries, 8, sizeof(uint32_t)); ++ u_vector_init(&display->color_transfer_funcs, 8, sizeof(uint32_t)); ++ ++ wp_color_manager_v1_add_listener(display->color_manager, ++ &color_manager_listener, display); ++ } + } + + static void +@@ -961,6 +1298,10 @@ wsi_wl_display_finish(struct wsi_wl_display *display) + u_vector_foreach(f, &display->formats) + u_vector_finish(&f->modifiers); + u_vector_finish(&display->formats); ++ u_vector_finish(&display->colorspaces); ++ u_vector_finish(&display->color_primaries); ++ u_vector_finish(&display->color_transfer_funcs); ++ + if (display->wl_shm) + wl_shm_destroy(display->wl_shm); + if (display->wl_syncobj) +@@ -975,6 +1316,8 @@ wsi_wl_display_finish(struct wsi_wl_display *display) + wp_commit_timing_manager_v1_destroy(display->commit_timing_manager); + if (display->tearing_control_manager) + wp_tearing_control_manager_v1_destroy(display->tearing_control_manager); ++ if (display->color_manager) ++ wp_color_manager_v1_destroy(display->color_manager); + if (display->wl_display_wrapper) + wl_proxy_wrapper_destroy(display->wl_display_wrapper); + if (display->queue) +@@ -1066,9 +1409,14 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl, + } + } + +- /* Round-trip again to get formats and modifiers */ ++ /* Round-trip again to get formats, modifiers and color properties */ + wl_display_roundtrip_queue(display->wl_display, display->queue); + ++ if (wsi_wl_display_determine_colorspaces(display) < 0) { ++ result = VK_ERROR_OUT_OF_HOST_MEMORY; ++ goto fail; ++ } ++ + if (wsi_wl->wsi->force_bgra8_unorm_first) { + /* Find BGRA8_UNORM in the list and swap it to the first position if we + * can find it. Some apps get confused if SRGB is first in the list. +@@ -1358,6 +1706,8 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface, + VkSurfaceFormatKHR* pSurfaceFormats) + { + VkIcdSurfaceWayland *surface = (VkIcdSurfaceWayland *)icd_surface; ++ struct wsi_wl_surface *wsi_wl_surface = ++ wl_container_of((VkIcdSurfaceWayland *)icd_surface, wsi_wl_surface, base); + struct wsi_wayland *wsi = + (struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND]; + +@@ -1369,18 +1719,22 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface, + VK_OUTARRAY_MAKE_TYPED(VkSurfaceFormatKHR, out, + pSurfaceFormats, pSurfaceFormatCount); + +- struct wsi_wl_format *disp_fmt; +- u_vector_foreach(disp_fmt, &display.formats) { +- /* Skip formats for which we can't support both alpha & opaque +- * formats. +- */ +- if (!(disp_fmt->flags & WSI_WL_FMT_ALPHA) || +- !(disp_fmt->flags & WSI_WL_FMT_OPAQUE)) +- continue; ++ VkColorSpaceKHR *cs; ++ u_vector_foreach(cs, &display.colorspaces) { ++ struct wsi_wl_format *disp_fmt; ++ u_vector_foreach(disp_fmt, &display.formats) { ++ /* Skip formats for which we can't support both alpha & opaque ++ * formats. ++ */ ++ if (!(disp_fmt->flags & WSI_WL_FMT_ALPHA) || ++ !(disp_fmt->flags & WSI_WL_FMT_OPAQUE)) { ++ continue; ++ } + +- vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { +- out_fmt->format = disp_fmt->vk_format; +- out_fmt->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; ++ vk_outarray_append_typed(VkSurfaceFormatKHR, &out, out_fmt) { ++ out_fmt->format = disp_fmt->vk_format; ++ out_fmt->colorSpace = *cs; ++ } + } + } + +@@ -1397,6 +1751,8 @@ wsi_wl_surface_get_formats2(VkIcdSurfaceBase *icd_surface, + VkSurfaceFormat2KHR* pSurfaceFormats) + { + VkIcdSurfaceWayland *surface = (VkIcdSurfaceWayland *)icd_surface; ++ struct wsi_wl_surface *wsi_wl_surface = ++ wl_container_of((VkIcdSurfaceWayland *)icd_surface, wsi_wl_surface, base); + struct wsi_wayland *wsi = + (struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND]; + +@@ -1408,18 +1764,22 @@ wsi_wl_surface_get_formats2(VkIcdSurfaceBase *icd_surface, + VK_OUTARRAY_MAKE_TYPED(VkSurfaceFormat2KHR, out, + pSurfaceFormats, pSurfaceFormatCount); + +- struct wsi_wl_format *disp_fmt; +- u_vector_foreach(disp_fmt, &display.formats) { +- /* Skip formats for which we can't support both alpha & opaque +- * formats. +- */ +- if (!(disp_fmt->flags & WSI_WL_FMT_ALPHA) || +- !(disp_fmt->flags & WSI_WL_FMT_OPAQUE)) +- continue; ++ VkColorSpaceKHR *cs; ++ u_vector_foreach(cs, &display.colorspaces) { ++ struct wsi_wl_format *disp_fmt; ++ u_vector_foreach(disp_fmt, &display.formats) { ++ /* Skip formats for which we can't support both alpha & opaque ++ * formats. ++ */ ++ if (!(disp_fmt->flags & WSI_WL_FMT_ALPHA) || ++ !(disp_fmt->flags & WSI_WL_FMT_OPAQUE)) { ++ continue; ++ } + +- vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { +- out_fmt->surfaceFormat.format = disp_fmt->vk_format; +- out_fmt->surfaceFormat.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; ++ vk_outarray_append_typed(VkSurfaceFormat2KHR, &out, out_fmt) { ++ out_fmt->surfaceFormat.format = disp_fmt->vk_format; ++ out_fmt->surfaceFormat.colorSpace = *cs; ++ } + } + } + +@@ -1515,6 +1875,9 @@ wsi_wl_surface_destroy(VkIcdSurfaceBase *icd_surface, VkInstance _instance, + dmabuf_feedback_fini(&wsi_wl_surface->pending_dmabuf_feedback); + } + ++ if (wsi_wl_surface->color_surface) ++ wp_color_management_surface_v1_destroy(wsi_wl_surface->color_surface); ++ + if (wsi_wl_surface->surface) + wl_proxy_wrapper_destroy(wsi_wl_surface->surface); + +@@ -1837,6 +2200,9 @@ wsi_CreateWaylandSurfaceKHR(VkInstance _instance, + surface->display = pCreateInfo->display; + surface->surface = pCreateInfo->surface; + ++ wsi_wl_surface->instance = instance; ++ wsi_wl_surface->colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; ++ + *pSurface = VkIcdSurfaceBase_to_handle(&surface->base); + + return VK_SUCCESS; +@@ -2459,6 +2825,10 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, + image->base.row_pitches[0] * chain->extent.height); + } + ++ VkResult ret = wsi_wl_swapchain_update_colorspace(chain); ++ if (ret != VK_SUCCESS) ++ return ret; ++ + /* For EXT_swapchain_maintenance1. We might have transitioned from FIFO to MAILBOX. + * In this case we need to let the FIFO request complete, before presenting MAILBOX. */ + while (!chain->legacy_fifo_ready) { +@@ -2815,6 +3185,9 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, + wl_callback_destroy(chain->frame); + if (chain->tearing_control) + wp_tearing_control_v1_destroy(chain->tearing_control); ++ if (needs_color_surface(chain->colorspace) && wsi_wl_surface->color_surface) { ++ wsi_wl_surface_remove_color_refcount(wsi_wl_surface); ++ } + + /* Only unregister if we are the non-retired swapchain, or + * we are a retired swapchain and memory allocation failed, +@@ -2979,6 +3352,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, + WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC); + } + ++ chain->colorspace = pCreateInfo->imageColorSpace; ++ + enum wsi_wl_buffer_type buffer_type; + struct wsi_base_image_params *image_params = NULL; + struct wsi_cpu_image_params cpu_image_params; +-- +2.49.0 + diff --git a/my-ostree-os/mesa/0002-vulkan-wsi-warn-once-when-hdr-metadata-is-skipped.patch b/my-ostree-os/mesa/0002-vulkan-wsi-warn-once-when-hdr-metadata-is-skipped.patch new file mode 100644 index 0000000..0b5c0a8 --- /dev/null +++ b/my-ostree-os/mesa/0002-vulkan-wsi-warn-once-when-hdr-metadata-is-skipped.patch @@ -0,0 +1,34 @@ +From 0c1f2b90c97b46b6c0576643353f4c0a494e36a6 Mon Sep 17 00:00:00 2001 +From: Xaver Hugl +Date: Tue, 11 Mar 2025 14:11:23 +0100 +Subject: [PATCH] vulkan/wsi: warn once when HDR metadata is skipped because of + protocol errors + +Signed-off-by: Xaver Hugl +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index 68254dc8610dc..6be46f49d1492 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -1251,8 +1251,12 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + .max_fall = round(chain->color.hdr_metadata.maxFrameAverageLightLevel), + .max_cll = round(chain->color.hdr_metadata.maxContentLightLevel), + }; +- bool should_use_hdr_metadata = chain->color.has_hdr_metadata +- && is_hdr_metadata_legal(&wayland_hdr_metadata); ++ bool should_use_hdr_metadata = chain->color.has_hdr_metadata; ++ if (should_use_hdr_metadata) { ++ should_use_hdr_metadata &= is_hdr_metadata_legal(&wayland_hdr_metadata); ++ if (!should_use_hdr_metadata) ++ mesa_log_once(MESA_LOG_WARN, "Not using HDR metadata to avoid protocol errors"); ++ } + for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { + if (colorspace_mapping[i].colorspace == chain->color.colorspace) { + should_use_hdr_metadata &= colorspace_mapping[i].should_use_hdr_metadata; +-- +GitLab + diff --git a/my-ostree-os/mesa/0003-vulkan-wsi-implement-support-for-VK_EXT_hdr_metadata.patch b/my-ostree-os/mesa/0003-vulkan-wsi-implement-support-for-VK_EXT_hdr_metadata.patch new file mode 100644 index 0000000..0790b26 --- /dev/null +++ b/my-ostree-os/mesa/0003-vulkan-wsi-implement-support-for-VK_EXT_hdr_metadata.patch @@ -0,0 +1,496 @@ +From fbdd6fedb4af31db2f4dc0333751f8fd7779a841 Mon Sep 17 00:00:00 2001 +From: Xaver Hugl +Date: Tue, 5 Nov 2024 19:17:28 +0100 +Subject: [PATCH 3/4] vulkan/wsi: implement support for VK_EXT_hdr_metadata on + Wayland + +Signed-off-by: Xaver Hugl +Reviewed-by: Alyssa Rosenzweig +Reviewed-by: Sebastian Wick +Acked-by: Daniel Stone +Part-of: +--- + src/amd/vulkan/radv_physical_device.c | 1 + + src/asahi/vulkan/hk_physical_device.c | 1 + + src/freedreno/vulkan/tu_device.cc | 1 + + src/gallium/frontends/lavapipe/lvp_device.c | 1 + + src/intel/vulkan/anv_physical_device.c | 1 + + src/nouveau/vulkan/nvk_physical_device.c | 1 + + src/panfrost/vulkan/panvk_physical_device.c | 1 + + src/vulkan/wsi/wsi_common.c | 12 ++ + src/vulkan/wsi/wsi_common_private.h | 2 + + src/vulkan/wsi/wsi_common_wayland.c | 151 ++++++++++++++++---- + 10 files changed, 146 insertions(+), 26 deletions(-) + +diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c +index 0d3660e7064..4dc4f647593 100644 +--- a/src/amd/vulkan/radv_physical_device.c ++++ b/src/amd/vulkan/radv_physical_device.c +@@ -630,6 +630,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device + .EXT_global_priority = true, + .EXT_global_priority_query = true, + .EXT_graphics_pipeline_library = !pdev->use_llvm && !(instance->debug_flags & RADV_DEBUG_NO_GPL), ++ .EXT_hdr_metadata = true, + .EXT_host_query_reset = true, + .EXT_image_2d_view_of_3d = true, + .EXT_image_compression_control = true, +diff --git a/src/asahi/vulkan/hk_physical_device.c b/src/asahi/vulkan/hk_physical_device.c +index 8dcbd15c2b7..d916d749a0d 100644 +--- a/src/asahi/vulkan/hk_physical_device.c ++++ b/src/asahi/vulkan/hk_physical_device.c +@@ -153,6 +153,7 @@ hk_get_device_extensions(const struct hk_instance *instance, + .EXT_global_priority = true, + .EXT_global_priority_query = true, + .EXT_graphics_pipeline_library = true, ++ .EXT_hdr_metadata = true, + .EXT_host_query_reset = true, + .EXT_host_image_copy = true, + .EXT_image_2d_view_of_3d = true, +diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc +index 7b18dcf24f9..41d15d64733 100644 +--- a/src/freedreno/vulkan/tu_device.cc ++++ b/src/freedreno/vulkan/tu_device.cc +@@ -274,6 +274,7 @@ get_device_extensions(const struct tu_physical_device *device, + .EXT_global_priority = true, + .EXT_global_priority_query = true, + .EXT_graphics_pipeline_library = true, ++ .EXT_hdr_metadata = true, + .EXT_host_image_copy = true, + .EXT_host_query_reset = true, + .EXT_image_2d_view_of_3d = true, +diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c +index 934c501e231..260200e7d1c 100644 +--- a/src/gallium/frontends/lavapipe/lvp_device.c ++++ b/src/gallium/frontends/lavapipe/lvp_device.c +@@ -211,6 +211,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported = + .EXT_extended_dynamic_state3 = true, + .EXT_external_memory_host = true, + .EXT_graphics_pipeline_library = true, ++ .EXT_hdr_metadata = true, + .EXT_host_image_copy = true, + .EXT_host_query_reset = true, + .EXT_image_2d_view_of_3d = true, +diff --git a/src/intel/vulkan/anv_physical_device.c b/src/intel/vulkan/anv_physical_device.c +index b2eda469415..8506790cd72 100644 +--- a/src/intel/vulkan/anv_physical_device.c ++++ b/src/intel/vulkan/anv_physical_device.c +@@ -282,6 +282,7 @@ get_device_extensions(const struct anv_physical_device *device, + .EXT_global_priority_query = device->max_context_priority >= + VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR, + .EXT_graphics_pipeline_library = !debug_get_bool_option("ANV_NO_GPL", false), ++ .EXT_hdr_metadata = true, + .EXT_host_image_copy = !device->emu_astc_ldr, + .EXT_host_query_reset = true, + .EXT_image_2d_view_of_3d = true, +diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c +index 9b05c1968aa..10ab3b6e488 100644 +--- a/src/nouveau/vulkan/nvk_physical_device.c ++++ b/src/nouveau/vulkan/nvk_physical_device.c +@@ -229,6 +229,7 @@ nvk_get_device_extensions(const struct nvk_instance *instance, + .EXT_global_priority = true, + .EXT_global_priority_query = true, + .EXT_graphics_pipeline_library = true, ++ .EXT_hdr_metadata = true, + .EXT_host_query_reset = true, + .EXT_host_image_copy = info->cls_eng3d >= TURING_A, + .EXT_image_2d_view_of_3d = true, +diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c +index dc3b371c3b0..4250d66bbb9 100644 +--- a/src/panfrost/vulkan/panvk_physical_device.c ++++ b/src/panfrost/vulkan/panvk_physical_device.c +@@ -231,6 +231,7 @@ get_device_extensions(const struct panvk_physical_device *device, + .EXT_global_priority = true, + .EXT_global_priority_query = true, + .EXT_graphics_pipeline_library = true, ++ .EXT_hdr_metadata = true, + .EXT_host_query_reset = true, + .EXT_image_drm_format_modifier = true, + .EXT_image_robustness = true, +diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c +index d18ca4d9ebd..7f41e61639f 100644 +--- a/src/vulkan/wsi/wsi_common.c ++++ b/src/vulkan/wsi/wsi_common.c +@@ -2253,3 +2253,15 @@ wsi_device_supports_explicit_sync(struct wsi_device *device) + (device->timeline_semaphore_export_handle_types & + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT); + } ++ ++VKAPI_ATTR void VKAPI_CALL ++wsi_SetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, ++ const VkSwapchainKHR* pSwapchains, ++ const VkHdrMetadataEXT* pMetadata) ++{ ++ for (uint32_t i = 0; i < swapchainCount; i++) { ++ VK_FROM_HANDLE(wsi_swapchain, swapchain, pSwapchains[i]); ++ if (swapchain->set_hdr_metadata) ++ swapchain->set_hdr_metadata(swapchain, pMetadata); ++ } ++} +diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h +index 849bdc6715f..40db1a7c176 100644 +--- a/src/vulkan/wsi/wsi_common_private.h ++++ b/src/vulkan/wsi/wsi_common_private.h +@@ -223,6 +223,8 @@ struct wsi_swapchain { + const uint32_t *indices); + void (*set_present_mode)(struct wsi_swapchain *swap_chain, + VkPresentModeKHR mode); ++ void (*set_hdr_metadata)(struct wsi_swapchain *swap_chain, ++ const VkHdrMetadataEXT* pMetadata); + }; + + bool +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index d4b47c1f1b8..de12f524891 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -140,6 +140,11 @@ struct wsi_wl_display { + bool same_gpu; + + clockid_t presentation_clock_id; ++ ++ struct { ++ bool mastering_display_primaries; ++ bool extended_target_volume; ++ } color_features; + }; + + struct wsi_wayland { +@@ -191,9 +196,14 @@ struct wsi_wl_surface { + struct wp_linux_drm_syncobj_surface_v1 *wl_syncobj_surface; + + struct vk_instance *instance; +- struct wp_color_management_surface_v1 *color_surface; +- int color_surface_refcount; +- VkColorSpaceKHR colorspace; ++ ++ struct { ++ struct wp_color_management_surface_v1 *color_surface; ++ int color_surface_refcount; ++ VkColorSpaceKHR colorspace; ++ VkHdrMetadataEXT hdr_metadata; ++ bool has_hdr_metadata; ++ } color; + }; + + struct wsi_wl_swapchain { +@@ -244,7 +254,11 @@ struct wsi_wl_swapchain { + unsigned int refresh_nsec; + } present_ids; + +- VkColorSpaceKHR colorspace; ++ struct { ++ VkColorSpaceKHR colorspace; ++ VkHdrMetadataEXT hdr_metadata; ++ bool has_hdr_metadata; ++ } color; + + struct wsi_wl_image images[0]; + }; +@@ -917,58 +931,69 @@ struct Colorspace { + VkColorSpaceKHR colorspace; + enum wp_color_manager_v1_primaries primaries; + enum wp_color_manager_v1_transfer_function tf; ++ bool should_use_hdr_metadata; + }; + struct Colorspace colorspace_mapping[] = { + { + .colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, ++ .should_use_hdr_metadata = false, + }, + { + .colorspace = VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_DISPLAY_P3, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, ++ .should_use_hdr_metadata = false, + }, + { + .colorspace = VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ .should_use_hdr_metadata = true, + }, + { + .colorspace = VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_DISPLAY_P3, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ .should_use_hdr_metadata = false, + }, + { + .colorspace = VK_COLOR_SPACE_BT709_LINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ .should_use_hdr_metadata = false, + }, + { + .colorspace = VK_COLOR_SPACE_BT709_NONLINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886, ++ .should_use_hdr_metadata = false, + }, + { + .colorspace = VK_COLOR_SPACE_BT2020_LINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ .should_use_hdr_metadata = false, + }, + { + .colorspace = VK_COLOR_SPACE_HDR10_ST2084_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ, ++ .should_use_hdr_metadata = true, + }, + /* VK_COLOR_SPACE_DOLBYVISION_EXT is left out because it's deprecated */ + { + .colorspace = VK_COLOR_SPACE_HDR10_HLG_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_HLG, ++ .should_use_hdr_metadata = true, + }, + { + .colorspace = VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_ADOBE_RGB, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, ++ .should_use_hdr_metadata = false, + }, + /* VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT is left out because there's no + * exactly matching transfer function in the Wayland protocol */ +@@ -977,6 +1002,7 @@ struct Colorspace colorspace_mapping[] = { + .colorspace = VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT, + .primaries = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, + .tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_SRGB, ++ .should_use_hdr_metadata = true, + }, + /* VK_COLOR_SPACE_DISPLAY_NATIVE_AMD isn't supported */ + /* VK_COLORSPACE_SRGB_NONLINEAR_KHR is just an alias */ +@@ -1033,7 +1059,17 @@ color_management_handle_supported_features(void *data, + struct wp_color_manager_v1 *color_manager, + unsigned int feature) + { +- /* We don't use any non-default features yet. */ ++ struct wsi_wl_display *display = data; ++ switch (feature) { ++ case WP_COLOR_MANAGER_V1_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES: ++ display->color_features.mastering_display_primaries = true; ++ break; ++ case WP_COLOR_MANAGER_V1_FEATURE_EXTENDED_TARGET_VOLUME: ++ display->color_features.extended_target_volume = true; ++ break; ++ default: ++ break; ++ } + } + + static void +@@ -1111,9 +1147,9 @@ needs_color_surface(VkColorSpaceKHR colorspace) + static void + wsi_wl_surface_add_color_refcount(struct wsi_wl_surface *wsi_surface) + { +- wsi_surface->color_surface_refcount++; +- if (wsi_surface->color_surface_refcount == 1) { +- wsi_surface->color_surface = ++ wsi_surface->color.color_surface_refcount++; ++ if (wsi_surface->color.color_surface_refcount == 1) { ++ wsi_surface->color.color_surface = + wp_color_manager_v1_get_surface(wsi_surface->display->color_manager, wsi_surface->surface); + } + } +@@ -1121,13 +1157,30 @@ wsi_wl_surface_add_color_refcount(struct wsi_wl_surface *wsi_surface) + static void + wsi_wl_surface_remove_color_refcount(struct wsi_wl_surface *wsi_surface) + { +- wsi_surface->color_surface_refcount--; +- if (wsi_surface->color_surface_refcount == 0) { +- wp_color_management_surface_v1_destroy(wsi_surface->color_surface); +- wsi_surface->color_surface = NULL; ++ wsi_surface->color.color_surface_refcount--; ++ if (wsi_surface->color.color_surface_refcount == 0) { ++ wp_color_management_surface_v1_destroy(wsi_surface->color.color_surface); ++ wsi_surface->color.color_surface = NULL; + } + } + ++static bool ++compare_hdr_metadata(struct VkHdrMetadataEXT *l, struct VkHdrMetadataEXT *r) ++{ ++ return l->displayPrimaryRed.x == r->displayPrimaryRed.x ++ && l->displayPrimaryRed.y == r->displayPrimaryRed.y ++ && l->displayPrimaryGreen.x == r->displayPrimaryGreen.x ++ && l->displayPrimaryGreen.y == r->displayPrimaryGreen.y ++ && l->displayPrimaryBlue.x == r->displayPrimaryBlue.x ++ && l->displayPrimaryBlue.y == r->displayPrimaryBlue.y ++ && l->whitePoint.x == r->whitePoint.x ++ && l->whitePoint.y == r->whitePoint.y ++ && l->maxLuminance == r->maxLuminance ++ && l->minLuminance == r->minLuminance ++ && l->maxContentLightLevel == r->maxContentLightLevel ++ && l->maxFrameAverageLightLevel == r->maxFrameAverageLightLevel; ++} ++ + static VkResult + wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + { +@@ -1137,29 +1190,43 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + /* we need the color management extension for + * everything except sRGB and PASS_THROUGH */ + if (!display->color_manager) { +- if (chain->colorspace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR || +- chain->colorspace == VK_COLOR_SPACE_PASS_THROUGH_EXT) { ++ if (chain->color.colorspace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR || ++ chain->color.colorspace == VK_COLOR_SPACE_PASS_THROUGH_EXT) { + return VK_SUCCESS; + } else { + return VK_ERROR_SURFACE_LOST_KHR; + } + } + +- bool new_color_surface = !surface->color_surface; +- bool needs_color_surface_new = needs_color_surface(chain->colorspace); +- bool needs_color_surface_old = needs_color_surface(surface->colorspace); ++ bool new_color_surface = !surface->color.color_surface; ++ bool needs_color_surface_new = needs_color_surface(chain->color.colorspace); ++ bool needs_color_surface_old = needs_color_surface(surface->color.colorspace); + if ((new_color_surface || !needs_color_surface_old) && needs_color_surface_new) { + wsi_wl_surface_add_color_refcount(surface); + } else if (needs_color_surface_old && !needs_color_surface_new) { + wsi_wl_surface_remove_color_refcount(surface); + } + +- if (!new_color_surface && surface->colorspace == chain->colorspace) ++ bool should_use_hdr_metadata = chain->color.has_hdr_metadata; ++ for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { ++ if (colorspace_mapping[i].colorspace == chain->color.colorspace) { ++ should_use_hdr_metadata &= colorspace_mapping[i].should_use_hdr_metadata; ++ break; ++ } ++ } ++ ++ if (!new_color_surface && ++ surface->color.colorspace == chain->color.colorspace && ++ surface->color.has_hdr_metadata == should_use_hdr_metadata && ++ compare_hdr_metadata(&surface->color.hdr_metadata, &chain->color.hdr_metadata)) { + return VK_SUCCESS; ++ } + + /* failure is fatal, so this potentially being wrong + in that case doesn't matter */ +- surface->colorspace = chain->colorspace; ++ surface->color.colorspace = chain->color.colorspace; ++ surface->color.hdr_metadata = chain->color.hdr_metadata; ++ surface->color.has_hdr_metadata = should_use_hdr_metadata; + if (!needs_color_surface_new) + return VK_SUCCESS; + +@@ -1172,7 +1239,7 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + unsigned int primaries = 0; + unsigned int tf = 0; + for (int i = 0; i < ARRAY_SIZE(colorspace_mapping); i++) { +- if (colorspace_mapping[i].colorspace == chain->colorspace) { ++ if (colorspace_mapping[i].colorspace == chain->color.colorspace) { + primaries = colorspace_mapping[i].primaries; + tf = colorspace_mapping[i].tf; + } +@@ -1183,6 +1250,29 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + + wp_image_description_creator_params_v1_set_primaries_named(creator, primaries); + wp_image_description_creator_params_v1_set_tf_named(creator, tf); ++ if (should_use_hdr_metadata && display->color_features.extended_target_volume) { ++ uint32_t max_cll = round(chain->color.hdr_metadata.maxContentLightLevel); ++ uint32_t max_fall = round(chain->color.hdr_metadata.maxFrameAverageLightLevel); ++ wp_image_description_creator_params_v1_set_max_cll(creator, max_cll); ++ wp_image_description_creator_params_v1_set_max_fall(creator, max_fall); ++ if (display->color_features.mastering_display_primaries) { ++ uint32_t red_x = round(chain->color.hdr_metadata.displayPrimaryRed.x * 1000000); ++ uint32_t red_y = round(chain->color.hdr_metadata.displayPrimaryRed.y * 1000000); ++ uint32_t green_x = round(chain->color.hdr_metadata.displayPrimaryGreen.x * 1000000); ++ uint32_t green_y = round(chain->color.hdr_metadata.displayPrimaryGreen.y * 1000000); ++ uint32_t blue_x = round(chain->color.hdr_metadata.displayPrimaryBlue.x * 1000000); ++ uint32_t blue_y = round(chain->color.hdr_metadata.displayPrimaryBlue.y * 1000000); ++ uint32_t white_x = round(chain->color.hdr_metadata.whitePoint.x * 1000000); ++ uint32_t white_y = round(chain->color.hdr_metadata.whitePoint.y * 1000000); ++ wp_image_description_creator_params_v1_set_mastering_display_primaries(creator, red_x, red_y, ++ green_x, green_y, ++ blue_x, blue_y, ++ white_x, white_y); ++ uint32_t min_lum = round(chain->color.hdr_metadata.minLuminance * 10000); ++ uint32_t max_lum = round(chain->color.hdr_metadata.maxLuminance); ++ wp_image_description_creator_params_v1_set_mastering_luminance(creator, min_lum, max_lum); ++ } ++ } + + wl_proxy_set_queue((struct wl_proxy *) creator, display->queue); + +@@ -1202,7 +1292,7 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + if (status == failed) + return VK_ERROR_SURFACE_LOST_KHR; + +- wp_color_management_surface_v1_set_image_description(chain->wsi_wl_surface->color_surface, ++ wp_color_management_surface_v1_set_image_description(chain->wsi_wl_surface->color.color_surface, + image_desc, + WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL); + wp_image_description_v1_destroy(image_desc); +@@ -1210,6 +1300,14 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + return VK_SUCCESS; + } + ++static void ++wsi_wl_swapchain_set_hdr_metadata(struct wsi_swapchain *wsi_chain, ++ const VkHdrMetadataEXT* pMetadata) ++{ ++ struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; ++ chain->color.hdr_metadata = *pMetadata; ++ chain->color.has_hdr_metadata = true; ++} + + static void + presentation_handle_clock_id(void* data, struct wp_presentation *wp_presentation, uint32_t clk_id) +@@ -1875,8 +1973,8 @@ wsi_wl_surface_destroy(VkIcdSurfaceBase *icd_surface, VkInstance _instance, + dmabuf_feedback_fini(&wsi_wl_surface->pending_dmabuf_feedback); + } + +- if (wsi_wl_surface->color_surface) +- wp_color_management_surface_v1_destroy(wsi_wl_surface->color_surface); ++ if (wsi_wl_surface->color.color_surface) ++ wp_color_management_surface_v1_destroy(wsi_wl_surface->color.color_surface); + + if (wsi_wl_surface->surface) + wl_proxy_wrapper_destroy(wsi_wl_surface->surface); +@@ -2201,7 +2299,7 @@ wsi_CreateWaylandSurfaceKHR(VkInstance _instance, + surface->surface = pCreateInfo->surface; + + wsi_wl_surface->instance = instance; +- wsi_wl_surface->colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; ++ wsi_wl_surface->color.colorspace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; + + *pSurface = VkIcdSurfaceBase_to_handle(&surface->base); + +@@ -3185,7 +3283,7 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, + wl_callback_destroy(chain->frame); + if (chain->tearing_control) + wp_tearing_control_v1_destroy(chain->tearing_control); +- if (needs_color_surface(chain->colorspace) && wsi_wl_surface->color_surface) { ++ if (needs_color_surface(chain->color.colorspace) && wsi_wl_surface->color.color_surface) { + wsi_wl_surface_remove_color_refcount(wsi_wl_surface); + } + +@@ -3352,7 +3450,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, + WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC); + } + +- chain->colorspace = pCreateInfo->imageColorSpace; ++ chain->color.colorspace = pCreateInfo->imageColorSpace; + + enum wsi_wl_buffer_type buffer_type; + struct wsi_base_image_params *image_params = NULL; +@@ -3426,6 +3524,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, + chain->base.wait_for_present = wsi_wl_swapchain_wait_for_present; + chain->base.present_mode = present_mode; + chain->base.image_count = num_images; ++ chain->base.set_hdr_metadata = wsi_wl_swapchain_set_hdr_metadata; + chain->extent = pCreateInfo->imageExtent; + chain->vk_format = pCreateInfo->imageFormat; + chain->buffer_type = buffer_type; +-- +2.49.0 + diff --git a/my-ostree-os/mesa/0004-vulkan-wsi-handle-the-compositor-not-supporting-exte.patch b/my-ostree-os/mesa/0004-vulkan-wsi-handle-the-compositor-not-supporting-exte.patch new file mode 100644 index 0000000..f4ee0ea --- /dev/null +++ b/my-ostree-os/mesa/0004-vulkan-wsi-handle-the-compositor-not-supporting-exte.patch @@ -0,0 +1,53 @@ +From 692057de05dcf90ea9ac180a23d4996ebc1e7206 Mon Sep 17 00:00:00 2001 +From: Xaver Hugl +Date: Thu, 7 Nov 2024 13:58:49 +0100 +Subject: [PATCH 4/4] vulkan/wsi: handle the compositor not supporting extended + target volume better + +Instead of unconditionally ignoring the HDR metadata, just attempt to create the image +description, and if it fails, fall back to creating it without HDR metadata. + +Signed-off-by: Xaver Hugl +Reviewed-by: Sebastian Wick +Acked-by: Daniel Stone +Part-of: +--- + src/vulkan/wsi/wsi_common_wayland.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c +index de12f524891..4c364401226 100644 +--- a/src/vulkan/wsi/wsi_common_wayland.c ++++ b/src/vulkan/wsi/wsi_common_wayland.c +@@ -1250,7 +1250,7 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + + wp_image_description_creator_params_v1_set_primaries_named(creator, primaries); + wp_image_description_creator_params_v1_set_tf_named(creator, tf); +- if (should_use_hdr_metadata && display->color_features.extended_target_volume) { ++ if (should_use_hdr_metadata) { + uint32_t max_cll = round(chain->color.hdr_metadata.maxContentLightLevel); + uint32_t max_fall = round(chain->color.hdr_metadata.maxFrameAverageLightLevel); + wp_image_description_creator_params_v1_set_max_cll(creator, max_cll); +@@ -1289,8 +1289,17 @@ wsi_wl_swapchain_update_colorspace(struct wsi_wl_swapchain *chain) + if (ret < 0) + return VK_ERROR_OUT_OF_DATE_KHR; + } +- if (status == failed) +- return VK_ERROR_SURFACE_LOST_KHR; ++ if (status == failed) { ++ wp_image_description_v1_destroy(image_desc); ++ if (!display->color_features.extended_target_volume && should_use_hdr_metadata) { ++ /* VK_EXT_hdr_metadata doesn't specify if or how the metadata is used, ++ * so it's fine to try again without it. */ ++ chain->color.has_hdr_metadata = false; ++ return wsi_wl_swapchain_update_colorspace(chain); ++ } else { ++ return VK_ERROR_SURFACE_LOST_KHR; ++ } ++ } + + wp_color_management_surface_v1_set_image_description(chain->wsi_wl_surface->color.color_surface, + image_desc, +-- +2.49.0 + diff --git a/my-ostree-os/mesa/Mesa-MLAA-License-Clarification-Email.txt b/my-ostree-os/mesa/Mesa-MLAA-License-Clarification-Email.txt new file mode 100644 index 0000000..30bdf2e --- /dev/null +++ b/my-ostree-os/mesa/Mesa-MLAA-License-Clarification-Email.txt @@ -0,0 +1,117 @@ + +Subject: RE: Question about Mesa MLAA license +From: Jorge Jimenez +Date: 01/08/2013 12:50 PM +To: Tom Callaway +CC: "jorge@iryoku.com" + +Yes to both questions. + +Thanks, +Jorge + +From: Tom Callaway +Sent: January 8, 2013 6:49 PM +To: Jorge Jimenez +CC: jorge@iryoku.com +Subject: Re: Question about Mesa MLAA license + +On 01/08/2013 12:39 PM, Jorge Jimenez wrote: +> Hi Tom, +> +> What we meant with that is that we made an exception for clause 2. +> Instead of clause 2, in the case of the Mesa project, you have to name +> the technique Jimenez's MLAA in the config options of Mesa. We did that +> just to allow them to solve license issues. This exception should be for +> the Mesa project, and any project using Mesa, like Fedora. +> +> We want to widespread usage of our MLAA, so we want to avoid any kind of +> license complications. Hope current one is good for Fedora, if not +> please tell, and we'll see what we can do! + +Okay, a few more questions: + +* If Fedora decides to simply reproduce the quoted statement: +"Uses Jimenez's MLAA. Copyright (C) 2010 by Jorge Jimenez, Belen Masia, +Jose I. Echevarria, Fernando Navarro and Diego Gutierrez." + +Specifically, if this is done as part of documentation included with +Mesa, is that sufficient to meet clause 2 even if the Mesa config option +is not set as described in your exception? + +* Currently, the Mesa config option for MLAA says: "Morphological +anti-aliasing based on Jimenez\' MLAA. 0 to disable, 8 for default +quality". Is this in compliance with your exception? + +Thanks again, + +~tom + +== +Fedora Project + +Subject: RE: Question about Mesa MLAA license +From: Jorge Jimenez +Date: 01/08/2013 12:39 PM +To: "jorge@iryoku.com" , Tom Callaway + +Hi Tom, + +What we meant with that is that we made an exception for clause 2. +Instead of clause 2, in the case of the Mesa project, you have to name +the technique Jimenez's MLAA in the config options of Mesa. We did that +just to allow them to solve license issues. This exception should be for +the Mesa project, and any project using Mesa, like Fedora. + +We want to widespread usage of our MLAA, so we want to avoid any kind of +license complications. Hope current one is good for Fedora, if not +please tell, and we'll see what we can do! + +Cheers, +Jorge + +From: Tom Callaway +Sent: January 8, 2013 6:30 PM +To: jorge@iryoku.com +Subject: Question about Mesa MLAA license + +Jorge, + +Thanks for all of your fantastic graphics work! I have been auditing +Fedora (a popular distribution of Linux) for license compliance and I +came across your MLAA code in Mesa. + +The license says: + + * 2. Redistributions in binary form must reproduce the following +statement: + * + * "Uses Jimenez's MLAA. Copyright (C) 2010 by Jorge Jimenez, Belen Masia, + * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez." + * + * Only for use in the Mesa project, this point 2 is filled by naming the + * technique Jimenez's MLAA in the Mesa config options. + +That wording is unclear. When you say "Only for use in the Mesa +project...", it seems like you could either be saying: + +- This code may only be used as part of Mesa. + +OR + +- In Mesa, you can comply with clause 2 by simply selecting "Jimenez's +MLAA" in the Mesa config options. + +***** + +If the first item is true, then we may have to remove the MLAA code from +Fedora's copy of Mesa. However, looking at the license on your SMAA +code, I do not believe it to be the case. Please let me know either way! + +Thanks in advance, + +Tom Callaway +Fedora Legal + +== +Fedora Project diff --git a/my-ostree-os/mesa/e4eb5e80c316c0af3fff310ca89e1175d81556c1.patch b/my-ostree-os/mesa/e4eb5e80c316c0af3fff310ca89e1175d81556c1.patch new file mode 100644 index 0000000..5cf4073 --- /dev/null +++ b/my-ostree-os/mesa/e4eb5e80c316c0af3fff310ca89e1175d81556c1.patch @@ -0,0 +1,144 @@ +From e4eb5e80c316c0af3fff310ca89e1175d81556c1 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Thu, 27 Feb 2025 15:44:27 +0100 +Subject: [PATCH] clover: Don't include libclc headers + +Per https://github.com/llvm/llvm-project/issues/119967 these +headers are internal implementation details of libclc and were +never supposed to be installed. They are not available anymore +since LLVM 20. Instead opencl-c.h should be used. + +There already ise a code path for including opencl-c.h, so always +use it. + +This didn't work for me out of the box, because the build system +currently hardcodes the clang resource directory, which is incorrect +for Fedora at least. Fix this by using GetResourcePath + +CLANG_RESOURCE_DIR provided by clang instead. This is basically +the same as what is done in clc_helper.c + +I've still retained the old behavior as a fallback just in case +(e.g. if clang is linked statically?) + +Reviewed-by: Karol Herbst +Part-of: +--- + .../frontends/clover/llvm/invocation.cpp | 53 +++++++++++++------ + src/gallium/frontends/clover/meson.build | 5 +- + 2 files changed, 39 insertions(+), 19 deletions(-) + +diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp +index 3cbb05baecf67..ca030b404d791 100644 +--- a/src/gallium/frontends/clover/llvm/invocation.cpp ++++ b/src/gallium/frontends/clover/llvm/invocation.cpp +@@ -24,6 +24,8 @@ + // OTHER DEALINGS IN THE SOFTWARE. + // + ++#include ++ + #include + #include + #include +@@ -39,6 +41,8 @@ + #include + #include + #include ++#include ++#include + + #if LLVM_VERSION_MAJOR >= 20 + #include +@@ -323,6 +327,30 @@ namespace { + return c; + } + ++ std::string getResourceDirectory() { ++ Dl_info info; ++ if (dladdr((void *)clang::CompilerInvocation::CreateFromArgs, &info) == 0) { ++ return FALLBACK_CLANG_RESOURCE_DIR; ++ } ++ ++ char *libclang_path = realpath(info.dli_fname, NULL); ++ if (libclang_path == nullptr) { ++ return FALLBACK_CLANG_RESOURCE_DIR; ++ } ++ ++ // GetResourcePath is a way to retrieve the actual libclang resource dir based on a given ++ // binary or library. ++ std::string clang_resource_dir = ++#if LLVM_VERSION_MAJOR >= 20 ++ clang::driver::Driver::GetResourcesPath(std::string(libclang_path)); ++#else ++ clang::driver::Driver::GetResourcesPath(std::string(libclang_path), CLANG_RESOURCE_DIR); ++#endif ++ free(libclang_path); ++ ++ return clang_resource_dir; ++ } ++ + std::unique_ptr + compile(LLVMContext &ctx, clang::CompilerInstance &c, + const std::string &name, const std::string &source, +@@ -331,25 +359,18 @@ namespace { + c.getFrontendOpts().ProgramAction = clang::frontend::EmitLLVMOnly; + c.getHeaderSearchOpts().UseBuiltinIncludes = true; + c.getHeaderSearchOpts().UseStandardSystemIncludes = true; +- c.getHeaderSearchOpts().ResourceDir = CLANG_RESOURCE_DIR; + +- if (use_libclc) { +- // Add libclc generic search path +- c.getHeaderSearchOpts().AddPath(LIBCLC_INCLUDEDIR, +- clang::frontend::Angled, +- false, false); ++ std::string clang_resource_dir = getResourceDirectory(); ++ c.getHeaderSearchOpts().ResourceDir = clang_resource_dir; + +- // Add libclc include +- c.getPreprocessorOpts().Includes.push_back("clc/clc.h"); +- } else { +- // Add opencl-c generic search path +- c.getHeaderSearchOpts().AddPath(CLANG_RESOURCE_DIR, +- clang::frontend::Angled, +- false, false); ++ // Add opencl-c generic search path ++ std::string clang_include_path = clang_resource_dir + "/include"; ++ c.getHeaderSearchOpts().AddPath(clang_include_path, ++ clang::frontend::Angled, ++ false, false); + +- // Add opencl include +- c.getPreprocessorOpts().Includes.push_back("opencl-c.h"); +- } ++ // Add opencl include ++ c.getPreprocessorOpts().Includes.push_back("opencl-c.h"); + + // Add definition for the OpenCL version + const auto dev_version = dev.device_version(); +diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build +index e569b86a1bea7..56a9894f0dbb1 100644 +--- a/src/gallium/frontends/clover/meson.build ++++ b/src/gallium/frontends/clover/meson.build +@@ -10,7 +10,6 @@ clover_opencl_cpp_args = [ + '-DCL_USE_DEPRECATED_OPENCL_2_0_APIS', + '-DCL_USE_DEPRECATED_OPENCL_2_1_APIS', + '-DCL_USE_DEPRECATED_OPENCL_2_2_APIS', +- '-DLIBCLC_INCLUDEDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'includedir')), + '-DLIBCLC_LIBEXECDIR="@0@/"'.format(dep_clc.get_variable(pkgconfig : 'libexecdir')) + ] + clover_incs = [inc_include, inc_src, inc_gallium, inc_gallium_aux] +@@ -43,9 +42,9 @@ libclllvm = static_library( + cpp_args : [ + clover_cpp_args, + clover_opencl_cpp_args, +- '-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths( ++ '-DFALLBACK_CLANG_RESOURCE_DIR="@0@"'.format(join_paths( + dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang', +- dep_llvm.version(), 'include', ++ dep_llvm.version() + )), + ], + gnu_symbol_visibility : 'hidden', +-- +GitLab + diff --git a/my-ostree-os/mesa/gnome-shell-glthread-disable.patch b/my-ostree-os/mesa/gnome-shell-glthread-disable.patch new file mode 100644 index 0000000..b2caeb8 --- /dev/null +++ b/my-ostree-os/mesa/gnome-shell-glthread-disable.patch @@ -0,0 +1,11 @@ +diff -up mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf.dma mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf +--- mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf.dma 2022-11-25 10:32:32.175879868 +1000 ++++ mesa-22.3.0-rc4/src/util/00-mesa-defaults.conf 2022-11-25 10:32:43.743067470 +1000 +@@ -653,6 +653,7 @@ TODO: document the other workarounds. + + + +