[idd] cleanup IDD version guards for HDR support

This commit is contained in:
Geoffrey McRae
2026-07-16 00:27:30 +10:00
parent 8734af2674
commit 117b76d662
4 changed files with 22 additions and 22 deletions

View File

@@ -45,8 +45,7 @@ static const struct LGMPQueueConfig POINTER_QUEUE_CONFIG =
static const UINT IDDCX_VERSION_1_10 = 0x1A00; static const UINT IDDCX_VERSION_1_10 = 0x1A00;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
static inline IDDCX_WIRE_BITS_PER_COMPONENT GetWireBitsPerComponent(bool hdr) static inline IDDCX_WIRE_BITS_PER_COMPONENT GetWireBitsPerComponent(bool hdr)
{ {
IDDCX_WIRE_BITS_PER_COMPONENT bits = {}; IDDCX_WIRE_BITS_PER_COMPONENT bits = {};
@@ -75,8 +74,7 @@ void CIndirectDeviceContext::QueryIddCxCapabilities()
m_iddCxVersion = ver.IddCxVersion; m_iddCxVersion = ver.IddCxVersion;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
const bool hasIddCx110DDIs = const bool hasIddCx110DDIs =
!!IDD_IS_FUNCTION_AVAILABLE(IddCxSwapChainReleaseAndAcquireBuffer2) && !!IDD_IS_FUNCTION_AVAILABLE(IddCxSwapChainReleaseAndAcquireBuffer2) &&
!!IDD_IS_FUNCTION_AVAILABLE(IddCxMonitorQueryHardwareCursor3) && !!IDD_IS_FUNCTION_AVAILABLE(IddCxMonitorQueryHardwareCursor3) &&
@@ -127,8 +125,7 @@ void CIndirectDeviceContext::InitAdapter()
* driver will not work. This behaviour is not documented by Microsoft. * driver will not work. This behaviour is not documented by Microsoft.
*/ */
caps.Flags = IDDCX_ADAPTER_FLAGS_USE_SMALLEST_MODE; caps.Flags = IDDCX_ADAPTER_FLAGS_USE_SMALLEST_MODE;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
if (CanUseIddCx110DDIs()) if (CanUseIddCx110DDIs())
caps.Flags |= IDDCX_ADAPTER_FLAGS_CAN_PROCESS_FP16; caps.Flags |= IDDCX_ADAPTER_FLAGS_CAN_PROCESS_FP16;
#endif #endif
@@ -390,8 +387,7 @@ NTSTATUS CIndirectDeviceContext::MonitorQueryTargetModes(
} }
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
NTSTATUS CIndirectDeviceContext::ParseMonitorDescription2( NTSTATUS CIndirectDeviceContext::ParseMonitorDescription2(
const IDARG_IN_PARSEMONITORDESCRIPTION2* inArgs, const IDARG_IN_PARSEMONITORDESCRIPTION2* inArgs,
IDARG_OUT_PARSEMONITORDESCRIPTION* outArgs) IDARG_OUT_PARSEMONITORDESCRIPTION* outArgs)
@@ -447,8 +443,7 @@ bool CIndirectDeviceContext::UpdateMonitorModes()
if (!m_monitor) if (!m_monitor)
return false; return false;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
if (CanUseIddCx110DDIs()) if (CanUseIddCx110DDIs())
{ {
IDDCX_TARGET_MODE2* modes = (IDDCX_TARGET_MODE2*)_malloca( IDDCX_TARGET_MODE2* modes = (IDDCX_TARGET_MODE2*)_malloca(
@@ -1023,6 +1018,7 @@ void CIndirectDeviceContext::SendCursor(const IDARG_OUT_QUERY_HWCURSOR& info, co
} }
} }
#ifdef HAS_IDDCX_110
void CIndirectDeviceContext::SetHDRActive(const struct IDDCX_HDR_METADATA * hdrMeta) void CIndirectDeviceContext::SetHDRActive(const struct IDDCX_HDR_METADATA * hdrMeta)
{ {
AcquireSRWLockExclusive(&m_hdrLock); AcquireSRWLockExclusive(&m_hdrLock);
@@ -1054,6 +1050,7 @@ void CIndirectDeviceContext::SetHDRActive(const struct IDDCX_HDR_METADATA * hdrM
ReleaseSRWLockExclusive(&m_hdrLock); ReleaseSRWLockExclusive(&m_hdrLock);
} }
#endif
bool CIndirectDeviceContext::GetHDRMetadata(D12FrameFormat & format) const bool CIndirectDeviceContext::GetHDRMetadata(D12FrameFormat & format) const
{ {

View File

@@ -35,6 +35,15 @@ extern "C" {
} }
#include "common/KVMFR.h" #include "common/KVMFR.h"
// IddCx 1.10 HDR/WCG types are only visible when the WDK targets
// (NTDDI >= 0x0A000005) *and* the build flags IDDCX_VERSION_MAJOR/MINOR are set to >= 1.10.
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10)) && \
NTDDI_VERSION >= 0x0A000005
#define HAS_IDDCX_110
#endif
#define MAX_POINTER_SIZE (sizeof(KVMFRCursor) + (512 * 512 * 4)) #define MAX_POINTER_SIZE (sizeof(KVMFRCursor) + (512 * 512 * 4))
#define POINTER_SHAPE_BUFFERS 3 #define POINTER_SHAPE_BUFFERS 3
@@ -151,8 +160,7 @@ public:
NTSTATUS MonitorQueryTargetModes( NTSTATUS MonitorQueryTargetModes(
const IDARG_IN_QUERYTARGETMODES* inArgs, IDARG_OUT_QUERYTARGETMODES* outArgs); const IDARG_IN_QUERYTARGETMODES* inArgs, IDARG_OUT_QUERYTARGETMODES* outArgs);
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
NTSTATUS ParseMonitorDescription2( NTSTATUS ParseMonitorDescription2(
const IDARG_IN_PARSEMONITORDESCRIPTION2* inArgs, IDARG_OUT_PARSEMONITORDESCRIPTION* outArgs); const IDARG_IN_PARSEMONITORDESCRIPTION2* inArgs, IDARG_OUT_PARSEMONITORDESCRIPTION* outArgs);
NTSTATUS MonitorQueryTargetModes2( NTSTATUS MonitorQueryTargetModes2(

View File

@@ -145,8 +145,7 @@ void CSwapChainProcessor::SwapChainThreadCore()
UINT dirtyRectCount = 0; UINT dirtyRectCount = 0;
ComPtr<IDXGIResource> surface; ComPtr<IDXGIResource> surface;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
if (m_devContext->CanProcessFP16()) if (m_devContext->CanProcessFP16())
{ {
IDARG_IN_RELEASEANDACQUIREBUFFER2 acquireIn = {}; IDARG_IN_RELEASEANDACQUIREBUFFER2 acquireIn = {};
@@ -554,8 +553,7 @@ bool CSwapChainProcessor::QueryHWCursor()
IDARG_OUT_QUERY_HWCURSOR out = {}; IDARG_OUT_QUERY_HWCURSOR out = {};
NTSTATUS status; NTSTATUS status;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
if (m_devContext->CanProcessFP16()) if (m_devContext->CanProcessFP16())
{ {
IDARG_OUT_QUERY_HWCURSOR3 out3 = {}; IDARG_OUT_QUERY_HWCURSOR3 out3 = {};

View File

@@ -40,8 +40,7 @@ static const UINT IDDCX_VERSION_1_10 = 0x1A00;
static bool LGIddCanUseIddCx110DDIs(UINT iddCxVersion) static bool LGIddCanUseIddCx110DDIs(UINT iddCxVersion)
{ {
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
return iddCxVersion >= IDDCX_VERSION_1_10 && return iddCxVersion >= IDDCX_VERSION_1_10 &&
!!IDD_IS_FUNCTION_AVAILABLE(IddCxSwapChainReleaseAndAcquireBuffer2) && !!IDD_IS_FUNCTION_AVAILABLE(IddCxSwapChainReleaseAndAcquireBuffer2) &&
!!IDD_IS_FUNCTION_AVAILABLE(IddCxMonitorQueryHardwareCursor3) && !!IDD_IS_FUNCTION_AVAILABLE(IddCxMonitorQueryHardwareCursor3) &&
@@ -127,8 +126,7 @@ NTSTATUS LGIddMonitorQueryTargetModes(IDDCX_MONITOR monitor, const IDARG_IN_QUER
} }
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
NTSTATUS LGIddParseMonitorDescription2(const IDARG_IN_PARSEMONITORDESCRIPTION2* inArgs, NTSTATUS LGIddParseMonitorDescription2(const IDARG_IN_PARSEMONITORDESCRIPTION2* inArgs,
IDARG_OUT_PARSEMONITORDESCRIPTION* outArgs) IDARG_OUT_PARSEMONITORDESCRIPTION* outArgs)
{ {
@@ -231,8 +229,7 @@ NTSTATUS LGIddCreateDevice(_Inout_ PWDFDEVICE_INIT deviceInit)
config.EvtIddCxMonitorAssignSwapChain = LGIddMonitorAssignSwapChain; config.EvtIddCxMonitorAssignSwapChain = LGIddMonitorAssignSwapChain;
config.EvtIddCxMonitorUnassignSwapChain = LGIddMonitorUnassignSwapChain; config.EvtIddCxMonitorUnassignSwapChain = LGIddMonitorUnassignSwapChain;
#if defined(IDDCX_VERSION_MAJOR) && defined(IDDCX_VERSION_MINOR) && \ #ifdef HAS_IDDCX_110
(IDDCX_VERSION_MAJOR > 1 || (IDDCX_VERSION_MAJOR == 1 && IDDCX_VERSION_MINOR >= 10))
if (hasIddCx110DDIs) if (hasIddCx110DDIs)
{ {
config.EvtIddCxParseMonitorDescription2 = LGIddParseMonitorDescription2; config.EvtIddCxParseMonitorDescription2 = LGIddParseMonitorDescription2;