public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/firefox] f45: Backported fix for HDR crash when HLG transform is missing (and it's always missing!)
@ 2026-08-21  8:01 Martin Stransky
  0 siblings, 0 replies; only message in thread
From: Martin Stransky @ 2026-08-21  8:01 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/firefox
Branch : f45
Commit : 38e2082ab3a1e1600be49511643c27fe4b9711c0
Author : Martin Stransky <stransky@redhat.com>
Date   : 2026-08-21T10:00:33+02:00
Stats  : +86/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/firefox/c/38e2082ab3a1e1600be49511643c27fe4b9711c0?branch=f45

Log:
Backported fix for HDR crash when HLG transform is missing (and it's always missing!)

---
diff --git a/D317117.1787384850.diff b/D317117.1787384850.diff
new file mode 100644
index 0000000..9871913
--- /dev/null
+++ b/D317117.1787384850.diff
@@ -0,0 +1,79 @@
+diff -up firefox-154.0/widget/gtk/nsWaylandDisplay.cpp.D317117 firefox-154.0/widget/gtk/nsWaylandDisplay.cpp
+--- firefox-154.0/widget/gtk/nsWaylandDisplay.cpp.D317117	2026-08-12 23:13:46.000000000 +0200
++++ firefox-154.0/widget/gtk/nsWaylandDisplay.cpp	2026-08-21 09:51:45.131779412 +0200
+@@ -1347,4 +1347,13 @@ void nsWaylandDisplay::Init() {
+   }
+ }
+ 
++bool nsWaylandDisplay::IsTFSupported(int aTF) {
++  if (aTF < sColorTransfersNum) {
++    return mSupportedTransfer[aTF] == aTF;
++  } else {
++    NS_WARNING("Unknow color transfer function!");
++    return false;
++  }
++}
++
+ }  // namespace mozilla::widget
+diff -up firefox-154.0/widget/gtk/nsWaylandDisplay.h.D317117 firefox-154.0/widget/gtk/nsWaylandDisplay.h
+--- firefox-154.0/widget/gtk/nsWaylandDisplay.h.D317117	2026-08-12 23:13:46.000000000 +0200
++++ firefox-154.0/widget/gtk/nsWaylandDisplay.h	2026-08-21 09:51:45.131642320 +0200
+@@ -197,6 +197,8 @@ class nsWaylandDisplay {
+   MonitorConfig* GetMonitorConfig(int x, int y);
+   bool RemoveMonitorConfig(int aId);
+ 
++  bool IsTFSupported(int aTF);
++
+   ~nsWaylandDisplay();
+ 
+  private:
+diff -up firefox-154.0/widget/gtk/WaylandSurface.cpp.D317117 firefox-154.0/widget/gtk/WaylandSurface.cpp
+--- firefox-154.0/widget/gtk/WaylandSurface.cpp.D317117	2026-08-12 23:13:47.000000000 +0200
++++ firefox-154.0/widget/gtk/WaylandSurface.cpp	2026-08-21 09:58:48.531193706 +0200
+@@ -1545,28 +1545,36 @@ bool WaylandSurface::EnableColorManageme
+           params, WP_COLOR_MANAGER_V1_PRIMARIES_SRGB);
+       break;
+   }
++  uint32_t requiredTF = 0;
+   switch (aTransferFunction) {
+     case gfx::TransferFunction::PQ:
+-      wp_image_description_creator_params_v1_set_tf_named(
+-          params, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ);
++      requiredTF = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ;
+       break;
+     case gfx::TransferFunction::HLG:
+-      wp_image_description_creator_params_v1_set_tf_named(
+-          params, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_HLG);
++      requiredTF = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_HLG;
+       break;
+     case gfx::TransferFunction::BT709:
+-      wp_image_description_creator_params_v1_set_tf_named(
+-          params, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886);
++      requiredTF = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886;
+       break;
+     case gfx::TransferFunction::SRGB:
+-      wp_image_description_creator_params_v1_set_tf_named(
+-          params, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB);
++      requiredTF = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB;
+       break;
+     case gfx::TransferFunction::LINEAR:
+-      wp_image_description_creator_params_v1_set_tf_named(
+-          params, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR);
++      requiredTF = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR;
+       break;
+   }
++
++  if (requiredTF == 0 || !WaylandDisplayGet()->IsTFSupported(requiredTF)) {
++    LOGWAYLAND("Transfer function %u isn't supported.", requiredTF);
++
++    wp_image_description_creator_params_v1_destroy(params);
++    mColorSurface = nullptr;
++
++    return false;
++  }
++
++  wp_image_description_creator_params_v1_set_tf_named(params, requiredTF);
++
+   mImageDescription = wp_image_description_creator_params_v1_create(params);
+   // wp_image_description_creator_params_v1_create() consumes params
+   params = nullptr;

diff --git a/firefox.spec b/firefox.spec
index d94031d..8fefc03 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -186,7 +186,7 @@ ExcludeArch: i686
 Summary:        Mozilla Firefox Web browser
 Name:           firefox
 Version:        154.0
-Release:        3%{?pre_tag}%{?dist}
+Release:        4%{?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+
@@ -255,6 +255,7 @@ Patch242:        0026-Add-KDE-integration-to-Firefox.patch
 # Upstream patches
 Patch400:        mozilla-1196777.patch
 Patch401:        mozilla-1667096.patch
+Patch402:        D317117.1787384850.diff
 
 # https://phabricator.services.mozilla.com/D312871
 # Drop with Firefox 156
@@ -542,6 +543,7 @@ cat %{SOURCE49} | sed -e "s|LIBCLANG_RT_PLACEHOLDER|`pwd`/wasi-sdk-30/build/sysr
 
 %patch -P400 -p1 -b .1196777
 %patch -P401 -p1 -b .1667096
+%patch -P402 -p1 -b .D317117
 
 %patch -P410 -p1 -b .libwebrtc-video-capture-implement-buffer-stride-support-for-pipewire
 
@@ -1211,6 +1213,10 @@ fi
 #---------------------------------------------------------------------
 
 %changelog
+* Fri Aug 21 2026 Martin Stransky <stransky@redhat.com> - 154.0-4
+- Backported fix for HDR crash when HLG transform is missing
+  (and it's always missing!).
+
 * Tue Aug 18 2026 Jan Grulich <jgrulich@redhat.com> - 154.0-3
 - WebRTC backport: video_capture - implement buffer stride support for PipeWire
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-21  8:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21  8:01 [rpms/firefox] f45: Backported fix for HDR crash when HLG transform is missing (and it's always missing!) Martin Stransky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox