All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v1 06/13] drm/probe-helper: make .get_modes() optional, add default action
Date: Tue, 7 Jun 2022 22:43:06 +0300	[thread overview]
Message-ID: <Yp+qSsdUM+OIji97@intel.com> (raw)
In-Reply-To: <87mteopvwx.fsf@intel.com>

On Tue, Jun 07, 2022 at 02:14:54PM +0300, Jani Nikula wrote:
> On Thu, 02 Jun 2022, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Tue, May 24, 2022 at 01:39:28PM +0300, Jani Nikula wrote:
> >> Add default action when .get_modes() not set. This also defines what a
> >> .get_modes() hook should do.
> >> 
> >> Cc: David Airlie <airlied@linux.ie>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> ---
> >>  drivers/gpu/drm/drm_probe_helper.c       | 14 +++++++++++++-
> >>  include/drm/drm_modeset_helper_vtables.h |  4 ++++
> >>  2 files changed, 17 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> >> index 836bcd5b4cb6..9df17f0ae225 100644
> >> --- a/drivers/gpu/drm/drm_probe_helper.c
> >> +++ b/drivers/gpu/drm/drm_probe_helper.c
> >> @@ -360,7 +360,19 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector)
> >>  		connector->helper_private;
> >>  	int count;
> >>  
> >> -	count = connector_funcs->get_modes(connector);
> >> +	if (connector_funcs->get_modes) {
> >> +		count = connector_funcs->get_modes(connector);
> >> +	} else {
> >> +		const struct drm_edid *drm_edid;
> >> +
> >> +		/* Note: This requires connector->ddc is set */
> >> +		drm_edid = drm_edid_read(connector);
> >> +
> >> +		/* Update modes etc. from the EDID */
> >> +		count = drm_edid_connector_update(connector, drm_edid);
> >> +
> >> +		drm_edid_free(drm_edid);
> >> +	}
> >
> > Not really a huge fan of this automagic fallback. I think I'd prefer
> > to keep it mandatory and just provide this as a helper for drivers to
> > plug into the right spot. Otherwise I'm sure I'll forget how this works
> > and then I'll be confused when I see a connector withput any apparent
> > .get_modes() implementation.
> 
> Fair enough.
> 
> I'm not sure how useful that is going to be, though, at least not for
> i915. If we add a .get_edid hook, where would you bolt that? It doesn't
> feel right to set a .get_modes hook to a default function that goes on
> to call a .get_edid hook. Or what do you think?

If .get_modes() remains mandatory do we need the .get_edid() hook?
Ie. would it be called from anywhere else than from .get_modes()?

So we'd just end with
foo_get_modes()
{
	edid = foo_get_edid();
	drm_edid_connector_update(edid);
}
in drivers than need a custom edid read function.

-- 
Ville Syrjälä
Intel

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v1 06/13] drm/probe-helper: make .get_modes() optional, add default action
Date: Tue, 7 Jun 2022 22:43:06 +0300	[thread overview]
Message-ID: <Yp+qSsdUM+OIji97@intel.com> (raw)
In-Reply-To: <87mteopvwx.fsf@intel.com>

On Tue, Jun 07, 2022 at 02:14:54PM +0300, Jani Nikula wrote:
> On Thu, 02 Jun 2022, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Tue, May 24, 2022 at 01:39:28PM +0300, Jani Nikula wrote:
> >> Add default action when .get_modes() not set. This also defines what a
> >> .get_modes() hook should do.
> >> 
> >> Cc: David Airlie <airlied@linux.ie>
> >> Cc: Daniel Vetter <daniel@ffwll.ch>
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >> ---
> >>  drivers/gpu/drm/drm_probe_helper.c       | 14 +++++++++++++-
> >>  include/drm/drm_modeset_helper_vtables.h |  4 ++++
> >>  2 files changed, 17 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> >> index 836bcd5b4cb6..9df17f0ae225 100644
> >> --- a/drivers/gpu/drm/drm_probe_helper.c
> >> +++ b/drivers/gpu/drm/drm_probe_helper.c
> >> @@ -360,7 +360,19 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector)
> >>  		connector->helper_private;
> >>  	int count;
> >>  
> >> -	count = connector_funcs->get_modes(connector);
> >> +	if (connector_funcs->get_modes) {
> >> +		count = connector_funcs->get_modes(connector);
> >> +	} else {
> >> +		const struct drm_edid *drm_edid;
> >> +
> >> +		/* Note: This requires connector->ddc is set */
> >> +		drm_edid = drm_edid_read(connector);
> >> +
> >> +		/* Update modes etc. from the EDID */
> >> +		count = drm_edid_connector_update(connector, drm_edid);
> >> +
> >> +		drm_edid_free(drm_edid);
> >> +	}
> >
> > Not really a huge fan of this automagic fallback. I think I'd prefer
> > to keep it mandatory and just provide this as a helper for drivers to
> > plug into the right spot. Otherwise I'm sure I'll forget how this works
> > and then I'll be confused when I see a connector withput any apparent
> > .get_modes() implementation.
> 
> Fair enough.
> 
> I'm not sure how useful that is going to be, though, at least not for
> i915. If we add a .get_edid hook, where would you bolt that? It doesn't
> feel right to set a .get_modes hook to a default function that goes on
> to call a .get_edid hook. Or what do you think?

If .get_modes() remains mandatory do we need the .get_edid() hook?
Ie. would it be called from anywhere else than from .get_modes()?

So we'd just end with
foo_get_modes()
{
	edid = foo_get_edid();
	drm_edid_connector_update(edid);
}
in drivers than need a custom edid read function.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2022-06-07 19:52 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 10:39 [PATCH v1 00/13] drm/edid: expand on struct drm_edid usage Jani Nikula
2022-05-24 10:39 ` Jani Nikula
2022-05-24 10:39 ` [Nouveau] " Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] " Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 01/13] drm/edid: add block count and data helper functions for drm_edid Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 13:29   ` [Intel-gfx] " Andrzej Hajda
2022-05-24 13:41     ` Jani Nikula
2022-06-02 16:54   ` Ville Syrjälä
2022-06-02 16:54     ` Ville Syrjälä
2022-06-02 17:08     ` [Intel-gfx] " Jani Nikula
2022-06-02 17:08       ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 02/13] drm/edid: keep track of alloc size in drm_do_get_edid() Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 03/13] drm/edid: add new interfaces around struct drm_edid Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 04/13] drm/edid: add drm_edid_connector_update() Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-06-02 17:09   ` [Intel-gfx] " Ville Syrjälä
2022-06-02 17:09     ` Ville Syrjälä
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 05/13] drm/probe-helper: abstract .get_modes() connector helper call Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 06/13] drm/probe-helper: make .get_modes() optional, add default action Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-06-02 17:14   ` [Intel-gfx] " Ville Syrjälä
2022-06-02 17:14     ` Ville Syrjälä
2022-06-07 11:14     ` [Intel-gfx] " Jani Nikula
2022-06-07 11:14       ` Jani Nikula
2022-06-07 19:43       ` Ville Syrjälä [this message]
2022-06-07 19:43         ` Ville Syrjälä
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 07/13] drm/probe-helper: add .get_edid() callback Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 08/13] drm/edid: add drm_edid_raw() to access the raw EDID data Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 09/13] drm/i915/edid: convert DP, HDMI and LVDS to drm_edid Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 10/13] drm/edid: do invalid block filtering in-place Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 11/13] drm/edid: add HF-EEODB support to EDID read and allocation Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-06-03 17:13   ` [Intel-gfx] " Ville Syrjälä
2022-06-03 17:13     ` Ville Syrjälä
2022-06-07 11:26     ` [Intel-gfx] " Jani Nikula
2022-06-07 11:26       ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 12/13] drm/edid: take HF-EEODB extension count into account Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 10:39 ` [Intel-gfx] [PATCH v1 13/13] drm/todo: add entry for converting the subsystem to struct drm_edid Jani Nikula
2022-05-24 10:39   ` Jani Nikula
2022-05-24 11:02 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: expand on struct drm_edid usage Patchwork
2022-05-24 11:02 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-05-24 11:34 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-05-24 11:37   ` Jani Nikula
2022-05-24 11:41     ` Sarvela, Tomi P
2022-05-25  8:48       ` Jani Nikula
2022-05-24 15:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: expand on struct drm_edid usage (rev2) Patchwork
2022-05-24 15:58 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-05-24 19:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-05-24 22:25 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=Yp+qSsdUM+OIji97@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.