Repository navigation
drm/apple: HDR10 static metadata across DCPAV, full output colour modes, max-Hz PQ, and VRR fixes - #3052
Conversation
Extend HDR10 static metadata (DCPAV selector 0x15 SetHDRStaticMetadata and selector 0x14 StopInfoFrame) from desktop 26.6 compact EPIC alone to all IOMFB-template external outputs, including legacy EPIC (12.3/13.5/ 14.7) and AFKv2 (firmware 27.x MCDP29xx/MCDP2900 converters and H17P external outputs): - Move the pinned AV service and per-link metadata cache from dcp_desktop_state into apple_dcp and bind dcpav-service-epic for both legacy and AFKv2 external AV classes (DCPDPService, DCPDP13Service, AppleDCPDP2HDMI, AppleDCPMCDP29XX, AppleDCPMCDP2900). - Dispatch 0x15/0x14 via afk_send_command_len() on wire_v2 endpoints and afk_send_command_with_reply_len() on legacy/compact endpoints. - Track a link generation counter so stale or failed transport replies never latch sent_valid or suppress subsequent retries, and forget link metadata on every power-off path. - Validate Type 1 HDR_OUTPUT_METADATA blobs in atomic check and align DSC PQ ranking with DCP-managed compression. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Retain the per-timing ColorModes catalogue reported by DCP firmware and expose the standard Linux DRM output colour properties on external connectors so compositors and userspace can select every colour mode supported by the display: - Store up to 64 compact 8-byte real colour elements per timing in dcp_display_mode (sorted by descending firmware score with unsafe and DSC flags) and extend pq_mode_rank() with YCbCr 4:2:2/4:2:0 fallbacks ranked below RGB and YCbCr 4:4:4. - Add dcp_select_color_mode() in dcp-color.h mapping EOTF (SDR, HDR gamma, ST 2084 PQ, BT.2100 HLG), Colorspace, color format (AUTO, RGB, YCbCr 4:4:4, YCbCr 4:2:2 incl. DP/HDMI tunnel encodings, YCbCr 4:2:0), Broadcast RGB (Automatic, Full, Limited), and max bpc (8..12) onto the timing's colour catalogue, preserving default AUTO behaviour and rejecting unsupported combinations with -EINVAL in atomic check. - Attach full HDMI/DP Colorspace bitmasks, Broadcast RGB, color format, and max bpc (8..12) on external connectors with a matching connector reset hook, atomic_check mode_changed triggers, and postclose reset. - Tag HLG and wide-gamut SDR (BT.2020, DCI-P3) RGB scanout surfaces in iomfb_flush() and expose live active colour mode and HDR InfoFrame state in connector debugfs (color_state). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…toggles Fix two VRR gaps on non-live-VRR IOMFB-template DCPs: - In iomfb_modeset(), clear Adaptive Sync (minRR = 0) when switching from a VRR timing (dcp->vrr_enabled) to a fixed timing (!mode->vrr), matching dcp_desktop_modeset(). - In dcp_crtc_atomic_check(), mark mode_changed when VRR_ENABLED changes on 12.3/13.5/14.7_tpl pipelines that apply Adaptive Sync inside iomfb_modeset(). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
External timings above HDMI 1.4's 340 MHz clock behind DP-to-HDMI 2.0 protocol converters (such as 1920x1080@180 and 2560x1440@144 on MCDP29xx/2900) have every non-virtual color element listed in UnsafeColorElementIDs. SDR already drives those timings through their unsafe elements, whereas collect_pq_mode() and dcp_select_color_mode() rejected unsafe PQ elements unconditionally, leaving HDR unavailable at the monitor's default max refresh rate. Allow falling back to the best non-DSC unsafe PQ element only on timings that have no safe SDR elements at all (!sdr_usable && sdr_unsafe) outside the external_sdr path. Timings with any safe SDR element continue to enforce UnsafeColorElementIDs strictly for PQ. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
J473 full atomic KMS colour-mode matrix + live HDR10 static metadata update + DPMS off/on restore pass ( J473 atomic KMS colour-mode, live 0x15/0x14, and DPMS readback (34/34 PASS)Acer QG270 S3 (
MSI MPG 325CQRXF (
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR review on exact head 9d8d2015093c21b428e097c073738cdd17c91d6c.
Overall the DCPAV 0x15/0x14 transport unification (with link-generation fencing across legacy EPIC, desktop 26.6 compact EPIC, and AFKv2), the compact per-timing colour catalogue + dcp_select_color_mode() design, and the VRR modeset/clear fixes are clean and well-structured. Exact-head CI (Apple DRM KUnit and Host tests) is green, commits carry clean human authorship and Signed-off-by: with zero AI trailers, and there is no model/board gating (§1) or naming issue (§6).
However, there are three correctness blockers to address before approval, plus the queued §5 hardware test runs noted in the PR description.
Blockers
-
Unsafe-only PQ fallback admits DSC-required unsafe elements in production (
drivers/gpu/drm/apple/parser.c,drivers/gpu/drm/apple/dcp-color.h)- Commit
9d8d201509states that unsafe-only timings fall back to the best non-DSC unsafe PQ element only, matching howout->sdr_unsafeexcludesDSCRequiredColorElementIDs. - However,
parse_color_modes()calls:passingif (!external_sdr) collect_pq_mode(&unsafe_pq, &best_unsafe_pq_rank, &cmode, limits, handle->pq_dsc, true);
handle->pq_dscinstead offalse. Becausedcp_modes_replace()(drivers/gpu/drm/apple/iomfb.c) setsctx->pq_dsc = READ_ONCE(dcp->iomfb_template_pq) && !dcp_has_panel(dcp)— which istruefor every IOMFB-template external output in production —collect_pq_mode()admits DSC-required unsafe PQ elements. Worse, because commit7023eff4a6changedcollect_pq_mode()ranking torank = 2 * rank + !needs_dsc, a DSC-required unsafe RGB element outranks a non-DSC unsafe YCbCr 4:4:4/4:2:2 element (e.g. onunsafe_only_blob,c.pq_dsc = truepicks DSC element113instead of non-DSC element105), which is unsafe on DP-to-HDMI 2.0 protocol converters. - The same gap exists in
dcp_select_color_mode()(drivers/gpu/drm/apple/dcp-color.h): in pass 1 (allow_unsafe == true),if ((e->flags & DCP_COLOR_FLAG_DSC) && hdr && !req->allow_dsc)still allowsDCP_COLOR_FLAG_DSCon unsafe HDR elements becausereq->allow_dscistrue. tools/testing/selftests/drivers/gpu/apple-dcp/rate.pymasked this becauseparse(unsafe_only_blob, ..., &c)zeroesc.pq_dscback tofalse.- Fix: Pass
falsefordscwhen collectingunsafe_pqinparse_color_modes(), reject(e->flags & DCP_COLOR_FLAG_DSC)whenallow_unsafe && hdrindcp_select_color_mode(), and add selftest coverage forc.pq_dsc = true/req.allow_dsc = trueon unsafe-only timings.
- Commit
-
Non-template IOMFB backends (
iomfb_v14_7,iomfb_v26_6,iomfb_m4) anddcp_is_ext26()silently accept non-default SDR colour properties they never apply (drivers/gpu/drm/apple/iomfb.c)apple_connector_attach_hdr()attaches fullColorspace,Broadcast RGB,color format, andmax bpcon all externalHDMIA/DisplayPort/USBconnectors, including non-template external pipelines (e.g.,DCP_FIRMWARE_V_14_7external HDMI/USB-C).- In
dcp_crtc_check_hdr(), non-default SDR requests (Broadcast RGB=Limited,color format=YCbCr444/422,max bpc=8, wide-gamut SDRColorspace=BT2020_RGB, etc.) do not checkREAD_ONCE(dcp->iomfb_template_pq). Becauseiomfb_v14_7external populatesdcp->modesviaparse_color_modes(),lookup_mode()anddcp_select_color_mode()succeed inatomic_check, even thoughiomfb_v14_7_modeset()(dcp_v14_external_modeset()),iomfb_v26_6_modeset(), andiomfb_m4never consumedcp->color_req(anddcp_is_ext26()overridesmode->color_mode_id = mode->sdr_rgb.idafterward). That causes atomic commits to succeed while silently ignoring userspace's requested colour mode. - Fix: In
dcp_crtc_check_hdr(), reject any non-default colour property request with-EINVALwhen!READ_ONCE(dcp->iomfb_template_pq) || dcp_is_ext26(dcp).
-
H17P external
iomfb_flush()clobbers explicitDCI_P3_RGB_D65wide-gamut SDR tagging, and paired v27 external HDR hints still checkoutput_pq(drivers/gpu/drm/apple/iomfb_template.c,drivers/gpu/drm/apple/dcp-peer-runtime-v27.inc)- In
iomfb_template.c, the new wide-gamut SDR switch setsreq->surf[l].base.colorspace = DCP_COLORSPACE_P3_D65whendcp->active_color.colorimetry == DCP_COLORIMETRY_DCI_P3_RGB_D65. Immediately afterward (#if DCP_FW_H17(DCP_FW_VER)), the existing H17P external SDR workaround unconditionally resetsDCP_COLORSPACE_P3_D65back toDCP_COLORSPACE_UNSPECIFIED, clobbering explicit DCI-P3 D65 wide-gamut SDR output on H17P external pipes. Guard that reset withdcp->active_color.colorimetry != DCP_COLORIMETRY_DCI_P3_RGB_D65. dcp_peer_finish_v27()(drivers/gpu/drm/apple/dcp-peer-runtime-v27.inc:72) still passesdcp->output_pq ? 0x20000 : 0x10000for IOMFB parameter 6, whereas single-pipeiomfb_modeset()was updated todcp_external_hdr_hints(dcp, dcp->output_hdr). Updatedcp_peer_finish_v27()to usedcp->output_hdrso paired v27 external displays handle HLG/HDR-gamma consistently.
- In
§1–§6 Checklist Summary
- §1 No model gating: Pass — replaces firmware-version checks in
dcp_hdr_output_supported()/dcp_hdr_metadata_live()/ctx->pq_dscwithiomfb_template_pqand service/catalogue capabilities. - §2 Production-ready, no hacks: Needs fixes for the 3 blockers above. Non-blocking notes:
apple_connector_attach_hdr()(drivers/gpu/drm/apple/apple_drv.c): afterif (!connector->state) apple_connector_reset(connector);, checkif (!connector->state) return -ENOMEM;beforedrm_connector_attach_max_bpc_property()dereferencesconnector->state.color_state_show()(drivers/gpu/drm/apple/connector.c):dcp->modeanddcp->active_colorare read without synchronization against concurrent modesets (unlikedcp->hdrwhich is properly spinlock-protected).
- §3 Safety: Blocker #1 above should be fixed so DSC-required unsafe PQ elements cannot be selected on HDMI 2.0 unsafe-only timings.
- §4 Clean-room & attribution: Pass — all 4 commits have human author/committer (
Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by:, and zero AI trailers in commits. - §5 Evidence: J473 GNOME HDR + DCPAV
0x15/0x14+Broadcast RGB+ BT.2020 SDR + s2idle + SELinuxAVC=0results look strong, but the PR itself lists queued hardware verification still to run (J616s desktop 26.6 panel regression + live VRR tracefs measurement, and J473 full YCbCr 4:4:4/4:2:2/12-bpc/live-metadata/DPMS matrix). Please post those results (and any legacy EPIC 13.5/14.7 check if available) alongside the fixes. - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
|
J616s (M4 Pro, desktop 26.6
|
…, and sync color_state Address review findings across the colour-mode and HDR path: - Never admit DSC-required unsafe PQ elements on unsafe-only timings even when pq_dsc / allow_dsc is true (pass false for dsc when collecting unsafe_pq in parse_color_modes() and skip DCP_COLOR_FLAG_DSC in the unsafe HDR pass of dcp_select_color_mode()); add selftest coverage in rate.py and display.py for pq_dsc=true / allow_dsc=true. - Reject non-default colour property requests with -EINVAL in dcp_crtc_check_hdr() on non-template IOMFB backends (!iomfb_template_pq) and RGB8-only ext26 pipelines instead of silently accepting them. - Preserve explicit DCI_P3_RGB_D65 wide-gamut SDR tagging on H17P external pipes in iomfb_flush() and pass dcp->output_hdr to paired v27 parameter 6 in dcp_peer_finish_v27(). - Check connector->state allocation after apple_connector_reset() before attaching max bpc, and snapshot mode/active_color/output flags under dcp->hdr.lock between iomfb_modeset() and color_state_show(). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Addressed all three blockers and both non-blocking notes in
Verified locally: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review on exact head 8c7d58b1ca475c1db6d1dfb73c3ec9f02c01e121.
All code blockers and §5 hardware runs from review #6037608483 are resolved; only waiting on host-tests CI to finish. Exact-head CI on 8c7d58b1ca475c1db6d1dfb73c3ec9f02c01e121: Apple DRM KUnit (kunit) is success, while Host tests (host-tests) is still in_progress. Leaving as COMMENT until host-tests completes green (ready to APPROVE once green).
Prior Blocker Verification (9d8d201509 → 8c7d58b1ca)
- Non-DSC unsafe PQ enforcement (
drivers/gpu/drm/apple/parser.c,drivers/gpu/drm/apple/dcp-color.h) — Resolvedparse_color_modes()now passesfalsefordscwhen collectingunsafe_pq, anddcp_select_color_mode()skipsDCP_COLOR_FLAG_DSCduring the unsafe HDR pass even whenreq->allow_dscistrue.- Regression tests in
tools/testing/selftests/drivers/gpu/apple-dcp/rate.py(c.pq_dsc = 0/1) anddisplay.py(req.allow_dsc = truerejecting DSC-required unsafe PQ element113) directly cover the previously masked production case.
- Non-template &
ext26colour property rejection (drivers/gpu/drm/apple/iomfb.c) — Resolveddcp_crtc_check_hdr()now returns-EINVALfor any non-default colour property request when!READ_ONCE(dcp->iomfb_template_pq) || dcp_is_ext26(dcp).
- H17P external
DCI_P3_RGB_D65preservation & paired v27 parameter 6 (drivers/gpu/drm/apple/iomfb_template.c,drivers/gpu/drm/apple/dcp-peer-runtime-v27.inc) — Resolvediomfb_flush()guards the H17P external SDRDCP_COLORSPACE_P3_D65→DCP_COLORSPACE_UNSPECIFIEDreset whendcp->active_color.colorimetry == DCP_COLORIMETRY_DCI_P3_RGB_D65.dcp_peer_finish_v27()now passesdcp->output_hdr ? 0x20000 : 0x10000for parameter 6, matching single-pipedcp_external_hdr_hints().
- §5 hardware matrix runs — Resolved
- J473 full atomic KMS colour-mode + live
0x15/0x14+ DPMS matrix (34/34 PASS,Enforcing,AVC=0, 0 failed units) and J616s desktop 26.6 panel takeover + EDR + 6-target VRR cadence sweep (PASS,Enforcing,AVC=0, 0 failed units) are posted.
- J473 full atomic KMS colour-mode + live
§1–§6 Checklist Summary
- §1 No model gating: Pass.
- §2 Production-ready, no hacks: Pass. Both non-blocking polish items from the previous review were addressed (
connector->state-ENOMEMcheck inapple_connector_attach_hdr(), anddcp->hdr.locksnapshot incolor_state_show()/ non-desktopiomfb_modeset()).- Tiny non-blocking note: the desktop 26.6
iomfb_modeset()branch (drivers/gpu/drm/apple/iomfb_template.c:3962) and_dcp_poweroff()(drivers/gpu/drm/apple/dcp.c:5087) still updatedcp->mode/dcp->active_color/dcp->output_pq/dcp->output_hdroutsidedcp->hdr.lock, which only affects informational debugfscolor_statereads during concurrent modeset/poweroff.
- Tiny non-blocking note: the desktop 26.6
- §3 Safety: Pass — DSC-required unsafe PQ elements are rejected on unsafe-only timings.
- §4 Clean-room & attribution: Pass — all 5 commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by:, and zero AI trailers. - §5 Evidence: Pass — J473 GNOME HDR + s2idle + 34/34 atomic KMS matrix and J616s desktop 26.6 + VRR cadence sweep all green with
AVC=0and 0 failed units. - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Promoting review #6037795262 on exact head 8c7d58b1ca475c1db6d1dfb73c3ec9f02c01e121 to APPROVE now that both Apple DRM KUnit (kunit, run 45376738423) and Host tests (host-tests, run 45376737953) have passed green on this head.
All four prior blockers are resolved (DSC-free unsafe PQ selection, explicit -EINVAL for non-default SDR colour requests on non-template/ext26 backends, H17P external DCI_P3_RGB_D65 / v27 parameter-6 pairing, and J473 + J616s hardware evidence) and §1–§6 checks are clean.
Assisted-by: LLM (Gemini 4 Neon)
|
Both CI checks on |
|
Hardware evidence correction for On J616s, the six fixed-versus-VRR median pairs differ by at most 0.004 ms at matching request rates, and all 12 captures recorded zero vblank intervals. This measures the test client's presentation pacing. The VRR row still needs an active-state measurement of the panel cadence. Both tested J473 converters reported VRR unavailable. The comparison also needs the monitor's own HDR indicator and a matched native macOS capture, which the lab owner is working through. The final head's two hosted checks passed. Please keep the physical display evidence gate open. Assisted-by: LLM (Codex) |
…treamFormat 4:2:0 Fix the swapped DCP PixelEncoding enum values in parser.h, expose converter DownstreamFormat YCbCr 4:2:0 modes, and complete hdr.lock coverage for color_state snapshots: - Apple DCP firmware assigns PixelEncoding=2 to 24-bpp YCbCr 4:2:2 (Score +20000, 12-bpc safe at 297 MHz / 241.5 MHz and admitted at 583.6 MHz HDMI 2.0 1440p144) and PixelEncoding=3 to 24/30/36-bpp YCbCr 4:4:4 (Score +30000, 8/10/12-bpc, 10/12-bpc unsafe at 297 MHz and excluded at 583.6 MHz). Fix DCP_COLOR_FORMAT_YCBCR422=2 and DCP_COLOR_FORMAT_YCBCR444=3 so explicit color format selection and YCbCr PQ/SDR ranking match the wire format. - Parse the optional DownstreamFormat dictionary on non-virtual ColorModes entries: when a DP-to-HDMI bridge downsamples to PixelEncoding=1 (YCbCr 4:2:0) on the downstream link (e.g. 4K60 over MCDP2900), record the entry as DCP_COLOR_FORMAT_YCBCR420 so explicit YCbCr 4:2:0 requests select it without aliasing YCbCr 4:4:4 or 4:2:2. - Synchronize the desktop 26.6 iomfb_modeset() and _dcp_poweroff() active_color/output_pq/output_hdr updates under dcp->hdr.lock to match color_state_show(). - Update apple-dcp host selftests in rate.py and display.py for the true PixelEncoding values and add a DownstreamFormat 4:2:0 fixture test. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Source review of exact head 940d1f1ef2ba, covering the driver diff against main; I did not review the selftests. Nothing here is a crash or memory-safety bug. Items 1 and 2 can produce a committed mode with no picture, and I would fix them before merge.
- User colour requests can fall through to firmware-unsafe SDR elements. In
dcp_select_color_mode(),max_passis 2 for every SDR request whenallow_unsafe_sdris set (!hdr || ...). Any explicitcolor format/Broadcast RGB/max bpcrequest with no safe match therefore takes an element listed inUnsafeColorElementIDs, for example YCbCr 4:4:4 10-bit at a 297 MHz timing. The default SDR path and the PQ fallback use unsafe elements only on unsafe-only timings (!sdr_usable && sdr_unsafe). The explicit-request path should follow the same condition, so that a request the timing cannot carry safely fails atomic check with -EINVAL instead of committing a mode the sink may not show. - The unsafe-only PQ fallback ranks by format and depth, not by link budget. On an unsafe-only timing,
collect_pq_mode(..., allow_unsafe=true)takes the highestpq_mode_rank(), which prefers RGB, then 10-bit. Every element on such a timing is flagged unsafe, so the firmware's flag no longer filters anything. The only evidence an element fits the link is that SDR runs on it, and SDR runs at 8-bit RGB. If the catalogue lists a 10-bit RGB PQ element at 1440p144 behind an HDMI 2.0 bridge (~733 MHz TMDS, over 600), it wins. The commit message says the firmware leaves out over-budget YCbCr 4:4:4 at 583.6 MHz. If that holds for every element, please say so in the code comment and keep a fixture for it. Otherwise, limit the fallback to elements whose bits per pixel do not exceed the SDR element thatsdr_unsafeselected: 8-bit RGB PQ, or 4:2:2 at up to 12-bit. - The 4:2:2/4:4:4 enum swap changes SDR on main.
parser.con main usesDCP_COLOR_FORMAT_YCBCR444to picksdr_444(around line 785) and for the PQ rank. After the swap, every external display whose default SDR element came fromsdr_444gets a different colour ID with no colour property set. The fix may well be right; the bpp/score reasoning in940d1f1eis convincing. But it is a default-path change for displays that work today. Please add a before/aftercolor_staterow on one 4:4:4-capable HDMI sink and one DP sink at this head, with default properties. - DownstreamFormat rewrites the element's own format. Setting
cmode.pixel_encoding = YCBCR420when the bridge's downstream link is 4:2:0 also feeds the existingsdr_rgb/sdr_444/sdrselection. An RGB element behind an MCDP2900 at 4K60 stops counting as RGB. Ondcp_is_ext26(),iomfb_modeset()requiressdr_rgbto be 8-bit RGB, so that timing would now be refused. Please keep the upstream encoding inpixel_encoding, and carry the downstream one in a separate field or flag thatdcp_color_format_matches()andcolor_stateconsult. - Stack.
struct dcp_display_modegrows bycolors[64](512 bytes), and it is a stack local indcp_crtc_check_hdr()and in bothiomfb_modeset()variants (selected).parse_color_modes()adds a 512-bytecolor_scores[]on top. Please check-Wframe-larger-thanwith KASAN on, because the tree already needed fixes there (#2924). If it is tight, let selection and check look up the mode by pointer under the existing modes lock instead of copying it. - Properties exposed where every non-default value fails.
Broadcast RGB/color format/max bpcare attached on every DP/HDMI connector, butdcp_crtc_check_hdr()refuses any non-default value when!iomfb_template_pq || dcp_is_ext26(). A compositor that writesmax bpc(KWin's per-output setting, for example) then fails its modeset on those pipes. Please attach these properties only where the backend can honour them, or treatmax bpcas a cap that the default selection already satisfies. - Firmware-version selection in new code. The VRR full-modeset condition in
dcp_crtc_atomic_check()now lists 12.3/13.5/14.7_tpl/26.6 desktop/27 external, anddcp_crtc_color_request()setsdefault_rgbfromfw_compat == V_27_0. The property that matters here is "template backend without live VRR".iomfb_template_pqalready carries the template half, soiomfb_template_pq && !dcp_vrr_live(dcp)would cover new firmware without another list entry. - Nit.
struct dcp_color_entrypackscolorimetry:5,format:4andeotf:3. AddBUILD_BUG_ON(DCP_COLORIMETRY_COUNT > 32), and the same for the other three fields, so a new enum value cannot silently truncate after it passes the< *_COUNTcheck inrecord_color_entry().
I also checked the following and found them correct: the insertion/eviction in record_color_entry(); the stale-reply fencing with hdr.generation in dcp_hdr_metadata_sync() / dcp_hdr_infoframe_stop(); the service bind/unbind refcounting; and the snapshot taken under hdr.lock in color_state_show().
The hardware rows at the current head (J473 KMS/HDR plus a J616s panel control) are still to be posted, as already noted on this PR.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review on exact head 940d1f1ef2bab8544f08767d2c8434a4fe26f383.
Both CI checks on 940d1f1ef2bab8544f08767d2c8434a4fe26f383 are green (kunit and host-tests), commit hygiene (§4) is clean (all 6 commits carry human author/committer and human Signed-off-by: only, no AI trailers, clean-room diff), §6 naming is clean, and the incremental dcp->hdr.lock updates in _dcp_poweroff() and desktop 26.6 iomfb_modeset() properly synchronize color_state_show().
Requesting changes for the following blockers before approval:
Blockers
-
Explicit SDR requests can fall through to
UnsafeColorElementIDson safe timings (drivers/gpu/drm/apple/dcp-color.h):
Indcp_select_color_mode(),max_passis2wheneverreq->allow_unsafe_sdr && (!hdr || (!mode->sdr_usable && mode->sdr_unsafe)). Because!hdris unconditionally true for SDR, any explicit SDR property request (color format,Broadcast RGB,max bpc,Colorspace) with no safe match on a safe timing (mode->sdr_usable == true) falls through to pass 2 and commits an element fromUnsafeColorElementIDsinstead of failing atomic check with-EINVAL(for example, requesting SDR RGB or YCbCr 4:4:4 on a 4K60 bridge timing where only 4:2:0 is safe, or 10-bit YCbCr 4:4:4 on a 297 MHz timing where only 8-bit is safe). Gate pass 2 onreq->allow_unsafe_sdr && !mode->sdr_usable && mode->sdr_unsafefor SDR as well as HDR. -
DownstreamFormatmutatescmode.pixel_encodingbefore upstream SDR selection (drivers/gpu/drm/apple/parser.c):
Overwritingcmode.pixel_encoding = DCP_COLOR_FORMAT_YCBCR420whendownstream_encoding == DCP_COLOR_FORMAT_YCBCR420alterstrace_iomfb_color_mode(),external_sdr_rank(),sdr_rgb, andsdr_444. An upstream RGB element behind a bridge downsampling to 4:2:0 ceases to matchDCP_COLOR_FORMAT_RGBforsdr_rgb(which causesext26modesets requiring 8-bitsdr_rgbto fail). Keepcmode.pixel_encodingas the upstream encoding and carry the downstream wire format separately (e.g., a flag indcp_color_entry.flagsor a dedicated field) consulted bydcp_color_format_matches(),dcp_color_entry_rank(),pq_mode_rank(), andcolor_state_show(). -
Colour properties exposed on backends that reject every non-default value (
drivers/gpu/drm/apple/apple_drv.c,drivers/gpu/drm/apple/iomfb.c):
apple_connector_attach_hdr()attachesBroadcast RGB,color format, andmax bpc(8..12, default12) to every external connector, including!iomfb_template_pqandext26pipes wheredcp_crtc_check_hdr()rejects any non-default request with-EINVAL. Compositors that setmax bpcper output (such as8or10) will fail modesets on those pipes even thoughext26already outputs 8-bit RGB. Attach these properties only where the backend supports them, or acceptmax bpccaps already satisfied by the default 8-bit output. -
§1 firmware-version list expansion in
dcp_crtc_atomic_check()(drivers/gpu/drm/apple/dcp.c):
The VRR full-modeset condition addsDCP_FIRMWARE_V_12_3,DCP_FIRMWARE_V_13_5, andDCP_FIRMWARE_V_14_7_TEMPLATEto a firmware-version gate instead of checking the backend capability (READ_ONCE(dcp->iomfb_template_pq) && !dcp_vrr_live(dcp), preserving any required panel guard). -
§5 exact-head hardware evidence still open on
940d1f1ef2ba:
Prior J473 and J616s captures were run on an earlier candidate (9d8d2015093c21), and940d1f1ef2bachanges the default-pathDCP_COLOR_FORMAT_YCBCR422/DCP_COLOR_FORMAT_YCBCR444enum values (sdr_444andpq_mode_rank()) plus addsDownstreamFormat4:2:0 parsing. Keeping the physical display evidence gate open until exact-head runs (default cmdline,Enforcing, 0 AVC denials, 0 failed units, 0 new kernel errors) are posted for:- J473: default-property before/after
color_stateon HDMI and DP sinks, corrected YCbCr 4:4:4/4:2:2, 4K60DownstreamFormatYCbCr 4:2:0, max-Hz PQ, live0x15/0x14, DPMS restore, and physical monitor HDR indicator / native macOS comparison. - J616s: panel takeover + EDR regression and active panel-cadence VRR measurement via tracefs (
VRR_ENABLED=0vs1) rather than client flip pacing.
- J473: default-property before/after
Non-blocking notes
- Unsafe-only PQ link budget (
drivers/gpu/drm/apple/parser.c): On unsafe-only timings (!sdr_usable && sdr_unsafe),collect_pq_mode(..., allow_unsafe=true)selects purely bypq_mode_rank(). While1080p18010-bit RGB fits HDMI 2.0 (517.5 MHz <= 600 MHz TMDS), a non-DSC 10-bit RGB PQ entry on a ~583.6 MHz timing (1440p144) would exceed 600 MHz. Please confirm and document in a code comment (with fixture coverage) that firmware omits over-budget non-DSC entries fromColorModes(or marks them DSC-required), or bound unsafe-only PQ against the link budget. - Stack frame size (
drivers/gpu/drm/apple/parser.h,iomfb.c,iomfb_template.c,parser.c):struct dcp_display_modegrows by 512 bytes (colors[64]) and is allocated on the stack indcp_crtc_check_hdr()and bothiomfb_modeset()variants, alongsides64 color_scores[64](+512 bytes) inparse_color_modes(). Verify-Wframe-larger-thanwith KASAN enabled, and consider doing selection/check under the modes lock without copying the full struct onto the stack. - Bitfield bounds (
drivers/gpu/drm/apple/parser.h,parser.c): AddBUILD_BUG_ONassertions forDCP_COLORIMETRY_COUNT <= 32,DCP_COLOR_FORMAT_COUNT <= 16,DCP_EOTF_COUNT <= 8, andDCP_COLOR_YCBCR_RANGE_COUNT <= 2sostruct dcp_color_entrybitfields cannot silently truncate if an enum grows.
… and stack usage Address review feedback across the colour-mode and VRR paths: - Gate pass 2 (unsafe fallback) in dcp_select_color_mode() on !mode->sdr_usable && mode->sdr_unsafe for SDR as well as HDR, so explicit SDR property requests on safe timings never fall through to UnsafeColorElementIDs. - Preserve cmode.pixel_encoding as the upstream encoding when parsing DownstreamFormat YCbCr 4:2:0 entries, carrying the downstream wire format in DCP_COLOR_FLAG_DOWNSTREAM_420 so tracepoints, sdr_rgb, and ext26 modesets remain unaffected while colour matching and color_state report wire YCbCr 4:2:0. - Bound unsafe-only PQ fallback to the wire bpp ceiling of the timing's non-DSC unsafe SDR elements (sdr_unsafe_max_bpp) as an extra link budget guard alongside firmware pre-filtering. - Attach Broadcast RGB, color format, and max bpc only on external connectors backed by iomfb_template, and allow default SDR commits with max_bpc >= 8 on fixed 8-bit pipes. - Replace the firmware-version list in dcp_crtc_atomic_check() with a capability check on iomfb_template_pq && !dcp_vrr_live(dcp) (keeping the firmware 27 panel guard), and share dcp_sdr_default_rgb(). - Eliminate struct dcp_display_mode and color_scores stack allocations across parser.c, iomfb.c, iomfb_template.c, iomfb_v14_7.c, and iomfb_v26_6.c, and add static_assert bounds for dcp_color_entry bitfields. - Extend apple-dcp host selftests to cover all of the above. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Updated branch to
Local verification at
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review on exact head d4acd94ddbf149dc18cd1ca60793cbe5723ee2a4.
All four prior code blockers and all three non-blocking notes from 940d1f1ef2ba are cleanly resolved, and both exact-head CI checks are green (Apple DRM KUnit / kunit run 45388146554 and Host tests / host-tests run 45388146593). Zero code or CI blockers remain. Posting as COMMENT so the §5 physical display evidence gate stays open until the exact-head J473 and J616s hardware runs on d4acd94ddbf149 are posted, at which point this is ready for APPROVE.
Prior Blocker Verification (940d1f1ef2ba → d4acd94ddbf1)
- Unsafe SDR fallthrough on safe timings (
drivers/gpu/drm/apple/dcp-color.h) — Resolved- Pass 2 in
dcp_select_color_mode()is now gated onreq->allow_unsafe_sdr && !mode->sdr_usable && mode->sdr_unsafefor both SDR and HDR, so explicit SDR requests without a safe match on safe timings return-EINVALinstead of falling through toUnsafeColorElementIDs. Covered by the new 4K60 safe-timing fixture indisplay.py.
- Pass 2 in
DownstreamFormatupstream encoding preservation (drivers/gpu/drm/apple/parser.h,parser.c,dcp-color.h) — Resolvedcmode.pixel_encodingstays untouched as the upstream encoding (preservingtrace_iomfb_color_mode(),external_sdr_rank(),sdr_rgb,sdr_444, andext26modesets), while downstream 4:2:0 is carried inDCP_COLOR_FLAG_DOWNSTREAM_420(keepingstruct dcp_color_entryat 8 bytes).dcp_color_entry_format()is consistently used for matching, ranking, wire-bpp bounding,dcp_color_mode_from_entry(),dcp_default_sdr_color(),pq_mode_rank()/out->pq.format, andcolor_statereporting. Covered by updatedds420_blobanddisplay.pyfixtures.
- External colour property exposure (
drivers/gpu/drm/apple/dcp.c,dcp.h,apple_drv.c,iomfb.c) — Resolveddcp_ext_color_props_supported()restrictsBroadcast RGB,color format, andmax bpcattachment to externaliomfb_templatepipes (skippingext26and nativev14_7/v26_6), anddcp_crtc_check_hdr()accepts default SDR commits withmax_bpc >= 8on fixed 8-bit pipes.
- §1 capability-based VRR modeset check (
drivers/gpu/drm/apple/dcp.c,iomfb.c) — Resolveddcp_crtc_atomic_check()replaces the firmware-version list withREAD_ONCE(dcp->iomfb_template_pq) && !dcp_vrr_live(dcp)(preserving the firmware 27 panel guard, with external H17P VRR already rejected above), anddcp_sdr_default_rgb()is shared iniomfb.c.
- Non-blocking notes — Resolved
- Unsafe-only PQ link budget: documented in
parser.cand additionally bounded bysdr_unsafe_max_bppin bothparse_color_modes()anddcp_select_color_mode(), with 24-bpp vs 30-bpp fixtures inrate.pyanddisplay.py. - Stack frame usage:
color_scoresheap-allocated with cleanout_freeteardown on all error paths, compound-literal copy removed fromparse_mode(),dcp_find_mode()reads from the retaineddcp_modes_snapshot()catalog without copying, and modeset copies usekzalloc_objwith__free(kfree). - Bitfield bounds:
static_assertchecks added for all fourdcp_color_entrybitfields inrecord_color_entry().
- Unsafe-only PQ link budget: documented in
§1–§6 Checklist Summary
- §1 No model gating: Pass.
- §2 Production-ready, no hacks: Pass.
- §3 Safety: Pass (unsafe SDR/PQ strictly gated to unsafe-only timings; unsafe PQ remains non-DSC and wire-bpp bounded).
- §4 Clean-room & attribution: Pass — all 7 commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by:, and zero AI trailers. - §5 Evidence: Pending exact-head
d4acd94ddbf149hardware runs (default cmdline,Enforcing, 0 AVC denials, 0 failed units, 0 new kernel errors):- J473: before/after default-property
color_stateon HDMI and DP sinks, corrected YCbCr 4:4:4/4:2:2, 4K60DownstreamFormatYCbCr 4:2:0, Blocker 1 negative safe-timing SDR checks, max-Hz PQ, live0x15/0x14, DPMS restore, GNOME HDR toggle, and monitor HDR indicator / native macOS comparison. - J616s: panel takeover + EDR regression and active panel-cadence VRR measurement via tracefs (
VRR_ENABLED=0vs1).
- J473: before/after default-property
- §6 Naming: Pass.
…er adopt dcp_takeover_adopt() adopts the bootloader's live fixed panel mode on desktop 26.6 with dcp->vrr_enabled = false and vrr_min_on = 0 to avoid a 200 ms boot blank. Because dcp_vrr_live() was true unconditionally, subsequent VRR_ENABLED 0->1 commits bypassed iomfb_modeset() and dcp_vrr_update() returned early on !dcp->vrr_enabled, leaving panel VRR inactive until an unrelated mode change occurred. Allow a single modeset in dcp_crtc_atomic_check() when enabling VRR_ENABLED on a live-VRR panel whose adaptive sync is not yet armed (and has not hit vrr_failed), keeping all subsequent VRR_ENABLED toggles live and flicker-free. Also populate dcp->active_color under hdr.lock during dcp_takeover_adopt(). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
R3 receipt at Blockers: J616s VRR still lacks measured variable display cadence. The exact R3 run recorded 408 userspace flips, zero vblank intervals and zero DCP swap intervals. The CRTC property changed while the display state still reported VRR off. Checked: The J473 exact R3 matrix matched 35 of 36 outcomes. The SDR 1080p120 YCbCr 4:4:4 case returned success to EvidenceThe exact J473 checks toggled PQ/HDR kernel state on both outputs and restored the stock boot. The negative case has |
|
Pushed Commit 8 ( Commit 8 (
|
| Target Hz (ms) | VRR_ENABLED=0 (0x780000) dcp:iomfb_swap_complete |
VRR_ENABLED=1 (0x180000) dcp:iomfb_swap_complete |
|---|---|---|
| 90 Hz (11.111 ms, non-divisor) | med=8.334 ms, p95=16.673 ms, err=3.674 ms, grid120=0.010 ms |
med=12.472 ms, p95=12.525 ms, err=1.920 ms, grid120=2.727 ms |
| 72 Hz (13.889 ms, non-divisor) | med=13.484 ms, p5=8.340 ms, p95=20.780 ms, err=3.290 ms |
med=12.506 ms, p5=12.489 ms, p95=16.670 ms, err=1.879 ms |
| 60 Hz (16.667 ms, divisor) | med=16.666 ms, err=0.006 ms |
med=16.667 ms, err=0.094 ms |
| 40 Hz (25.000 ms, divisor) | med=25.000 ms, err=0.007 ms |
med=25.000 ms, err=0.004 ms |
color_statereportsdepth: 8,format: RGB (0),vrr_enabled: 1,output_edr: 1(panel takeover + EDR regression PASS).
Live macOS 27.2 (26B123) dual-display guest reference diff (J473 Acer QG270 S3 HDMI + MSI MPG 325CQRXF USB-C)
From Apple DCPAV validateVideo and UnifiedPipeline::mode_set_gated logs across all 7 live HDR/refresh transitions:
- PixelEncoding enum: macOS logs
encoding=3 [YCbCr 4:4:4]andencoding=2 [YCbCr 4:2:2]verbatim, confirming ourparser.henum fix. - Acer
1920x1080@180 HzHDR: macOS drives HDR at1920x1080@180 Hz(10bpc YCbCr 4:4:4 BT.2020, 30 bpp = 12.42 Gbps,DSC=NO,VRR=NO,type=0x87DRM InfoFrame enabled), confirming that >340 MHz unsafe-only timings must allow non-DSC PQ. Linux selectscolor:113(10bpc RGB BT.2020 PQ, same 30 bpp / 12.42 Gbps budget, zero RGB->YCbCr conversion) by default, and explicitcolor format = YCbCr444selects macOS's exactcolor:116. - MSI
2560x1440HDR: macOS selects12bpc encoding=2 [YCbCr 4:2:2] range=1 [Limited] colorimetry=7 [BT.2020 (YCbCr)],DSC=NO,VRR=NO,InfoFrame(0x87)enabled — an exact 1:1 match with Linuxcolor:105. - VRR on these J473 DP-to-HDMI bridges: macOS reports
AdaptiveSync enabled=NO,VRR=NO,SupportsVariableRefreshRate=No,QMSVRREnableConfig=0, and zero VRR modes on both Acer (MCDP29XX) and MSI (MCDP2900), matching Linuxvrr_capable=0.
J473 R3 results (d4acd94ddbf149, exact-head d199ac168c7ef2 R4 queued behind current J473 holder)
- Stock
fleet87BEFORE vs trial AFTER default SDRcolor_statebyte-for-byte identical: Acer1080p180color:86(10b RGB sRGB SDR Full), MSI1440p144color:80(8b RGB sRGB SDR Full). - GNOME HDR ON/OFF @ max-Hz (
1080p180color:113+1440p144color:105,hdr_infoframe=1->0): PASS. - KMS colour matrix:
RGB8/10/12b Full/Limited, wide-gamut SDRBT2020_RGB(color:85),YCbCr444 (3)8/10/12b,YCbCr422 (2)12b, 4K60DownstreamFormatYCbCr420 (1)SAFE (color:119), Blocker 1 safe-timing SDR rejection (neg_sdr_4k60_rgb_unsafe->-EINVAL), live0x15metadata update (MaxCLL 418 -> 600/700), and DPMS restore all PASS. (The1080p120max_bpc=10YCbCr444test returned0becausemax_bpcis a ceiling and validly selected safe 8-bitYCbCr444; updated toneg_sdr_1080p120_bt2020_rgb_unsafefor exact-headd199ac168c7ef2R4.)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH at d199ac168c7e
Blockers:
- Exact-head CI on
d199ac168c7enot yet all green:kunitandpr-textare green, while thehost-testsrerun (after the unrelatedg15-retention-tests --mutationsGitHub HTTPS timeout;apple-dcppassed) andreadinessare still queued. - Exact-head
d199ac168c7eJ473 R4 hardware row still queued: exact-head J616s tracefs VRR cadence proof and the live macOS 27.2 dual-display comparison are posted, while J473 R3 was run on prior headd4acd94ddbf149(and the PR body'sTested:/Not yet:lines still referenced4acd94ddbf149).
Checked:
- Delta
d4acd94ddbf1..d199ac168c7e(dcp.c,iomfb.c,lifecycle.py): Clean, zero new §1–§4/§6 issues.dcp_crtc_atomic_check()triggers one modeset to arm adaptive sync ondcp_vrr_live()panels whenVRR_ENABLEDtransitions0 -> 1while!dcp->vrr_enabledand!vrr_failed, keeping subsequent toggles live viadcp_vrr_update().dcp_takeover_adopt()populatesdcp->mode,dcp->active_color,output_pq,output_hdr, andvrr_enabledatomically underdcp->hdr.lock.lifecycle.pycovers both the armed-after-adopt andvrr_failedcases. - Non-blocking note (
drivers/gpu/drm/apple/iomfb.c:3021-3032): If another commit is pushed, guard thed->trial_modeset_okreuse branch indcp_desktop_modeset()with(!crtc_state->vrr_enabled || READ_ONCE(dcp->vrr_enabled))so a no-fbconboot whose very first atomic modeset directly requestsVRR_ENABLED=1still arms adaptive sync instead of keeping the fixed adopted mode. - §1–§4, §6: No new model/SoC/board gating; no hacks or extra cmdline requirements; safety invariants preserved; all 8 commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:with clean PR title/body; naming clean. - §5 J616s exact-head proof: Verified on
d199ac168c7e(7.3.0-aurora-fleet87, default cmdline,Enforcing,AVC=0, 0 failed units) with realdcp:iomfb_swap_completetracefs cadence showing 90 Hz / 72 Hz stepping off the fixed 120 Hz grid onto the 240 Hz ProMotion grid underVRR_ENABLED=1(0x180000) plus panel takeover and EDR intact.
Evidence
- Head verified:
d199ac168c7ef277e6f8a33fe7b17b789d5e2eca(state: OPEN, 8 commits,MERGEABLE). - CI on
d199ac168c7e:pr-text / pr-text:success(run45400124927)Apple DRM KUnit / kunit:success(run45400124131)Host tests / host-tests: prior attempt45400124639passed502/503includingapple-dcpand failed only on agithub.com:443connect timeout ing15-retention-tests --mutations; rerun job138474295022is currentlyqueued.readiness / readiness: job138466181484is currentlyqueued.
- Hardware evidence on
d199ac168c7e:- J616s (
issuecomment-7132694448): exact-headd199ac168c7etakeover adopt, one-time VRR arming, live0x780000<->0x180000switching,dcp:iomfb_swap_completetracefs table (90/72/60/40 Hz),color_state(depth: 8,RGB,vrr_enabled: 1,output_edr: 1),Enforcing,AVC=0, 0 failed units. - macOS 27.2 (
26B123) dual-display reference (issuecomment-7132694448): confirmsPixelEncoding2/3, non-DSC PQ on1080p180, 1:1color:105match on1440p144, andSupportsVariableRefreshRate=Noon both J473 bridges. - J473 R4 on exact head
d199ac168c7e: pending (R3 was run atd4acd94ddbf149).
- J616s (
|
Merge readiness at
Areas: Updated by pr-readiness on every push, edit and review, and every 30 minutes. Rules: merge policy · labels. |
|
Exact-head
All exact-head |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at d199ac16
Blockers: none
Checked: Verified host-tests, kunit, and pr-text passing on d199ac168c7e, zero AI attribution across all 8 commits and PR text, prior code review of Commit 8 (dcp_takeover_adopt VRR arming + lifecycle.py) clean, and exact-head d199ac168c7e J616s tracefs VRR + J473 R4 36/36 KMS/HDR/DPMS + live macOS 27.2 dual-display parity rows complete.
Evidence
- Exact head:
d199ac168c7ef277e6f8a33fe7b17b789d5e2eca(8 commits, humanSigned-off-by:only, zero AI attribution). - CI on exact head:
host-testsPASS,kunitPASS,pr-textPASS. - Hardware evidence at
d199ac168c7e:- J616s active-panel-cadence tracefs VRR proof (
dcp:iomfb_swap_complete, 90/72/60/40 Hz,Enforcing,AVC=0, 0 failed units). - J473 R4 (
7.3.0-aurora-fleet87, default cmdline,Enforcing,AVC=0, ORACLE receiptj473-20261125T002648.3FtoQ2): default SDR byte-for-byte identical, GNOME 51.1 HDR ON/OFF @ max Hz PASS, 36/36 atomic KMS colour/HDR/DPMS matrix PASS (including 5/5-EINVALnegative checks, live0x15static metadata updates, DPMS restore). - Live macOS 27.2 dual-display guest reference diff matching PixelEncoding enum, HDR modes, and bridge VRR capability.
- J616s active-panel-cadence tracefs VRR proof (
What: Enable HDR10 static metadata (
DCPAV0x15/0x14) across all external DCPAV transports, expose the full per-timingColorModescatalogue (RGB / YCbCr 4:4:4 / 4:2:2 / 4:2:0 viaDownstreamFormat, 8/10/12 bpc,Broadcast RGB, wide gamut, PQ/HLG, max-Hz non-DSC unsafe PQ fallback bounded by unsafe SDR wire bpp), fix swapped YCbCr 4:2:2/4:4:4PixelEncodingvalues, fix VRR modeset / Adaptive Sync clearing across IOMFB-template pipelines, and arm adaptive sync on firstVRR_ENABLEDenable after desktop boot takeover. Supersedes draft #2965.Tested: Exact head
d199ac168c7ef2: localrun-host-tests.py --only dcp56/56 PASS (incl.apple-dcp94/94),arm64 LLVM=1 W=10 C warnings,checkpatch.pl0 errors/0 warnings, CIkunit+pr-textPASS (host-testsrerun in progress). Exact-headd199ac168c7ef2hardware rows on7.3.0-aurora-fleet87(default cmdline,Enforcing,AVC=0, stock restored):1080p180color:8610b RGB;1440p144color:808b RGB), GNOME HDR ON/OFF @ 180/144 Hz PASS, 36/36 atomic KMS colour/HDR/DPMS matrix PASS (incl.YCbCr444 (3),YCbCr422 (2), 4K60DownstreamFormatYCbCr420 (1)SAFE, all 5 negative-EINVALchecks, live0x15MaxCLL update without modeset,0x14stop, DPMS restore); matched against live macOS 27.2 (26B123) dual-display guest capture on the same J473 cabling (encoding=2/3, 1080p180 + 1440p HDRDSC=NOInfoFrame(0x87),VRR=NOon both bridges); plus 2xs2idlesurvival (R1).3456x2234@120boot takeover + EDR +color_state, one-time VRR arming (VRR=YES), live zero-modeset floor switching (0x780000<->0x180000), and real kernel tracefsdcp:iomfb_swap_complete(n=34per run) showing 90 Hz shifting from strict 120 Hz grid (med=8.334 ms,p95=16.673 ms,grid120=0.010 ms,err=3.674 ms) to ProMotion's 80 Hz sub-step (med=12.472 ms,max=12.531 ms,grid120=2.727 ms,err=1.920 ms) and 72 Hz error dropping3.290 -> 1.879 ms.m1prolegacy 13.5 peer regression atd4acd94ddbf149): clean boot (Enforcing,running,AVC=0, 0 failed units).Risk: two-way · Apple Silicon Macs with external HDMI/USB-C/DP displays or ProMotion VRR panels (
appledrm).Not yet: Physical monitor OSD HDR indicator glance on both J473 displays during one HDR-on step (logged for morning check); direct USB-C->DP-Alt external VRR monitor check (both lab J473 cables use
MCDP29XX/MCDP2900DP-to-HDMI bridges where macOS 27.2 also reportsVRR=NO).Details
Problem
External displays and desktop-takeover VRR panels on Apple Silicon DCP have six gaps when driving HDR, VRR, and non-default output colour modes:
DCPAVselector0x15SetHDRStaticMetadataand0x14StopInfoFrame) is only wired on desktop 26.6 compact EPIC; legacy EPIC (12.3/13.5/14.7) and AFKv2 (v27/MCDP29xx/MCDP2900/ H17P external) enter PQ colour modes without sending or stopping the Dynamic Range and Mastering InfoFrame.Colorspace={Default, BT2020_RGB}and drop the per-timingColorModescatalogue after selecting a single default SDR/PQ pair, so compositors and KMS clients cannot configureBroadcast RGB(Full/Limited),color format(RGB / YCbCr 4:4:4 / 4:2:2 / 4:2:0),max bpc(8..12), wide-gamut SDR (BT2020_RGB,DCI-P3), or HLG.parser.hhadDCP_COLOR_FORMAT_YCBCR422andDCP_COLOR_FORMAT_YCBCR444swapped (3vs2) relative to DCP firmware'sPixelEncodingvalues (2= 24-bpp YCbCr 4:2:2,3= 24/30/36-bpp YCbCr 4:4:4), andparse_color_modes()ignoredDownstreamFormaton DP-to-HDMI bridge 4K60 entries that downsample to YCbCr 4:2:0 on the downstream wire.1920x1080@180and2560x1440@144onMCDP29xx/MCDP2900) list every non-virtual colour element inUnsafeColorElementIDs. SDR already drives these timings through their unsafe elements, whereascollect_pq_mode()rejected unsafe PQ elements unconditionally, causing GNOME HDR toggle to fail with-EINVALat the monitor's default max refresh rate.minRR = 0), andVRR_ENABLEDtoggles on legacy12.3/13.5/14.7_tplpipelines did not trigger a modeset.iomfb_v26_6),dcp_takeover_adopt()adopts the bootloader's fixed mode withdcp->vrr_enabled = falseandvrr_min_on = 0, sodcp_vrr_live()bypassediomfb_modeset()on the firstVRR_ENABLED 0->1toggle anddcp_vrr_update()returned early without arming adaptive sync.Design & Implementation
hdrservice/cache state fromdcp_desktop_stateintoapple_dcp, binddcpav-service-epicfor external AV classes (DCPDPService,DCPDP13Service,AppleDCPDP2HDMI,AppleDCPMCDP29XX,AppleDCPMCDP2900), dispatch0x15/0x14viaafk_send_command_len()onwire_v2andafk_send_command_with_reply_len()on legacy/compact, fence stale/failed replies with a link generation counter, validate Type 1 blobs in atomic check, and forget link metadata on power-off.DCP_COLOR_FORMAT_YCBCR422 = 2andDCP_COLOR_FORMAT_YCBCR444 = 3inparser.h. ParseDownstreamFormat.PixelEncodinginparser.cwhile keepingcmode.pixel_encodinguntouched as the upstream encoding and carrying downstream 4:2:0 inDCP_COLOR_FLAG_DOWNSTREAM_420(dcp_color_entry.flags, still 8 bytes withstatic_assertbounds).dcp_display_mode, adddcp_select_color_mode()(dcp-color.h) mapping EOTF,Colorspace,color format,Broadcast RGB, andmax bpconto the catalogue, gating pass 2 (unsafe fallback) strictly on!mode->sdr_usable && mode->sdr_unsafefor both SDR and HDR.Broadcast RGB,color format,max bpc, and wide-gamutColorspaceproperties only oniomfb_templateexternal pipes (dcp_ext_color_props_supported()/apple_typec_port_color_props()) soext26and nativev14_7/v26_6pipes keep their existing surface.<connector>/color_statedebugfs reporting activetiming_id,color_id, depth, format, colorimetry, EOTF, range,vrr_enabled,output_pq/hdr/edr, and live DCPAV HDR InfoFrame state.!mode->sdr_usable && mode->sdr_unsafe), bounded by the timing's highest unsafe SDR wire bpp (sdr_unsafe_max_bpp).minRR = 0) when leaving VRR oniomfb_template.READ_ONCE(dcp->iomfb_template_pq) && !dcp_vrr_live(dcp)(with the V27 panel guard) indcp_crtc_atomic_check()so non-live-VRR pipelines modeset onVRR_ENABLEDtransitions without enumerating firmware versions.VRR_ENABLED 0->1whendcp_vrr_live()is true afterdcp_takeover_adopt()(!dcp->vrr_enabled && !dcp->vrr_failed), armingVRR=YES(24..120 Hz) while keeping boot flicker-free and all subsequentVRR_ENABLEDtoggles live; also populatedcp->active_colorunderdcp->hdr.lockindcp_takeover_adopt().struct dcp_display_modeandcolor_scoresoff the stack (kcalloc,dcp_find_mode(),kzalloc_obj+__free(kfree)), keeping all modified functions under-Wframe-larger-than=1024.Evidence
Local & CI verification (exact head
d199ac168c7ef2)python3 tools/asahi/run-host-tests.py --only dcp: 56/56 PASS (includingapple-dcp94/94 PASS)arm64 LLVM=1 W=1build: 0 C warnings/errors; all modified functions pass-Wframe-larger-than=1024scripts/checkpatch.pl --no-tree: 0 errors, 0 warningsJ473 exact-head
d199ac168c7ef2R4 (HDMI-A-1Acer QG270 S3 +DP-2MSI MPG 325CQRXF, 36/36 KMS + GNOME HDR + macOS 27.2 parity)26B123) parityHDMI-A-1/DP-21080p180/1440p144color:86(10b RGB) /color:80(8b RGB)hdr_service=1 hdr_infoframe=0fleet87HDMI-A-1(MCDP29XX)1920x1080@180(timing:78)color:113(10b RGB BT2020_RGB PQ Full, 30 bpp)hdr_infoframe=1(0x15)1080p180HDRDSC=NOtype=0x87(10b YCbCr444, 30 bpp; explicitYCbCr444->color:116)DP-2(MCDP2900)2560x1440@144(timing:78)color:105(12b YCbCr422 (2) BT2020_YCC PQ Limited)hdr_infoframe=1(0x15)12b encoding=2 [YCbCr 4:2:2] Limited BT.2020,DSC=NO,type=0x87)HDMI-A-1/DP-21080p180/1440p144color:86/color:80hdr_infoframe=0(0x14)0x87stoppedDP-2/HDMI-A-13840x2160@60/1080p120color:119(8b YCbCr420 (1) SDR Limited); 5/5 unsafe negative-EINVALhdr_infoframe=0DownstreamFormat4:2:0 SAFE selected; unsafe SDR/PQ on safe timings rejected-EINVAL0x15+ DPMS restoreHDMI-A-1/DP-21080p60/1440p60color:113/color:105(MaxCLL 418->600 / 700)0x15sends, 50x14stopsJ616s exact-head
d199ac168c7ef2active ProMotion VRR hardware tracefs (dcp:iomfb_swap_complete,n=34each)VRR_ENABLED=0(min 0x780000/ 120 Hz)VRR_ENABLED=1(min 0x180000/ 24 Hz)11.111 msnon-divisor)med=8.334 ms,p95=16.673 ms,grid120=0.010 ms,err=3.674 msmed=12.472 ms,p95=12.525 ms,max=12.531 ms,grid120=2.727 ms,err=1.920 ms13.889 msnon-divisor)med=16.652 ms,p5=8.340 ms,p95=20.780 ms,err=3.290 msmed=12.506 ms,p5=12.489 ms,p95=16.670 ms,err=1.879 ms16.667 msdivisor)med=16.666 ms,err=0.004 msmed=16.666 ms,err=0.006 ms25.000 msdivisor)med=25.000 ms,err=0.006 msmed=25.000 ms,err=0.007 ms