Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 2/5] igt: Use is_intel_dgfx()
Date: Mon, 16 Sep 2024 23:18:38 +0300	[thread overview]
Message-ID: <20240916201841.29592-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240916201841.29592-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the hand rolled copies of is_intel_dgfx() with
the real thing.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_power.c          | 6 ++----
 tests/intel/kms_pm_dc.c  | 6 ++----
 tests/intel/kms_pm_rpm.c | 6 ++----
 tests/kms_addfb_basic.c  | 9 ++++-----
 4 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/lib/igt_power.c b/lib/igt_power.c
index f4d3efcf0cec..e891da87acf3 100644
--- a/lib/igt_power.c
+++ b/lib/igt_power.c
@@ -12,7 +12,7 @@
 #include "igt_power.h"
 #include "igt_sysfs.h"
 
-#include "xe/xe_query.h"
+#include "intel_common.h"
 
 static const char *rapl_domains[] = { "cpu", "gpu", "pkg", "ram" };
 
@@ -101,13 +101,11 @@ static inline void rapl_close(struct rapl *r)
 int igt_power_open(int fd, struct igt_power *p, const char *domain)
 {
 	int i;
-	bool is_dgfx;
 
 	p->hwmon_fd = -1;
 	p->rapl.fd = -1;
 
-	is_dgfx = fd >= 0 && (is_xe_device(fd) ? xe_has_vram(fd) : gem_has_lmem(fd));
-	if (is_dgfx) {
+	if (fd >= 0 && is_intel_dgfx(fd)) {
 		if (strncmp(domain, "gpu", strlen("gpu")) == 0) {
 			p->hwmon_fd = igt_hwmon_open(fd);
 			if (p->hwmon_fd >= 0)
diff --git a/tests/intel/kms_pm_dc.c b/tests/intel/kms_pm_dc.c
index 07b140ce5b16..362c9b6edb25 100644
--- a/tests/intel/kms_pm_dc.c
+++ b/tests/intel/kms_pm_dc.c
@@ -46,7 +46,7 @@
 #include "limits.h"
 #include "time.h"
 #include "igt_pm.h"
-#include "xe/xe_query.h"
+#include "intel_common.h"
 
 /**
  * SUBTEST: dc3co-vpb-simulation
@@ -711,7 +711,6 @@ static void kms_poll_state_restore(int sig)
 igt_main
 {
 	data_t data = {};
-	bool is_dgfx;
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
@@ -805,8 +804,7 @@ igt_main
 
 	igt_describe("This test validates display engine entry to DC9 state");
 	igt_subtest("dc9-dpms") {
-		is_dgfx = is_xe_device(data.drm_fd) ? xe_has_vram(data.drm_fd) : gem_has_lmem(data.drm_fd);
-		if (!is_dgfx)
+		if (!is_intel_dgfx(data.drm_fd))
 			igt_require_f(igt_pm_pc8_plus_residencies_enabled(data.msr_fd),
 				      "PC8+ residencies not supported\n");
 		test_dc9_dpms(&data);
diff --git a/tests/intel/kms_pm_rpm.c b/tests/intel/kms_pm_rpm.c
index 852e9cb5f84d..990c509156f3 100644
--- a/tests/intel/kms_pm_rpm.c
+++ b/tests/intel/kms_pm_rpm.c
@@ -39,8 +39,8 @@
 #include "igt_kmod.h"
 #include "igt_sysfs.h"
 #include "intel_blt.h"
+#include "intel_common.h"
 #include "xe/xe_ioctl.h"
-#include "xe/xe_query.h"
 
 /**
  * SUBTEST: basic-pci-d3-state
@@ -1116,7 +1116,6 @@ static bool device_in_pci_d3(struct pci_device *pci_dev)
 static void pci_d3_state_subtest(void)
 {
 	struct pci_device *pci_dev, *bridge_pci_dev;
-	bool is_dgfx;
 
 	igt_require(has_runtime_pm);
 
@@ -1126,8 +1125,7 @@ static void pci_d3_state_subtest(void)
 	disable_all_screens_and_wait(&ms_data);
 	igt_assert(igt_wait(device_in_pci_d3(pci_dev), 2000, 100));
 
-	is_dgfx = is_xe_device(drm_fd) ? xe_has_vram(drm_fd) : gem_has_lmem(drm_fd);
-	if (is_dgfx)
+	if (is_intel_dgfx(drm_fd))
 		igt_require_f(pci_device_has_kernel_driver(bridge_pci_dev),
 			      "pci bridge device does not bind with pcieport driver\n");
 
diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 8fe22ec05166..b22818592e57 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -51,6 +51,7 @@
 #include "igt_rand.h"
 #include "igt_device.h"
 #include "i915/intel_memory_region.h"
+#include "intel_common.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 
@@ -303,13 +304,11 @@ static void invalid_tests(int fd)
 			    IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
 		igt_calc_fb_size(&fb);
 
-		if (is_i915_device(fd)) {
-			igt_require(gem_has_lmem(fd));
+		igt_require(is_intel_dgfx(fd));
+		if (is_i915_device(fd))
 			handle = gem_create_in_memory_regions(fd, fb.size, REGION_SMEM);
-		} else {
-			igt_require(xe_has_vram(fd));
+		else
 			handle = xe_bo_create(fd, 0, fb.size, system_memory(fd), 0);
-		}
 
 		f.handles[0] = handle;
 		do_ioctl_err(fd, DRM_IOCTL_MODE_ADDFB2, &f, EREMOTE);
-- 
2.44.2


  parent reply	other threads:[~2024-09-16 20:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16 20:18 [PATCH i-g-t 0/5] Power/energy and display memory bandwidth measurement tools Ville Syrjala
2024-09-16 20:18 ` [PATCH i-g-t 1/5] lib/power: Allow use of rapl by specifying fd=-1 Ville Syrjala
2024-10-11 17:17   ` Kamil Konieczny
2024-10-14 16:57     ` Ville Syrjälä
2024-09-16 20:18 ` Ville Syrjala [this message]
2024-10-11 17:20   ` [PATCH i-g-t 2/5] igt: Use is_intel_dgfx() Kamil Konieczny
2024-09-16 20:18 ` [PATCH i-g-t 3/5] lib/igt_power: Add power_supply/BAT based measurement Ville Syrjala
2024-10-11 17:30   ` Kamil Konieczny
2024-10-14 17:07     ` Ville Syrjälä
2024-09-16 20:18 ` [PATCH i-g-t 4/5] tools/power: Introduce a small power/energy measurement tool Ville Syrjala
2024-10-11 17:39   ` Kamil Konieczny
2024-09-16 20:18 ` [PATCH i-g-t 5/5] tools/intel_display_bandwidth: Tool for measuring display memory bandwidth utilization Ville Syrjala
2024-10-11 17:52   ` Kamil Konieczny
2024-10-14 16:34     ` Ville Syrjälä
2025-02-26 15:39       ` Govindapillai, Vinod
2025-02-26 15:51         ` Ville Syrjälä
2025-02-26 16:23           ` Govindapillai, Vinod
2024-09-16 21:24 ` ✓ CI.xeBAT: success for Power/energy and display memory bandwidth measurement tools Patchwork
2024-09-16 21:40 ` ✓ Fi.CI.BAT: " Patchwork
2024-09-17  0:20 ` ✗ CI.xeFULL: failure " Patchwork
2024-09-17 11:05 ` ✗ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240916201841.29592-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox