From c2ccc4f4bc096f7c5721356e940372b9942443a2 Mon Sep 17 00:00:00 2001 From: Paul Scalise Date: Fri, 4 Dec 2026 16:54:36 -0600 Subject: [PATCH] drm/adbe: Keep the layer on screen for a colour-only commit A new CTM goes to the pipe in a packet, and the packet also carries the plane's layer. A commit that changed only the colour sent the last staged plane update, which before the first frame is still zero, so the pipe fell back to scanout address 0. Remember the format, base and stride of the layer each packet puts on screen (the boot framebuffer at probe and after a park), and repeat that layer when a commit has no plane update. Tested on an iPhone 7 (D10) booted from RAM: while CTM-only property commits set and clear the matrix, the pipe's base, format and stride registers stay on the frame being shown. GAMMA_LUT still applies, and 240 page flips take 16.67 ms each. Assisted-by: LLM Signed-off-by: Paul Scalise --- drivers/gpu/drm/adbe/adbe_drv.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/adbe/adbe_drv.c b/drivers/gpu/drm/adbe/adbe_drv.c index aadb6128c4c129..51a61a7a5cd5a3 100644 --- a/drivers/gpu/drm/adbe/adbe_drv.c +++ b/drivers/gpu/drm/adbe/adbe_drv.c @@ -382,8 +382,10 @@ struct adbe { u32 next_stride; u32 next_format; bool next_dirty; - /* Commit tail only. */ + /* Commit tail only: the layer the last packet put on screen. */ u32 cur_base; + u32 cur_stride; + u32 cur_format; bool boot_black; /* Protected by drm.event_lock. */ @@ -701,6 +703,8 @@ static int adbe_kick(struct adbe *adbe, u32 format, u32 base, u32 stride, jiffies + msecs_to_jiffies(ADBE_FLIP_TIMEOUT_MS)); adbe->cur_base = base; + adbe->cur_stride = stride; + adbe->cur_format = format; return 0; } @@ -745,6 +749,8 @@ static void adbe_park_pipe(struct adbe *adbe) spin_unlock_irqrestore(&adbe->drm.event_lock, flags); } adbe->cur_base = adbe->boot_base; + adbe->cur_stride = adbe->boot_stride; + adbe->cur_format = adbe->boot_format; } /* @@ -1056,6 +1062,7 @@ static void adbe_crtc_atomic_flush(struct drm_crtc *crtc, { struct adbe *adbe = to_adbe(crtc->dev); struct drm_pending_vblank_event *event = crtc->state->event; + bool cm_changed = false; unsigned long flags; crtc->state->event = NULL; @@ -1064,12 +1071,19 @@ static void adbe_crtc_atomic_flush(struct drm_crtc *crtc, adbe_prc_load(adbe, crtc->state->gamma_lut); if (adbe->has_cm) { adbe_cm_set(adbe, crtc->state->ctm); - adbe->next_dirty = true; /* the matrix goes in a packet */ + cm_changed = true; } } if (adbe->next_dirty) { adbe->next_dirty = false; adbe_kick(adbe, adbe->next_format, adbe->next_base, adbe->next_stride, &event); + } else if (cm_changed) { + /* + * The matrix goes in a packet, which also carries the layer. + * Without a plane update in this commit, repeat the layer on + * screen: the boot framebuffer before the first frame. + */ + adbe_kick(adbe, adbe->cur_format, adbe->cur_base, adbe->cur_stride, &event); } if (!event) return; @@ -2192,6 +2206,8 @@ static int adbe_adopt(struct adbe *adbe) adbe->boot_base1 = readl(adbe->regs + ADP_BASE + 4); adbe->boot_stride1 = readl(adbe->regs + ADP_STRIDE + 4); adbe->cur_base = base; + adbe->cur_stride = stride; + adbe->cur_format = adbe->boot_format; adbe->bus_offset = adbe->boot.start - (base & ~ADBE_ADDR_TAG); adbe->saved_inten = readl(adbe->regs + ADP_INTEN);