From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc()
Date: Wed, 21 Nov 2018 13:15:24 +0200 [thread overview]
Message-ID: <20181121111524.GY9144@intel.com> (raw)
In-Reply-To: <20181121095956.GQ4266@phenom.ffwll.local>
On Wed, Nov 21, 2018 at 10:59:56AM +0100, Daniel Vetter wrote:
> On Tue, Nov 20, 2018 at 07:55:42PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > The early return in drm_atomic_set_mode_for_crtc() isn't quite
> > right. It would mistakenly return and fail to update
> > crtc_state->enable if someone actually tried to set a zeroed
> > mode on a currently disabled crtc. I suppose that should never
> > happen but better safe than sorry.
> >
> > Additionally the early return will not be taken if we're trying to
> > disable an already disable crtc. While that is not actually harmful
> > it is inconsistent, so let's handle that case as well.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Do we have an igt for this? I.e. trying to set a all-0 mode for a disabled
> CRTC and seeing what happens ...
It should get rejected by drm_mode_convert_umode()->drm_mode_validate_basic()
so presumably you shouldn't be able to do this from userspace. In kernel
users could bypass that check and sneak something like this in however.
But I guess having an igt to verify that we do indeed reject bad modes
would a decent idea. Looks like currently we only have
kms_invalid_dotclock.
>
> Patch itself looks fine, has my r-b if the igt materializes.
> -Daniel
>
> > ---
> > drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> > index 86ac33922b09..ed0ea82e8a1d 100644
> > --- a/drivers/gpu/drm/drm_atomic_uapi.c
> > +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> > @@ -68,8 +68,13 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
> > struct drm_mode_modeinfo umode;
> >
> > /* Early return for no change. */
> > - if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> > - return 0;
> > + if (state->enable) {
> > + if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
> > + return 0;
> > + } else {
> > + if (!mode)
> > + return 0;
> > + }
> >
> > drm_property_blob_put(state->mode_blob);
> > state->mode_blob = NULL;
> > --
> > 2.18.1
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2018-11-21 11:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 17:55 [PATCH] drm/atomic: Fix the early return in drm_atomic_set_mode_for_crtc() Ville Syrjala
2018-11-20 18:23 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-11-21 4:51 ` ✓ Fi.CI.IGT: " Patchwork
2018-11-21 9:59 ` [PATCH] " Daniel Vetter
2018-11-21 11:15 ` Ville Syrjälä [this message]
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=20181121111524.GY9144@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/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;
as well as URLs for NNTP newsgroup(s).