[igt-dev] [PATCH i-g-t 13/20] tests/psr: Get rid of global variable running_with_psr_disabled
Dhinakaran Pandiyan
dhinakaran.pandiyan at intel.com
Wed Apr 11 02:37:25 UTC 2018
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
tests/kms_psr_sink_crc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index a7c6a057..bb92d672 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -31,8 +31,6 @@
#include "intel_bufmgr.h"
-bool running_with_psr_disabled;
-
#define CRC_BLACK "000000000000"
#define CRC_LEN 12
@@ -76,6 +74,7 @@ typedef struct {
int mod_stride;
drmModeModeInfo *mode;
igt_output_t *output;
+ bool with_psr_disabled;
} data_t;
static void create_cursor_fb(data_t *data)
@@ -93,7 +92,6 @@ static void create_cursor_fb(data_t *data)
igt_put_cairo_ctx(data->drm_fd, &data->fb_white, cr);
}
-
static void setup_output(data_t *data)
{
igt_display_t *display = &data->display;
@@ -198,7 +196,7 @@ static bool sink_support(data_t *data)
igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
- return running_with_psr_disabled ||
+ return data->with_psr_disabled ||
strstr(buf, "Sink_Support: yes\n");
}
@@ -208,7 +206,7 @@ static bool psr_enabled(data_t *data)
igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
- return running_with_psr_disabled ||
+ return data->with_psr_disabled ||
strstr(buf, "HW Enabled & Active bit: yes\n");
}
@@ -432,11 +430,13 @@ static void dpms_off_on(data_t data)
DRM_MODE_DPMS_ON);
}
-static int opt_handler(int opt, int opt_index, void *data)
+static int opt_handler(int opt, int opt_index, void *_data)
{
+ data_t *data = _data;
+
switch (opt) {
case 'n':
- running_with_psr_disabled = true;
+ data->with_psr_disabled = true;
break;
default:
igt_assert(0);
@@ -457,7 +457,7 @@ int main(int argc, char *argv[])
enum operations op;
igt_subtest_init_parse_opts(&argc, argv, "", long_options,
- help_str, opt_handler, NULL);
+ help_str, opt_handler, &data);
igt_skip_on_simulation();
igt_fixture {
@@ -466,7 +466,7 @@ int main(int argc, char *argv[])
kmstest_set_vt_graphics_mode();
data.devid = intel_get_drm_devid(data.drm_fd);
- igt_set_module_param_int("enable_psr", running_with_psr_disabled ?
+ igt_set_module_param_int("enable_psr", data.with_psr_disabled ?
0 : 1);
igt_require_f(sink_support(&data),
"Sink does not support PSR\n");
--
2.14.1
More information about the igt-dev
mailing list