diff mbox

[igt,4/4] tests/kms_psr_sink_crc: test even if PSR is disabled by default

Message ID 1433428266-1867-4-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni June 4, 2015, 2:31 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Use the igt_set_module_param_int() call to enable it, then restore the
previous value after we are done testing.

With this, we can change the psr_enabled() function to psr_possible():
the only requirement should be that we have a PSR capable sink. The
test should now be able to make "Source_OK" and "Enabled" become true
whenever it wants.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 tests/kms_psr_sink_crc.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Rodrigo Vivi June 4, 2015, 4:01 p.m. UTC | #1
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

On Thu, Jun 4, 2015 at 7:31 AM, Paulo Zanoni <przanoni@gmail.com> wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>
> Use the igt_set_module_param_int() call to enable it, then restore the
> previous value after we are done testing.
>
> With this, we can change the psr_enabled() function to psr_possible():
> the only requirement should be that we have a PSR capable sink. The
> test should now be able to make "Source_OK" and "Enabled" become true
> whenever it wants.
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  tests/kms_psr_sink_crc.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
> index 099391b..1823a68 100644
> --- a/tests/kms_psr_sink_crc.c
> +++ b/tests/kms_psr_sink_crc.c
> @@ -203,7 +203,7 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)
>         gem_bo_busy(data->drm_fd, handle);
>  }
>
> -static bool psr_enabled(data_t *data)
> +static bool psr_possible(data_t *data)
>  {
>         FILE *file;
>         char buf[4096];
> @@ -229,14 +229,6 @@ static bool psr_enabled(data_t *data)
>         igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
>                       "Sink_Support: %s\n", buf);
>
> -       ret = fscanf(file, "Source_OK: %s\n", buf);
> -       igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
> -                     "Source_OK: %s\n", buf);
> -
> -       ret = fscanf(file, "Enabled: %s\n", buf);
> -       igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
> -                     "Enabled: %s\n", buf);
> -
>         fclose(file);
>         return true;
>  }
> @@ -570,7 +562,9 @@ int main(int argc, char *argv[])
>                 kmstest_set_vt_graphics_mode();
>                 data.devid = intel_get_drm_devid(data.drm_fd);
>
> -               igt_skip_on(!psr_enabled(&data));
> +               igt_set_module_param_int("enable_psr", 1);
> +
> +               igt_skip_on(!psr_possible(&data));
>
>                 data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
>                 igt_assert(data.bufmgr);
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 099391b..1823a68 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -203,7 +203,7 @@  static void fill_render(data_t *data, uint32_t handle, unsigned char color)
 	gem_bo_busy(data->drm_fd, handle);
 }
 
-static bool psr_enabled(data_t *data)
+static bool psr_possible(data_t *data)
 {
 	FILE *file;
 	char buf[4096];
@@ -229,14 +229,6 @@  static bool psr_enabled(data_t *data)
 	igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
 		      "Sink_Support: %s\n", buf);
 
-	ret = fscanf(file, "Source_OK: %s\n", buf);
-	igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
-		      "Source_OK: %s\n", buf);
-
-	ret = fscanf(file, "Enabled: %s\n", buf);
-	igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
-		      "Enabled: %s\n", buf);
-
 	fclose(file);
 	return true;
 }
@@ -570,7 +562,9 @@  int main(int argc, char *argv[])
 		kmstest_set_vt_graphics_mode();
 		data.devid = intel_get_drm_devid(data.drm_fd);
 
-		igt_skip_on(!psr_enabled(&data));
+		igt_set_module_param_int("enable_psr", 1);
+
+		igt_skip_on(!psr_possible(&data));
 
 		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
 		igt_assert(data.bufmgr);