From f32b477021c5f44d60fbf71ed78e4b4911531072 Mon Sep 17 00:00:00 2001 From: a-ramses Date: Thu, 27 Aug 2026 21:45:44 +0200 Subject: [PATCH] drm/apple: iomfb: fix framebuffer retirement on DCP 14.7 DCP 14.7 expects the 0x234-byte A407 extension before the pointer-null flags. Linux placed the extension after the flags, so surface clear requests were not applied and stale framebuffer references could not be retired. Move the extension to the firmware layout and enable the existing framebuffer release paths for this ABI. Signed-off-by: a-ramses --- drivers/gpu/drm/apple/iomfb_template.c | 6 ------ drivers/gpu/drm/apple/iomfb_template.h | 15 +++++++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_template.c b/drivers/gpu/drm/apple/iomfb_template.c index 845e7e1d9a5cbd..a41db2949f48f8 100644 --- a/drivers/gpu/drm/apple/iomfb_template.c +++ b/drivers/gpu/drm/apple/iomfb_template.c @@ -739,8 +739,6 @@ static void dcp_swap_cleared(struct apple_dcp *dcp, void *data, void *cookie) return; } - /* TODO: Figure out how to clear surfaces for 14.x */ -#if DCP_FW_VER < DCP_FW_VERSION(14, 7, 0) while (!list_empty(&dcp->swapped_out_fbs)) { struct dcp_fb_reference *entry; entry = list_first_entry(&dcp->swapped_out_fbs, @@ -752,7 +750,6 @@ static void dcp_swap_cleared(struct apple_dcp *dcp, void *data, void *cookie) list_del(&entry->head); kfree(entry); } -#endif } static void dcp_swap_clear_started(struct apple_dcp *dcp, void *data, @@ -1153,8 +1150,6 @@ static void dcp_swapped(struct apple_dcp *dcp, void *data, void *cookie) } dcp->swap_start = ktime_get(); - /* TODO: Figure out how to clear surfaces on 14.x */ -#if DCP_FW_VER < DCP_FW_VERSION(14, 7, 0) while (!list_empty(&dcp->swapped_out_fbs)) { struct dcp_fb_reference *entry; entry = list_first_entry(&dcp->swapped_out_fbs, @@ -1166,7 +1161,6 @@ static void dcp_swapped(struct apple_dcp *dcp, void *data, void *cookie) list_del(&entry->head); kfree(entry); } -#endif } static void dcp_swap_started(struct apple_dcp *dcp, void *data, void *cookie) diff --git a/drivers/gpu/drm/apple/iomfb_template.h b/drivers/gpu/drm/apple/iomfb_template.h index f3f93c17a050f9..b07e85191f490d 100644 --- a/drivers/gpu/drm/apple/iomfb_template.h +++ b/drivers/gpu/drm/apple/iomfb_template.h @@ -112,6 +112,15 @@ struct DCP_FW_NAME(dcp_swap_submit_req) { u32 clear; // or maybe switch to default fb? #if DCP_FW_VER >= DCP_FW_VERSION(13, 2, 0) u32 unkU32Ptr; +#endif +#if DCP_FW_VER >= DCP_FW_VERSION(14, 7, 0) + /* + * The v14.7 extension precedes the pointer-null flags. macOS + * 14.8.3 A407 captures place swap_null at offset 0x1b4a; keeping + * this padding after the flags shifts them to the obsolete v13.x + * location at 0x1916 and prevents surface clears from taking effect. + */ + u8 padding_14_7[0x234]; #endif u8 swap_null; u8 surf_null[SWAP_SURFACES]; @@ -124,12 +133,6 @@ struct DCP_FW_NAME(dcp_swap_submit_req) { u8 unkU32out_null; #endif u8 padding[1]; -#if DCP_FW_VER >= DCP_FW_VERSION(14, 7, 0) - u8 padding_14_7[0x1e9]; - u8 unk_14_7_zero[0x46]; - u32 unk_14_7_u32; - u8 unk_bool; -#endif } __packed; struct DCP_FW_NAME(dcp_swap_submit_resp) {