mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-19 05:46:25 +00:00
lib: add igt_restore_vt_mode
Add a function to restore the previous VT mode after igt_set_vt_graphics_mode is called. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
5c7bcb11be
commit
fcb324c2cc
@ -269,17 +269,30 @@ err:
|
|||||||
|
|
||||||
static unsigned long orig_vt_mode = -1UL;
|
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)
|
long ret;
|
||||||
set_vt_mode(orig_vt_mode);
|
|
||||||
|
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:
|
* kmstest_set_vt_graphics_mode:
|
||||||
*
|
*
|
||||||
* Sets the controlling VT (if available) into graphics/raw mode and installs an
|
* Sets the controlling VT (if available) into graphics/raw mode and installs
|
||||||
* igt exit handler to set the VT back to text mode on exit.
|
* 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
|
* All kms tests must call this function to make sure that the fbcon doesn't
|
||||||
* interfere by e.g. blanking the screen.
|
* interfere by e.g. blanking the screen.
|
||||||
@ -288,7 +301,7 @@ void kmstest_set_vt_graphics_mode(void)
|
|||||||
{
|
{
|
||||||
long ret;
|
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();
|
igt_disable_exit_handler();
|
||||||
ret = set_vt_mode(KD_GRAPHICS);
|
ret = set_vt_mode(KD_GRAPHICS);
|
||||||
@ -296,6 +309,8 @@ void kmstest_set_vt_graphics_mode(void)
|
|||||||
|
|
||||||
igt_assert(ret >= 0);
|
igt_assert(ret >= 0);
|
||||||
orig_vt_mode = ret;
|
orig_vt_mode = ret;
|
||||||
|
|
||||||
|
igt_debug("VT: graphics mode set\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_card_number(int fd)
|
static int get_card_number(int fd)
|
||||||
|
@ -102,6 +102,7 @@ void kmstest_dump_mode(drmModeModeInfo *mode);
|
|||||||
|
|
||||||
int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
|
int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
|
||||||
void kmstest_set_vt_graphics_mode(void);
|
void kmstest_set_vt_graphics_mode(void);
|
||||||
|
void kmstest_restore_vt_mode(void);
|
||||||
|
|
||||||
struct kmstest_connector_config {
|
struct kmstest_connector_config {
|
||||||
drmModeCrtc *crtc;
|
drmModeCrtc *crtc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user