From patchwork Wed May 11 12:18:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 12846149 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 B8B62C4332F for ; Wed, 11 May 2022 12:18:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5FE9110E9FA; Wed, 11 May 2022 12:18:42 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8266F10E1D7; Wed, 11 May 2022 12:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652271516; x=1683807516; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FvGbaNGCq/+K3Cjb2cto+uL5fRGt5j2OYiLdp0WO3ew=; b=DgXn3wx1AiQH9DV0KsuCo/A0v1V8JGNbyp6KsXrpfZwT9MqsvOanTzGB 6Wpd0h9bQIXOScXgOT2XG40iojW9//KI4JS7SWu60Mjak2BwN+1N3YO7y c16t93dxsH7Pn+vRkLHHS2rZjin84w7RLWoat7hugE8AV6XxgKs0MOUR7 C63L9JUsfvhprKolkKvI1VdcJP9MljjyfOAOXxXUBHIxjHjbO8RNg0Ng4 tIEYH4y5/W0Rd9SlXzqbXwDPYYwCut/xdVYCQEnrZDPRG7GHXcleXlqft JpG3kHXr5ArynSydOKxXyk4S1Jrg53eaAlAszpY/DugQAYcf3TLlgMZFV Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10343"; a="269348752" X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="269348752" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 05:18:36 -0700 X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="520495149" Received: from mmlucey-mobl1.ger.corp.intel.com (HELO tursulin-mobl2.home) ([10.213.195.130]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 05:18:35 -0700 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 11 May 2022 13:18:18 +0100 Message-Id: <20220511121821.1010974-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220511121821.1010974-1-tvrtko.ursulin@linux.intel.com> References: <20220511121821.1010974-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 5/8] libdrmfdinfo: Track largest engine index X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Prep code for incoming work. Signed-off-by: Tvrtko Ursulin --- lib/igt_drm_fdinfo.c | 2 ++ lib/igt_drm_fdinfo.h | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c index 9b5c81a9b68d..f056b1a14b0e 100644 --- a/lib/igt_drm_fdinfo.c +++ b/lib/igt_drm_fdinfo.c @@ -162,6 +162,8 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info, info->capacity[idx] = 1; info->busy[idx] = val; info->num_engines++; + if (idx > info->last_engine_index) + info->last_engine_index = idx; } } else if (!strncmp(l, "drm-engine-capacity-", 20)) { idx = parse_engine(l, info, diff --git a/lib/igt_drm_fdinfo.h b/lib/igt_drm_fdinfo.h index 8e62c5962a58..2dd8ea141e50 100644 --- a/lib/igt_drm_fdinfo.h +++ b/lib/igt_drm_fdinfo.h @@ -38,6 +38,7 @@ struct drm_client_fdinfo { unsigned long id; unsigned int num_engines; + unsigned int last_engine_index; unsigned int capacity[DRM_CLIENT_FDINFO_MAX_ENGINES]; char names[DRM_CLIENT_FDINFO_MAX_ENGINES][256]; uint64_t busy[DRM_CLIENT_FDINFO_MAX_ENGINES];