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=1796220853; b=MV4dxKVUvuzG6eWOA0IeCPKCV8yeld3EnfSpQOlqrHIkxgKlKPIdlIXK7uaJ5IPl/Nfw CUT6Kaw+uKDIZajX0BEn0fpJXgj6jin9UAoXyFpOKqXSJOB6weTB8hghhY0FyuuHo8zW4 cOQdnb9qvAyzLT8P/VvZSjuR3RX66R7PGbIgJS+Pfzpo89z6d7wfcC/wKs+kuUJJ+e1Pi zIu2ynhIwPqiElJKJpEN+CfM5qHp54RAaMVA+a4U91+jGElacCeKy+Ph2RRImz6AwS3C1 XHGqTReZI9NqILzBPf9pYvRA0KfDB8Qn+8QkqTQmKAlDNYdEf+3GrzCh3pJ1xVIQIMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220853; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=74oQenXbKmAzL7LjjdeUZm483LfTHEjpHmhWz6IGC18=; b=mWKz7Uk9HKapIevQlV/+qTMo2FMCu6ESkMI4l3AILw5zxAhF95lnI4vwRMWyUKXxorKn NeHvzcEs9KAwqNdfDcKe6mxis/WgC65tRCca190CeYthJPvLk98HY01jKRiE3fycZb9Bx 8O0ceEmCFm8B8+nw3IMNO9j22OthRXj2EDe7DIMASwZ6A8TQISgfqodj2Pjdei0x7dshv VXUCOmBjrwcxWdbaVzkXqFREbQtAFfkA0RH4qWcAUqe6O7t2xMzziZ+LjapBYbFUK9tmm 4Lp+7g2uMLrS47rGu7iw1VZ4htOHbgP+cTx0qfZjIBSgzRa70R1GdzP1m/vxPkRTneQ== 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=nt0dsaEG; 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 D3F0B606A32F for ; Wed, 2 Dec 2026 14:14:13 +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=nt0dsaEG Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6CA81F00896; Wed, 2 Dec 2026 14:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796220853; bh=74oQenXbKmAzL7LjjdeUZm483LfTHEjpHmhWz6IGC18=; h=Subject:To:Cc:From:Date; b=nt0dsaEGCn8wrYzMxtRBi4nft4tw0ojOCmvQxh2HoqtlcIBhQk9RS9ILni2FSaHkp vFfxLFjwp/ai2FuP8uqc4ZAkZwiMVrevTPp+s68E3SZGUcowlDYV9uFs3uuFGVQ78m y3jVOQXqwGrMfqed1CKA2tDCRrUD4jOR5AsMsAIM= Subject: FAILED: patch "[PATCH] drm/vc4: Look up the async page flip fence before committing" failed to apply to 6.12-stable tree To: mcanal@igalia.com,itoral@igalia.com Cc: From: Date: Wed, 02 Dec 2026 13:46:13 +0100 Message-ID: <2026120213-curdle-upstate-5486@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.12-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.12.y git checkout FETCH_HEAD git cherry-pick -x f9fc6da01a290609428d308033143f1d96ab658f # git commit -s git send-email --to '' --in-reply-to '2026120213-curdle-upstate-5486@gregkh' --subject-prefix 'PATCH 6.12.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;