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=1796220861; b=Y/z+w7zVxIm/dVYp0/GrH6RAwQyyP+2r4tmwTPVMkqWUMsmmZpi7Si6LrojjRf+4hpSO LLIUDVZcu2uefHfdTAzeHGTsfUpcOvoX+1Jl6aFqw9dWdoTOGiXyD33dECEgPnw0x3J66 zDSIJ0pdtGZ/Zw67bQX/ijDclTtJiqU9Ui53qHr7zGUNhAI9uKJL7D8HtNA7IufQjZZTa bAC3mX881PEl8V0BMzBXCF2YXhKUq8LlPr543F3Y80riYS8Ri+EcaYAHsgx8nYelJ9mkp XNiLqyoedv8UUfvIdrhaqtiBYdmtlikbEjjtS4vDEtzjgj3bCaDtF3PGoSrsjyLbTBQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220861; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=gC1IMxuy4BBaOTDktPxmTLpX/m9kXfTL97PRGIJEs1I=; b=l9wdbyqK0Z+fJpv3iuimnHyY43hmcZMNl/t7aCH8ya9uEI+rMxou28LSorEO9rNhGlWu ifeyz/cKHsPqNv+LdMhxYl3orpw6/8qDdgnSCBXdtluiPN5osvQIseLm4crpGnUYhqllG 6ez2ifAlisRjufGGhzLuu9zVzgUwKRcbavrKdvxSa8Ix651j/bD633jg035wDsnbQoEif QOdFz0xT0GNlu4DWbXZGIqLD1Wl+iosfyrg7wksJtw3xEu0F9j4rl3Qsroh67z3Da+0cF EMpvf8Ek9bv1MonP0u1HWYhtJ/y2HCErcFj5i1cOjeNtF2nFcTQjma3DsjCpkdgXBJQ== 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="dO4/UXoq"; 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 58229606A322 for ; Wed, 2 Dec 2026 14:14:21 +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=dO4/UXoq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 365E61F00896; Wed, 2 Dec 2026 14:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796220860; bh=gC1IMxuy4BBaOTDktPxmTLpX/m9kXfTL97PRGIJEs1I=; h=Subject:To:Cc:From:Date; b=dO4/UXoqfDUd1RlFCt+Vv3OtjPFjnkDIcc+w7dBeusgnpR0kU/gEvwOOYXess4a2a DRiyRtNz8CbxVs+C2SJYwTGcOrbRHVdJQWAot85PkrBk0tyxZtOu0D0rErAtGn8a/J w4H2IaPv3aV0E5JJof0tLTox5KB5LBWxWZz1W1xI= Subject: FAILED: patch "[PATCH] drm/vc4: Look up the async page flip fence before committing" failed to apply to 6.1-stable tree To: mcanal@igalia.com,itoral@igalia.com Cc: From: Date: Wed, 02 Dec 2026 13:46:39 +0100 Message-ID: <2026120239-gangway-daunting-8a46@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.1-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.1.y git checkout FETCH_HEAD git cherry-pick -x f9fc6da01a290609428d308033143f1d96ab658f # git commit -s git send-email --to '' --in-reply-to '2026120239-gangway-daunting-8a46@gregkh' --subject-prefix 'PATCH 6.1.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;