From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.251.105.195 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796142935; b=JkzsPn2wDp4zCsueZPlMJkMrdMXa6QnMlZd+HdAQ3ub58ZR0Kha0BAWrvwX6M6rVfNca K312bepgAU+KoL3I4OsvlvGRPBM8whrofjcNU+peDZwyj+Q5rVfA1Ar43ZhpWD8nGX1G+ J5UABobWC31BOuOVYD9y3vpiyftJD5Y7ewziSKk3G4AaUXmrKT9THmXk3L9vk/1OU3icg ykrcxx9H5RBiWXw6iuil4SZPLdZLNle83jb/2tgdhdXn4DSMPMjlySDd6vV5yPS21GO0o /hRlZkqg9qSzlvwsDj4x1tlgwOT5BI8v/C9lQ3oVcVUAYMQ0ymaSsDxWdhcESFlUZtg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796142935; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key; bh=nO+oi0cT5KLY52ld0H1PqdOEYBzSpSiStxHWCfJi2Cw=; b=0H5UABhkfUPLzQJePC+C/xiGMTkxq6XWje/fQ+LL7qXK8EmgntuvvgCSxTb25sKST1G3 K2vjJC26o337sdqFq6NSK0zOxbG23VrXQzBbeJ6Oi387gH686+RUg27K0OXUOke7Okm/E O/CdrNWME/227c0IVQpxfs9wclLBypoNpuofp3tDnyqRi5DqIp/Jl2c9a58/z/+iJXJ6q +bFZo8upfXwFt2jGeyu30OlTc4DxD/xbuoAs4QyhWOEx3X5qoGBR72zVc7V+kGuk2vaFF xtRfv/KoesCOO0eFzvkdcZIiM/kq25+sdQqOAjudcb8/1ApU9YaWORwc/tXPBOaSWiw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=HG8EXPsp; arc=none smtp.remote-ip=148.251.105.195 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 927DB606A32F; Tue, 1 Dec 2026 16:35:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 927DB606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=HG8EXPsp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796142932; bh=ZNeHQhrU0RnSlsc7wY7adin4CXrnXazmA0onEfvT9FI=; h=From:Date:Subject:To:Cc:From; b=HG8EXPspTdO18P6DK6250CyoQER/0xamVzipQDu4ZMOKhPdyyZLPE4KT16JhBsYCw VzXryv3gyqLfh9mYtKJAM9nyyFi6T26NmzL/39pAJsYEafPRRAVI6cWHnjmYVjJiCu VxQF1BPEuaoLFf11Wq0wTsb9+70ooUllNA0U7GIGEWCHkszD4EtOPWojvKK8pX6ea6 tJB6dR64qC8pa7JMeKqGvGojkFaywKQC2PPn0l7dN/lv+Q34B+/rUNrSeDnSGZDu5P K5uwdKOffWo0CWchbCAvWuHOKDBboH7mBCxO+4lf4GfkymcqFA17Illc1Ty0+n7BNc h6BAGZjCYzx8Q== Received: from fedora1.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 85DB817E0E04; Tue, 01 Dec 2026 17:35:31 +0100 (CET) From: Boris Brezillon Date: Tue, 01 Dec 2026 17:35:28 +0100 Subject: [PATCH v2] drm/panthor: Explode container fences to optimize pipelining X-Mailing-List: linux-kernel@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: 7bit Message-Id: <20261201-panhtor-dep-skip-v2-1-1b38efda8a0d@collabora.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAA/33NQQ7CIBBA0auQWXdMAdPGrryH6QJhkIm1EGiIp uHuxh7A7V+8v0OhzFRgEjtkqlw4rjAJ1QmwwawPQnYwCVC9GqTqJSazhi1mdJSwPDnhxQ5Gk/K jtSN0AlImz++DvM2dgMBli/lzHKr81T9YlSjxrJXXUjsyvb/auCzmHrM52fiCubX2BZJpWrK0A AAA X-Change-ID: 20261201-panhtor-dep-skip-9c6a3e2f7cc7 To: Steven Price , Liviu Dudau , Akash Goel , Karunika Choo , Lukas Zapolskas , Chris Diamand Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Philipp Stanner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Boris Brezillon , Xianzhong Li X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796142931; l=2846; i=boris.brezillon@collabora.com; s=20260429; h=from:subject:message-id; bh=ZNeHQhrU0RnSlsc7wY7adin4CXrnXazmA0onEfvT9FI=; b=lYAVdV0m3+gGlzZtr5esspNvhFiH1MGAcRv/WE/c+OUDOpl8qBiv8p17PWcv9Slzj8DJAhYVK v2xBl/DsvtuAavSYp0NeJmPt+/Mpbb5U1N0MWeTYCObiYv1MlUKrZ20 X-Developer-Key: i=boris.brezillon@collabora.com; a=ed25519; pk=eN+ORdOgQY7d5U+0kA8h5bf67XdD8bhKbjD/TCHexSY= If a job is passed a dependency that's coming from the same queue the job is targeting, we can get rid of the dependency because of the implicit serialization provided by the queue. This will allow us benefit from the pipelining provided by the ring buffer (no extra MCU <-> CPU round-trip to have the job pushed to the ring buffer). drm_sched_entity_add_dependency_cb() already has this optimization in place, all we need to do is explode the chain/array containers with a dma_fence_unwrap_for_each() when we add job dependencies. Signed-off-by: Boris Brezillon Cc: Xianzhong Li --- Some recent effort to improve job pipelining [1] showed that the MCU <-> CPU round-trip that lets us signal job fences adds a non-negligible overhead, and this problem seems to be easier and more systematically fixed if it's addressed at the KMD side, so here's a patch doing exactly that. [1]https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/46172 --- Changes in v2: - Explode container fences with dma_fence_unwrap_for_each() instead of and rely on drm_sched_entity_add_dependency_cb() elimination instead of open-coding it --- drivers/gpu/drm/panthor/panthor_drv.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c index dc8d0191aef4..a527ce86a113 100644 --- a/drivers/gpu/drm/panthor/panthor_drv.c +++ b/drivers/gpu/drm/panthor/panthor_drv.c @@ -7,6 +7,7 @@ #include #endif +#include #include #include #include @@ -612,8 +613,9 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx, int ret = 0; for (u32 i = 0; i < sync_op_count; i++) { + struct dma_fence *fence, *inner_fence; struct panthor_sync_signal *sig_sync; - struct dma_fence *fence; + struct dma_fence_unwrap iter; if (!sync_op_is_wait(&sync_ops[i])) continue; @@ -637,9 +639,16 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx, return ret; } - ret = drm_sched_job_add_dependency(job, fence); - if (ret) - return ret; + /* Explode containers so that drm_sched_entity_add_dependency_cb() can + * eliminate fences that are coming from the same queue. + */ + dma_fence_unwrap_for_each(inner_fence, &iter, fence) { + ret = drm_sched_job_add_dependency(job, inner_fence); + if (ret) { + dma_fence_put(iter.chain); + return ret; + } + } } return 0; --- base-commit: 28f286b0dfa9610d4ee2447415e964e8bc603056 change-id: 20261201-panhtor-dep-skip-9c6a3e2f7cc7 Best regards, -- Boris Brezillon