gentoo-ebuilds/net-misc/sunshine/files/sunshine-2025.122.141614-nvcodec.patch
James Le Cuirot 05a3d368c5
net-misc/sunshine: Version bump to 2025.122.141614 and refresh 9999
Sorry this took so long, and thank you to the users who contributed fixes. This
has always been a tricky package, but hopefully we won't have to go through this
amount of change again.

Unfortunately, Boost 1.87 is still required for now. I tried to port it to 1.88,
but Sunshine uses parts of boost::process that just aren't there anymore. I'll
send what I have so far upstream shortly.

Bug: https://bugs.gentoo.org/955560
Bug: https://bugs.gentoo.org/956631
Closes: https://bugs.gentoo.org/947046
Closes: https://bugs.gentoo.org/951973
Closes: https://bugs.gentoo.org/956006
Closes: https://github.com/gentoo/gentoo/pull/42477
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2025-06-17 23:47:43 +01:00

44 lines
2 KiB
Diff

From bc4e3f63d7c9d5790b1849d807d30bd9f2133040 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sun, 18 Feb 2024 10:25:25 +0000
Subject: [PATCH] Broaden the accepted versions of nvenc
--- a/src/nvenc/nvenc_base.cpp
+++ b/src/nvenc/nvenc_base.cpp
@@ -17,7 +17,7 @@
// - NV_ENC_*_VER definitions where the value inside NVENCAPI_STRUCT_VERSION() was increased
// - Incompatible struct changes in nvEncodeAPI.h (fields removed, semantics changed, etc.)
// - Test both old and new drivers with all supported codecs
-#if NVENCAPI_VERSION != MAKE_NVENC_VER(12U, 0U)
+#if NVENCAPI_MAJOR_VERSION < 12 || NVENCAPI_MAJOR_VERSION > 13
#error Check and update NVENC code for backwards compatibility!
#endif
@@ -322,7 +322,11 @@ namespace nvenc {
auto &format_config = enc_config.encodeCodecConfig.hevcConfig;
set_h264_hevc_common_format_config(format_config);
if (buffer_is_10bit()) {
+#if NVENCAPI_MAJOR_VERSION > 12 || (NVENCAPI_MAJOR_VERSION == 12 && NVENCAPI_MINOR_VERSION >= 2)
+ format_config.inputBitDepth = format_config.outputBitDepth = NV_ENC_BIT_DEPTH_10;
+#else
format_config.pixelBitDepthMinus8 = 2;
+#endif
}
set_ref_frames(format_config.maxNumRefFramesInDPB, format_config.numRefL0, 5);
set_minqp_if_enabled(config.min_qp_hevc);
@@ -355,8 +359,12 @@ namespace nvenc {
}
format_config.enableBitstreamPadding = config.insert_filler_data;
if (buffer_is_10bit()) {
+#if NVENCAPI_MAJOR_VERSION > 12 || (NVENCAPI_MAJOR_VERSION == 12 && NVENCAPI_MINOR_VERSION >= 2)
+ format_config.inputBitDepth = format_config.outputBitDepth = NV_ENC_BIT_DEPTH_10;
+#else
format_config.inputPixelBitDepthMinus8 = 2;
format_config.pixelBitDepthMinus8 = 2;
+#endif
}
format_config.colorPrimaries = colorspace.primaries;
format_config.transferCharacteristics = colorspace.tranfer_function;
--
2.49.0