[igt-dev] [CI 5/5] tests/fbcon_fbt: Enable PSR1 via debugfs

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Wed Sep 5 21:15:59 UTC 2018


Test only PSR1 on PSR2 panels by making use of the debugfs toggle.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Reviewed-by: José Roberto de Souza <jose.souza at intel.com>
---
 tests/kms_fbcon_fbt.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index d1f3a385..4cfececa 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -25,6 +25,7 @@
  */
 
 #include "igt.h"
+#include "igt_psr.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -205,29 +206,39 @@ static bool psr_wait_until_enabled(int fd)
 	return r;
 }
 
+static void disable_features(int fd)
+{
+	igt_set_module_param_int("enable_fbc", 0);
+	psr_disable(fd);
+}
+
+static inline void fbc_modparam_enable(int fd)
+{
+	igt_set_module_param_int("enable_fbc", 1);
+}
+
+static inline void psr_debugfs_enable(int fd)
+{
+	psr_enable(fd);
+}
+
 struct feature {
 	bool (*supported_on_chipset)(int fd);
 	bool (*wait_until_enabled)(int fd);
 	bool (*connector_possible_fn)(drmModeConnectorPtr connector);
-	const char *param_name;
+	void (*enable)(int fd);
 } fbc = {
 	.supported_on_chipset = fbc_supported_on_chipset,
 	.wait_until_enabled = fbc_wait_until_enabled,
 	.connector_possible_fn = connector_can_fbc,
-	.param_name = "enable_fbc",
+	.enable = fbc_modparam_enable,
 }, psr = {
 	.supported_on_chipset = psr_supported_on_chipset,
 	.wait_until_enabled = psr_wait_until_enabled,
 	.connector_possible_fn = connector_can_psr,
-	.param_name = "enable_psr",
+	.enable = psr_debugfs_enable,
 };
 
-static void disable_features(void)
-{
-	igt_set_module_param_int(fbc.param_name, 0);
-	igt_set_module_param_int(psr.param_name, 0);
-}
-
 static void subtest(struct feature *feature, bool suspend)
 {
 	struct drm_info drm;
@@ -237,8 +248,8 @@ static void subtest(struct feature *feature, bool suspend)
 
 	igt_require(feature->supported_on_chipset(drm.debugfs_fd));
 
-	disable_features();
-	igt_set_module_param_int(feature->param_name, 1);
+	disable_features(drm.debugfs_fd);
+	feature->enable(drm.debugfs_fd);
 
 	kmstest_unset_all_crtcs(drm.fd, drm.res);
 	wait_user("Modes unset.");
-- 
2.17.1



More information about the igt-dev mailing list