From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/5] tests/kms_frontbuffer_tracking: Rework toggling drrs/fbc/psr.
Date: Mon, 12 Mar 2018 18:30:10 +0100 [thread overview]
Message-ID: <20180312173013.50903-3-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180312173013.50903-1-maarten.lankhorst@linux.intel.com>
Add a helper <feature>_set for each function, and allow -1 to restore
the initial value. This is useful for the basic subtest, which is run
near the end.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_frontbuffer_tracking.c | 63 +++++++++++++++++++++++++++-------------
1 file changed, 43 insertions(+), 20 deletions(-)
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 19a69cca5b37..746f8d1f8a75 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -747,7 +747,7 @@ static void __debugfs_read(const char *param, char *buf, int len)
buf[len] = '\0';
}
-static int __debugfs_write(const char *param, char *buf, int len)
+static int __debugfs_write(const char *param, const char *buf, int len)
{
return igt_sysfs_write(drm.debugfs, param, buf, len - 1);
}
@@ -781,24 +781,54 @@ static void psr_print_status(void)
igt_info("PSR status:\n%s\n", buf);
}
-static void drrs_set(unsigned int val)
+static void drrs_set(int val)
{
char buf[2];
int ret;
igt_debug("Manually %sabling DRRS. %u\n", val ? "en" : "dis", val);
- snprintf(buf, sizeof(buf), "%d", val);
+ snprintf(buf, sizeof(buf), "%d", !!val);
ret = debugfs_write("i915_drrs_ctl", buf);
/*
- * drrs_enable() is called on DRRS capable platform only,
- * whereas drrs_disable() is called on all platforms.
- * So handle the failure of debugfs_write only for drrs_enable().
+ * enabling psr is done on DRRS capable platform only,
+ * whereas disabling/default is called on all platforms.
+ * So handle the failure of debugfs_write only when explicitly enabling drrs.
*/
- if (val)
+ if (val > 0)
igt_assert_f(ret == (sizeof(buf) - 1), "debugfs_write failed");
}
+static bool psr_set(int val)
+{
+ int oldval;
+ static int default_psr = -1;
+
+ oldval = igt_get_module_param_int("enable_psr");
+ if (default_psr == -1)
+ default_psr = oldval;
+
+ if (val == -1)
+ val = default_psr;
+
+ igt_set_module_param_int("enable_psr", val);
+
+ return val != oldval;
+}
+
+static void fbc_set(int val)
+{
+ static int default_fbc = -1;
+
+ if (default_fbc == -1)
+ default_fbc = igt_get_module_param_int("enable_fbc");
+
+ if (val == -1)
+ val = default_fbc;
+
+ igt_set_module_param_int("enable_fbc", val);
+}
+
static bool is_drrs_high(void)
{
char buf[MAX_DRRS_STATUS_BUF_LEN];
@@ -963,13 +993,6 @@ static bool drrs_wait_until_rr_switch_to_low(void)
return igt_wait(is_drrs_low(), 5000, 1);
}
-#define fbc_enable() igt_set_module_param_int("enable_fbc", 1)
-#define fbc_disable() igt_set_module_param_int("enable_fbc", 0)
-#define psr_enable() igt_set_module_param_int("enable_psr", 1)
-#define psr_disable() igt_set_module_param_int("enable_psr", 0)
-#define drrs_enable() drrs_set(1)
-#define drrs_disable() drrs_set(0)
-
static void get_sink_crc(sink_crc_t *crc, bool mandatory)
{
int rc, errno_;
@@ -1198,9 +1221,9 @@ static void disable_features(const struct test_mode *t)
if (t->feature == FEATURE_DEFAULT)
return;
- fbc_disable();
- psr_disable();
- drrs_disable();
+ fbc_set(0);
+ psr_set(0);
+ drrs_set(0);
}
static void *busy_thread_func(void *data)
@@ -1830,11 +1853,11 @@ static void enable_features_for_test(const struct test_mode *t)
return;
if (t->feature & FEATURE_FBC)
- fbc_enable();
+ fbc_set(1);
if (t->feature & FEATURE_PSR)
- psr_enable();
+ psr_set(1);
if (t->feature & FEATURE_DRRS)
- drrs_enable();
+ drrs_set(1);
}
static void check_test_requirements(const struct test_mode *t)
--
2.16.2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-03-12 17:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 17:30 [igt-dev] [PATCH i-g-t 0/5] tests/kms_frontbuffer_tracking: Rework to prevent modesets! Maarten Lankhorst
2018-03-12 17:30 ` [igt-dev] [PATCH i-g-t 1/5] lib/igt_aux: Add igt_get_module_param_int Maarten Lankhorst
2018-03-14 14:00 ` Chris Wilson
2018-03-12 17:30 ` Maarten Lankhorst [this message]
2018-03-12 17:30 ` [igt-dev] [PATCH i-g-t 3/5] tests/kms_frontbuffer_tracking: Fix basic subtest Maarten Lankhorst
2018-03-12 17:30 ` [igt-dev] [PATCH i-g-t 4/5] tests/kms_frontbuffer_tracking: Add support for toggling edp psr through debugfs Maarten Lankhorst
2018-03-12 17:30 ` [igt-dev] [PATCH i-g-t 5/5] tests/kms_frontbuffer_tracking: Remove redundant modesets during subtest start, v2 Maarten Lankhorst
2018-03-12 23:51 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_frontbuffer_tracking: Rework to prevent modesets! Patchwork
2018-03-13 5:02 ` [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=20180312173013.50903-3-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@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 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.