All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [intel-gfx][igt-dev] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend.
@ 2018-08-23 12:16 ` Jyoti Yadav
  0 siblings, 0 replies; 7+ messages in thread
From: Jyoti Yadav @ 2018-08-23 12:16 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, vandita.kulkarni, rodrigo.vivi

From: Jyoti <jyoti.r.yadav@intel.com>

BIOS programs few of PWM related registers during initial boot.
But during System suspend those registers are cleared.
This test aim to check whether display programs those registers properly after
system resume.
Also checks brightness programming during DPMS ON/OFF cycle to check backlight
programming is done properly from display side.

Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
---
 tests/pm_backlight.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
index a695f90..6f6d727 100644
--- a/tests/pm_backlight.c
+++ b/tests/pm_backlight.c
@@ -47,6 +47,7 @@ struct context {
 #define FADESPEED 100 /* milliseconds between steps */
 
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
+static int8_t *pm_data = NULL;
 
 static int backlight_read(int *result, const char *fname)
 {
@@ -150,19 +151,60 @@ static void test_fade(struct context *context)
 		nanosleep(&ts, NULL);
 	}
 }
+static void test_fade_with_dpms(struct context *context, igt_output_t *output)
+{
+	int i;
+	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
+	bool has_runtime_pm;
+	has_runtime_pm = igt_setup_runtime_pm();
+	igt_info("Runtime PM support: %d\n", has_runtime_pm);
+	igt_assert(has_runtime_pm);
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
+
+	/* Fade out, then in */
+	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+}
+static void test_fade_with_suspend(struct context *context, igt_output_t *output)
+{
+	int i;
+	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	/* Fade out, then in */
+	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+}
 
 igt_main
 {
 	struct context context = {0};
 	int old;
 	igt_display_t display;
+	igt_output_t *output;
 	struct igt_fb fb;
 
 	igt_skip_on_simulation();
 
 	igt_fixture {
 		enum pipe pipe;
-		igt_output_t *output;
 		bool found = false;
 		char full_name[32] = {};
 		char *name;
@@ -187,7 +229,6 @@ igt_main
 		for_each_pipe_with_valid_output(&display, pipe, output) {
 			if (strcmp(name + 6, output->name))
 				continue;
-
 			found = true;
 			break;
 		}
@@ -205,6 +246,7 @@ igt_main
 		igt_plane_set_fb(primary, &fb);
 
 		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+		pm_data = igt_pm_enable_sata_link_power_management();
 	}
 
 	igt_subtest("basic-brightness")
@@ -213,6 +255,10 @@ igt_main
 		test_bad_brightness(&context);
 	igt_subtest("fade")
 		test_fade(&context);
+	igt_subtest("fade_with_dpms")
+		test_fade_with_dpms(&context, output);
+	igt_subtest("fade_with_suspend")
+		test_fade_with_suspend(&context, output);
 
 	igt_fixture {
 		/* Restore old brightness */
@@ -220,6 +266,8 @@ igt_main
 
 		igt_display_fini(&display);
 		igt_remove_fb(display.drm_fd, &fb);
+		igt_pm_restore_sata_link_power_management(pm_data);
+		free(pm_data);
 		close(display.drm_fd);
 	}
 }
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH] [intel-gfx] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend.
@ 2018-08-23 12:16 ` Jyoti Yadav
  0 siblings, 0 replies; 7+ messages in thread
From: Jyoti Yadav @ 2018-08-23 12:16 UTC (permalink / raw)
  To: igt-dev; +Cc: madhav.chauhan, intel-gfx, rodrigo.vivi, Jyoti

From: Jyoti <jyoti.r.yadav@intel.com>

BIOS programs few of PWM related registers during initial boot.
But during System suspend those registers are cleared.
This test aim to check whether display programs those registers properly after
system resume.
Also checks brightness programming during DPMS ON/OFF cycle to check backlight
programming is done properly from display side.

Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
---
 tests/pm_backlight.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
index a695f90..6f6d727 100644
--- a/tests/pm_backlight.c
+++ b/tests/pm_backlight.c
@@ -47,6 +47,7 @@ struct context {
 #define FADESPEED 100 /* milliseconds between steps */
 
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
+static int8_t *pm_data = NULL;
 
 static int backlight_read(int *result, const char *fname)
 {
@@ -150,19 +151,60 @@ static void test_fade(struct context *context)
 		nanosleep(&ts, NULL);
 	}
 }
+static void test_fade_with_dpms(struct context *context, igt_output_t *output)
+{
+	int i;
+	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
+	bool has_runtime_pm;
+	has_runtime_pm = igt_setup_runtime_pm();
+	igt_info("Runtime PM support: %d\n", has_runtime_pm);
+	igt_assert(has_runtime_pm);
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
+
+	/* Fade out, then in */
+	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+}
+static void test_fade_with_suspend(struct context *context, igt_output_t *output)
+{
+	int i;
+	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	/* Fade out, then in */
+	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
+		test_and_verify(context, i);
+		nanosleep(&ts, NULL);
+	}
+}
 
 igt_main
 {
 	struct context context = {0};
 	int old;
 	igt_display_t display;
+	igt_output_t *output;
 	struct igt_fb fb;
 
 	igt_skip_on_simulation();
 
 	igt_fixture {
 		enum pipe pipe;
-		igt_output_t *output;
 		bool found = false;
 		char full_name[32] = {};
 		char *name;
@@ -187,7 +229,6 @@ igt_main
 		for_each_pipe_with_valid_output(&display, pipe, output) {
 			if (strcmp(name + 6, output->name))
 				continue;
-
 			found = true;
 			break;
 		}
@@ -205,6 +246,7 @@ igt_main
 		igt_plane_set_fb(primary, &fb);
 
 		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+		pm_data = igt_pm_enable_sata_link_power_management();
 	}
 
 	igt_subtest("basic-brightness")
@@ -213,6 +255,10 @@ igt_main
 		test_bad_brightness(&context);
 	igt_subtest("fade")
 		test_fade(&context);
+	igt_subtest("fade_with_dpms")
+		test_fade_with_dpms(&context, output);
+	igt_subtest("fade_with_suspend")
+		test_fade_with_suspend(&context, output);
 
 	igt_fixture {
 		/* Restore old brightness */
@@ -220,6 +266,8 @@ igt_main
 
 		igt_display_fini(&display);
 		igt_remove_fb(display.drm_fd, &fb);
+		igt_pm_restore_sata_link_power_management(pm_data);
+		free(pm_data);
 		close(display.drm_fd);
 	}
 }
-- 
1.9.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for tests/pm_backlight.c : Brightness test with DPMS and System suspend. (rev3)
  2018-08-23 12:16 ` [igt-dev] [PATCH] [intel-gfx] " Jyoti Yadav
  (?)
@ 2018-08-23 12:34 ` Patchwork
  -1 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-08-23 12:34 UTC (permalink / raw)
  To: Jyoti Yadav; +Cc: igt-dev

== Series Details ==

Series: tests/pm_backlight.c : Brightness test with DPMS and System suspend. (rev3)
URL   : https://patchwork.freedesktop.org/series/48480/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4693 -> IGTPW_1740 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/48480/revisions/3/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1740 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      fi-kbl-guc:         PASS -> DMESG-FAIL (fdo#106947)

    igt@gem_exec_suspend@basic-s3:
      {fi-kbl-soraka}:    NOTRUN -> INCOMPLETE (fdo#107556)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       PASS -> INCOMPLETE (fdo#103713)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_hangcheck:
      fi-kbl-7560u:       DMESG-FAIL (fdo#106947, fdo#106560) -> PASS

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b:
      {fi-byt-clapper}:   FAIL (fdo#107362) -> PASS

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
      {fi-byt-clapper}:   FAIL (fdo#103191, fdo#107362) -> PASS

    igt@pm_rpm@basic-pci-d3-state:
      fi-skl-6600u:       FAIL -> PASS

    
    ==== Warnings ====

    {igt@kms_psr@primary_page_flip}:
      fi-cnl-psr:         DMESG-FAIL (fdo#107372) -> DMESG-WARN (fdo#107372)

    
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
  fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107372 https://bugs.freedesktop.org/show_bug.cgi?id=107372
  fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556


== Participating hosts (53 -> 48) ==

  Additional (1): fi-kbl-soraka 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-icl-u 


== Build changes ==

    * IGT: IGT_4607 -> IGTPW_1740

  CI_DRM_4693: f22275363ffa04dbd719032810154e857110cd75 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1740: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1740/
  IGT_4607: 6e0b3e7a2d241af36f8c6b1cc335aa1db3532d29 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@pm_backlight@fade_with_dpms
+igt@pm_backlight@fade_with_suspend

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1740/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for tests/pm_backlight.c : Brightness test with DPMS and System suspend. (rev3)
  2018-08-23 12:16 ` [igt-dev] [PATCH] [intel-gfx] " Jyoti Yadav
  (?)
  (?)
@ 2018-08-23 13:27 ` Patchwork
  -1 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-08-23 13:27 UTC (permalink / raw)
  To: Jyoti Yadav; +Cc: igt-dev

== Series Details ==

Series: tests/pm_backlight.c : Brightness test with DPMS and System suspend. (rev3)
URL   : https://patchwork.freedesktop.org/series/48480/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4607_full -> IGTPW_1740_full =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/48480/revisions/3/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1740_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_userptr_blits@unsync-unmap:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_cursor_crc@cursor-256x256-suspend:
      shard-snb:          PASS -> DMESG-WARN (fdo#102365)

    igt@kms_frontbuffer_tracking@fbc-suspend:
      shard-kbl:          PASS -> INCOMPLETE (fdo#105959, fdo#103665)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@drv_suspend@debugfs-reader:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS +1

    igt@drv_suspend@fence-restore-tiled2untiled:
      shard-kbl:          DMESG-WARN (fdo#103313) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-mmap-wc:
      shard-glk:          FAIL (fdo#103167) -> PASS

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

    igt@perf@polling:
      shard-hsw:          FAIL (fdo#102252) -> PASS

    
  fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
  fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103313 https://bugs.freedesktop.org/show_bug.cgi?id=103313
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105959 https://bugs.freedesktop.org/show_bug.cgi?id=105959
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4607 -> IGTPW_1740
    * Linux: CI_DRM_4690 -> CI_DRM_4693

  CI_DRM_4690: 5b8042159e2b05425c098868ed6fac9518ee638d @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4693: f22275363ffa04dbd719032810154e857110cd75 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1740: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1740/
  IGT_4607: 6e0b3e7a2d241af36f8c6b1cc335aa1db3532d29 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1740/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH] [intel-gfx] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend.
  2018-08-23 12:16 ` [igt-dev] [PATCH] [intel-gfx] " Jyoti Yadav
@ 2018-08-30  0:40   ` Rodrigo Vivi
  -1 siblings, 0 replies; 7+ messages in thread
From: Rodrigo Vivi @ 2018-08-30  0:40 UTC (permalink / raw)
  To: Jyoti Yadav; +Cc: igt-dev, intel-gfx

On Thu, Aug 23, 2018 at 08:16:28AM -0400, Jyoti Yadav wrote:
> From: Jyoti <jyoti.r.yadav@intel.com>
> 
> BIOS programs few of PWM related registers during initial boot.
> But during System suspend those registers are cleared.
> This test aim to check whether display programs those registers properly after
> system resume.
> Also checks brightness programming during DPMS ON/OFF cycle to check backlight
> programming is done properly from display side.
> 
> Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
> ---
>  tests/pm_backlight.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
> index a695f90..6f6d727 100644
> --- a/tests/pm_backlight.c
> +++ b/tests/pm_backlight.c
> @@ -47,6 +47,7 @@ struct context {
>  #define FADESPEED 100 /* milliseconds between steps */
>  
>  IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
> +static int8_t *pm_data = NULL;
>  
>  static int backlight_read(int *result, const char *fname)
>  {
> @@ -150,19 +151,60 @@ static void test_fade(struct context *context)
>  		nanosleep(&ts, NULL);
>  	}
>  }
> +static void test_fade_with_dpms(struct context *context, igt_output_t *output)

nip: what about test_fade_after_dpms_on_off() ?

but with is not wrong or bad, just my poor brain first thought you
would try fade test between off and on, what doesn't make any sense I know...

> +{
> +	int i;
> +	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
> +	bool has_runtime_pm;
> +	has_runtime_pm = igt_setup_runtime_pm();
> +	igt_info("Runtime PM support: %d\n", has_runtime_pm);
> +	igt_assert(has_runtime_pm);
> +	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
> +
> +	/* Fade out, then in */
> +	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}
> +	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}

I think this function should only include the dpms part and then we call

test_fade(context) directly instead of duplicating the code...

> +}
> +static void test_fade_with_suspend(struct context *context, igt_output_t *output)
> +{
> +	int i;
> +	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
> +	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
> +
> +	/* Fade out, then in */
> +	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}
> +	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}

same here...

besides the code duplication everything else lgtm

Thanks,
Rodrigo.

> +}
>  
>  igt_main
>  {
>  	struct context context = {0};
>  	int old;
>  	igt_display_t display;
> +	igt_output_t *output;
>  	struct igt_fb fb;
>  
>  	igt_skip_on_simulation();
>  
>  	igt_fixture {
>  		enum pipe pipe;
> -		igt_output_t *output;
>  		bool found = false;
>  		char full_name[32] = {};
>  		char *name;
> @@ -187,7 +229,6 @@ igt_main
>  		for_each_pipe_with_valid_output(&display, pipe, output) {
>  			if (strcmp(name + 6, output->name))
>  				continue;
> -
>  			found = true;
>  			break;
>  		}
> @@ -205,6 +246,7 @@ igt_main
>  		igt_plane_set_fb(primary, &fb);
>  
>  		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> +		pm_data = igt_pm_enable_sata_link_power_management();
>  	}
>  
>  	igt_subtest("basic-brightness")
> @@ -213,6 +255,10 @@ igt_main
>  		test_bad_brightness(&context);
>  	igt_subtest("fade")
>  		test_fade(&context);
> +	igt_subtest("fade_with_dpms")
> +		test_fade_with_dpms(&context, output);
> +	igt_subtest("fade_with_suspend")
> +		test_fade_with_suspend(&context, output);
>  
>  	igt_fixture {
>  		/* Restore old brightness */
> @@ -220,6 +266,8 @@ igt_main
>  
>  		igt_display_fini(&display);
>  		igt_remove_fb(display.drm_fd, &fb);
> +		igt_pm_restore_sata_link_power_management(pm_data);
> +		free(pm_data);
>  		close(display.drm_fd);
>  	}
>  }
> -- 
> 1.9.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH] [intel-gfx] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend.
@ 2018-08-30  0:40   ` Rodrigo Vivi
  0 siblings, 0 replies; 7+ messages in thread
From: Rodrigo Vivi @ 2018-08-30  0:40 UTC (permalink / raw)
  To: Jyoti Yadav; +Cc: igt-dev, madhav.chauhan, intel-gfx

On Thu, Aug 23, 2018 at 08:16:28AM -0400, Jyoti Yadav wrote:
> From: Jyoti <jyoti.r.yadav@intel.com>
> 
> BIOS programs few of PWM related registers during initial boot.
> But during System suspend those registers are cleared.
> This test aim to check whether display programs those registers properly after
> system resume.
> Also checks brightness programming during DPMS ON/OFF cycle to check backlight
> programming is done properly from display side.
> 
> Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
> ---
>  tests/pm_backlight.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
> index a695f90..6f6d727 100644
> --- a/tests/pm_backlight.c
> +++ b/tests/pm_backlight.c
> @@ -47,6 +47,7 @@ struct context {
>  #define FADESPEED 100 /* milliseconds between steps */
>  
>  IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
> +static int8_t *pm_data = NULL;
>  
>  static int backlight_read(int *result, const char *fname)
>  {
> @@ -150,19 +151,60 @@ static void test_fade(struct context *context)
>  		nanosleep(&ts, NULL);
>  	}
>  }
> +static void test_fade_with_dpms(struct context *context, igt_output_t *output)

nip: what about test_fade_after_dpms_on_off() ?

but with is not wrong or bad, just my poor brain first thought you
would try fade test between off and on, what doesn't make any sense I know...

> +{
> +	int i;
> +	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
> +	bool has_runtime_pm;
> +	has_runtime_pm = igt_setup_runtime_pm();
> +	igt_info("Runtime PM support: %d\n", has_runtime_pm);
> +	igt_assert(has_runtime_pm);
> +	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
> +
> +	/* Fade out, then in */
> +	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}
> +	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}

I think this function should only include the dpms part and then we call

test_fade(context) directly instead of duplicating the code...

> +}
> +static void test_fade_with_suspend(struct context *context, igt_output_t *output)
> +{
> +	int i;
> +	static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };
> +	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
> +	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
> +	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
> +
> +	/* Fade out, then in */
> +	for (i = context->max; i > 0; i -= context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}
> +	for (i = 0; i <= context->max; i += context->max / FADESTEPS) {
> +		test_and_verify(context, i);
> +		nanosleep(&ts, NULL);
> +	}

same here...

besides the code duplication everything else lgtm

Thanks,
Rodrigo.

> +}
>  
>  igt_main
>  {
>  	struct context context = {0};
>  	int old;
>  	igt_display_t display;
> +	igt_output_t *output;
>  	struct igt_fb fb;
>  
>  	igt_skip_on_simulation();
>  
>  	igt_fixture {
>  		enum pipe pipe;
> -		igt_output_t *output;
>  		bool found = false;
>  		char full_name[32] = {};
>  		char *name;
> @@ -187,7 +229,6 @@ igt_main
>  		for_each_pipe_with_valid_output(&display, pipe, output) {
>  			if (strcmp(name + 6, output->name))
>  				continue;
> -
>  			found = true;
>  			break;
>  		}
> @@ -205,6 +246,7 @@ igt_main
>  		igt_plane_set_fb(primary, &fb);
>  
>  		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> +		pm_data = igt_pm_enable_sata_link_power_management();
>  	}
>  
>  	igt_subtest("basic-brightness")
> @@ -213,6 +255,10 @@ igt_main
>  		test_bad_brightness(&context);
>  	igt_subtest("fade")
>  		test_fade(&context);
> +	igt_subtest("fade_with_dpms")
> +		test_fade_with_dpms(&context, output);
> +	igt_subtest("fade_with_suspend")
> +		test_fade_with_suspend(&context, output);
>  
>  	igt_fixture {
>  		/* Restore old brightness */
> @@ -220,6 +266,8 @@ igt_main
>  
>  		igt_display_fini(&display);
>  		igt_remove_fb(display.drm_fd, &fb);
> +		igt_pm_restore_sata_link_power_management(pm_data);
> +		free(pm_data);
>  		close(display.drm_fd);
>  	}
>  }
> -- 
> 1.9.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] [intel-gfx][igt-dev] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend.
@ 2018-08-31  4:39 Jyoti Yadav
  0 siblings, 0 replies; 7+ messages in thread
From: Jyoti Yadav @ 2018-08-31  4:39 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, rodrigo.vivi

From: Jyoti <jyoti.r.yadav@intel.com>

BIOS programs few of PWM related registers during initial boot.
But during System suspend those registers are cleared.
This test aim to check whether display programs those registers properly after
system resume.
Also checks brightness programming during DPMS ON/OFF cycle to check backlight
programming is done properly from display side.

v2 : Optimize the code to avoid code redundancy. (Rodrigo)

Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
---
 tests/pm_backlight.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
index a695f90..8b5c79d 100644
--- a/tests/pm_backlight.c
+++ b/tests/pm_backlight.c
@@ -47,6 +47,7 @@ struct context {
 #define FADESPEED 100 /* milliseconds between steps */
 
 IGT_TEST_DESCRIPTION("Basic backlight sysfs test");
+static int8_t *pm_data = NULL;
 
 static int backlight_read(int *result, const char *fname)
 {
@@ -150,19 +151,38 @@ static void test_fade(struct context *context)
 		nanosleep(&ts, NULL);
 	}
 }
+static void test_fade_with_dpms(struct context *context, igt_output_t *output)
+{
+	bool has_runtime_pm;
+	has_runtime_pm = igt_setup_runtime_pm();
+	igt_info("Runtime PM support: %d\n", has_runtime_pm);
+	igt_assert(has_runtime_pm);
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE));
+	test_fade(context);
+}
+static void test_fade_with_suspend(struct context *context, igt_output_t *output)
+{
+	kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF);
+	igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED));
+	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+	test_fade(context);
+}
 
 igt_main
 {
 	struct context context = {0};
 	int old;
 	igt_display_t display;
+	igt_output_t *output;
 	struct igt_fb fb;
 
 	igt_skip_on_simulation();
 
 	igt_fixture {
 		enum pipe pipe;
-		igt_output_t *output;
 		bool found = false;
 		char full_name[32] = {};
 		char *name;
@@ -187,7 +207,6 @@ igt_main
 		for_each_pipe_with_valid_output(&display, pipe, output) {
 			if (strcmp(name + 6, output->name))
 				continue;
-
 			found = true;
 			break;
 		}
@@ -205,6 +224,7 @@ igt_main
 		igt_plane_set_fb(primary, &fb);
 
 		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+		pm_data = igt_pm_enable_sata_link_power_management();
 	}
 
 	igt_subtest("basic-brightness")
@@ -213,6 +233,10 @@ igt_main
 		test_bad_brightness(&context);
 	igt_subtest("fade")
 		test_fade(&context);
+	igt_subtest("fade_with_dpms")
+		test_fade_with_dpms(&context, output);
+	igt_subtest("fade_with_suspend")
+		test_fade_with_suspend(&context, output);
 
 	igt_fixture {
 		/* Restore old brightness */
@@ -220,6 +244,8 @@ igt_main
 
 		igt_display_fini(&display);
 		igt_remove_fb(display.drm_fd, &fb);
+		igt_pm_restore_sata_link_power_management(pm_data);
+		free(pm_data);
 		close(display.drm_fd);
 	}
 }
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-31  4:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 12:16 [PATCH] [intel-gfx][igt-dev] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend Jyoti Yadav
2018-08-23 12:16 ` [igt-dev] [PATCH] [intel-gfx] " Jyoti Yadav
2018-08-23 12:34 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/pm_backlight.c : Brightness test with DPMS and System suspend. (rev3) Patchwork
2018-08-23 13:27 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-08-30  0:40 ` [igt-dev] [PATCH] [intel-gfx] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend Rodrigo Vivi
2018-08-30  0:40   ` Rodrigo Vivi
2018-08-31  4:39 [PATCH] [intel-gfx][igt-dev] " Jyoti Yadav

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.