From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796220857; b=VBL9B414z13y18eabXzamGmsfS2PDqXtxR0Yie8XoTxok8HssC2rTwV5Id0sYpQPjMX8 DmA9Dmmvb1DM1J/w9S+Dk3O8R3bpFZ+oB1TR13cl1D38zAAs6pMvO0m3T6GCy/U0hVnH4 IITZSQ4OiovkHQd4jWXf5zB+Jkp4IqzZPPJtB6GnsO/1rYXQUGeSlVudxEbm0epyfaw36 drjjyDRNyLekb8+ivlr1LEAmxulq7EQ4z8ZeIlyrr3gKQMp1IGZWSoa8jpS9bhJO9nfCs Oo+1LEgFzSbpPQsUiD18O8wO5yR53PWUtr4gcKeU4f7ckjGCOsaoRLQCO9cm8/BEu9g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220857; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=es8Zmugeyz0yEsN8UzKzdrB64gHDZ9oKCMmd2IxVjeg=; b=jkPucozEE+0Mw3Zsx/PUoNpxHR25Py6SVyQweNCjzATLWe+zED+CsYjx1eYgKSFChIAm f+L7vbeqOiDG2H+KxJ+guxmnH2rtABOPfCpgL2QcJfRRWzeoF1tfCjv5DGW2UWdIsr7u9 DtHQOwOn3djvSQu3URVBrlXTIGEt7NNkV0FLQR2dnY8/lPF17hdSQbymY9nBR12D0EbXz qinSTpDtuwWuE1Kkw2VGhXM+A44npw9FdlnZa86OgdNsw037sH49kOodeM2pZe1KIiMFZ 0+e9B3fWoLCQutOk7STrVyPpCb9ZOlS1avRZ7VeTU5v6k7dW47QEe2etDnO29HBX3ww== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2F5DTSPz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB662606A327 for ; Wed, 2 Dec 2026 14:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2F5DTSPz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74C7F1F0089C; Wed, 2 Dec 2026 14:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796220857; bh=es8Zmugeyz0yEsN8UzKzdrB64gHDZ9oKCMmd2IxVjeg=; h=Subject:To:Cc:From:Date; b=2F5DTSPz1gFguIhsGNR0rUoX2SZa8zitkvdHqL3VBP78m5yx3DtFlqcExFhuaWW25 zLDi++kq8D2/2kGuYjHyB/vvuOyeSKHvYqf/a0ZsG1U2oIR5Wuvt7JCym8h2lVcN8A NoWtOblS7KCpQhvCwgOfU/8xYCcIeEkMTTcjZ0Cw= Subject: FAILED: patch "[PATCH] drm/vc4: Look up the async page flip fence before committing" failed to apply to 6.6-stable tree To: mcanal@igalia.com,itoral@igalia.com Cc: From: Date: Wed, 02 Dec 2026 13:46:33 +0100 Message-ID: <2026120233-outgoing-surfer-edf9@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x f9fc6da01a290609428d308033143f1d96ab658f # git commit -s git send-email --to '' --in-reply-to '2026120233-outgoing-surfer-edf9@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From f9fc6da01a290609428d308033143f1d96ab658f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= Date: Sat, 14 Nov 2026 16:16:52 -0300 Subject: [PATCH] drm/vc4: Look up the async page flip fence before committing the flip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vc4_async_page_flip_common() ignores dma_resv_get_singleton() failures. By then the plane state already points at the new framebuffer, so the flip is never completed. So, its state leaks, the vblank reference is never dropped and the event is never sent. Look up the fence before changing any state, so the error can be properly returned to userspace. Cc: stable@vger.kernel.org Fixes: d19e00ee06a9 ("drm/vc4: crtc: Fix out of order frames during asynchronous page flips") Reviewed-by: Iago Toral Quiroga Link: https://patch.msgid.link/20261114-vc4-async-flip-fixes-v2-3-d33cbe99ed5d@igalia.com Signed-off-by: MaĆ­ra Canal diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 177ee27ab6d1..4b6d4a5f7bc9 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -948,33 +948,22 @@ static void vc4_async_page_flip_fence_cb(struct dma_fence *fence, queue_work(vc4_crtc->async_flip_wq, &flip_state->work); } -static int vc4_async_set_fence_cb(struct drm_device *dev, - struct vc4_async_flip_state *flip_state) +static void vc4_async_set_fence_cb(struct vc4_async_flip_state *flip_state) { - struct drm_framebuffer *fb = flip_state->fb; - struct drm_gem_dma_object *dma_bo = drm_fb_dma_get_gem_obj(fb, 0); struct vc4_crtc *vc4_crtc = to_vc4_crtc(flip_state->crtc); - int ret; INIT_WORK(&flip_state->work, vc4_async_page_flip_work); - ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ, - &flip_state->fence); - if (ret) - return ret; - if (flip_state->fence && !dma_fence_add_callback(flip_state->fence, &flip_state->cb, vc4_async_page_flip_fence_cb)) - return 0; + return; /* No fence or the fence has already signaled. Complete the flip * immediately, after earlier queued flips. */ flush_workqueue(vc4_crtc->async_flip_wq); vc4_async_page_flip_work(&flip_state->work); - - return 0; } static int @@ -983,14 +972,22 @@ vc4_async_page_flip_common(struct drm_crtc *crtc, struct drm_pending_vblank_event *event, uint32_t flags) { - struct drm_device *dev = crtc->dev; + struct drm_gem_dma_object *dma_bo = drm_fb_dma_get_gem_obj(fb, 0); struct drm_plane *plane = crtc->primary; struct vc4_async_flip_state *flip_state; + int ret; flip_state = kzalloc_obj(*flip_state); if (!flip_state) return -ENOMEM; + ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ, + &flip_state->fence); + if (ret) { + kfree(flip_state); + return ret; + } + drm_framebuffer_get(fb); flip_state->fb = fb; flip_state->crtc = crtc; @@ -1016,7 +1013,7 @@ vc4_async_page_flip_common(struct drm_crtc *crtc, */ drm_atomic_set_fb_for_plane(plane->state, fb); - vc4_async_set_fence_cb(dev, flip_state); + vc4_async_set_fence_cb(flip_state); /* Driver takes ownership of state on successful async commit. */ return 0;