commit:     bd696ba108f04a0307927a6cac36ab0de1c12d37
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 17 18:38:15 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 17 18:38:36 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd696ba1

kde-plasma/kwin: backport fix for LTO

Bug: https://bugs.kde.org/show_bug.cgi?id=499789
Signed-off-by: Sam James <sam <AT> gentoo.org>

 kde-plasma/kwin/files/kwin-6.3.0-lto.patch         | 76 ++++++++++++++++++++++
 .../{kwin-6.3.0-r1.ebuild => kwin-6.3.0-r2.ebuild} |  5 +-
 2 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/kde-plasma/kwin/files/kwin-6.3.0-lto.patch 
b/kde-plasma/kwin/files/kwin-6.3.0-lto.patch
new file mode 100644
index 000000000000..f73586869130
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-6.3.0-lto.patch
@@ -0,0 +1,76 @@
+https://bugs.kde.org/show_bug.cgi?id=499789
+https://invent.kde.org/plasma/kwin/-/commit/196c95d8bbab6519d0cc742ae3b595081051c08e
+
+From 196c95d8bbab6519d0cc742ae3b595081051c08e Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <[email protected]>
+Date: Sun, 16 Feb 2025 23:53:40 +0200
+Subject: [PATCH] core: Fix initialization of IccProfile::s_connectionSpace
+
+Colorimetry constants can be initialized after IccProfile::s_connectionSpace
+when LTO is enabled. It's okay with the C++ standard.
+
+As a way around it, this change moves the CIEXYZD50 constant to the
+IccProfile where it's actually needed.
+
+We need to reconsider how the constants are defined, e.g. have static
+getters or use constexpr. But as a short term solution, this should be
+fine.
+
+BUG: 499789
+
+Co-authored-by: Xaver Hugl <[email protected]>
+(cherry picked from commit 6d6667fc2a3f0a5e51676be267a5a8e1ce3c1337)
+--- a/src/core/colorspace.cpp
++++ b/src/core/colorspace.cpp
+@@ -400,12 +400,6 @@ static const Colorimetry CIEXYZ = Colorimetry{
+     XYZ{0.0, 0.0, 1.0},
+     xy{1.0 / 3.0, 1.0 / 3.0}.toXYZ(),
+ };
+-static const Colorimetry CIEXYZD50 = Colorimetry{
+-    XYZ{1.0, 0.0, 0.0},
+-    XYZ{0.0, 1.0, 0.0},
+-    XYZ{0.0, 0.0, 1.0},
+-    XYZ(0.9642, 1.0, 0.8249),
+-};
+ static const Colorimetry DCIP3 = Colorimetry{
+     xy{0.680, 0.320},
+     xy{0.265, 0.690},
+@@ -442,8 +436,6 @@ const Colorimetry &Colorimetry::fromName(NamedColorimetry 
name)
+         return BT2020;
+     case NamedColorimetry::CIEXYZ:
+         return CIEXYZ;
+-    case NamedColorimetry::CIEXYZD50:
+-        return CIEXYZD50;
+     case NamedColorimetry::DCIP3:
+         return DCIP3;
+     case NamedColorimetry::DisplayP3:
+--- a/src/core/colorspace.h
++++ b/src/core/colorspace.h
+@@ -38,7 +38,6 @@ enum class NamedColorimetry {
+     GenericFilm,
+     BT2020,
+     CIEXYZ,
+-    CIEXYZD50,
+     DCIP3,
+     DisplayP3,
+     AdobeRGB
+--- a/src/core/iccprofile.cpp
++++ b/src/core/iccprofile.cpp
+@@ -18,7 +18,14 @@
+ namespace KWin
+ {
+ 
+-const ColorDescription IccProfile::s_connectionSpace = 
ColorDescription(Colorimetry::fromName(NamedColorimetry::CIEXYZD50), 
TransferFunction(TransferFunction::linear, 0, 1), 1, 0, 1, 1);
++static const Colorimetry CIEXYZD50 = Colorimetry{
++    XYZ{1.0, 0.0, 0.0},
++    XYZ{0.0, 1.0, 0.0},
++    XYZ{0.0, 0.0, 1.0},
++    XYZ(0.9642, 1.0, 0.8249),
++};
++
++const ColorDescription IccProfile::s_connectionSpace = 
ColorDescription(CIEXYZD50, TransferFunction(TransferFunction::linear, 0, 1), 
1, 0, 1, 1);
+ 
+ IccProfile::IccProfile(cmsHPROFILE handle, const Colorimetry &colorimetry, 
std::optional<ColorPipeline> &&bToA0Tag, std::optional<ColorPipeline> 
&&bToA1Tag, const std::shared_ptr<ColorTransformation> &inverseEOTF, const 
std::shared_ptr<ColorTransformation> &vcgt, std::optional<double> 
minBrightness, std::optional<double> maxBrightness)
+     : m_handle(handle)
+-- 
+GitLab

diff --git a/kde-plasma/kwin/kwin-6.3.0-r1.ebuild 
b/kde-plasma/kwin/kwin-6.3.0-r2.ebuild
similarity index 98%
rename from kde-plasma/kwin/kwin-6.3.0-r1.ebuild
rename to kde-plasma/kwin/kwin-6.3.0-r2.ebuild
index d996b2c9ff3f..84c11f09990f 100644
--- a/kde-plasma/kwin/kwin-6.3.0-r1.ebuild
+++ b/kde-plasma/kwin/kwin-6.3.0-r2.ebuild
@@ -114,7 +114,10 @@ BDEPEND="
 # -m 0755 to avoid suid with USE="-filecaps"
 FILECAPS=( -m 0755 cap_sys_nice=ep usr/bin/kwin_wayland )
 
-PATCHES=( "${FILESDIR}/${P}-crashfix.patch" )
+PATCHES=(
+       "${FILESDIR}/${P}-crashfix.patch"
+       "${FILESDIR}/${P}-lto.patch"
+)
 
 src_prepare() {
        ecm_src_prepare

Reply via email to