From patchwork Sat Apr 20 21:32:11 2024 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: 13637217 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 CF721C04FFE for ; Sat, 20 Apr 2024 21:38:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DFB0F10EAE3; Sat, 20 Apr 2024 21:37:59 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="pqbCCC8e"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id C24BD10EACE for ; Sat, 20 Apr 2024 21:37:51 +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=tQOJOdR7R8fPlGzGpAxIDtGIt/YwPd67iplbtKJy1G0=; b=pqbCCC8eWv2SvqHdXKB3G0VNPi SZ63j/wTIuXNMf6jZzIhKuLXAHV93Mx7mxh1+ZXHfNGF670878NfSwrH0pZ03hUIsHADSGafOnF/V +MHFsPakiMkbFmb4/ssfUUQ8McNC0DzOasn2wfBLPIJWlAJTa6KyjcEs4OIndjttJcC8vsCMkFS+K JUjrzq83mfLP6/vEJl/8+c1pKYdVS/ksgx6H7RVBj+66u3TX9pM9jpcXHkKNIsxt7k29XNi/iYQQ8 zsy0QSzHr1UOa309CZPyFuqb+qCmiSD4m10um1XsDAP95xF5xlo7nBSdQmzYFglIUKMJmLZyhDYJU aBVTZSXA==; Received: from [179.234.232.152] (helo=morissey..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1ryIP2-006j7P-PS; Sat, 20 Apr 2024 23:37:45 +0200 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Melissa Wen , Chema Casanova , Tvrtko Ursulin , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, kernel-dev@igalia.com, =?utf-8?q?Ma?= =?utf-8?q?=C3=ADra_Canal?= , Tvrtko Ursulin Subject: [PATCH v3 3/5] drm/v3d: Create function to update a set of GPU stats Date: Sat, 20 Apr 2024 18:32:11 -0300 Message-ID: <20240420213632.339941-5-mcanal@igalia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420213632.339941-2-mcanal@igalia.com> References: <20240420213632.339941-2-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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Given a set of GPU stats, that is, a `struct v3d_stats` related to a queue in a given context, create a function that can update this set of GPU stats. Signed-off-by: MaĆ­ra Canal Reviewed-by: Tvrtko Ursulin Reviewed-by: Jose Maria Casanova Crespo --- drivers/gpu/drm/v3d/v3d_sched.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index b6b5542c3fcf..b9614944931c 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -118,6 +118,14 @@ v3d_job_start_stats(struct v3d_job *job, enum v3d_queue queue) global_stats->start_ns = now; } +static void +v3d_stats_update(struct v3d_stats *stats, u64 now) +{ + stats->enabled_ns += now - stats->start_ns; + stats->jobs_completed++; + stats->start_ns = 0; +} + void v3d_job_update_stats(struct v3d_job *job, enum v3d_queue queue) { @@ -127,13 +135,8 @@ v3d_job_update_stats(struct v3d_job *job, enum v3d_queue queue) struct v3d_stats *local_stats = &file->stats[queue]; u64 now = local_clock(); - local_stats->enabled_ns += now - local_stats->start_ns; - local_stats->jobs_completed++; - local_stats->start_ns = 0; - - global_stats->enabled_ns += now - global_stats->start_ns; - global_stats->jobs_completed++; - global_stats->start_ns = 0; + v3d_stats_update(local_stats, now); + v3d_stats_update(global_stats, now); } static struct dma_fence *v3d_bin_job_run(struct drm_sched_job *sched_job)