Check plane rotation is reset after VT mode is restored
cover Check plane rotation is reset after VT mode is restored
The following patches allow the VT mode to be reset and then add a check in kms_rotation_crc to ensure the rotation has been restored. The test in kms_rotation_crc uses CRC values to determine this rather than just reading the property since the original issue exposed an inconsistency between the cached value for the rotation and the actual value.
https://bugs.freedesktop.org/show_bug.cgi?id=82236
Thomas Wood (2):
lib: add igt_restore_vt_mode
tests: check plane rotation is reset after the VT mode is restored
lib/igt_kms.c | 27 +++++++++++++++++++++------ lib/igt_kms.h | 1 + tests/kms_rotation_crc.c | 15 ++++++++++++++- 3 files changed, 36 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/2 lib: add igt_restore_vt_mode
Add a function to restore the previous VT mode after igt_set_vt_graphics_mode is called.
--- lib/igt_kms.c | 27 +++++++++++++++++++++------ lib/igt_kms.h | 1 + 2 files changed, 22 insertions(+), 6 deletions(-)
lib/igt_kms.c +21 -6
@@ -269,17 +269,30 @@ err:static unsigned long orig_vt_mode =-1UL ; -static void restore_vt_mode_at_exit (int sig) +/** +* kmstest_restore_vt_mode: +* +* Restore the VT mode in use before #kmstest_set_vt_graphics_mode was called. +*/ +void kmstest_restore_vt_mode (void ) { -if (orig_vt_mode !=-1UL ) -set_vt_mode (orig_vt_mode); +long ret; + +if (orig_vt_mode !=-1UL ) { + ret =set_vt_mode (orig_vt_mode); + orig_vt_mode =-1UL ; + +igt_assert (ret >=0 ); +igt_debug ("VT: original mode restored\n" ); + } }/** * kmstest_set_vt_graphics_mode: * -* Sets the controlling VT (if available) into graphics/raw mode and installs an -* igt exit handler to set the VT back to text mode on exit. +* Sets the controlling VT (if available) into graphics/raw mode and installs +* an igt exit handler to set the VT back to text mode on exit. Use +* #kmstest_restore_vt_mode to restore the previous VT mode manually. * * All kms tests must call this function to make sure that the fbcon doesn't * interfere by e.g. blanking the screen.
@@ -288,7 +301,7 @@ void kmstest_set_vt_graphics_mode(void) {long ret; -igt_install_exit_handler (restore_vt_mode_at_exit); +igt_install_exit_handler ((igt_exit_handler_t ) kmstest_restore_vt_mode);igt_disable_exit_handler (); ret =set_vt_mode (KD_GRAPHICS );
@@ -296,6 +309,8 @@ void kmstest_set_vt_graphics_mode(void)igt_assert (ret >=0 ); orig_vt_mode = ret; + +igt_debug ("VT: graphics mode set\n" ); }static int get_card_number (int fd)
lib/igt_kms.h +1 -0
@@ -102,6 +102,7 @@ void kmstest_dump_mode(drmModeModeInfo *mode);int kmstest_get_pipe_from_crtc_id (int fd,int crtc_id);void kmstest_set_vt_graphics_mode (void ); +void kmstest_restore_vt_mode (void );struct kmstest_connector_config {drmModeCrtc *crtc;
Signature · 1 line
1.9.3
PATCH 2/2 tests: check plane rotation is reset after the VT mode is restored
In reply to Thomas WoodMake sure the rotation is reset after the VT mode is restored by collecting the unrotated CRC and comparing with the CRC value after VT mode has been restored. The CRC is used to ensure the hardware state is checked, rather than any software state.
References: https://bugs.freedesktop.org/show_bug.cgi?id=82236
--- tests/kms_rotation_crc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
tests/kms_rotation_crc.c +14 -1
@@ -153,7 +153,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)igt_output_t *output;enum pipe pipe;int valid_tests =0 ; -igt_crc_t crc_output; +igt_crc_t crc_output, crc_unrotated;enum igt_commit_style commit =COMMIT_LEGACY ;if (plane_type ==IGT_PLANE_PRIMARY ) {
@@ -173,12 +173,25 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)if (!prepare_crtc (data, output, pipe, plane))continue ; +/* collect unrotated CRC */ +igt_display_commit2 (display, commit); +igt_pipe_crc_collect_crc (data->pipe_crc, &crc_unrotated); +igt_plane_set_rotation (plane,IGT_ROTATION_180 );igt_display_commit2 (display, commit);igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output);igt_assert (igt_crc_equal (&data->ref_crc, &crc_output)); +/* check the rotation state has been reset when the VT +* mode is restored */ +kmstest_restore_vt_mode (); +kmstest_set_vt_graphics_mode (); +prepare_crtc (data, output, pipe, plane); +igt_pipe_crc_collect_crc (data->pipe_crc, &crc_output); +igt_assert (igt_crc_equal (&crc_unrotated, &crc_output)); + + valid_tests++;cleanup_crtc (data, output, plane); }
Signature · 1 line
1.9.3