From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33F02C433EF for ; Tue, 7 Jun 2022 11:15:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FDC010E12A; Tue, 7 Jun 2022 11:15:01 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id D364810E12A; Tue, 7 Jun 2022 11:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654600499; x=1686136499; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=Q4DD6Gu/aSRDkzAQ+tgk8rapaBwE5igmzYyTcbz+tGw=; b=DnPvdK+4GYhvIxcRFS9alPedcRvIHE7OB1ObvCmr1yTWkNMB/W72tAmJ FAWkGjKuFmDXpPCjShZNawVue8NK0/a7ZD9WtxlN/0N0hpXwKOurJsio2 JTXO5t+pDzxt/2yQsw3N5D4tm5Nn3fFb9mHcFtISx8tqU3ONoKbVeqLZf BmB/s7NBtGASOwF/qZFItg0QZbAJw26dGGSSWSjhW69dt8IKlwbo8jhCY KXKnU6t0npLFoYhOJZfVEX5UYv0ypVCFKzRAXLlS43uasMEyndZEBWCDB M8tvEgBdqf3fYX7Xx8OIES9VTMfwegi+P/PJpSk85PW4FW7fjOpJ+NI7j A==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="259463685" X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="259463685" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 04:14:59 -0700 X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="636081446" Received: from gknielse-mobl.amr.corp.intel.com (HELO localhost) ([10.252.57.112]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 04:14:57 -0700 From: Jani Nikula To: Ville =?utf-8?B?U3lyasOkbMOk?= In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: Date: Tue, 07 Jun 2022 14:14:54 +0300 Message-ID: <87mteopvwx.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Intel-gfx] [PATCH v1 06/13] drm/probe-helper: make .get_modes() optional, add default action X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 02 Jun 2022, Ville Syrj=C3=A4l=C3=A4 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. >>=20 >> Cc: David Airlie >> Cc: Daniel Vetter >> Signed-off-by: Jani Nikula >> --- >> drivers/gpu/drm/drm_probe_helper.c | 14 +++++++++++++- >> include/drm/drm_modeset_helper_vtables.h | 4 ++++ >> 2 files changed, 17 insertions(+), 1 deletion(-) >>=20 >> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_pr= obe_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_co= nnector *connector) >> connector->helper_private; >> int count; >>=20=20 >> - count =3D connector_funcs->get_modes(connector); >> + if (connector_funcs->get_modes) { >> + count =3D connector_funcs->get_modes(connector); >> + } else { >> + const struct drm_edid *drm_edid; >> + >> + /* Note: This requires connector->ddc is set */ >> + drm_edid =3D drm_edid_read(connector); >> + >> + /* Update modes etc. from the EDID */ >> + count =3D 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? BR, Jani. > >>=20=20 >> /* >> * Fallback for when DDC probe failed in drm_get_edid() and thus skipp= ed >> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_= modeset_helper_vtables.h >> index fafa70ac1337..b4402bc64e57 100644 >> --- a/include/drm/drm_modeset_helper_vtables.h >> +++ b/include/drm/drm_modeset_helper_vtables.h >> @@ -894,6 +894,10 @@ struct drm_connector_helper_funcs { >> * libraries always call this with the &drm_mode_config.connection_mut= ex >> * held. Because of this it's safe to inspect &drm_connector->state. >> * >> + * This callback is optional. By default, it reads the EDID using >> + * drm_edid_read() and updates the connector display info, modes, and >> + * properties using drm_edid_connector_update(). >> + * >> * RETURNS: >> * >> * The number of modes added by calling drm_mode_probed_add(). >> --=20 >> 2.30.2 --=20 Jani Nikula, Intel Open Source Graphics Center