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=1796220849; b=ZWfaP2+XoqIdT1V3X2fdSWoiH5TtjiyB2RdciKuYyRMFzmi02Kg1X3ehRQBkFeVBZnwQ mDxEVjo7a+i3IwFaF2F6UqphZgjDmr1JGe8LpLepv95ABl9uajXaVdQd1iutYtIL8aSEf IS5vcsADuLsHwm0HhrOIettJ2N4GxON8BaqOXjOj5WOQx2EgoKYmTeWyyBnGRNdoCvluV wZTHsWFSYHtkE5hFLCguwKF9MvL8hP5UtAAMyNwFsv/P8i/nD82LRJuY5mofQNESgpiBW nJjt2v5FDvc8jg+dTvfhqyeoszYgdVF+oFqW706N0SHNaC9c1BhdPGj4UkoY6vEmhlw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220849; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=ssX4nsuBVSSPCvmsEok2h8vopX3izWjdYLdVEujYkOU=; b=C7k/BSL7UMCPXEwSwB0glUz557cwiXLnVuVM6Y4F/C7AAims6LGXPFdb1NgWO+5i7l8B /xnW9/Umvh1q4WrDzkUGxMhcNnLo0AOsKM3ccYR8c3D2vzIqwNrJbTajDj+PojIi49m46 XKp972Amv92gbY0hPOdSQeKlgpJct9usP8tYXlsYF6Isn0uynL31K8txIJ6rtAC0QKX4W ORcC2ix1nVgQwmZ3VbBYXwb+zHEV0Xh8UALiGyUdWIKQRYf801TuWTTcPwIS021oBxUVE q+ueFSgy3yP+SULZtKngKnqTf1leqmW8r0ebgsChvClagxe3JcZdRYebetNDHyHt2rA== 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=EQczvHPV; 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 8B0E1606A336 for ; Wed, 2 Dec 2026 14:14:09 +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=EQczvHPV Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF1A01F00899; Wed, 2 Dec 2026 14:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796220849; bh=ssX4nsuBVSSPCvmsEok2h8vopX3izWjdYLdVEujYkOU=; h=Subject:To:Cc:From:Date; b=EQczvHPVne84XpjCIQi0w+ztlq3Ti8u2AoAuJ4otgFWhq+om1Up9RzwzSpzm7zQRk vpl7o/zOhvnFSX7LVp44yVIeyMXlk3e6CPn5DchCQ7dkHJFqUtWieEoyLJ/s0TNb+s OUHigthD/UpyyCZxLXfh4M8+ra87AfcSTt00Ttr4= Subject: FAILED: patch "[PATCH] drm/vc4: Look up the async page flip fence before committing" failed to apply to 6.18-stable tree To: mcanal@igalia.com,itoral@igalia.com Cc: From: Date: Wed, 02 Dec 2026 13:45:52 +0100 Message-ID: <2026120252-corner-overreact-fdda@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.18-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.18.y git checkout FETCH_HEAD git cherry-pick -x f9fc6da01a290609428d308033143f1d96ab658f # git commit -s git send-email --to '' --in-reply-to '2026120252-corner-overreact-fdda@gregkh' --subject-prefix 'PATCH 6.18.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;