From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67E4B10E5B3 for ; Fri, 3 Mar 2023 01:17:43 +0000 (UTC) Date: Thu, 2 Mar 2023 17:17:29 -0800 From: Umesh Nerlige Ramappa To: Kamil Konieczny , , Lionel G Landwerlin Message-ID: References: <20230215004648.2100655-1-umesh.nerlige.ramappa@intel.com> <20230215004648.2100655-31-umesh.nerlige.ramappa@intel.com> <20230216193912.xouv7cxb3lx3s7ov@kamilkon-desk1> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Disposition: inline In-Reply-To: MIME-Version: 1.0 Subject: Re: [igt-dev] [PATCH i-g-t 30/31] tools/perf: Choose the right card List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Thu, Feb 16, 2023 at 01:27:00PM -0800, Umesh Nerlige Ramappa wrote: >On Thu, Feb 16, 2023 at 08:39:12PM +0100, Kamil Konieczny wrote: >>Hi Umesh, >> >>On 2023-02-14 at 16:46:47 -0800, Umesh Nerlige Ramappa wrote: >>>Choose the right dri card to open for perf recorder. >>> >>>Signed-off-by: Umesh Nerlige Ramappa >>>--- >>> tools/i915-perf/i915_perf_recorder.c | 18 ++++++++---------- >>> 1 file changed, 8 insertions(+), 10 deletions(-) >>> >>>diff --git a/tools/i915-perf/i915_perf_recorder.c b/tools/i915-perf/i915_perf_recorder.c >>>index ee8a288d..9337da12 100644 >>>--- a/tools/i915-perf/i915_perf_recorder.c >>>+++ b/tools/i915-perf/i915_perf_recorder.c >>>@@ -241,10 +241,10 @@ read_device_param(const char *stem, int id, const char *param) >>> } >>> >>> static int >>>-find_intel_render_node(void) >>>+find_intel_card_node(void) >>> { >>>- for (int i = 128; i < (128 + 16); i++) { >>>- if (read_device_param("renderD", i, "vendor") == 0x8086) >>>+ for (int i = 0; i < 128; i++) { >>>+ if (read_device_param("card", i, "vendor") == 0x8086) >> >>These looks like a fix. Btw why do we stick to first card only ? >>May you instroduce params for a tool and use N-th card ? >>Is OA useable for only one card at a moment ? > >That's a bug. The tool already supports cards/device, but I don't seem >to be passing the device/card number to find_intel_card_node(). > >I think I have lost track of the original patch (not authored by me), >so I am missing a few changes. Will fix this. Hmm, Looking at it again, it's not a bug. This function is only called if the user of the tool does not pass the card/device parameter (card < 0 below). It picks what's available. If the user passes the device number, then the specific card is opened for streaming perf reports. Umesh > >Thanks, >Umesh >> >>Regards, >>Kamil >> >>> return i; >>> } >>> >>>@@ -273,20 +273,18 @@ open_render_node(uint32_t *devid, int card) >>> char *name; >>> int ret; >>> int fd; >>>- int render; >>> >>> if (card < 0) { >>>- render = find_intel_render_node(); >>>- if (render < 0) >>>+ card = find_intel_card_node(); >>>+ >>>+ if (card < 0) >>> return -1; >>>- } else { >>>- render = 128 + card; >>> } >>> >>>- ret = asprintf(&name, "/dev/dri/renderD%u", render); >>>+ ret = asprintf(&name, "/dev/dri/card%u", card); >>> assert(ret != -1); >>> >>>- *devid = read_device_param("renderD", render, "device"); >>>+ *devid = read_device_param("card", card, "device"); >>> >>> fd = open(name, O_RDWR); >>> free(name); >>>-- >>>2.36.1 >>>