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=1796214090; b=yv/NxWbP8TnH1rpYvHeAQg51E+e4dopENozK2cm7sTdMm4KZwgGz1jmCHOR9DHICIUOZ cpV8DH/rCmsuTFpgBu7ItHha4QWYTL5LLc7ULRme2fIqMw6+D8DfapqQY2vewO+lrMUCD CpTy5XWJiTEFSvrLfD/4PSHYc4K/EoTe5i7zVQz31LqX6XlxfDjtM2ap8ZPqmyfum2PFL LSdjdK8eqJlWqxSw97kHkBOJemTU6x3tZ1nTxjRTeY1feRvCsUE+DocOXtJIRazUmjy6X C3LQOFXlLv3Kn1rAwtwbGjOtuVMxxmI3VkXSUhIc0dAbhzmIY2hmSeaVU1bwN26L2Xg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796214090; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:In-Reply-To:References:Organization:X-Mailer:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=N5w5Kkp6hW1t21gxpJZo7tgtRYmwHqkzO5D6Vlyso+s=; b=C+l3ZYTW8pqFGuMLACEPgpuyw1DV253sTP8CtS9PPZhP7rFKWe3fDOLGPTlFuA0EGzmX 8H8eNPzVhLI2nWzAse4kLEQ0zZjBmYgEJDxcxsSSv3WRCoUOBxCL9tHfyymI2hW2cpdP0 JJK+9uP90YsNIkuZlKNJwz9hgsNSQZf6vSB1ObxOi2FM55qSh9pKWKd2haLmQDpwqOr4f UZrLP01R/4CQWDXrHJ7wEtC2G/JIrva4181GYJze2wzV+aRj3vFnYBE39vgtoXhJHUuJM Y7Zgp6rbF2vRDJA/d5/Bu7pXL2l9JJd6FTO2C7IkmUSbTwHXTuTCzoWq4+vUrTEUBuA== 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=pydR3RAU; 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 C4BB6606A322; Wed, 2 Dec 2026 12:21:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C4BB6606A322 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) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=pydR3RAU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796214088; bh=jThdjhdZY8T4h4sk0cIOgyS4UFS9gKe7P7Q1AMN9XH0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pydR3RAUIkhfmbDVmk6gb0cuQiuqURUQGjlpVSOR2FAI27d8bYAUozjAn/QmkMyny HUN8+iHdi5v7U2eIfWZ0S3uXuZo9zJX/A9iZi2Rykpd4EALWKKeHCzDYgQVrOiqr6j XHUVgt8aYwgIQEYSexoe7xQ1ZYrqal+skb8cIuQQzK5x3tKK+hL3mVIuY4kd9o5xxC rj2oYoMjVC67cD7sB+WoqjkV6sy45rUbeywqnyPscYih8zuH7sWeLGAcFWfrooVShC 9vdE3q/6ExDFsJh9i5w3NoOAIyCXAn5tKgn7fq9mW5JSUpYmcDCDrR8DXL+dNLE2Uw ANMAo+vi5f9ag== Received: from fedora1.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 3AF2817E03D4; Wed, 02 Dec 2026 13:21:27 +0100 (CET) Date: Wed, 2 Dec 2026 13:21:21 +0100 From: Boris Brezillon 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 , Christian =?UTF-8?B?S8O2bmln?= , Philipp Stanner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Xianzhong Li Subject: Re: [PATCH v4 2/3] drm/sched: Add a drm_sched_job_add_dependency_unwrapped() helper Message-ID: <20261202132121.1044c6b5@fedora1.home> In-Reply-To: <20261202-panhtor-dep-skip-v4-2-f84482d7a49c@collabora.com> References: <20261202-panhtor-dep-skip-v4-0-f84482d7a49c@collabora.com> <20261202-panhtor-dep-skip-v4-2-f84482d7a49c@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) X-Mailing-List: linux-media@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=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 02 Dec 2026 12:34:18 +0100 Boris Brezillon wrote: > drm_sched_job_add_dependency() adds the dependency as is to the job, > but drivers like to have containers unwrapped and each individual fence > added as a dependency so they can skip same-queue dependencies and > benefit from hardware pipelining. > > We don't make this behavior the default to not regress the existing > drm_sched_job_add_dependency() users. Note that > drm_sched_job_add_{resv,implicit}_dependencies() don't need this > unwrapping because it already happened at resv update time. We could > add a drm_sched_job_add_syncobj_dependency_unwrapped() variant, but > there's no known user for that yet, so let's postpone this until > someone actually needs it. > > Signed-off-by: Boris Brezillon > --- > drivers/gpu/drm/scheduler/sched_main.c | 29 +++++++++++++++++++++++++++++ > include/drm/gpu_scheduler.h | 2 ++ > 2 files changed, 31 insertions(+) > > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c > index 5f123a5e39ff..6449d74b5218 100644 > --- a/drivers/gpu/drm/scheduler/sched_main.c > +++ b/drivers/gpu/drm/scheduler/sched_main.c > @@ -66,6 +66,7 @@ > * This implies waiting for previously executed jobs. > */ > > +#include > #include > #include > #include > @@ -708,6 +709,34 @@ int drm_sched_job_add_dependency(struct drm_sched_job *job, > } > EXPORT_SYMBOL(drm_sched_job_add_dependency); > > +/** > + * drm_sched_job_add_dependency_unwrapped - unwrap the fence (if this is a > + * container) and add the resulting fences as job dependencies > + * @job: scheduler job to add the dependencies to > + * @fence: the dma_fence to add to the list of dependencies. > + * > + * Note that @fence is consumed in both the success and error cases. > + * > + * Returns: > + * 0 on success, or an error on failing to expand the array. > + */ > +int drm_sched_job_add_dependency_unwrapped(struct drm_sched_job *job, > + struct dma_fence *fence) > +{ > + struct dma_fence *inner_fence; > + int ret; For the record, missing ret = 0 initialization here. > + > + dma_fence_unwrap_for_each(inner_fence, fence) { > + ret = drm_sched_job_add_dependency(job, dma_fence_get(inner_fence)); > + if (ret) > + break; > + } > + > + dma_fence_put(fence); > + return ret; > +} > +EXPORT_SYMBOL(drm_sched_job_add_dependency_unwrapped); > + > /** > * drm_sched_job_add_syncobj_dependency - adds a syncobj's fence as a job dependency > * @job: scheduler job to add the dependencies to > diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h > index 3b0978fa8cf0..5308f53d3168 100644 > --- a/include/drm/gpu_scheduler.h > +++ b/include/drm/gpu_scheduler.h > @@ -694,6 +694,8 @@ void drm_sched_job_arm(struct drm_sched_job *job); > void drm_sched_entity_push_job(struct drm_sched_job *sched_job); > int drm_sched_job_add_dependency(struct drm_sched_job *job, > struct dma_fence *fence); > +int drm_sched_job_add_dependency_unwrapped(struct drm_sched_job *job, > + struct dma_fence *fence); > int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job, > struct drm_file *file, > u32 handle, >