[PATCH i-g-t 2/5] igt: Use is_intel_dgfx()
Kamil Konieczny
kamil.konieczny at linux.intel.com
Fri Oct 11 17:20:47 UTC 2024
Hi Ville,
On 2024-09-16 at 23:18:38 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Replace the hand rolled copies of is_intel_dgfx() with
> the real thing.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at 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
>
More information about the igt-dev
mailing list