diff options
author | Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> | 2018-07-16 15:39:04 -0700 |
---|---|---|
committer | Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> | 2018-07-17 11:11:08 -0700 |
commit | d7e1dfbff4dc43f018ee64e91a1d78524e83e20d (patch) | |
tree | 034db8f86328f07d82646b5726bc282408a7ea7e /lib | |
parent | 1a02046973e6d40f0b2d08a8a0370f384c11fbba (diff) |
tests/psr: Move PSR state test functions to lib
kms_frontbuffer_tracking and kms_psr test PSR in different ways, let'
fix that by creating common library functions.
v2: Include the new file in meson.build
v3: Leave --no-psr intact (Rodrigo)
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.sources | 2 | ||||
-rw-r--r-- | lib/igt_psr.c | 40 | ||||
-rw-r--r-- | lib/igt_psr.h | 34 | ||||
-rw-r--r-- | lib/meson.build | 1 |
4 files changed, 77 insertions, 0 deletions
diff --git a/lib/Makefile.sources b/lib/Makefile.sources index 042c1d3b..14356c94 100644 --- a/lib/Makefile.sources +++ b/lib/Makefile.sources @@ -103,6 +103,8 @@ lib_source_list = \ igt_kmod.h \ igt_syncobj.c \ igt_syncobj.h \ + igt_psr.c \ + igt_psr.h \ $(NULL) .PHONY: version.h.tmp diff --git a/lib/igt_psr.c b/lib/igt_psr.c new file mode 100644 index 00000000..c979b0b5 --- /dev/null +++ b/lib/igt_psr.c @@ -0,0 +1,40 @@ +/* + * Copyright © 2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt_psr.h" + +bool psr_active(int fd, bool check_active) +{ + bool active; + char buf[512]; + + igt_debugfs_read(fd, "i915_edp_psr_status", buf); + active = strstr(buf, "HW Enabled & Active bit: yes\n") && + (strstr(buf, "SRDENT") || strstr(buf, "SLEEP")); + return check_active ? active : !active; +} + +bool psr_wait_entry(int fd) +{ + return igt_wait(psr_active(fd, true), 500, 1); +} diff --git a/lib/igt_psr.h b/lib/igt_psr.h new file mode 100644 index 00000000..980f85e0 --- /dev/null +++ b/lib/igt_psr.h @@ -0,0 +1,34 @@ +/* + * Copyright © 2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef IGT_PSR_H +#define IGT_PSR_H + +#include "igt_debugfs.h" +#include "igt_core.h" +#include "igt_aux.h" + +bool psr_wait_entry(int fd); +bool psr_active(int fd, bool check_active); + +#endif diff --git a/lib/meson.build b/lib/meson.build index 939167f9..74a5f61e 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -48,6 +48,7 @@ lib_sources = [ 'uwildmat/uwildmat.c', 'igt_kmod.c', 'igt_vc4.c', + 'igt_psr.c', ] lib_deps = [ |