From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org,
Keith Packard <keithp@keithp.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [RFC][PATCH 08/11] drm: Add drm_connector_fill_modes()
Date: Tue, 6 Mar 2018 12:30:34 +0200 [thread overview]
Message-ID: <20180306103034.GA5453@intel.com> (raw)
In-Reply-To: <20180306100030.GZ22212@phenom.ffwll.local>
On Tue, Mar 06, 2018 at 11:00:30AM +0100, Daniel Vetter wrote:
> On Tue, Feb 27, 2018 at 02:56:57PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Wrap the ->fill_modes() call in a small helper that first clears out the
> > stale data from connector->display_info. This should guarantee that we
> > get consistent display_info whether or not the drivers use the EDID
> > based stuff to clear and fill it.
> >
> > TODO: what about just after init, before anyone has called
> > ->fill_modes()? In that case userspace could see stale data if they do
> > the cheap getconnector ioctl. Not sure if that's a valid concern though.
> >
> > Cc: Keith Packard <keithp@keithp.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Some thoughts:
> - I think unconditionally resetting for panels is the wrong thing to do.a
I think we do fill it dynamically at least for eDP. I suppose not
resetting and just overwriting with the same data could work, but in
theory it could also lead to inconsistent behaviour if the code that
fills the info assumes that things stay at 0 until filled.
> - We're not resetting in even more places, can't we just condense them all
> down to 1?
> - I'm undecided on whether this should be in the core, or in the helpers.
> Atm the core is the one that implements the "just give me the current
> mode list, don't reprobe" logic, but then we punt everything else to
> ->fill_modes (including setting all modes to stale and all that stuff).
> I'm slightly leaning towards doing this in the helper code, not the core
> code. Any reasons for doing this in core?
I was pretty much just hoping to force everyone down one path. Having
multiple ways of doing things can lead to inconsistent behaviour,
especially when people are unsure which one to choose. And at least
I don't particularly enjoy having to remind myself about the internal
vs. external differences all the time.
But I must admit to not having really thought this thing through, so
I might be on the wrong track here.
>
> Cheers, Daniel
> > ---
> > drivers/gpu/drm/drm_connector.c | 44 +++++++++++++++++++++++++++++++++++++----
> > drivers/gpu/drm/drm_edid.c | 14 +------------
> > drivers/gpu/drm/drm_fb_helper.c | 2 +-
> > drivers/gpu/drm/drm_sysfs.c | 6 +++---
> > include/drm/drm_connector.h | 3 +++
> > include/drm/drm_edid.h | 1 -
> > 6 files changed, 48 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> > index d8c3ef4f17da..2bf19a37dbac 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -1389,7 +1389,7 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
> > * duplicate it rather than attempt to ensure some arbitrary
> > * ordering of calls.
> > */
> > - drm_reset_display_info(connector);
> > + drm_connector_reset_display_info(connector);
> > if (edid && drm_edid_is_valid(edid))
> > drm_add_display_info(connector, edid);
> >
> > @@ -1594,9 +1594,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
> >
> > mutex_lock(&dev->mode_config.mutex);
> > if (out_resp->count_modes == 0) {
> > - connector->funcs->fill_modes(connector,
> > - dev->mode_config.max_width,
> > - dev->mode_config.max_height);
> > + drm_connector_fill_modes(connector,
> > + dev->mode_config.max_width,
> > + dev->mode_config.max_height);
> > }
> >
> > out_resp->mm_width = connector->display_info.width_mm;
> > @@ -1759,3 +1759,39 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
> > return tg;
> > }
> > EXPORT_SYMBOL(drm_mode_create_tile_group);
> > +
> > +/**
> > + * drm_connector_reset_display_info - reset the connector's display info
> > + * @connector: DRM connector
> > + *
> > + * Clear the old display info for @connector allowing the driver to
> > + * repopulate it based on fresh data.
> > + */
> > +void drm_connector_reset_display_info(struct drm_connector *connector)
> > +{
> > + struct drm_display_info *info = &connector->display_info;
> > +
> > + memset(info, 0, sizeof(*info));
> > +}
> > +EXPORT_SYMBOL_GPL(drm_connector_reset_display_info);
> > +
> > +/**
> > + * drm_connector_fill_modes - fill connector mode list and dynamic display info
> > + * @connector: DRM connector
> > + * @max_width: max width for modes
> > + * @max_height: max height for modes
> > + *
> > + * Reset the display info and calls &drm_connector_funcs.fill_modes() vfunc
> > + * repopulate it and and the mode list.
> > + *
> > + * RETURNS:
> > + * The number of modes found on @connector.
> > + */
> > +int drm_connector_fill_modes(struct drm_connector *connector,
> > + unsigned int max_width, unsigned int max_height)
> > +{
> > + drm_connector_reset_display_info(connector);
> > +
> > + return connector->funcs->fill_modes(connector, max_width, max_height);
> > +}
> > +EXPORT_SYMBOL(drm_connector_fill_modes);
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index 78c1f37be3db..618093c4a039 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -4435,18 +4435,6 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
> > }
> > }
> >
> > -/* A connector has no EDID information, so we've got no EDID to compute quirks from. Reset
> > - * all of the values which would have been set from EDID
> > - */
> > -void
> > -drm_reset_display_info(struct drm_connector *connector)
> > -{
> > - struct drm_display_info *info = &connector->display_info;
> > -
> > - memset(info, 0, sizeof(*info));
> > -}
> > -EXPORT_SYMBOL_GPL(drm_reset_display_info);
> > -
> > u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edid)
> > {
> > struct drm_display_info *info = &connector->display_info;
> > @@ -4665,7 +4653,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
> > int num_modes = 0;
> > u32 quirks;
> >
> > - drm_reset_display_info(connector);
> > + drm_connector_reset_display_info(connector);
> >
> > if (edid == NULL) {
> > clear_eld(connector);
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index 18cb63b30e33..f3eddbbd0616 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -2027,7 +2027,7 @@ static int drm_fb_helper_probe_connector_modes(struct drm_fb_helper *fb_helper,
> >
> > drm_fb_helper_for_each_connector(fb_helper, i) {
> > connector = fb_helper->connector_info[i]->connector;
> > - count += connector->funcs->fill_modes(connector, maxX, maxY);
> > + count += drm_connector_fill_modes(connector, maxX, maxY);
> > }
> >
> > return count;
> > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> > index 1c5b5ce1fd7f..3c6e800b66a0 100644
> > --- a/drivers/gpu/drm/drm_sysfs.c
> > +++ b/drivers/gpu/drm/drm_sysfs.c
> > @@ -130,9 +130,9 @@ static ssize_t status_store(struct device *device,
> > connector->name,
> > old_force, connector->force);
> >
> > - connector->funcs->fill_modes(connector,
> > - dev->mode_config.max_width,
> > - dev->mode_config.max_height);
> > + drm_connector_fill_modes(connector,
> > + dev->mode_config.max_width,
> > + dev->mode_config.max_height);
> > }
> >
> > mutex_unlock(&dev->mode_config.mutex);
> > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> > index 8815ef1ce429..bf14474c83f5 100644
> > --- a/include/drm/drm_connector.h
> > +++ b/include/drm/drm_connector.h
> > @@ -1124,6 +1124,9 @@ void drm_mode_connector_set_link_status_property(struct drm_connector *connector
> > uint64_t link_status);
> > int drm_connector_init_panel_orientation_property(
> > struct drm_connector *connector, int width, int height);
> > +void drm_connector_reset_display_info(struct drm_connector *connector);
> > +int drm_connector_fill_modes(struct drm_connector *connector,
> > + unsigned int max_width, unsigned int max_height);
> >
> > /**
> > * struct drm_tile_group - Tile group metadata
> > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> > index 8d89a9c3748d..db5e6a990c2d 100644
> > --- a/include/drm/drm_edid.h
> > +++ b/include/drm/drm_edid.h
> > @@ -465,7 +465,6 @@ struct edid *drm_get_edid(struct drm_connector *connector,
> > struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
> > struct i2c_adapter *adapter);
> > struct edid *drm_edid_duplicate(const struct edid *edid);
> > -void drm_reset_display_info(struct drm_connector *connector);
> > u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edid);
> > int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
> >
> > --
> > 2.13.6
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-03-06 10:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 12:56 [RFC][PATCH 00/11] drm: Try to make display info less nuts Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 01/11] drm/gma500: Fill display_info.{width, height}_mm from .get_modes() Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 02/11] drm/i915: " Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 03/11] drm/shmobile: Don't fill display_info.{width, height}_mm at init time Ville Syrjala
2018-02-27 12:56 ` [RFC][PATCH 04/11] drm: Split the display info into static and dynamic parts Ville Syrjala
2018-02-27 13:08 ` Maxime Ripard
2018-02-27 13:23 ` Philipp Zabel
2018-02-28 4:58 ` Archit Taneja
2018-02-28 8:46 ` Sharma, Shashank
2018-02-28 9:17 ` Stefan Agner
2018-02-28 21:11 ` Alex Deucher
2018-03-02 7:59 ` Linus Walleij
2018-03-06 9:41 ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 05/11] drm/edid: Clear display info fully Ville Syrjala
2018-02-28 8:58 ` Sharma, Shashank
2018-03-06 9:33 ` Daniel Vetter
2018-03-06 9:42 ` Daniel Vetter
2018-03-06 9:52 ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 06/11] drm/edid: Don't call drm_add_display_info() with an invalid EDID Ville Syrjala
2018-03-06 9:45 ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 07/11] drm/probe-helper: Avoid iterating the list twice on ww backoff Ville Syrjala
2018-03-06 9:49 ` Daniel Vetter
2018-03-06 11:48 ` Ville Syrjälä
2018-02-27 12:56 ` [RFC][PATCH 08/11] drm: Add drm_connector_fill_modes() Ville Syrjala
2018-03-06 10:00 ` Daniel Vetter
2018-03-06 10:30 ` Ville Syrjälä [this message]
2018-02-27 12:56 ` [RFC][PATCH 09/11] drm: Fix getconnector locking Ville Syrjala
2018-03-06 9:55 ` Daniel Vetter
2018-02-27 12:56 ` [RFC][PATCH 10/11] drm: Fix debugfs edid_override locking Ville Syrjala
2018-03-06 9:56 ` Daniel Vetter
2018-02-27 12:57 ` [RFC][PATCH 11/11] drm: Sprinkle lockdep asserts for edid/display_info Ville Syrjala
2018-03-06 9:31 ` Daniel Vetter
2018-03-06 12:18 ` Ville Syrjälä
2018-03-06 16:23 ` Harry Wentland
2018-03-06 17:13 ` Daniel Vetter
2018-03-06 18:32 ` Harry Wentland
2018-03-07 16:26 ` Daniel Vetter
2018-02-27 14:06 ` ✓ Fi.CI.BAT: success for drm: Try to make display info less nuts Patchwork
2018-02-27 20:14 ` ✗ Fi.CI.IGT: failure " Patchwork
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=20180306103034.GA5453@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=keithp@keithp.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;
as well as URLs for NNTP newsgroup(s).