From: Anshuman Gupta <anshuman.gupta@intel.com>
To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 1/2] tests/i915/i915_pm_rpm: Enable PC8+ residency test for ICL
Date: Wed, 6 Mar 2019 17:39:29 +0530 [thread overview]
Message-ID: <1551874170-32222-2-git-send-email-anshuman.gupta@intel.com> (raw)
In-Reply-To: <1551874170-32222-1-git-send-email-anshuman.gupta@intel.com>
Enabled has_pc8 global for ICL and Gen9.
Added PC8+ residency test for display enabled case as well.
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
tests/i915/i915_pm_rpm.c | 75 +++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 68 insertions(+), 7 deletions(-)
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index be296f5..af7a5d0 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -90,7 +90,7 @@ enum plane_type {
int drm_fd, msr_fd, pc8_status_fd;
int debugfs;
-bool has_runtime_pm, has_pc8;
+bool has_runtime_pm, has_pc8, connected_screens;
struct mode_set_data ms_data;
/* Stuff used when creating FBs and mode setting. */
@@ -98,8 +98,8 @@ struct mode_set_data {
drmModeResPtr res;
drmModeConnectorPtr connectors[MAX_CONNECTORS];
drmModePropertyBlobPtr edids[MAX_CONNECTORS];
-
uint32_t devid;
+ bool pc8_needs_screen_off;
};
/* Stuff we query at different times so we can compare. */
@@ -121,6 +121,7 @@ struct modeset_params {
struct modeset_params lpsp_mode_params;
struct modeset_params non_lpsp_mode_params;
struct modeset_params *default_mode_params;
+struct modeset_params *screens_mode_params[MAX_CONNECTORS];
static int8_t *pm_data = NULL;
@@ -297,6 +298,39 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
return true;
}
+static bool init_modeset_params_for_all_screen(struct mode_set_data *data)
+{
+ drmModeConnectorPtr connector = NULL;
+ drmModeModeInfoPtr mode = NULL;
+ int screen = 0;
+
+ if (!data->res)
+ return false;
+
+ for (int i = 0; i < data->res->count_connectors; i++) {
+ drmModeConnectorPtr c = data->connectors[i];
+
+ if (c->connection == DRM_MODE_CONNECTED && c->count_modes) {
+ screens_mode_params[screen] =
+ malloc(sizeof(struct modeset_params));
+ connector = c;
+ mode = &c->modes[0];
+ igt_create_pattern_fb(drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+ &screens_mode_params[screen]->fb);
+ screens_mode_params[screen]->crtc_id =
+ kmstest_find_crtc_for_connector(drm_fd, data->res, connector, 0);
+ screens_mode_params[screen]->connector_id = connector->connector_id;
+ screens_mode_params[screen]->mode = mode;
+ screen++;
+ }
+ }
+
+ if (!connector)
+ return false;
+
+ return true;
+}
static void init_modeset_cached_params(struct mode_set_data *data)
{
bool lpsp, non_lpsp;
@@ -305,6 +339,7 @@ static void init_modeset_cached_params(struct mode_set_data *data)
SCREEN_TYPE_LPSP);
non_lpsp = init_modeset_params_for_type(data, &non_lpsp_mode_params,
SCREEN_TYPE_NON_LPSP);
+ connected_screens = init_modeset_params_for_all_screen(data);
if (lpsp)
default_mode_params = &lpsp_mode_params;
@@ -353,6 +388,23 @@ static bool enable_one_screen_with_type(struct mode_set_data *data,
return set_mode_for_params(params);
}
+static void enable_all_screens(struct mode_set_data *data)
+{
+ struct modeset_params *params = NULL;
+
+ /* SKIP if there are no connected screens. */
+ igt_require(connected_screens);
+
+ for (int i = 0; i < MAX_CONNECTORS ; i++) {
+ params = screens_mode_params[i];
+
+ if (params)
+ set_mode_for_params(params);
+ else
+ break;
+ }
+ return;
+}
static void enable_one_screen(struct mode_set_data *data)
{
/* SKIP if there are no connected screens. */
@@ -685,8 +737,12 @@ static void setup_pc8(void)
{
has_pc8 = false;
- /* Only Haswell supports the PC8 feature. */
- if (!IS_HASWELL(ms_data.devid) && !IS_BROADWELL(ms_data.devid))
+ if (IS_HASWELL(ms_data.devid) && IS_BROADWELL(ms_data.devid))
+ ms_data.pc8_needs_screen_off = true;
+ else if (AT_LEAST_GEN(ms_data.devid, 9))
+ ms_data.pc8_needs_screen_off = false;
+ /* Only Haswell supports the PC8 feature on lesser than GEN9. */
+ else
return;
/* Make sure our Kernel supports MSR and the module is loaded. */
@@ -778,7 +834,6 @@ static void teardown_environment(void)
igt_pm_restore_sata_link_power_management(pm_data);
free(pm_data);
-
fini_mode_set_data(&ms_data);
close(debugfs);
@@ -808,9 +863,15 @@ static void pc8_residency_subtest(void)
"configuration.\n");
/* Make sure PC8+ residencies stop! */
- enable_one_screen(&ms_data);
- igt_assert_f(!pc8_plus_residency_changed(10),
+ if (ms_data.pc8_needs_screen_off) {
+ enable_one_screen(&ms_data);
+ igt_assert_f(!pc8_plus_residency_changed(10),
"PC8+ residency didn't stop with screen enabled.\n");
+ } else {
+ enable_all_screens(&ms_data);
+ igt_assert_f(pc8_plus_residency_changed(10),
+ "Machine is not reaching PC8+ states with all screen enabled.\n");
+ }
}
static void modeset_subtest(enum screen_type type, int rounds, int wait_flags)
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 1/2] tests/i915/i915_pm_rpm: Enable PC8+ residency test for ICL
Date: Wed, 6 Mar 2019 17:39:29 +0530 [thread overview]
Message-ID: <1551874170-32222-2-git-send-email-anshuman.gupta@intel.com> (raw)
In-Reply-To: <1551874170-32222-1-git-send-email-anshuman.gupta@intel.com>
Enabled has_pc8 global for ICL and Gen9.
Added PC8+ residency test for display enabled case as well.
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
tests/i915/i915_pm_rpm.c | 75 +++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 68 insertions(+), 7 deletions(-)
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index be296f5..af7a5d0 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -90,7 +90,7 @@ enum plane_type {
int drm_fd, msr_fd, pc8_status_fd;
int debugfs;
-bool has_runtime_pm, has_pc8;
+bool has_runtime_pm, has_pc8, connected_screens;
struct mode_set_data ms_data;
/* Stuff used when creating FBs and mode setting. */
@@ -98,8 +98,8 @@ struct mode_set_data {
drmModeResPtr res;
drmModeConnectorPtr connectors[MAX_CONNECTORS];
drmModePropertyBlobPtr edids[MAX_CONNECTORS];
-
uint32_t devid;
+ bool pc8_needs_screen_off;
};
/* Stuff we query at different times so we can compare. */
@@ -121,6 +121,7 @@ struct modeset_params {
struct modeset_params lpsp_mode_params;
struct modeset_params non_lpsp_mode_params;
struct modeset_params *default_mode_params;
+struct modeset_params *screens_mode_params[MAX_CONNECTORS];
static int8_t *pm_data = NULL;
@@ -297,6 +298,39 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
return true;
}
+static bool init_modeset_params_for_all_screen(struct mode_set_data *data)
+{
+ drmModeConnectorPtr connector = NULL;
+ drmModeModeInfoPtr mode = NULL;
+ int screen = 0;
+
+ if (!data->res)
+ return false;
+
+ for (int i = 0; i < data->res->count_connectors; i++) {
+ drmModeConnectorPtr c = data->connectors[i];
+
+ if (c->connection == DRM_MODE_CONNECTED && c->count_modes) {
+ screens_mode_params[screen] =
+ malloc(sizeof(struct modeset_params));
+ connector = c;
+ mode = &c->modes[0];
+ igt_create_pattern_fb(drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+ &screens_mode_params[screen]->fb);
+ screens_mode_params[screen]->crtc_id =
+ kmstest_find_crtc_for_connector(drm_fd, data->res, connector, 0);
+ screens_mode_params[screen]->connector_id = connector->connector_id;
+ screens_mode_params[screen]->mode = mode;
+ screen++;
+ }
+ }
+
+ if (!connector)
+ return false;
+
+ return true;
+}
static void init_modeset_cached_params(struct mode_set_data *data)
{
bool lpsp, non_lpsp;
@@ -305,6 +339,7 @@ static void init_modeset_cached_params(struct mode_set_data *data)
SCREEN_TYPE_LPSP);
non_lpsp = init_modeset_params_for_type(data, &non_lpsp_mode_params,
SCREEN_TYPE_NON_LPSP);
+ connected_screens = init_modeset_params_for_all_screen(data);
if (lpsp)
default_mode_params = &lpsp_mode_params;
@@ -353,6 +388,23 @@ static bool enable_one_screen_with_type(struct mode_set_data *data,
return set_mode_for_params(params);
}
+static void enable_all_screens(struct mode_set_data *data)
+{
+ struct modeset_params *params = NULL;
+
+ /* SKIP if there are no connected screens. */
+ igt_require(connected_screens);
+
+ for (int i = 0; i < MAX_CONNECTORS ; i++) {
+ params = screens_mode_params[i];
+
+ if (params)
+ set_mode_for_params(params);
+ else
+ break;
+ }
+ return;
+}
static void enable_one_screen(struct mode_set_data *data)
{
/* SKIP if there are no connected screens. */
@@ -685,8 +737,12 @@ static void setup_pc8(void)
{
has_pc8 = false;
- /* Only Haswell supports the PC8 feature. */
- if (!IS_HASWELL(ms_data.devid) && !IS_BROADWELL(ms_data.devid))
+ if (IS_HASWELL(ms_data.devid) && IS_BROADWELL(ms_data.devid))
+ ms_data.pc8_needs_screen_off = true;
+ else if (AT_LEAST_GEN(ms_data.devid, 9))
+ ms_data.pc8_needs_screen_off = false;
+ /* Only Haswell supports the PC8 feature on lesser than GEN9. */
+ else
return;
/* Make sure our Kernel supports MSR and the module is loaded. */
@@ -778,7 +834,6 @@ static void teardown_environment(void)
igt_pm_restore_sata_link_power_management(pm_data);
free(pm_data);
-
fini_mode_set_data(&ms_data);
close(debugfs);
@@ -808,9 +863,15 @@ static void pc8_residency_subtest(void)
"configuration.\n");
/* Make sure PC8+ residencies stop! */
- enable_one_screen(&ms_data);
- igt_assert_f(!pc8_plus_residency_changed(10),
+ if (ms_data.pc8_needs_screen_off) {
+ enable_one_screen(&ms_data);
+ igt_assert_f(!pc8_plus_residency_changed(10),
"PC8+ residency didn't stop with screen enabled.\n");
+ } else {
+ enable_all_screens(&ms_data);
+ igt_assert_f(pc8_plus_residency_changed(10),
+ "Machine is not reaching PC8+ states with all screen enabled.\n");
+ }
}
static void modeset_subtest(enum screen_type type, int rounds, int wait_flags)
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-03-06 12:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 12:09 [igt-dev] [PATCH i-g-t 0/2] Enabling PC8+ residency for all GEN9+ platforms Anshuman Gupta
2019-03-06 12:09 ` Anshuman Gupta
2019-03-06 12:09 ` Anshuman Gupta [this message]
2019-03-06 12:09 ` [PATCH i-g-t 1/2] tests/i915/i915_pm_rpm: Enable PC8+ residency test for ICL Anshuman Gupta
2019-03-06 12:09 ` [igt-dev] [PATCH i-g-t 2/2] tests/i915/i915_pm_rpm: modeset-pc8-residency-stress Anshuman Gupta
2019-03-06 12:09 ` Anshuman Gupta
2019-03-06 13:13 ` [igt-dev] ✓ Fi.CI.BAT: success for Enabling PC8+ residency for all GEN9+ platforms Patchwork
2019-03-06 17:44 ` [igt-dev] ✓ 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=1551874170-32222-2-git-send-email-anshuman.gupta@intel.com \
--to=anshuman.gupta@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.