From patchwork Fri May 6 10:10:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 12840944 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 B2B1AC433F5 for ; Fri, 6 May 2022 10:11:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C1E110FB11; Fri, 6 May 2022 10:11:55 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34B6B10FAFC; Fri, 6 May 2022 10:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651831914; x=1683367914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VVpEfLpW2uxsHKPgEAboBmLcZnTPsqHegeGO/kcu/pI=; b=L+pCSUIVnqtH9uWiIdXr17Cva4DN2R74iQYj6Ix+ibYfWCPiogMsE0vC Tk16ZQh8mdFDDyTRp5eVwUEayANDpucRn81RC/bB0tqf4PGV0pw2Lobfw wo/RdK3AgIDeXlKkDLMlHI70YD4RzSLdAqw3TKK0T1kqO7jtlk30Y967A m7XyKoNAJL92qOAm7Cs6CWE98wgzkwoux/lttqk+Dnmppuo6Znli7iMod k+/zXY9Hj9oxLGHEgagB9sDnU72TFaNArrzU2iMohEhvADlXnIWFMps/u EWXbk6Lb7Zz5Qtyr1A9I63bVaMnMIfIQ1CXlZH0ehkB5YaSYL/K0R90o8 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="268570797" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="268570797" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 03:11:53 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="665423263" Received: from psikora-mobl.ger.corp.intel.com (HELO localhost) ([10.249.157.88]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 03:11:51 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Date: Fri, 6 May 2022 13:10:21 +0300 Message-Id: <835a4b82d2dbec9134bed2d58176a50f38eb85ed.1651830938.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH 14/25] drm/edid: convert mode_in_range() and drm_monitor_supports_rb() to drm_edid 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: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We'll need to propagate drm_edid everywhere. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_edid.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 4b2d3453fc5c..b8deced8de01 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2627,16 +2627,16 @@ is_rb(const struct detailed_timing *descriptor, void *data) /* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ static bool -drm_monitor_supports_rb(const struct edid *edid) +drm_monitor_supports_rb(const struct drm_edid *drm_edid) { - if (edid->revision >= 4) { + if (drm_edid->edid->revision >= 4) { bool ret = false; - drm_for_each_detailed_block(edid, is_rb, &ret); + drm_for_each_detailed_block(drm_edid->edid, is_rb, &ret); return ret; } - return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0); + return ((drm_edid->edid->input & DRM_EDID_INPUT_DIGITAL) != 0); } static void @@ -2820,7 +2820,7 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector, } /* check whether it can be found in default mode table */ - if (drm_monitor_supports_rb(drm_edid->edid)) { + if (drm_monitor_supports_rb(drm_edid)) { mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate, true); if (mode) @@ -3059,10 +3059,11 @@ range_pixel_clock(const struct edid *edid, const u8 *t) return t[9] * 10000 + 5001; } -static bool -mode_in_range(const struct drm_display_mode *mode, const struct edid *edid, - const struct detailed_timing *timing) +static bool mode_in_range(const struct drm_display_mode *mode, + const struct drm_edid *drm_edid, + const struct detailed_timing *timing) { + const struct edid *edid = drm_edid->edid; u32 max_clock; const u8 *t = (const u8 *)timing; @@ -3081,7 +3082,7 @@ mode_in_range(const struct drm_display_mode *mode, const struct edid *edid, if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3)))) return false; - if (mode_is_rb(mode) && !drm_monitor_supports_rb(edid)) + if (mode_is_rb(mode) && !drm_monitor_supports_rb(drm_edid)) return false; return true; @@ -3114,7 +3115,7 @@ static int drm_dmt_modes_for_range(struct drm_connector *connector, struct drm_device *dev = connector->dev; for (i = 0; i < ARRAY_SIZE(drm_dmt_modes); i++) { - if (mode_in_range(drm_dmt_modes + i, drm_edid->edid, timing) && + if (mode_in_range(drm_dmt_modes + i, drm_edid, timing) && valid_inferred_mode(connector, drm_dmt_modes + i)) { newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); if (newmode) { @@ -3156,7 +3157,7 @@ static int drm_gtf_modes_for_range(struct drm_connector *connector, return modes; drm_mode_fixup_1366x768(newmode); - if (!mode_in_range(newmode, drm_edid->edid, timing) || + if (!mode_in_range(newmode, drm_edid, timing) || !valid_inferred_mode(connector, newmode)) { drm_mode_destroy(dev, newmode); continue; @@ -3176,7 +3177,7 @@ static int drm_cvt_modes_for_range(struct drm_connector *connector, int i, modes = 0; struct drm_display_mode *newmode; struct drm_device *dev = connector->dev; - bool rb = drm_monitor_supports_rb(drm_edid->edid); + bool rb = drm_monitor_supports_rb(drm_edid); for (i = 0; i < ARRAY_SIZE(extra_modes); i++) { const struct minimode *m = &extra_modes[i]; @@ -3186,7 +3187,7 @@ static int drm_cvt_modes_for_range(struct drm_connector *connector, return modes; drm_mode_fixup_1366x768(newmode); - if (!mode_in_range(newmode, drm_edid->edid, timing) || + if (!mode_in_range(newmode, drm_edid, timing) || !valid_inferred_mode(connector, newmode)) { drm_mode_destroy(dev, newmode); continue;