Message ID | 1449482810-22540-1-git-send-email-rodrigo.vivi@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Dec 07, 2015 at 02:06:49AM -0800, Rodrigo Vivi wrote: > This simple test checks if PSR is enabled when it should. > Minimal and fastest check possible. > > To make it faster for BAT we first check if it is enabled and return > Success. We just do the dpms_on in case psr is not enabled. So it was > probably because display went off maybe in idle. Even for this case > the test case is fast enough: ~ 1s. Please don't do that. If you need a mode enabled, enable it. We have some other not-so-awesome testcase which try to inherit modeset state from fbcon and then sometimes fall over. If that causes too much delay due to unecessary modesets, then we need to extract a bit of logic into libraries to make sure everyone uses the same setup for basic tests, and that we don't force a modeset by accident in-between (either the test or fbcon). -Daniel > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> > --- > tests/kms_psr_sink_crc.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c > index 8cd11a7..28ba5c2 100644 > --- a/tests/kms_psr_sink_crc.c > +++ b/tests/kms_psr_sink_crc.c > @@ -227,6 +227,26 @@ static bool psr_possible(data_t *data) > return true; > } > > +static bool psr_enabled(data_t *data) > +{ > + int ret; > + FILE *file; > + char str[4]; > + > + file = igt_debugfs_fopen("i915_edp_psr_status", "r"); > + igt_require(file); > + > + ret = fscanf(file, "Sink_Support: %s\n", str); > + igt_assert_neq(ret, 0); > + ret = fscanf(file, "Source_OK: %s\n", str); > + igt_assert_neq(ret, 0); > + ret = fscanf(file, "Enabled: %s\n", str); > + igt_assert_neq(ret, 0); > + > + fclose(file); > + return strcmp(str, "yes") == 0; > +} > + > static bool psr_active(data_t *data) > { > int ret; > @@ -569,6 +589,22 @@ int main(int argc, char *argv[]) > display_init(&data); > } > > + igt_subtest("psr_enabled_basic") { > + if (psr_enabled(&data)) > + igt_success(); > + else { > + /* > + * The only excuse to have PSR disabled at this point > + * is if dpms is off for some reason. So let's try to > + * force dpms on and check if that was the case. > + */ > + kmstest_set_connector_dpms(data.drm_fd, > + data.output->config.connector, > + DRM_MODE_DPMS_ON); > + igt_assert(psr_enabled(&data)); > + } > + } > + > for (op = PAGE_FLIP; op <= RENDER; op++) { > igt_subtest_f("primary_%s", op_str(op)) { > data.test_plane = PRIMARY; > -- > 2.4.3 >
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 8cd11a7..28ba5c2 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -227,6 +227,26 @@ static bool psr_possible(data_t *data) return true; } +static bool psr_enabled(data_t *data) +{ + int ret; + FILE *file; + char str[4]; + + file = igt_debugfs_fopen("i915_edp_psr_status", "r"); + igt_require(file); + + ret = fscanf(file, "Sink_Support: %s\n", str); + igt_assert_neq(ret, 0); + ret = fscanf(file, "Source_OK: %s\n", str); + igt_assert_neq(ret, 0); + ret = fscanf(file, "Enabled: %s\n", str); + igt_assert_neq(ret, 0); + + fclose(file); + return strcmp(str, "yes") == 0; +} + static bool psr_active(data_t *data) { int ret; @@ -569,6 +589,22 @@ int main(int argc, char *argv[]) display_init(&data); } + igt_subtest("psr_enabled_basic") { + if (psr_enabled(&data)) + igt_success(); + else { + /* + * The only excuse to have PSR disabled at this point + * is if dpms is off for some reason. So let's try to + * force dpms on and check if that was the case. + */ + kmstest_set_connector_dpms(data.drm_fd, + data.output->config.connector, + DRM_MODE_DPMS_ON); + igt_assert(psr_enabled(&data)); + } + } + for (op = PAGE_FLIP; op <= RENDER; op++) { igt_subtest_f("primary_%s", op_str(op)) { data.test_plane = PRIMARY;
This simple test checks if PSR is enabled when it should. Minimal and fastest check possible. To make it faster for BAT we first check if it is enabled and return Success. We just do the dpms_on in case psr is not enabled. So it was probably because display went off maybe in idle. Even for this case the test case is fast enough: ~ 1s. Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> --- tests/kms_psr_sink_crc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)