[igt-dev] [PATCH i-g-t 13/20] tests/psr: Get rid of global variable running_with_psr_disabled

Katarzyna Dec katarzyna.dec at intel.com
Fri Apr 13 11:22:23 UTC 2018


On Tue, Apr 10, 2018 at 07:37:25PM -0700, Dhinakaran Pandiyan wrote:
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
 Reviewed-by: Katarzyna Dec <katarzyna.dec 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
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list