Re: [PATCH v1 06/13] drm/probe-helper: make .get_modes() optional, add default action

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 07, 2022 at 02:14:54PM +0300, Jani Nikula wrote:
> On Thu, 02 Jun 2022, Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> 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@xxxxxxxx>
> >> Cc: Daniel Vetter <daniel@xxxxxxxx>
> >> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> >> ---
> >>  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



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux