public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Souza, Jose" <jose.souza@intel.com>
To: "Shankar, Uma" <uma.shankar@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_fbcon_fbt: When restoring fbcon always set mode to text mode
Date: Mon, 1 Jun 2020 16:42:41 +0000	[thread overview]
Message-ID: <0d2f8ea8f9df106e57b3da2ddb81c85947fbceec.camel@intel.com> (raw)
In-Reply-To: <E7C9878FBA1C6D42A1CA3F62AEB6945F82516C6F@BGSMSX104.gar.corp.intel.com>

On Mon, 2020-06-01 at 17:14 +0530, Shankar, Uma wrote:
> > -----Original Message-----
> > From: Souza, Jose <jose.souza@intel.com>
> > Sent: Friday, May 29, 2020 10:21 PM
> > To: Shankar, Uma <uma.shankar@intel.com>; igt-dev@lists.freedesktop.org
> > Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_fbcon_fbt: When restoring fbcon
> > always set mode to text mode
> > 
> > On Fri, 2020-05-29 at 21:19 +0530, Shankar, Uma wrote:
> > > > -----Original Message-----
> > > > From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of
> > > > José Roberto de Souza
> > > > Sent: Friday, May 29, 2020 6:22 AM
> > > > To: igt-dev@lists.freedesktop.org
> > > > Subject: [igt-dev] [PATCH i-g-t] tests/kms_fbcon_fbt: When restoring
> > > > fbcon always set mode to text mode
> > > > 
> > > > If by some reason or tests, this tests is executed and VT mode is
> > > > already in KD_GRAPHICS the call to kmstest_set_vt_graphics_mode()
> > > > will set orig_vt_mode as KD_GRAPHICS and when it was calling
> > > > kmstest_restore_vt_mode() it would set KD_GRAPHICS again not
> > > > returning to fbcon and causing the test to fail.
> > > > 
> > > > As it can be seen here:
> > > > (kms_fbcon_fbt:11004) igt_kms-DEBUG: VT: graphics mode set (mode was
> > 0x1)"
> > > > https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_499/fi-ehl-
> > > > 1/igt@kms_fbcon_fbt@fbc.html
> > > > 
> > > > So here adding a new function to alaways set mode the KD_TEXT when
> > > > we want to restore to fbcon.
> > > > 
> > > > Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> > > > ---
> > > >  lib/igt_kms.c         | 11 +++++++++++
> > > >  lib/igt_kms.h         |  1 +
> > > >  tests/kms_fbcon_fbt.c |  2 +-
> > > >  3 files changed, 13 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c index
> > > > d4cbc1c53..afef59396 100644
> > > > --- a/lib/igt_kms.c
> > > > +++ b/lib/igt_kms.c
> > > > @@ -968,6 +968,17 @@ void kmstest_set_vt_graphics_mode(void)
> > > >  	igt_debug("VT: graphics mode set (mode was 0x%lx)\n", ret);  }
> > > > 
> > > > +/**
> > > > + * kmstest_set_vt_text_mode:
> > > > + *
> > > > + * Sets the controlling VT (if available) into text mode.
> > > > + * Unlikely kmstest_set_vt_graphics_mode() it do not install an igt
> > > > +exit
> > > > + * handler to set the VT back to the previous mode.
> > > > + */
> > > > +void kmstest_set_vt_text_mode(void) {
> > > > +	igt_assert(set_vt_mode(KD_TEXT) >= 0); }
> > > > 
> > > >  static void reset_connectors_at_exit(int sig)  { diff --git
> > > > a/lib/igt_kms.h b/lib/igt_kms.h index adca59ac6..32a0e4cc6 100644
> > > > --- a/lib/igt_kms.h
> > > > +++ b/lib/igt_kms.h
> > > > @@ -93,6 +93,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);
> > > > +void kmstest_set_vt_text_mode(void);
> > > > 
> > > >  enum igt_atomic_crtc_properties {
> > > >         IGT_CRTC_BACKGROUND = 0,
> > > > diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c index
> > > > e6dd4353b..e99a1f2f2 100644
> > > > --- a/tests/kms_fbcon_fbt.c
> > > > +++ b/tests/kms_fbcon_fbt.c
> > > > @@ -283,7 +283,7 @@ static void restore_fbcon(struct drm_info *drm)
> > > >  	kmstest_unset_all_crtcs(drm->fd, drm->res);
> > > >  	igt_remove_fb(drm->fd, &drm->fb);
> > > >  	igt_device_drop_master(drm->fd);
> > > > -	kmstest_restore_vt_mode();
> > > > +	kmstest_set_vt_text_mode();
> > > 
> > > Can we level set the state to KD_TEXT in beginning only before we begin our
> > test.
> > > This way test will start with the expected state, and we can then set
> > > KD_GRAPHICS, restore will ensure previous state is set again as
> > > KD_TEXT, and we can just continue with the existing restore logic. Will that
> > cause any issue ?
> > 
> > We could be overwriting the previous state, KD_TEXT is the state we expect in
> > our CI but it do not means that is the state that other users have prior of
> > executing this test, that is why kmstest_restore_vt_mode() don't just set to
> > KD_TEXT.
> 
> But will this not put the mode as KD_TEXT for other user as well who would be expecting it to be
> KD_GRAPHICS. How we ensure that we exit with original state of  KD_GRAPHICS with which
> we started.

This test will restore the state that was set when it was executed, if it is not in the right state is not the job of this test to fix the global
state.
This changes here will make sure state is changed to what we need while executing it, the right fix for the state outside of this test is track
down what test or whatever is causing it and fix it.

> 
> > > Regards,
> > > Uma Shankar
> > > 
> > > >  }
> > > > 
> > > >  static void subtest(struct drm_info *drm, struct feature *feature,
> > > > bool suspend)
> > > > --
> > > > 2.26.2
> > > > 
> > > > _______________________________________________
> > > > igt-dev mailing list
> > > > igt-dev@lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-06-01 16:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  0:52 [igt-dev] [PATCH i-g-t] tests/kms_fbcon_fbt: When restoring fbcon always set mode to text mode José Roberto de Souza
2020-05-29  1:25 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-05-29  6:41 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-06-01 18:09   ` Souza, Jose
2020-05-29 15:49 ` [igt-dev] [PATCH i-g-t] " Shankar, Uma
2020-05-29 16:51   ` Souza, Jose
2020-06-01 11:44     ` Shankar, Uma
2020-06-01 16:42       ` Souza, Jose [this message]
2020-06-01 18:03         ` Shankar, Uma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d2f8ea8f9df106e57b3da2ddb81c85947fbceec.camel@intel.com \
    --to=jose.souza@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=uma.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox