IGT PSR Fix-ups
cover IGT PSR Fix-ups
These patches, along with the kernel series at
https://patchwork.freedesktop.org/series/27137/ allow our PSR IGT tests to run more predictably on HSW, BDW, and SKL. These patches depend on the kernel series in order to run properly. On the systems I have available the following sets of tests run and pass. I still see some very sporadic (every few hundred tests executions or so) failures to read the sink CRC.
HSW:
* kms_psr_sink_crc (all)
* kms_frontbuffer_tracking (subtests psr-1p*, my system doesn't support FBC)
* kms_fbcon_fbt (subtests psr*)
BDW and SKL:
* kms_psr_sink_crc (all)
* kms_frontbuffer_tracking (subtests psr-1p* and fbcpsr-1p*)
* kms_fbcon_fbt (subtests psr*)
Note: Based on review feedback the changes in this series were
substantially restructured vs. previous versions.
Jim Bride (11):
tests/kms_psr_sink_crc: Change assert_or_manual() to a macro tests/kms_frontbuffer_tracking: Fix multidraw subtest tests/kms_frontbuffer_tracking: Remove unneeded HSW work-around.
lib: Add utility functions to enable and disable PSR.
lib: Add library functions for PSR source and sink support
lib: Add function to return PSR active status
lib: Add igt_psr_await_status() and modify tests to use it.
lib: Add igt_psr_print_status() and change tests to use it.
lib: Add igt_psr_valid_connector() and change tests to use it.
lib: Add igt_psr_find_good_mode() and modify tests to use it.
lib: Add igt_psr_get_sink_crc() and change tests to use it.
lib/Makefile.sources | 2 + lib/igt.h | 1 + lib/igt_psr.c | 233 +++++++++++++++++++++++++++++++++++++++ lib/igt_psr.h | 42 +++++++ tests/kms_fbcon_fbt.c | 42 +++---- tests/kms_frontbuffer_tracking.c | 83 +++++--------- tests/kms_psr_sink_crc.c | 148 ++++++++++++------------- 7 files changed, 398 insertions(+), 153 deletions(-) create mode 100644 lib/igt_psr.c create mode 100644 lib/igt_psr.h
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/11 tests/kms_psr_sink_crc: Change assert_or_manual() to a macro
Make assert_or_manual() a macro so that we get accurate line number information when this assertion fails.
v2: Rebase
--- tests/kms_psr_sink_crc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/kms_psr_sink_crc.c +5 -5
@@ -278,11 +278,11 @@ static bool is_green(char *crc) (bh & mask) == 0); } -static void assert_or_manual (bool condition,const char *expected) -{ -igt_debug_manual_check ("no-crc" , expected); -igt_assert (igt_interactive_debug || condition); -} +#define assert_or_manual (condition, expected) \ +do { \ + igt_debug_manual_check("no-crc", expected); \ + igt_assert(igt_interactive_debug || condition); \ +} while (0)static void run_test (data_t *data) {
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/11 tests/kms_frontbuffer_tracking: Fix multidraw subtest
In reply to Jim BrideThe multidraw subtest was not taking whether or not the GEM buffer had ever been in write-combining mode when checking for PSR state, so fix that.
--- tests/kms_frontbuffer_tracking.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/kms_frontbuffer_tracking.c +2 -1
@@ -2140,7 +2140,8 @@ static void multidraw_subtest(const struct test_mode *t) assertions = used_method !=IGT_DRAW_MMAP_GTT ?ASSERT_LAST_ACTION_CHANGED :ASSERT_NO_ACTION_CHANGE ; -if (op_disables_psr (t, used_method)) +if (op_disables_psr (t, used_method) && + !wc_used) assertions |=ASSERT_PSR_DISABLED ;do_assertions (assertions);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/11 tests/kms_frontbuffer_tracking: Remove unneeded HSW work-around.
In reply to Jim BrideThis work-around actually causes issues on HSW now. Without this code in-place I'm seeing good results on HSW.
--- tests/kms_frontbuffer_tracking.c | 6 ------ 1 file changed, 6 deletions(-)
tests/kms_frontbuffer_tracking.c +0 -6
@@ -436,12 +436,6 @@ static bool connector_get_mode(drmModeConnectorPtr c, drmModeModeInfoPtr *mode)else *mode = &c->modes[0 ]; -/* On HSW the CRC WA is so awful that it makes you think everything is -* bugged. */ -if (IS_HASWELL (intel_get_drm_devid (drm.fd)) && - c->connector_type == DRM_MODE_CONNECTOR_eDP) - *mode = &std_1024_mode; -return true; }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/11 lib: Add utility functions to enable and disable PSR.
In reply to Jim BrideCreate files to contain PSR-specific IGT functions and add macros to enable and disable PSR.
--- lib/Makefile.sources | 1 + lib/igt.h | 1 + lib/igt_psr.h | 30 ++++++++++++++++++++++++++++++ tests/kms_fbcon_fbt.c | 2 +- tests/kms_frontbuffer_tracking.c | 4 ++-- tests/kms_psr_sink_crc.c | 8 +++++--- 6 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 lib/igt_psr.h
lib/Makefile.sources +1 -0
@@ -83,6 +83,7 @@ lib_source_list = \ uwildmat/uwildmat.c \ igt_kmod.c \ igt_kmod.h \ + igt_psr.h \ $(NULL) .PHONY: version.h.tmp
lib/igt.h +1 -0
@@ -38,6 +38,7 @@#include "igt_kms.h" #include "igt_pm.h" #include "igt_stats.h" +#include "igt_psr.h" #ifdef HAVE_CHAMELIUM #include "igt_chamelium.h" #endif
lib/igt_psr.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright © 2017 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 + +#define igt_psr_enable () igt_set_module_param_int("enable_psr", 1) +#define igt_psr_disable () igt_set_module_param_int("enable_psr", 0) + +#endif /* IGT_PSR_H */
tests/kms_fbcon_fbt.c +1 -1
@@ -193,7 +193,7 @@ struct feature {static void disable_features (void ) {igt_set_module_param_int (fbc.param_name,0 ); -igt_set_module_param_int (psr.param_name,0 ); +igt_psr_disable (); }static void subtest (struct feature *feature,bool suspend)
tests/kms_frontbuffer_tracking.c +2 -2
@@ -927,8 +927,8 @@ static bool psr_wait_until_enabled(void)#define fbc_enable () igt_set_module_param_int("enable_fbc", 1)#define fbc_disable () igt_set_module_param_int("enable_fbc", 0) -#define psr_enable () igt_set_module_param_int("enable_psr", 1) -#define psr_disable () igt_set_module_param_int("enable_psr", 0) +#define psr_enable () igt_psr_enable() +#define psr_disable () igt_psr_disable()static void get_sink_crc (sink_crc_t *crc,bool mandatory) {
tests/kms_psr_sink_crc.c +5 -3
@@ -507,9 +507,11 @@ 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 ? -0 :1 ); - +if (running_with_psr_disabled) +igt_psr_disable (); +else +igt_psr_enable (); +igt_skip_on (!psr_possible (&data)); data.bufmgr =drm_intel_bufmgr_gem_init (data.drm_fd,4096 );
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/11 lib: Add library functions for PSR source and sink support
In reply to Jim BrideAdd functions to tell whether the source and sink support PSR as well as a function to determine whether PSR is possible (both source and sink support PSR.) Also modify the PSR tests to use these functions.
--- lib/Makefile.sources | 1 + lib/igt_psr.c | 85 ++++++++++++++++++++++++++++++++++++++++ lib/igt_psr.h | 4 ++ tests/kms_fbcon_fbt.c | 5 +-- tests/kms_frontbuffer_tracking.c | 5 +-- tests/kms_psr_sink_crc.c | 6 +-- 6 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 lib/igt_psr.c
lib/Makefile.sources +1 -0
@@ -83,6 +83,7 @@ lib_source_list = \ uwildmat/uwildmat.c \ igt_kmod.c \ igt_kmod.h \ + igt_psr.c \ igt_psr.h \ $(NULL)
lib/igt_psr.c new file +85 -0
85 lines not on this page · raw message
lib/igt_psr.h +4 -0
@@ -27,4 +27,8 @@#define igt_psr_enable () igt_set_module_param_int("enable_psr", 1)#define igt_psr_disable () igt_set_module_param_int("enable_psr", 0) +bool igt_psr_source_support (int fd); +bool igt_psr_sink_support (int fd); +bool igt_psr_possible (int fd); +#endif /* IGT_PSR_H */
tests/kms_fbcon_fbt.c +1 -4
@@ -149,10 +149,7 @@ static void set_mode_for_one_screen(struct drm_info *drm, struct igt_fb *fb,static bool psr_supported_on_chipset (int fd) { -char buf[256 ]; - -igt_debugfs_read (fd,"i915_edp_psr_status" , buf); -return strstr (buf,"Sink_Support: yes\n" ); +return igt_psr_sink_support (fd); }static bool connector_can_psr (drmModeConnectorPtr connector)
tests/kms_frontbuffer_tracking.c +1 -4
@@ -1543,10 +1543,7 @@ static void teardown_fbc(void)static bool psr_sink_has_support (void ) { -char buf[256 ]; - -debugfs_read ("i915_edp_psr_status" , buf); -return strstr (buf,"Sink_Support: yes\n" ); +return igt_psr_sink_support (drm.fd); }static void setup_psr (void )
tests/kms_psr_sink_crc.c +1 -5
@@ -194,12 +194,8 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)static bool psr_possible (data_t *data) { -char buf[512 ]; - -igt_debugfs_read (data->drm_fd,"i915_edp_psr_status" , buf); -return running_with_psr_disabled || -strstr (buf,"Sink_Support: yes\n" ); +igt_psr_possible (data->drm_fd); }static bool psr_active (data_t *data)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/11 lib: Add function to return PSR active status
In reply to Jim BrideAdd igt_psr_active() which returns whether PSR is active or not and modify tests to use this function.
--- lib/igt_psr.c | 19 +++++++++++++++++++ lib/igt_psr.h | 1 + tests/kms_fbcon_fbt.c | 5 +---- tests/kms_frontbuffer_tracking.c | 6 +----- tests/kms_psr_sink_crc.c | 5 +---- 5 files changed, 23 insertions(+), 13 deletions(-)
lib/igt_psr.c +19 -0
@@ -83,3 +83,22 @@ bool igt_psr_possible(int fd)return igt_psr_source_support (fd) &&igt_psr_sink_support (fd); } + +/** +* igt_psr_active: +* +* Returns true if PSR is active on the panel. +*/ +bool igt_psr_active (int fd) +{ +char buf[BUFSIZE ]; +bool actret = false; +bool hwactret = false; + +igt_debugfs_read (fd,"i915_edp_psr_status" , buf); + hwactret = (strstr (buf,"HW Enabled & Active bit: yes\n" ) !=NULL ); + actret = (strstr (buf,"Active: yes\n" ) !=NULL ); +igt_debug ("hwactret: %s actret: %s\n" , hwactret ?"true" :"false" , + actret ?"true" :"false" ); +return hwactret && actret; +}
lib/igt_psr.h +1 -0
@@ -30,5 +30,6 @@bool igt_psr_source_support (int fd);bool igt_psr_sink_support (int fd);bool igt_psr_possible (int fd); +bool igt_psr_active (int fd);#endif /* IGT_PSR_H */
tests/kms_fbcon_fbt.c +1 -4
@@ -159,10 +159,7 @@ static bool connector_can_psr(drmModeConnectorPtr connector)static bool psr_is_enabled (int fd) { -char buf[256 ]; - -igt_debugfs_read (fd,"i915_edp_psr_status" , buf); -return strstr (buf,"\nActive: yes\n" ); +return igt_psr_active (fd); }static bool psr_wait_until_enabled (int fd)
tests/kms_frontbuffer_tracking.c +1 -5
@@ -800,11 +800,7 @@ static void fbc_print_status(void)static bool psr_is_enabled (void ) { -char buf[256 ]; - -debugfs_read ("i915_edp_psr_status" , buf); -return strstr (buf,"\nActive: yes\n" ) && -strstr (buf,"\nHW Enabled & Active bit: yes\n" ); +return igt_psr_active (drm.fd); }static void psr_print_status (void )
tests/kms_psr_sink_crc.c +1 -4
@@ -200,12 +200,9 @@ static bool psr_possible(data_t *data)static bool psr_active (data_t *data) { -char buf[512 ]; - -igt_debugfs_read (data->drm_fd,"i915_edp_psr_status" , buf);return running_with_psr_disabled || -strstr (buf,"HW Enabled & Active bit: yes\n" ); +igt_psr_active (data->drm_fd); }static bool wait_psr_entry (data_t *data)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/11 lib: Add igt_psr_await_status() and modify tests to use it.
In reply to Jim Bride--- lib/igt_psr.c | 12 ++++++++++++ lib/igt_psr.h | 1 + tests/kms_fbcon_fbt.c | 28 ++++++++++++---------------- tests/kms_frontbuffer_tracking.c | 17 +++++------------ tests/kms_psr_sink_crc.c | 16 ++-------------- 5 files changed, 32 insertions(+), 42 deletions(-)
lib/igt_psr.c +12 -0
@@ -102,3 +102,15 @@ bool igt_psr_active(int fd) actret ? "true" : "false");return hwactret && actret; } + +/** +* igt_psr_await_status: +* @active: A boolean that causes the function to wait for PSR to activate +* if set to true, or to wait for PSR to deactivate if false. +* +* Returns true if the requested condition is met. +*/ +bool igt_psr_await_status (int fd,bool active) +{ +return igt_wait (igt_psr_active (fd) == active,5000 ,1 ); +}
lib/igt_psr.h +1 -0
@@ -31,5 +31,6 @@ bool igt_psr_source_support(int fd);bool igt_psr_sink_support (int fd);bool igt_psr_possible (int fd);bool igt_psr_active (int fd); +bool igt_psr_await_status (int fd,bool active);#endif /* IGT_PSR_H */
tests/kms_fbcon_fbt.c +12 -16
@@ -103,8 +103,9 @@ static bool fbc_is_enabled(int fd)return strstr (buf,"FBC enabled\n" ); } -static bool fbc_wait_until_enabled (int fd) +static bool fbc_await_status (int fd,bool enabled) { +igt_assert (enabled);return igt_wait (fbc_is_enabled (fd),5000 ,1 ); }
@@ -157,29 +158,24 @@ static bool connector_can_psr(drmModeConnectorPtr connector)return (connector->connector_type == DRM_MODE_CONNECTOR_eDP); } -static bool psr_is_enabled (int fd) +static bool psr_await_status (int fd,bool enabled) { -return igt_psr_active (fd); -} - -static bool psr_wait_until_enabled (int fd) -{ -return igt_wait (psr_is_enabled (fd),5000 ,1 ); +return igt_psr_await_status (fd, enabled); }struct feature {bool (*supported_on_chipset)(int fd); -bool (*wait_until_enabled)(int fd); +bool (*await_status)(int fd,bool enabled);bool (*connector_possible_fn)(drmModeConnectorPtr connector);const char *param_name; } fbc = { .supported_on_chipset = fbc_supported_on_chipset, - .wait_until_enabled = fbc_wait_until_enabled, + .await_status = fbc_await_status, .connector_possible_fn = connector_can_fbc, .param_name ="enable_fbc" , }, psr = { .supported_on_chipset = psr_supported_on_chipset, - .wait_until_enabled = psr_wait_until_enabled, + .await_status = psr_await_status, .connector_possible_fn = connector_can_psr, .param_name ="enable_psr" , };
@@ -204,17 +200,17 @@ static void subtest(struct feature *feature, bool suspend)kmstest_unset_all_crtcs (drm.fd, drm.res);wait_user ("Modes unset." ); -igt_assert (!feature->wait_until_enabled (drm.fd)); +igt_assert (feature->await_status (drm.fd, false));set_mode_for_one_screen (&drm, &fb, feature->connector_possible_fn);wait_user ("Screen set." ); -igt_assert (feature->wait_until_enabled (drm.fd)); +igt_assert (feature->await_status (drm.fd, true));if (suspend) {igt_system_suspend_autoresume (SUSPEND_STATE_MEM ,SUSPEND_TEST_NONE );sleep (5 ); -igt_assert (feature->wait_until_enabled (drm.fd)); +igt_assert (feature->await_status (drm.fd, true)); }igt_remove_fb (drm.fd, &fb);
@@ -224,13 +220,13 @@ static void subtest(struct feature *feature, bool suspend)sleep (3 );wait_user ("Back to fbcon." ); -igt_assert (!feature->wait_until_enabled (drm.fd)); +igt_assert (feature->await_status (drm.fd, false));if (suspend) {igt_system_suspend_autoresume (SUSPEND_STATE_MEM ,SUSPEND_TEST_NONE );sleep (5 ); -igt_assert (!feature->wait_until_enabled (drm.fd)); +igt_assert (feature->await_status (drm.fd, false)); } }
tests/kms_frontbuffer_tracking.c +5 -12
@@ -798,11 +798,6 @@ static void fbc_print_status(void)igt_info ("FBC status:\n%s\n" , buf); } -static bool psr_is_enabled (void ) -{ -return igt_psr_active (drm.fd); -} -static void psr_print_status (void ) {char buf[256 ];
@@ -916,11 +911,6 @@ static bool fbc_wait_until_enabled(void)return igt_wait (fbc_is_enabled (),2000 ,1 ); } -static bool psr_wait_until_enabled (void ) -{ -return igt_wait (psr_is_enabled (),5000 ,1 ); -} -#define fbc_enable () igt_set_module_param_int("enable_fbc", 1)#define fbc_disable () igt_set_module_param_int("enable_fbc", 0)#define psr_enable () igt_psr_enable()
@@ -1704,12 +1694,15 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags) } \ \if (flags_ &ASSERT_PSR_ENABLED ) { \ -if (!psr_wait_until_enabled ()) { \ +if (!igt_psr_await_status (drm.fd, true)) { \psr_print_status (); \igt_assert_f (false,"PSR disabled\n" ); \ } \ }else if (flags_ &ASSERT_PSR_DISABLED ) { \ -igt_assert (!psr_wait_until_enabled ()); \ +if (!igt_psr_await_status (drm.fd, false)) { \ +psr_print_status (); \ +igt_assert_f (false,"PSR enabled\n" ); \ + } \ } \ }while (0 )
tests/kms_psr_sink_crc.c +2 -14
@@ -198,22 +198,10 @@ static bool psr_possible(data_t *data)igt_psr_possible (data->drm_fd); } -static bool psr_active (data_t *data) -{ - -return running_with_psr_disabled || -igt_psr_active (data->drm_fd); -} -static bool wait_psr_entry (data_t *data) { -int timeout =5 ; -while (timeout--) { -if (psr_active (data)) -return true; -sleep (1 ); - } -return false; +return running_with_psr_disabled || +igt_psr_await_status (data->drm_fd, true); }static void get_sink_crc (data_t *data,char *crc) {
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/11 lib: Add igt_psr_print_status() and change tests to use it.
In reply to Jim Bride--- lib/igt_psr.c | 13 +++++++++++++ lib/igt_psr.h | 1 + tests/kms_frontbuffer_tracking.c | 5 +---- 3 files changed, 15 insertions(+), 4 deletions(-)
lib/igt_psr.c +13 -0
@@ -114,3 +114,16 @@ bool igt_psr_await_status(int fd, bool active) {return igt_wait (igt_psr_active (fd) == active,5000 ,1 ); } + +/** +* igt_psr_print_status: +* +* Dumps the contents of i915_edp_psr_status from debugfs. +*/ +void igt_psr_print_status (int fd) +{ +char buf[BUFSIZE ]; + +igt_debugfs_read (fd,"i915_edp_psr_status" , buf); +igt_info ("PSR status:\n%s\n" , buf); +}
lib/igt_psr.h +1 -0
@@ -32,5 +32,6 @@ bool igt_psr_sink_support(int fd);bool igt_psr_possible (int fd);bool igt_psr_active (int fd);bool igt_psr_await_status (int fd,bool active); +void igt_psr_print_status (int fd);#endif /* IGT_PSR_H */
tests/kms_frontbuffer_tracking.c +1 -4
@@ -800,10 +800,7 @@ static void fbc_print_status(void)static void psr_print_status (void ) { -char buf[256 ]; - -debugfs_read ("i915_edp_psr_status" , buf); -igt_info ("PSR status:\n%s\n" , buf); +igt_psr_print_status (drm.fd); }static struct timespec fbc_get_last_action (void )
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/11 lib: Add igt_psr_find_good_mode() and modify tests to use it.
In reply to Jim Bride--- lib/igt_psr.c | 34 +++++++++++++++++++++++++++++++++ lib/igt_psr.h | 2 ++ tests/kms_fbcon_fbt.c | 4 ++++ tests/kms_frontbuffer_tracking.c | 2 +- tests/kms_psr_sink_crc.c | 41 ++++++++++++++++++++++++++++++---------- 5 files changed, 72 insertions(+), 11 deletions(-)
lib/igt_psr.c +34 -0
@@ -138,3 +138,37 @@ bool igt_psr_valid_connector(drmModeConnectorPtr connector) {return (connector->connector_type == DRM_MODE_CONNECTOR_eDP); } + +/** +* igt_psr_find_good_mode +* @connector: a drmModeConnector pointer to find the mode on +* @mode: a drmModeModePtr pointer that is set to the matching mode +* +* Returns true (and populates *mode with the match) if a valid +* PSR mdoe is found, and false otherwise. +*/ +bool igt_psr_find_good_mode (drmModeConnectorPtr connector, +drmModeModeInfoPtr *mode) +{ +int i; + +if (!connector->count_modes) { +igt_warn ("no modes for connector %d.\n" , + connector->connector_id); +return false; + }else { +igt_debug ("Connector has %d modes.\n" , connector->count_modes); + } + +for (i =0 ; i < connector->count_modes; i++) { +if ((connector->modes[i].vtotal - + connector->modes[i].vdisplay) >=36 ) { +igt_debug ("Mode %d good for PSR.\n" , i); + *mode = &(connector->modes[i]); +return true; + }else { +igt_debug ("Throwing out mode %d\n" , i); + } + } +return false; +}
lib/igt_psr.h +2 -0
@@ -34,5 +34,7 @@ bool igt_psr_active(int fd);bool igt_psr_await_status (int fd,bool active);void igt_psr_print_status (int fd);bool igt_psr_valid_connector (drmModeConnectorPtr connector); +bool igt_psr_find_good_mode (drmModeConnectorPtr connector, +drmModeModeInfoPtr *mode);#endif /* IGT_PSR_H */
tests/kms_fbcon_fbt.c +4 -0
@@ -125,6 +125,10 @@ static void set_mode_for_one_screen(struct drm_info *drm, struct igt_fb *fb,if (c->connection ==DRM_MODE_CONNECTED && c->count_modes &&connector_possible (c)) { +if (c->connector_type == DRM_MODE_CONNECTOR_eDP) { +if (igt_psr_find_good_mode (c, &mode)) +break ; + } mode = &c->modes[0 ];break ; }
tests/kms_frontbuffer_tracking.c +1 -1
@@ -435,7 +435,7 @@ static bool connector_get_mode(drmModeConnectorPtr c, drmModeModeInfoPtr *mode)if (opt.small_modes) *mode =get_connector_smallest_mode (c);else - *mode = &c->modes[0 ]; +igt_assert (igt_psr_find_good_mode (c, mode));return true; }
tests/kms_psr_sink_crc.c +31 -10
83 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/11 lib: Add igt_psr_get_sink_crc() and change tests to use it.
In reply to Jim BrideOur tests were sometimes using the string representation of the sink CRC and sometimes a binary version, so for consistency's sake, as well as to make the utility function return something closer to what the eDP spec talks about, all sink CRC operations are now assuming that the sink CRC is retrieved in binary form.
--- lib/igt_psr.c | 59 ++++++++++++++++++++++++++++++++ lib/igt_psr.h | 2 ++ tests/kms_frontbuffer_tracking.c | 25 ++++++-------- tests/kms_psr_sink_crc.c | 74 ++++++++++++++++++---------------------- 4 files changed, 105 insertions(+), 55 deletions(-)
lib/igt_psr.c +59 -0
@@ -172,3 +172,62 @@ bool igt_psr_find_good_mode(drmModeConnectorPtr connector, }return false; } + +/** +* igt_psr_open_sink_crc: +* @drm_fd: a file descriptor to the drm debugfs tree +* +* Returns a valid file descriptor to the sink CRC debugfs file +* if successful or -1 on an error. +*/ +int igt_psr_open_sink_crc (int drm_fd) +{ +int crc_fd; + + crc_fd =openat (drm_fd,"i915_sink_crc_eDP1" ,O_RDONLY ); +igt_assert_lte (0 , crc_fd); +return crc_fd; +} + + +/** +* igt_psr_get_sink_crc: +* @fd: a file descriptor to the sink CRC debugfs node +* @data: A six byte array of characters that holds the read CRC values +* +* Returns 0 on success non-zero on error. +*/ +int igt_psr_get_sink_crc (int fd,char *data) +{ +int rc, errno_; +char buf[13 ];/* two chars per byte x 6 bytes plus a '\0' */ + +memset (buf,0 ,13 ); +lseek (fd,0 ,SEEK_SET ); + + rc =read (fd, buf,12 ); + errno_ = errno; + +if (rc ==-1 ) { +if (errno_ ==ENOTTY ) +igt_info ("Sink CRC not supported: panel doesn't support it\n" ); +else if (errno_ !=ETIMEDOUT ) +igt_assert_f (rc !=-1 ,"Unexpected error: %d\n" , + errno_); +return errno_; + }else { +int i; +unsigned long long val =strtoull (buf,NULL ,16 ); + +/* +* Stuff the six CRC bytes into their individual locations. +* We start from the least significant byte of the read value +* to simplify masking, shifting each byte off as we set the +* appropriate element in the array. +*/ +for (i =5 ; i >=0 ; i--, val >>=8 ) { + data[i] = (unsigned char ) (val &0xff ); + } +return 0 ; + } +}
lib/igt_psr.h +2 -0
@@ -36,5 +36,7 @@ void igt_psr_print_status(int fd);bool igt_psr_valid_connector (drmModeConnectorPtr connector);bool igt_psr_find_good_mode (drmModeConnectorPtr connector,drmModeModeInfoPtr *mode); +int igt_psr_open_sink_crc (int drm_fd); +int igt_psr_get_sink_crc (int fd,char *data);#endif /* IGT_PSR_H */
tests/kms_frontbuffer_tracking.c +10 -15
@@ -183,7 +183,7 @@ struct { }; -#define SINK_CRC_SIZE 12 +#define SINK_CRC_SIZE 6typedef struct {char data[SINK_CRC_SIZE ]; }sink_crc_t ;
@@ -916,32 +916,27 @@ static bool fbc_wait_until_enabled(void)static void get_sink_crc (sink_crc_t *crc,bool mandatory) { -int rc, errno_; +int rc; +const char bad_crc[6 ] = {0 ,0 ,0 ,0 ,0 ,0 };if (!sink_crc.supported) { -memcpy (crc,"unsupported!" ,SINK_CRC_SIZE ); +memcpy (crc, bad_crc,SINK_CRC_SIZE );return ; } -lseek (sink_crc.fd,0 ,SEEK_SET ); - - rc =read (sink_crc.fd, crc->data,SINK_CRC_SIZE ); - errno_ = errno; + rc =igt_psr_get_sink_crc (sink_crc.fd, crc->data); -if (rc ==-1 && errno_ ==ENOTTY ) { +if (rc ==ENOTTY ) {igt_info ("Sink CRC not supported: panel doesn't support it\n" ); sink_crc.supported = false; - }else if (rc ==-1 && errno_ ==ETIMEDOUT ) { -if (sink_crc.reliable) { -igt_info ("Sink CRC is unreliable on this machine.\n" ); + }else if (rc ==ETIMEDOUT ) { +if (sink_crc.reliable) sink_crc.reliable = false; - }if (mandatory)igt_skip ("Sink CRC is unreliable on this machine.\n" ); }else { -igt_assert_f (rc !=-1 ,"Unexpected error: %d\n" , errno_); -igt_assert (rc ==SINK_CRC_SIZE ); +igt_assert_f (rc ==0 ,"Unexpected error: %d\n" , rc); } }
@@ -1410,7 +1405,7 @@ static void setup_sink_crc(void)fill_fb_region (&prim_mode_params.fb,COLOR_PRIM_BG );set_mode_for_params (&prim_mode_params); - sink_crc.fd =openat (drm.debugfs,"i915_sink_crc_eDP1" ,O_RDONLY ); + sink_crc.fd =igt_psr_open_sink_crc (drm.debugfs);igt_assert_lte (0 , sink_crc.fd);/* Do a first read to try to detect if it's supported. */
tests/kms_psr_sink_crc.c +34 -40
149 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/11 lib: Add igt_psr_valid_connector() and change tests to use it.
In reply to Jim Bride--- lib/igt_psr.c | 11 +++++++++++ lib/igt_psr.h | 1 + tests/kms_frontbuffer_tracking.c | 12 +++++++----- tests/kms_psr_sink_crc.c | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-)
lib/igt_psr.c +11 -0
@@ -127,3 +127,14 @@ void igt_psr_print_status(int fd)igt_debugfs_read (fd,"i915_edp_psr_status" , buf);igt_info ("PSR status:\n%s\n" , buf); } + +/** +* igt_psr_valid_connector: +* @connector: a drmModeConnector pointer to check +* +* Returns true if connector is an eDP connector. +*/ +bool igt_psr_valid_connector (drmModeConnectorPtr connector) +{ +return (connector->connector_type == DRM_MODE_CONNECTOR_eDP); +}
lib/igt_psr.h +1 -0
@@ -33,5 +33,6 @@ bool igt_psr_possible(int fd);bool igt_psr_active (int fd);bool igt_psr_await_status (int fd,bool active);void igt_psr_print_status (int fd); +bool igt_psr_valid_connector (drmModeConnectorPtr connector);#endif /* IGT_PSR_H */
tests/kms_frontbuffer_tracking.c +7 -5
@@ -424,11 +424,12 @@ static void init_mode_params(struct modeset_params *params, uint32_t crtc_id,static bool connector_get_mode (drmModeConnectorPtr c,drmModeModeInfoPtr *mode) { *mode =NULL ; +bool valid =igt_psr_valid_connector (c);if (c->connection !=DRM_MODE_CONNECTED || !c->count_modes)return false; -if (c->connector_type == DRM_MODE_CONNECTOR_eDP && opt.no_edp) +if (valid && opt.no_edp)return false;if (opt.small_modes)
@@ -461,7 +462,7 @@ static bool find_connector(bool edp_only, bool pipe_a, uint32_t forbidden_id,for (i =0 ; i < drm.res->count_connectors; i++) { c = drm.connectors[i]; -if (edp_only && c->connector_type != DRM_MODE_CONNECTOR_eDP) +if (edp_only && !igt_psr_valid_connector (c))continue ;if (pipe_a && !connector_supports_pipe_a (c))continue ;
@@ -1395,7 +1396,7 @@ static void setup_sink_crc(void)drmModeConnectorPtr c; c =get_connector (prim_mode_params.connector_id); -if (c->connector_type != DRM_MODE_CONNECTOR_eDP) { +if (!igt_psr_valid_connector (c)) {igt_info ("Sink CRC not supported: primary screen is not eDP\n" ); sink_crc.supported = false;return ;
@@ -1531,8 +1532,9 @@ static bool psr_sink_has_support(void)static void setup_psr (void ) { -if (get_connector (prim_mode_params.connector_id)->connector_type != - DRM_MODE_CONNECTOR_eDP) { +drmModeConnectorPtr c =get_connector (prim_mode_params.connector_id); + +if (!igt_psr_valid_connector (c)) {igt_info ("Can't test PSR: no usable eDP screen.\n" );return ; }
tests/kms_psr_sink_crc.c +1 -1
@@ -103,7 +103,7 @@ static void setup_output(data_t *data)for_each_pipe_with_valid_output (display, pipe, output) {drmModeConnectorPtr c = output->config.connector; -if (c->connector_type != DRM_MODE_CONNECTOR_eDP) +if (!igt_psr_valid_connector (c))continue ;igt_output_set_pipe (output, pipe);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH IGT 03/11] tests/kms_frontbuffer_tracking: Remove unneeded HSW work-around.
In reply to Jim BrideEm Ter, 2017-07-11 às 15:48 -0700, Jim Bride escreveu:
Quoted 2 lines
This work-around actually causes issues on HSW now. Without this code in-place I'm seeing good results on HSW.
Which issues?
Quoted 25 lines
Cc Rodrigo Vivi <[email protected]>Cc Paulo Zanoni <[email protected]>Signed-off-by Jim Bride <[email protected]>---
tests/kms_frontbuffer_tracking.c | 6 ------1 file changed, 6 deletions(-)tests/kms_frontbuffer_tracking.c +0
-0@@ -436,12 +436,6 @@ static bool connector_get_mode(drmModeConnectorPtr c, drmModeModeInfoPtr *mode)else
*mode = &c->modes[0];tests/kms_frontbuffer_tracking.c +0
-1- /* On HSW the CRC WA is so awful that it makes you thinkeverything is
tests/kms_frontbuffer_tracking.c +0
-5-* bugged. */ -if (IS_HASWELL (intel_get_drm_devid (drm.fd)) && - c->connector_type == DRM_MODE_CONNECTOR_eDP) - *mode = &std_1024_mode; -
Quoted 3 lines
return true;
}
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx