From f7e22b4ff26aefceb15b302be9c52a8c4dbea123 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Wed, 25 Nov 2026 12:05:57 +0000 Subject: [PATCH] drm/apple: m4: read the notch rows of the M4 panel too The notch-free geometry is wired up on the M4 (firmware 26.6.2) path: the modes, the check, the swap's destination row. But the bind of an M4 DCP returns before apple,notch-height is read, so notch_rows is always 0 there, the notch-free twin is never offered and the panel has no "notch" property. Read them before iomfb_m4_start(). Seen on a J713 (26.6.2) with an earlier tree and another implementation of the same swap: the firmware shows a 2560x1600 frame at destination row 64 with the rows above it black, also across DPMS. Signed-off-by: Eduardo --- drivers/gpu/drm/apple/dcp.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index c4934fcb3fef3..bb20ad720c87c 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -7580,6 +7580,24 @@ static int dcp_ext26_start_resident(struct apple_dcp *dcp) return ret; } +/* + * The notch rows are a fact of the panel; whether they are drawn on is the + * boot loader's choice first, then the user's, at run time (see dcp-notch.h). + */ +static void dcp_read_notch(struct apple_dcp *dcp) +{ + of_property_read_u32(dcp->dev->of_node, "apple,notch-height", &dcp->notch_rows); + dcp->notch_rows = min_t(u32, dcp->notch_rows, MAX_NOTCH_HEIGHT); + dcp->notch_policy = boot_show_notch() ? DCP_NOTCH_SHOWN : DCP_NOTCH_HIDDEN; + if (!dcp_notch_dynamic(dcp) && dcp->notch_policy == DCP_NOTCH_HIDDEN) + dcp->notch_height = dcp->notch_rows; + if (dcp->notch_rows) + dev_info(dcp->dev, "Detected display with notch of %u pixel (%s%s)\n", + dcp->notch_rows, + dcp->notch_policy == DCP_NOTCH_SHOWN ? "shown" : "hidden", + dcp_notch_dynamic(dcp) ? "" : " for this boot"); +} + static int dcp_comp_bind_pipe(struct device *dev, struct device *main, void *data) { struct device_node *panel_np; @@ -7605,6 +7623,7 @@ static int dcp_comp_bind_pipe(struct device *dev, struct device *main, void *dat ret = dcp_pin_live_session(dcp); if (ret) return ret; + dcp_read_notch(dcp); ret = iomfb_m4_start(dcp, main); if (!ret) WRITE_ONCE(dcp->active, true); @@ -7676,21 +7695,7 @@ static int dcp_comp_bind_pipe(struct device *dev, struct device *main, void *dat dev_info(dev, "DCP index:%u dptx target phy: %u dptx die: %u\n", dcp->index, dcp->dptx_phy, dcp->dptx_die); - /* - * The notch rows are a fact of the panel; whether they are drawn on is - * the boot loader's choice first, then the user's, at run time (see - * dcp-notch.h). - */ - of_property_read_u32(dev->of_node, "apple,notch-height", &dcp->notch_rows); - dcp->notch_rows = min_t(u32, dcp->notch_rows, MAX_NOTCH_HEIGHT); - dcp->notch_policy = boot_show_notch() ? DCP_NOTCH_SHOWN : DCP_NOTCH_HIDDEN; - if (!dcp_notch_dynamic(dcp) && dcp->notch_policy == DCP_NOTCH_HIDDEN) - dcp->notch_height = dcp->notch_rows; - if (dcp->notch_rows) - dev_info(dev, "Detected display with notch of %u pixel (%s%s)\n", - dcp->notch_rows, - dcp->notch_policy == DCP_NOTCH_SHOWN ? "shown" : "hidden", - dcp_notch_dynamic(dcp) ? "" : " for this boot"); + dcp_read_notch(dcp); /* initialize brightness scale to a sensible default to avoid divide by 0*/ dcp->brightness.scale = 65536;