From patchwork Thu Feb 9 12:44:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13134511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC120C05027 for ; Thu, 9 Feb 2023 12:46:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EACBF10EAB4; Thu, 9 Feb 2023 12:46:17 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 530D510EAB4 for ; Thu, 9 Feb 2023 12:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=HvoF000wzIR7TT3ihMI1xDghTf2N8ZGbeFTkmv+bPaE=; b=fImrussJ0KpV+c/A9iRcxCJjDi oTlY66QXpMckoQ3fip4KT4NgHciZSnpMVDI+RPZ1kMFzvmQamaZ40+Idwgd3EAysRVgj94wDz1CpX wX4FyWw07HH8OnjFXnarwPWmzKksjurAaVJEJjpuDvfB8Y5MAdqCm/1u2rDMqNWgALWYsVGRzGfNg Saf3G6AaxJvWTnXyUpVredcLvO0W93Yg5WTkOIYV0u4OrAiMDbSd4BNW6xEk0VGXk1AjB7JCPIaGz aZ5N2EDWwGP+prgtXaTKymKAZo2Pxfg1RKv+LQKoTN5bfEd9pybkOpSJTHCfAC6IHd/7HeJYLt2EX 1rmKo0YA==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pQ6JO-00DvU2-LY; Thu, 09 Feb 2023 13:46:03 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Luben Tuikov , David Airlie , Daniel Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Rob Clark , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Melissa Wen Subject: [PATCH v2 1/5] drm/sched: Create wrapper to add a syncobj dependency to job Date: Thu, 9 Feb 2023 09:44:44 -0300 Message-Id: <20230209124447.467867-2-mcanal@igalia.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209124447.467867-1-mcanal@igalia.com> References: <20230209124447.467867-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to add a syncobj's fence as a dependency to a job, it is necessary to call drm_syncobj_find_fence() to find the fence and then add the dependency with drm_sched_job_add_dependency(). So, wrap these steps in one single function, drm_sched_job_add_syncobj_dependency(). Reviewed-by: Christian König Reviewed-by: Luben Tuikov Signed-off-by: Maíra Canal --- drivers/gpu/drm/scheduler/sched_main.c | 29 ++++++++++++++++++++++++++ include/drm/gpu_scheduler.h | 6 ++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 0e4378420271..9b16480686f6 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -718,6 +719,34 @@ int drm_sched_job_add_dependency(struct drm_sched_job *job, } EXPORT_SYMBOL(drm_sched_job_add_dependency); +/** + * drm_sched_job_add_syncobj_dependency - adds a syncobj's fence as a job dependency + * @job: scheduler job to add the dependencies to + * @file_private: drm file private pointer + * @handle: syncobj handle to lookup + * @point: timeline point + * + * This adds the fence matching the given syncobj to @job. + * + * Returns: + * 0 on success, or an error on failing to expand the array. + */ +int drm_sched_job_add_syncobj_dependency(struct drm_sched_job *job, + struct drm_file *file, + u32 handle, + u32 point) +{ + struct dma_fence *fence; + int ret; + + ret = drm_syncobj_find_fence(file, handle, point, 0, &fence); + if (ret) + return ret; + + return drm_sched_job_add_dependency(job, fence); +} +EXPORT_SYMBOL(drm_sched_job_add_syncobj_dependency); + /** * drm_sched_job_add_resv_dependencies - add all fences from the resv to the job * @job: scheduler job to add the dependencies to diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 9935d1e2ff69..4cc54f8b57b4 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -48,6 +48,8 @@ struct drm_gem_object; struct drm_gpu_scheduler; struct drm_sched_rq; +struct drm_file; + /* These are often used as an (initial) index * to an array, and as such should start at 0. */ @@ -515,6 +517,10 @@ int drm_sched_job_init(struct drm_sched_job *job, void drm_sched_job_arm(struct drm_sched_job *job); int drm_sched_job_add_dependency(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, + u32 point); int drm_sched_job_add_resv_dependencies(struct drm_sched_job *job, struct dma_resv *resv, enum dma_resv_usage usage); From patchwork Thu Feb 9 12:44:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13134512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82CA1C61DA4 for ; Thu, 9 Feb 2023 12:46:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBF0110EAB8; Thu, 9 Feb 2023 12:46:25 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59CE410EAB8 for ; Thu, 9 Feb 2023 12:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=rNUEXqoODhXPBUInTmCiAwVWDHFRnHDxTjsYEuYJ+30=; b=ASOb9XEXpQl6/HbBXTUshlaE3e 3wzqQnCyDDK9gFd6Vh9bMuqjLTIuCtVT6tfyJJWlHzLdUZsm4YbJqsLDdmozz8n2YZumobnKk5Oq7 28q4Zri6ydyQzKEeD72NHYJB6zIsfS8llYrQVF967en//fzE069lfZQcti5fSK1XErb+qGO66zeeu u5B7REVZbRSA7AFWxEGaGrIOBdhtfsYTxzyg1D6p/ppXeIb7jn2fchzArhsNyB4tz+CHcs4g5yBVW 8Ev+ga5n4/wF7GRHrhBajs2J4bnJDt5X+I6rAdN5zWD9WVbOGpok19byfeotYPxX1KUzt8V54ofnE I4fd/3gw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pQ6JU-00DvU2-Ov; Thu, 09 Feb 2023 13:46:09 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Luben Tuikov , David Airlie , Daniel Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Rob Clark , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Melissa Wen Subject: [PATCH v2 2/5] drm/lima: Use drm_sched_job_add_syncobj_dependency() Date: Thu, 9 Feb 2023 09:44:45 -0300 Message-Id: <20230209124447.467867-3-mcanal@igalia.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209124447.467867-1-mcanal@igalia.com> References: <20230209124447.467867-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As lima_gem_add_deps() performs the same steps as drm_sched_job_add_syncobj_dependency(), replace the open-coded implementation in Lima in order to simply use the DRM function. Signed-off-by: Maíra Canal --- drivers/gpu/drm/lima/lima_gem.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c index 0f1ca0b0db49..10252dc11a22 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -277,21 +277,13 @@ static int lima_gem_add_deps(struct drm_file *file, struct lima_submit *submit) int i, err; for (i = 0; i < ARRAY_SIZE(submit->in_sync); i++) { - struct dma_fence *fence = NULL; - if (!submit->in_sync[i]) continue; - err = drm_syncobj_find_fence(file, submit->in_sync[i], - 0, 0, &fence); + err = drm_sched_job_add_syncobj_dependency(&submit->task->base, file, + submit->in_sync[i], 0); if (err) return err; - - err = drm_sched_job_add_dependency(&submit->task->base, fence); - if (err) { - dma_fence_put(fence); - return err; - } } return 0; From patchwork Thu Feb 9 12:44:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13134513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24B66C61DA4 for ; Thu, 9 Feb 2023 12:46:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 589E810EABD; Thu, 9 Feb 2023 12:46:29 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id B48FB10EAB8 for ; Thu, 9 Feb 2023 12:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iyV22XRyKOfL+ReLvq9qxEA5sWL1NnSlJU35bZwKPTg=; b=cVbB5QL2xB4pjpJjiDJZXELLGd l1Vn8TzlER9lmvr7E0gFYSEE+2YShUjRzxyX/BONrRzgK1IpDqixl3vz5T5h1uYRVjnGAQbV83MWJ 8lJUZJgeDfQ5UpcqcQHqT59OXF09sThmJ3ruFQ08LKA5jKKFUzyzBanQZ74vi5w45muOhg7M/nvBk Z2Ub9ydSYWERmevSMe42/TBFKO1PQJ+cbsRTxp8Paa3UXkMyVwRQSfXa9kwsIKNQk7hDUYAOtjimY bdKfDSXbJJyb1dYRI8P2WvfGitIHgsd/97ZlMoUX2r9+PnpMomGq+a/YmLcYTQz5Bjtrg0L/YChsD UY7ifopw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pQ6Ja-00DvU2-SC; Thu, 09 Feb 2023 13:46:15 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Luben Tuikov , David Airlie , Daniel Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Rob Clark , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Melissa Wen Subject: [PATCH v2 3/5] drm/msm: Use drm_sched_job_add_syncobj_dependency() Date: Thu, 9 Feb 2023 09:44:46 -0300 Message-Id: <20230209124447.467867-4-mcanal@igalia.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209124447.467867-1-mcanal@igalia.com> References: <20230209124447.467867-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As msm_parse_deps() performs the same steps as drm_sched_job_add_syncobj_dependency(), replace the open-coded implementation in msm in order to simply use the DRM function. Signed-off-by: Maíra Canal --- drivers/gpu/drm/msm/msm_gem_submit.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 73a2ca122c57..d360277809f2 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -550,7 +550,6 @@ static struct drm_syncobj **msm_parse_deps(struct msm_gem_submit *submit, for (i = 0; i < nr_in_syncobjs; ++i) { uint64_t address = in_syncobjs_addr + i * syncobj_stride; - struct dma_fence *fence; if (copy_from_user(&syncobj_desc, u64_to_user_ptr(address), @@ -570,12 +569,8 @@ static struct drm_syncobj **msm_parse_deps(struct msm_gem_submit *submit, break; } - ret = drm_syncobj_find_fence(file, syncobj_desc.handle, - syncobj_desc.point, 0, &fence); - if (ret) - break; - - ret = drm_sched_job_add_dependency(&submit->base, fence); + ret = drm_sched_job_add_syncobj_dependency(&submit->base, file, + syncobj_desc.handle, syncobj_desc.point); if (ret) break; From patchwork Thu Feb 9 12:44:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13134514 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 566A0C61DA4 for ; Thu, 9 Feb 2023 12:46:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF99E10EABE; Thu, 9 Feb 2023 12:46:34 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 529F510EABE for ; Thu, 9 Feb 2023 12:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=oeOXjyMQt5ujoJDziirlRNy5dxOS9/taSNuk4Gni6rk=; b=C7d1gGreHnvvirExM9na3PztIs Uu6uUjqb44EAoRr5t18e//UtnTKiPCt1G0Bti5vrHBG9n7mlIlrAg8iveGovSkr3OTa1yCs+1tuZu Os5bSmYVi6XcUgF8AhMe3TQcJ/Ez5nzCGNVfWFVPKGPg+FCJsdVwTlfmXAP22/9w4ZG/G7m1QCLqE P/CBgBp7XWx6QGjx7AVVsVqtoRsU2UyiJegADC8IMxxtmUBiNCuVfnREjOO460dRl1CDujMNMzTRZ aWYrNirh4AGyTftuu7AnJo5zqHRqiBHPG2E31U1rx69Y6N3gJcmEqQhXiRzT3IVQC0d7mQ8KeuXJ+ YaTq8Abw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pQ6Jh-00DvU2-M8; Thu, 09 Feb 2023 13:46:22 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Luben Tuikov , David Airlie , Daniel Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Rob Clark , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Melissa Wen Subject: [PATCH v2 4/5] drm/panfrost: Use drm_sched_job_add_syncobj_dependency() Date: Thu, 9 Feb 2023 09:44:47 -0300 Message-Id: <20230209124447.467867-5-mcanal@igalia.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209124447.467867-1-mcanal@igalia.com> References: <20230209124447.467867-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org, Alyssa Rosenzweig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As panfrost_copy_in_sync() performs the same steps as drm_sched_job_add_syncobj_dependency(), replace the open-coded implementation in Panfrost in order to simply use the DRM function. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Maíra Canal Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_drv.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index abb0dadd8f63..f49096f53141 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -220,15 +220,8 @@ panfrost_copy_in_sync(struct drm_device *dev, } for (i = 0; i < in_fence_count; i++) { - struct dma_fence *fence; - - ret = drm_syncobj_find_fence(file_priv, handles[i], 0, 0, - &fence); - if (ret) - goto fail; - - ret = drm_sched_job_add_dependency(&job->base, fence); - + ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, + handles[i], 0); if (ret) goto fail; } From patchwork Thu Feb 9 12:44:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13134515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E7DFC636D6 for ; Thu, 9 Feb 2023 12:46:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFC1510EAC1; Thu, 9 Feb 2023 12:46:38 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71E3410EAC1 for ; Thu, 9 Feb 2023 12:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Inj1IBfV14c20dmyZ/J7NK00GJjIwFxr42LgpgkWDvQ=; b=GBcbDHHbHYZN3vgkVcFmO5yNX9 KpOpvept3jMZFnUrRAhPYB0IT/3WQLEAy701EC1HANgLkv0YW1IArJcp1SbpMVYlrEp8mA5J/YPbc mduXxOjqA2q6Rlad5unNg4DAzpmKID0t07RXhV416FUoYNYvazOseTKuCwvgThZmc+b32DNNQwhTe MGmfULV8sHTMGAcw+oFo53f2aVporMlKMmQ5XNvVtDbVDNS3UmcWRxCPx+J3j4Dc8DiKl2++mtmgc R3fZCJ6nc+4Q8qQIscEofH5Tqi53pCFuCppdr7KysbqgB+BvaVs/igXCig9NA4yIFlpQTMdTLr5hc cpx65ZrA==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pQ6Jn-00DvU2-Js; Thu, 09 Feb 2023 13:46:28 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Luben Tuikov , David Airlie , Daniel Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Rob Clark , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Melissa Wen Subject: [PATCH v2 5/5] drm/v3d: Use drm_sched_job_add_syncobj_dependency() Date: Thu, 9 Feb 2023 09:44:48 -0300 Message-Id: <20230209124447.467867-6-mcanal@igalia.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230209124447.467867-1-mcanal@igalia.com> References: <20230209124447.467867-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As v3d_job_add_deps() performs the same steps as drm_sched_job_add_syncobj_dependency(), replace the open-coded implementation in v3d in order to simply use the DRM function. Signed-off-by: Maíra Canal Reviewed-by: Melissa Wen --- drivers/gpu/drm/v3d/v3d_gem.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c index 5da1806f3969..24cc65ffb4df 100644 --- a/drivers/gpu/drm/v3d/v3d_gem.c +++ b/drivers/gpu/drm/v3d/v3d_gem.c @@ -396,20 +396,6 @@ v3d_wait_bo_ioctl(struct drm_device *dev, void *data, return ret; } -static int -v3d_job_add_deps(struct drm_file *file_priv, struct v3d_job *job, - u32 in_sync, u32 point) -{ - struct dma_fence *in_fence = NULL; - int ret; - - ret = drm_syncobj_find_fence(file_priv, in_sync, point, 0, &in_fence); - if (ret == -EINVAL) - return ret; - - return drm_sched_job_add_dependency(&job->base, in_fence); -} - static int v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv, void **container, size_t size, void (*free)(struct kref *ref), @@ -447,14 +433,14 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv, DRM_DEBUG("Failed to copy wait dep handle.\n"); goto fail_deps; } - ret = v3d_job_add_deps(file_priv, job, in.handle, 0); - if (ret) + ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in.handle, 0); + if (ret && ret != -ENOENT) goto fail_deps; } } } else { - ret = v3d_job_add_deps(file_priv, job, in_sync, 0); - if (ret) + ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in_sync, 0); + if (ret && ret != -ENOENT) goto fail_deps; }