Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test
  2024-07-31 15:02 ` [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test Jeevan B
@ 2024-07-31 14:59   ` B, Jeevan
  0 siblings, 0 replies; 5+ messages in thread
From: B, Jeevan @ 2024-07-31 14:59 UTC (permalink / raw)
  To: B, Jeevan, igt-dev@lists.freedesktop.org
  Cc: Modem, Bhanuprakash, Joshi, Kunal1, Manna, Animesh,
	Nerlige Ramappa, Umesh, De Marchi, Lucas

Please ignore. Floated by mistake. 

> -----Original Message-----
> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of Jeevan B
> Sent: Wednesday, July 31, 2024 8:33 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Modem, Bhanuprakash <bhanuprakash.modem@intel.com>; Joshi, Kunal1
> <kunal1.joshi@intel.com>; Manna, Animesh <animesh.manna@intel.com>;
> Nerlige Ramappa, Umesh <umesh.nerlige.ramappa@intel.com>; De Marchi,
> Lucas <lucas.demarchi@intel.com>
> Subject: [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization
> test
> 
> From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> 
> Add the basic test for engine utilization.
> 
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Link: https://lore.kernel.org/r/20240703002532.3156277-3-
> umesh.nerlige.ramappa@intel.com
> ---
>  tests/intel/xe_drm_fdinfo.c | 33 ++++++++++++++++++++++++++++++---
>  1 file changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c index
> f0aa23e2f..2f9661a0b 100644
> --- a/tests/intel/xe_drm_fdinfo.c
> +++ b/tests/intel/xe_drm_fdinfo.c
> @@ -14,17 +14,20 @@
>  #include "xe/xe_spin.h"
>  /**
>   * TEST: xe drm fdinfo
> - * Description: Read and verify drm client memory consumption using fdinfo
> + * Description: Read and verify drm client memory consumption and
> + engine utilization using fdinfo
>   * Category: Core
>   * Mega feature: General Core features
>   * Sub-category: driver
> - * Functionality: Per client memory statistics
> + * Functionality: Per client memory and engine utilization statistics
>   * Feature: SMI, core
>   * Test category: SysMan
>   *
>   * SUBTEST: basic-memory
>   * Description: Check if basic fdinfo content is present for memory
>   *
> + * SUBTEST: basic-engine-utilization
> + * Description: Check if basic fdinfo content is present for engine
> + utilization
> + *
>   * SUBTEST: drm-total-resident
>   * Description: Create and compare total and resident memory consumption by
> client
>   *
> @@ -35,10 +38,18 @@
>   * Description: Create and compare active memory consumption by client
>   */
> 
> -IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption
> using fdinfo");
> +IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption and
> +engine utilization using fdinfo");
> 
>  #define BO_SIZE (65536)
> 
> +static const char *engine_map[] = {
> +	"rcs",
> +	"bcs",
> +	"vcs",
> +	"vecs",
> +	"ccs",
> +};
> +
>  /* Subtests */
>  static void test_active(int fd, struct drm_xe_engine *engine)  { @@ -287,6
> +298,18 @@ static void basic_memory(int xe)
>  	}
>  }
> 
> +static void basic_engine_utilization(int xe) {
> +	struct drm_client_fdinfo info = { };
> +	unsigned int ret;
> +
> +	ret = igt_parse_drm_fdinfo(xe, &info, engine_map,
> +				   ARRAY_SIZE(engine_map), NULL, 0);
> +	igt_assert_f(ret != 0, "failed with err:%d\n", errno);
> +	igt_assert(!strcmp(info.driver, "xe"));
> +	igt_require(info.num_engines);
> +}
> +
>  igt_main
>  {
>  	int xe;
> @@ -303,6 +326,10 @@ igt_main
>  	igt_subtest("basic-memory")
>  		basic_memory(xe);
> 
> +	igt_describe("Check if basic fdinfo content is present for engine
> utilization");
> +	igt_subtest("basic-engine-utilization")
> +		basic_engine_utilization(xe);
> +
>  	igt_describe("Create and compare total and resident memory
> consumption by client");
>  	igt_subtest("drm-total-resident")
>  		test_total_resident(xe);
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH i-g-t 0/3] New test to validate link-off between active regions (LOBF)
@ 2024-07-31 15:02 Jeevan B
  2024-07-31 15:02 ` [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test Jeevan B
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jeevan B @ 2024-07-31 15:02 UTC (permalink / raw)
  To: igt-dev; +Cc: bhanuprakash.modem, kunal1.joshi, animesh.manna, Jeevan B

Add debugfs entry to validate LOBF status and create a new
test to validate and fix typo.

Signed-off-by: Jeevan B <jeevan.b@intel.com>

Jeevan B (2):
  lib/igt_kms: Added library functions for LOBF status
  tests/kms_vrr: Add new test to validate LOBF

Umesh Nerlige Ramappa (1):
  tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test

 lib/igt_kms.c               | 23 +++++++++++++++
 lib/igt_kms.h               |  1 +
 tests/intel/xe_drm_fdinfo.c | 33 +++++++++++++++++++--
 tests/kms_vrr.c             | 59 +++++++++++++++++++++++++++++++++++--
 4 files changed, 111 insertions(+), 5 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test
  2024-07-31 15:02 [PATCH i-g-t 0/3] New test to validate link-off between active regions (LOBF) Jeevan B
@ 2024-07-31 15:02 ` Jeevan B
  2024-07-31 14:59   ` B, Jeevan
  2024-07-31 15:02 ` [PATCH i-g-t 2/3] lib/igt_kms: Added library functions for LOBF status Jeevan B
  2024-07-31 15:02 ` [PATCH i-g-t 3/3] tests/kms_vrr: Add new test to validate LOBF Jeevan B
  2 siblings, 1 reply; 5+ messages in thread
From: Jeevan B @ 2024-07-31 15:02 UTC (permalink / raw)
  To: igt-dev
  Cc: bhanuprakash.modem, kunal1.joshi, animesh.manna,
	Umesh Nerlige Ramappa, Lucas De Marchi

From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

Add the basic test for engine utilization.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20240703002532.3156277-3-umesh.nerlige.ramappa@intel.com
---
 tests/intel/xe_drm_fdinfo.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index f0aa23e2f..2f9661a0b 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -14,17 +14,20 @@
 #include "xe/xe_spin.h"
 /**
  * TEST: xe drm fdinfo
- * Description: Read and verify drm client memory consumption using fdinfo
+ * Description: Read and verify drm client memory consumption and engine utilization using fdinfo
  * Category: Core
  * Mega feature: General Core features
  * Sub-category: driver
- * Functionality: Per client memory statistics
+ * Functionality: Per client memory and engine utilization statistics
  * Feature: SMI, core
  * Test category: SysMan
  *
  * SUBTEST: basic-memory
  * Description: Check if basic fdinfo content is present for memory
  *
+ * SUBTEST: basic-engine-utilization
+ * Description: Check if basic fdinfo content is present for engine utilization
+ *
  * SUBTEST: drm-total-resident
  * Description: Create and compare total and resident memory consumption by client
  *
@@ -35,10 +38,18 @@
  * Description: Create and compare active memory consumption by client
  */
 
-IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption using fdinfo");
+IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption and engine utilization using fdinfo");
 
 #define BO_SIZE (65536)
 
+static const char *engine_map[] = {
+	"rcs",
+	"bcs",
+	"vcs",
+	"vecs",
+	"ccs",
+};
+
 /* Subtests */
 static void test_active(int fd, struct drm_xe_engine *engine)
 {
@@ -287,6 +298,18 @@ static void basic_memory(int xe)
 	}
 }
 
+static void basic_engine_utilization(int xe)
+{
+	struct drm_client_fdinfo info = { };
+	unsigned int ret;
+
+	ret = igt_parse_drm_fdinfo(xe, &info, engine_map,
+				   ARRAY_SIZE(engine_map), NULL, 0);
+	igt_assert_f(ret != 0, "failed with err:%d\n", errno);
+	igt_assert(!strcmp(info.driver, "xe"));
+	igt_require(info.num_engines);
+}
+
 igt_main
 {
 	int xe;
@@ -303,6 +326,10 @@ igt_main
 	igt_subtest("basic-memory")
 		basic_memory(xe);
 
+	igt_describe("Check if basic fdinfo content is present for engine utilization");
+	igt_subtest("basic-engine-utilization")
+		basic_engine_utilization(xe);
+
 	igt_describe("Create and compare total and resident memory consumption by client");
 	igt_subtest("drm-total-resident")
 		test_total_resident(xe);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH i-g-t 2/3] lib/igt_kms: Added library functions for LOBF status
  2024-07-31 15:02 [PATCH i-g-t 0/3] New test to validate link-off between active regions (LOBF) Jeevan B
  2024-07-31 15:02 ` [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test Jeevan B
@ 2024-07-31 15:02 ` Jeevan B
  2024-07-31 15:02 ` [PATCH i-g-t 3/3] tests/kms_vrr: Add new test to validate LOBF Jeevan B
  2 siblings, 0 replies; 5+ messages in thread
From: Jeevan B @ 2024-07-31 15:02 UTC (permalink / raw)
  To: igt-dev; +Cc: bhanuprakash.modem, kunal1.joshi, animesh.manna, Jeevan B

Added helper functions to check LOBF status to check weather
it is enabled or disabled.

v2: rename function name.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
Reviewed-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 lib/igt_kms.c | 23 +++++++++++++++++++++++
 lib/igt_kms.h |  1 +
 2 files changed, 24 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 64318ef7f..e030b35a6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6071,6 +6071,29 @@ void igt_dump_crtcs_fd(int drmfd)
 	drmModeFreeResources(mode_resources);
 }
 
+/**
+ * igt_get_i915_edp_lobf_status
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Return: True if its enabled.
+ */
+bool igt_get_i915_edp_lobf_status(int drmfd, char *connector_name)
+{
+	char buf[24];
+	int fd, res;
+
+	fd = igt_debugfs_connector_dir(drmfd, connector_name, O_RDONLY);
+	igt_assert(fd >= 0);
+
+	res = igt_debugfs_simple_read(fd, "i915_edp_lobf_info", buf, sizeof(buf));
+	igt_require(res > 0);
+
+	close(fd);
+
+	return strstr(buf, "LOBF status: enabled");
+}
+
 /**
  * igt_get_output_max_bpc:
  * @drmfd: A drm file descriptor
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 501d48763..e8582a45b 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1195,6 +1195,7 @@ void igt_require_pipe(igt_display_t *display,
 void igt_dump_connectors_fd(int drmfd);
 void igt_dump_crtcs_fd(int drmfd);
 bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display);
+bool igt_get_i915_edp_lobf_status(int drmfd, char *connector_name);
 unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);
 unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);
 void igt_assert_output_bpc_equal(int drmfd, enum pipe pipe,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH i-g-t 3/3] tests/kms_vrr: Add new test to validate LOBF
  2024-07-31 15:02 [PATCH i-g-t 0/3] New test to validate link-off between active regions (LOBF) Jeevan B
  2024-07-31 15:02 ` [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test Jeevan B
  2024-07-31 15:02 ` [PATCH i-g-t 2/3] lib/igt_kms: Added library functions for LOBF status Jeevan B
@ 2024-07-31 15:02 ` Jeevan B
  2 siblings, 0 replies; 5+ messages in thread
From: Jeevan B @ 2024-07-31 15:02 UTC (permalink / raw)
  To: igt-dev; +Cc: bhanuprakash.modem, kunal1.joshi, animesh.manna, Jeevan B

Validate refresh rate changes that appear to be stable but actually
change slightly in the VRR using the fixed refresh rate framework
for non-PSR scenarios.

v2: add PR check.
v3: update commit message and fix code structure.
v4: update logic using existing code.
v5: combine output constraints condition and minor fixes.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
Reviewed-by: Kunal Joshi <kunal1.joshi@intel.com>
---
 tests/kms_vrr.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 57 insertions(+), 2 deletions(-)

diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c
index 7e8885f16..9ddb56cbc 100644
--- a/tests/kms_vrr.c
+++ b/tests/kms_vrr.c
@@ -31,6 +31,7 @@
  */
 
 #include "igt.h"
+#include "igt_psr.h"
 #include "i915/intel_drrs.h"
 #include "sw_sync.h"
 #include <fcntl.h>
@@ -76,6 +77,11 @@
  * 		without a full modeset.
  * Functionality: LRR
  *
+ * SUBTEST: lobf
+ * Description: Test to validate link-off between active frames in non-psr
+ *              operation
+ * Functionality: LOBF
+ *
  * SUBTEST: max-min
  * Description: Oscillates between highest and lowest refresh each frame for
  *              manual flicker profiling
@@ -106,7 +112,8 @@ enum {
 	TEST_FASTSET = 1 << 7,
 	TEST_MAXMIN = 1 << 8,
 	TEST_CMRR = 1 << 9,
-	TEST_NEGATIVE = 1 << 10,
+	TEST_LINK_OFF = 1 << 10,
+	TEST_NEGATIVE = 1 << 11,
 };
 
 enum {
@@ -129,6 +136,7 @@ typedef struct vtest_ns {
 typedef struct data {
 	igt_display_t display;
 	int drm_fd;
+	int debugfs_fd;
 	igt_plane_t *primary;
 	igt_fb_t fb[2];
 	range_t range;
@@ -784,6 +792,31 @@ test_seamless_virtual_rr_basic(data_t *data, enum pipe pipe, igt_output_t *outpu
 	}
 }
 
+/* FIXME: test_lobf : Lobf can be enabled when
+ * (Set Context Latency + Guardband) > (First SDP Position + Wake Time)
+ * one the depends patches are merged please fix this function.
+ */
+
+static void
+test_lobf(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
+{
+	uint64_t rate[] = {0};
+
+	rate[0] = rate_from_refresh(data->switch_modes[HIGH_RR_MODE].vrefresh);
+	prepare_test(data, output, pipe);
+
+	igt_info("LOBF test execution on %s, PIPE %s with VRR range: (%u-%u) Hz\n",
+		 output->name, kmstest_pipe_name(pipe), data->range.min, data->range.max);
+
+	igt_output_override_mode(output, &data->switch_modes[HIGH_RR_MODE]);
+	flip_and_measure(data, output, pipe, rate, 1, TEST_DURATION_NS);
+	igt_output_override_mode(output, &data->switch_modes[LOW_RR_MODE]);
+	rate[0] = rate_from_refresh(data->switch_modes[LOW_RR_MODE].vrefresh);
+	flip_and_measure(data, output, pipe, rate, 1, NSECS_PER_SEC);
+	igt_assert_f(igt_get_i915_edp_lobf_status(data->drm_fd, output->name),
+		     "LOBF not enabled\n");
+}
+
 static void
 test_cmrr(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
 {
@@ -843,7 +876,9 @@ static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output)
 
 static bool output_constraint(data_t *data, igt_output_t *output, uint32_t flags)
 {
-	if ((flags & (TEST_SEAMLESS_VRR | TEST_SEAMLESS_DRRS | TEST_CMRR)) &&
+	data->debugfs_fd = igt_debugfs_dir(data->drm_fd);
+
+	if ((flags & (TEST_SEAMLESS_VRR | TEST_SEAMLESS_DRRS | TEST_CMRR | TEST_LINK_OFF)) &&
 	    output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP)
 		return false;
 
@@ -853,6 +888,17 @@ static bool output_constraint(data_t *data, igt_output_t *output, uint32_t flags
 		return false;
 	}
 
+	if (flags & TEST_LINK_OFF) {
+		if (psr_sink_support(data->drm_fd, data->debugfs_fd, PSR_MODE_1, NULL) ||
+		    psr_sink_support(data->drm_fd, data->debugfs_fd, PR_MODE, NULL))
+			psr_disable(data->drm_fd, data->debugfs_fd, NULL);
+
+		if (igt_get_i915_edp_lobf_status(data->drm_fd, output->name)) {
+			igt_info("LOBF not supported. \n");
+			return false;
+		}
+	}
+
 	/* Reset output */
 	igt_display_reset(&data->display);
 
@@ -881,6 +927,7 @@ static bool output_constraint(data_t *data, igt_output_t *output, uint32_t flags
 
 	data->range.min = data->switch_modes[LOW_RR_MODE].vrefresh;
 
+	close(data->debugfs_fd);
 	return true;
 }
 
@@ -1037,6 +1084,14 @@ igt_main_args("drs:", long_opts, help_str, opt_handler, &data)
 
 			run_vrr_test(&data, test_cmrr, TEST_CMRR);
 		}
+
+		igt_describe("Test to validate the link-off between active frames in "
+			     "non-PSR operation.");
+		igt_subtest_with_dynamic("lobf") {
+			igt_require(intel_display_ver(intel_get_drm_devid(data.drm_fd)) >= 20);
+
+			run_vrr_test(&data, test_lobf, TEST_LINK_OFF);
+		}
 	}
 
 	igt_fixture {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-31 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 15:02 [PATCH i-g-t 0/3] New test to validate link-off between active regions (LOBF) Jeevan B
2024-07-31 15:02 ` [PATCH i-g-t 1/3] tests/intel/xe_drm_fdinfo: Add basic-engine-utilization test Jeevan B
2024-07-31 14:59   ` B, Jeevan
2024-07-31 15:02 ` [PATCH i-g-t 2/3] lib/igt_kms: Added library functions for LOBF status Jeevan B
2024-07-31 15:02 ` [PATCH i-g-t 3/3] tests/kms_vrr: Add new test to validate LOBF Jeevan B

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox