From: Daniel Vetter <daniel@ffwll.ch>
To: John Stultz <john.stultz@linaro.org>
Cc: Daniel Stone <daniel@fooishbar.org>,
Chen Feng <puck.chen@hisilicon.com>,
lkml <linux-kernel@vger.kernel.org>,
Xinliang Liu <z.liuxinliang@hisilicon.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
Rongrong Zou <zourongrong@gmail.com>,
Daniel Vetter <daniel.vetter@intel.com>,
Xinwei Kong <kong.kongxinwei@hisilicon.com>
Subject: Re: [RFC][PATCH 1/2] drm/probe-helper: Add mode_valid check to drm_crtc_helper_funcs
Date: Tue, 14 Feb 2017 22:49:32 +0100 [thread overview]
Message-ID: <20170214214932.GF11138@dvetter-linux.ger.corp.intel.com> (raw)
In-Reply-To: <CALAqxLXxRbYTuP5CaOtzBpX=AeXArP4Td0uZWiVE6=u7kQ9-8g@mail.gmail.com>
On Tue, Feb 14, 2017 at 01:07:21PM -0800, John Stultz wrote:
> On Tue, Feb 14, 2017 at 12:32 PM, Daniel Stone <daniel@fooishbar.org> wrote:
> > Hi John,
> >
> > On 14 February 2017 at 19:25, John Stultz <john.stultz@linaro.org> wrote:
> >> +static enum drm_mode_status
> >> +drm_connector_check_crtc_modes(struct drm_connector *connector,
> >> + struct drm_display_mode *mode)
> >> +{
> >> + struct drm_device *dev = connector->dev;
> >> + const struct drm_crtc_helper_funcs *crtc_funcs;
> >> + struct drm_crtc *c;
> >> +
> >> + if (mode->status != MODE_OK)
> >> + return mode->status;
> >> +
> >> + /* Check all the crtcs on a connector to make sure the mode is valid */
> >> + drm_for_each_crtc(c, dev) {
> >> + crtc_funcs = c->helper_private;
> >> + if (crtc_funcs && crtc_funcs->mode_valid)
> >> + mode->status = crtc_funcs->mode_valid(c, mode);
> >> + if (mode->status != MODE_OK)
> >> + break;
> >> + }
> >> + return mode->status;
> >> +}
> >
> > Hm, that's unfortunate: it limits the mode list for every connector,
> > to those which are supported by every single CRTC. So if you have one
> > CRTC serving low-res LVDS, and another serving higher-res HDMI,
> > suddenly you can't get bigger modes on HDMI. The idea seems sound
> > enough, but a little more nuance might be good ...
>
> Yea. That is not my intent at all I'm just trying to get the drm_crtc
> attached to the connector that we're getting the EDID mode lines from.
> I had tried going connector->encoder->crtc, but at the time this is
> called, the encoder is null. So Rob suggested the for_each_crtc(), and
> I guess I mistook that for being each crtc on the connector.
>
> Thanks for pointing out this issue. From Daniel's feedback it looks
> like I need to start over from scratch though, so little worry this
> implementation will go much further.
Well your idea was somewhat right, but logic inverted. In ->mode_valid we
need to check whether any encoder/crtc combo could support the mode. Which
means you need to reject it only when there's no encoder/crtc combo that
could support the mode (you reject it if there's only one crtc which can't
handle it).
On the ->mode_fixup/atomic_check callbacks otoh we need to reject the mode
when it's not suitable for the current chain (as described in the atomic
states). That little difference is why this is not an entirely trivial
problem, and yes there's lots of hw out there where this matters.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2017-02-14 21:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 19:25 [RFC][PATCH 0/2] Add mode_valid drm_crtc_helper_funcs for HiKey John Stultz
2017-02-14 19:25 ` [RFC][PATCH 1/2] drm/probe-helper: Add mode_valid check to drm_crtc_helper_funcs John Stultz
2017-02-14 19:38 ` Daniel Vetter
2017-02-14 19:45 ` John Stultz
2017-02-14 20:22 ` Daniel Vetter
2017-02-14 21:03 ` John Stultz
2017-02-14 21:42 ` Daniel Vetter
2017-02-15 16:54 ` Maxime Ripard
2017-02-14 19:51 ` Ville Syrjälä
2017-02-14 20:32 ` Daniel Stone
2017-02-14 21:07 ` John Stultz
2017-02-14 21:49 ` Daniel Vetter [this message]
2017-02-15 2:21 ` Rob Clark
2017-02-20 22:32 ` Daniel Vetter
2017-02-28 6:03 ` John Stultz
2017-02-28 9:34 ` Daniel Vetter
2017-02-14 19:25 ` [RFC][PATCH 2/2] drm: kirin: Restrict modes to known good mode clocks John Stultz
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=20170214214932.GF11138@dvetter-linux.ger.corp.intel.com \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=daniel@fooishbar.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=john.stultz@linaro.org \
--cc=kong.kongxinwei@hisilicon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=puck.chen@hisilicon.com \
--cc=z.liuxinliang@hisilicon.com \
--cc=zourongrong@gmail.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
Powered by JetHome