@@ -269,10 +269,20 @@ pub unsafe extern "C" fn evt_commit_modes(
269269// HDR paths get real implementations alongside caps::HDR10 later.
270270// ---------------------------------------------------------------------
271271
272- /// SDR-only wire format: 8-bit RGB, nothing else.
273- fn wire_bpc_sdr8 ( ) -> ffi:: IDDCX_WIRE_BITS_PER_COMPONENT {
272+ /// Wire format for one mode: RGB at the session's bit depth (8 for SDR-8,
273+ /// 10 for SDR-10/HDR10, 12 for HDR12). The OS picks the highest depth the
274+ /// whole path supports; HDR additionally needs the EDID's CTA-861.3 block
275+ /// (core::edid) and the adapter's CAN_PROCESS_FP16 flag (shell::entry).
276+ fn wire_bpc_for ( mode : & Mode ) -> ffi:: IDDCX_WIRE_BITS_PER_COMPONENT {
277+ use luminal_driver_proto:: BitDepth ;
274278 let mut bpc: ffi:: IDDCX_WIRE_BITS_PER_COMPONENT = unsafe { zeroed ( ) } ;
275- bpc. Rgb = ffi:: IDDCX_BITS_PER_COMPONENT_IDDCX_BITS_PER_COMPONENT_8 ;
279+ bpc. Rgb = match mode. bit_depth {
280+ BitDepth :: Sdr8 => ffi:: IDDCX_BITS_PER_COMPONENT_IDDCX_BITS_PER_COMPONENT_8 ,
281+ BitDepth :: Sdr10 | BitDepth :: Hdr10 => {
282+ ffi:: IDDCX_BITS_PER_COMPONENT_IDDCX_BITS_PER_COMPONENT_10
283+ }
284+ BitDepth :: Hdr12 => ffi:: IDDCX_BITS_PER_COMPONENT_IDDCX_BITS_PER_COMPONENT_12 ,
285+ } ;
276286 bpc
277287}
278288
@@ -282,7 +292,11 @@ pub unsafe extern "C" fn evt_adapter_query_target_info(
282292 out_args : * mut ffi:: IDARG_OUT_QUERYTARGET_INFO ,
283293) -> NTSTATUS {
284294 let out = & mut * out_args;
285- out. TargetCaps = ffi:: IDDCX_TARGET_CAPS_IDDCX_TARGET_CAPS_NONE ;
295+ // HDR10/advanced color needs the target to advertise the wide/high
296+ // color-space pipeline; harmless for SDR-only monitors (the OS still
297+ // gates on the per-monitor EDID + wire bit depth).
298+ out. TargetCaps = ffi:: IDDCX_TARGET_CAPS_IDDCX_TARGET_CAPS_HIGH_COLOR_SPACE
299+ | ffi:: IDDCX_TARGET_CAPS_IDDCX_TARGET_CAPS_WIDE_COLOR_SPACE ;
286300 out. DitheringSupport = zeroed ( ) ;
287301 STATUS_SUCCESS
288302}
@@ -313,7 +327,7 @@ pub unsafe extern "C" fn evt_parse_monitor_description2(
313327 slot. Size = size_of :: < ffi:: IDDCX_MONITOR_MODE2 > ( ) as u32 ;
314328 slot. Origin = ffi:: IDDCX_MONITOR_MODE_ORIGIN_IDDCX_MONITOR_MODE_ORIGIN_MONITORDESCRIPTOR ;
315329 slot. MonitorVideoSignalInfo = signal_info ( mode, 0 ) ;
316- slot. BitsPerComponent = wire_bpc_sdr8 ( ) ;
330+ slot. BitsPerComponent = wire_bpc_for ( mode ) ;
317331 }
318332 out. MonitorModeBufferOutputCount = fill as u32 ;
319333 STATUS_SUCCESS
@@ -343,7 +357,7 @@ pub unsafe extern "C" fn evt_query_target_modes2(
343357 // unused. A nonzero requirement against a zero adapter budget makes
344358 // every mode unactivatable (Extend reverts, Scale/Res grayed).
345359 slot. RequiredBandwidth = 0 ;
346- slot. BitsPerComponent = wire_bpc_sdr8 ( ) ;
360+ slot. BitsPerComponent = wire_bpc_for ( mode ) ;
347361 }
348362 out. TargetModeBufferOutputCount = fill as u32 ;
349363 STATUS_SUCCESS
@@ -356,11 +370,47 @@ pub unsafe extern "C" fn evt_commit_modes2(
356370 STATUS_SUCCESS
357371}
358372
373+ /// CAN_PROCESS_FP16 contract (IddCx 1.10): the OS provides the HDR 3x4
374+ /// color matrix here for adapters that advertise FP16 processing. Our
375+ /// pipeline is pass-through — ring consumers receive the composed FP16
376+ /// scRGB desktop verbatim and the host encoder performs the colorspace
377+ /// conversion — so the matrix is acknowledged and traced, not applied to
378+ /// pixels. GammaSupport is declared SOFTWARE to match.
379+ pub unsafe extern "C" fn evt_monitor_set_gamma_ramp (
380+ monitor : ffi:: IDDCX_MONITOR ,
381+ in_args : * const ffi:: IDARG_IN_SET_GAMMARAMP ,
382+ ) -> NTSTATUS {
383+ let inp = & * in_args;
384+ let ramp_type = inp. Type as u32 ;
385+ tracelogging:: write_event!(
386+ PROVIDER ,
387+ "SetGammaRamp" ,
388+ level( Informational ) ,
389+ u64 ( "monitor" , & ( monitor as u64 ) ) ,
390+ u32 ( "type" , & ramp_type) ,
391+ u32 ( "size" , & inp. GammaRampSizeInBytes )
392+ ) ;
393+ STATUS_SUCCESS
394+ }
395+
359396pub unsafe extern "C" fn evt_set_default_hdr_metadata (
360- _monitor : ffi:: IDDCX_MONITOR ,
361- _in_args : * const ffi:: IDARG_IN_MONITOR_SET_DEFAULT_HDR_METADATA ,
397+ monitor : ffi:: IDDCX_MONITOR ,
398+ in_args : * const ffi:: IDARG_IN_MONITOR_SET_DEFAULT_HDR_METADATA ,
362399) -> NTSTATUS {
363- // SDR-only shell: accept and ignore. Stored + used when caps::HDR10
364- // and the phase-4 frame pipeline land.
400+ // The OS pushes the desktop's effective HDR10 static metadata here when
401+ // advanced color engages. The wire pixels already carry the composed
402+ // desktop (FP16 scRGB), so nothing needs reprocessing — trace it for
403+ // diagnostics; surfacing it to the host via GET_STATUS can come later
404+ // if the encoder wants monitor-derived mastering data.
405+ let inp = & * in_args;
406+ let meta_type = inp. Type as u32 ;
407+ tracelogging:: write_event!(
408+ PROVIDER ,
409+ "SetDefaultHdrMetaData" ,
410+ level( Informational ) ,
411+ u64 ( "monitor" , & ( monitor as u64 ) ) ,
412+ u32 ( "type" , & meta_type) ,
413+ u32 ( "size" , & inp. Size )
414+ ) ;
365415 STATUS_SUCCESS
366416}
0 commit comments