From cce0cd950c3bce0d68033e57b6c22adb2d8c461b Mon Sep 17 00:00:00 2001 From: nmzik Date: Thu, 24 Sep 2026 18:10:19 +0400 Subject: [PATCH] videoout: add RGB10A2 PQ buffer support Co-authored-by: Mac --- src/graphics/host_gpu/renderer/image/imageInfo.h | 6 +++++- src/graphics/presentation/videoOut.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/graphics/host_gpu/renderer/image/imageInfo.h b/src/graphics/host_gpu/renderer/image/imageInfo.h index b7886acda..fd1cfad8e 100644 --- a/src/graphics/host_gpu/renderer/image/imageInfo.h +++ b/src/graphics/host_gpu/renderer/image/imageInfo.h @@ -329,7 +329,9 @@ struct VideoOutFormatPolicy { VideoOutPixelFormatInfo info; }; -inline constexpr std::array VIDEO_OUT_FORMAT_POLICIES {{ +inline constexpr uint64_t VIDEO_OUT_PIXEL_FORMAT_R10_G10_B10_A2_BT2100_PQ = 0x8100070422000000ull; + +inline constexpr std::array VIDEO_OUT_FORMAT_POLICIES {{ {0x8000000022000000ull, {vk::Format::eR8G8B8A8Srgb, Prospero::BufferFormat::k8_8_8_8Srgb, 4, false}}, {0x8000000000000000ull, @@ -338,6 +340,8 @@ inline constexpr std::array VIDEO_OUT_FORMAT_POLICIES { {vk::Format::eA2B10G10R10UnormPack32, Prospero::BufferFormat::k10_10_10_2UNorm, 4, false}}, {0x8100000000000000ull, {vk::Format::eA2R10G10B10UnormPack32, Prospero::BufferFormat::k10_10_10_2UNorm, 4, false}}, + {VIDEO_OUT_PIXEL_FORMAT_R10_G10_B10_A2_BT2100_PQ, + {vk::Format::eA2B10G10R10UnormPack32, Prospero::BufferFormat::k10_10_10_2UNorm, 4, false}}, {0xc001000622000000ull, {vk::Format::eR16G16B16A16Sfloat, Prospero::BufferFormat::k16_16_16_16Float, 8, false}}, {0xc001000600000000ull, diff --git a/src/graphics/presentation/videoOut.cpp b/src/graphics/presentation/videoOut.cpp index 415a55e2f..4d653af74 100644 --- a/src/graphics/presentation/videoOut.cpp +++ b/src/graphics/presentation/videoOut.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include #include @@ -541,6 +543,14 @@ Graphics::ImageInfo BufferAttributeGroup::ImageInfo(const VideoOutBuffer& buffer if (!Graphics::DecodeVideoOutPixelFormat(attribute.pixel_format, pixel_format)) { EXIT("unsupported video-out pixel format: 0x%016" PRIx64 "\n", attribute.pixel_format); } + if (attribute.pixel_format == Graphics::VIDEO_OUT_PIXEL_FORMAT_R10_G10_B10_A2_BT2100_PQ) { + static std::atomic_flag warned = ATOMIC_FLAG_INIT; + if (!warned.test_and_set(std::memory_order_relaxed)) { + Log::WriteToConsoleAndLog(fmt::format( + "Warning: HDR-to-SDR conversion is not implemented; displaying PQ video-out " + "pixels unchanged (format=0x{:016x}).\n", attribute.pixel_format)); + } + } const auto tile_mode = Graphics::Prospero::TileMode::kRenderTarget; const auto pitch = Graphics::TileGetTexturePitch(pixel_format.guest_format, attribute.width, tile_mode);