Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp53438lfe; Fri, 15 Apr 2022 19:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynIjYqDYJnvDWqi56XaxqKwoViMK0Unf3XeJPyXHH/8+K+6xUUxdaP9zt6B5TEkzcO4Za1 X-Received: by 2002:a17:902:db0d:b0:14f:b047:8d22 with SMTP id m13-20020a170902db0d00b0014fb0478d22mr1495695plx.90.1650074841219; Fri, 15 Apr 2022 19:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650074841; cv=none; d=google.com; s=arc-20160816; b=rWs50n6iuVPC8bMiNAxUXQTAArGzOSM2yTQnG1L3n0VN5FCqjoPiE0hIKUeVucrXgV yCGEs9QitoHqMuOt2IDT1uAdUMHoyyaW3IZgdKYXelX4tP/OrlPvPD3JvzZ6ZUjkDQxi HPblJkasJM18dzEDWcBghRP1qOlMSE08OCmnU61L5gAdMWLsEGHKvEGIkIP+HyqlW4dj I5n24tyqCyCj+3jaeW4PrBU0wVPA3SxmXw9sjkaH4F7JFOra+TrtcFCgWkGM9htWNOqw zgUMFoeCPGDnbWW0IiO5HvPFGrc65y7iWxwTS0ekRpwPZlRhUULCjQhVJrAupqbFamMO 74Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eVzMG+zpu3+1hRtFVA+ruZ6wFZcWgleiqmePRHdUybo=; b=QhJWy+AwQvVkbO4YckR7M/h2+3GxcwIreoBxtKkuXID/UsAs7T1sl44+jcz3tyrsFO c0x1cORc9fNNjwB5DCVYY9KxEmH0BgSF/zoWjYBT9R+j2ApIo0BtTvZlcg4/U/0JWNEj BKTN4l8orvjjMYwPKcy6zEKH3M1Kse3Bv406QNazNdaY5BfF9mNLPwfVqTeAug4/rWjy C8bVwRxicaNc6XTH0U4NzEOZl5T3T7Mz1nYEHG1h4/CTmuq7EkiUcbmHnHryboBl57TJ E59YkkWcgVcnoI/ZuLrwhgs7ZTY1QMW+90LnTg4M6OPUIUGTA/pYqw2y3tF4Knz7wzMk Jr8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qZz7Q6sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z6-20020a1709028f8600b001569c351044si2596891plo.479.2022.04.15.19.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qZz7Q6sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 502F71DEAB2; Fri, 15 Apr 2022 18:26:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355630AbiDOPu0 (ORCPT + 99 others); Fri, 15 Apr 2022 11:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355285AbiDOPuX (ORCPT ); Fri, 15 Apr 2022 11:50:23 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4332898F43 for ; Fri, 15 Apr 2022 08:47:55 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id t1so11091847wra.4 for ; Fri, 15 Apr 2022 08:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eVzMG+zpu3+1hRtFVA+ruZ6wFZcWgleiqmePRHdUybo=; b=qZz7Q6sxtsctCU+AZWdIgKNJKHt4F7pgzRWBWcwwkztrzO4hMxC+3y6bM+aQbE2xPm ZgDOt/of8dP232h4DWHKBZdrlFl7mr/rHPWLMlTUAIgQShx/CLBs7x04LE2hA4klZfjd W3bXY/m5KdcR0T/MgcaxM6ZN3LAMge79NTXnUcoGdGzzo1aJuBQrv7EwuBB0yst9SEeQ SqZ5p94yOj0JYqxZpDZUQrI50oNOazZEPOOIs36FyidDLsR1wcEYZqF52fn0aTdqFSru f/OHnqPmd3EHYQVhLnCWJUJ+ZdbHsz4kHAKKZict87s4Il+PYOPtJNePZ6nVOBeHy0PA d8Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eVzMG+zpu3+1hRtFVA+ruZ6wFZcWgleiqmePRHdUybo=; b=wTSiT5q2AxApe0ParW98yAeGdD5XM2A2kBWBbQ3A1PSJLOI59KW9v7+Op8pi3pYFcc 0JEwF0f4QE7qeibEm1razX8p2WGfjcrI8kqSej66bCDaoOSxWl58Vm5N25MFI9MCX66n hQ+hluphmV2ScsVGGbJstcSiV/ClyqWG100C5ZWJFWIFq/t54JWBy8B6c6r5iLv/IZi6 f0MISJN3IqdVNBTSRmPIKS/G432cl8th32+lLE/hYP7SrD3fc16haCPz8TFJQiXFLLQ5 8yeDltQPj7Ru7TXCYLsYLQFF7dIBBbCIEht++SFTZn+yQx1/JD+D/Lc7xnmj6Kl0XMoz ZFyA== X-Gm-Message-State: AOAM533L21vdI+cp3Eugc0OoBpcXfE95KSmiwD5niZ5+/w6Inmq67Cz4 yh+Wxq3Qoz2ETVIrEbL/M7U= X-Received: by 2002:a5d:5705:0:b0:207:a299:27e2 with SMTP id a5-20020a5d5705000000b00207a29927e2mr5877936wrv.59.1650037673765; Fri, 15 Apr 2022 08:47:53 -0700 (PDT) Received: from localhost.localdomain ([94.73.37.128]) by smtp.gmail.com with ESMTPSA id a7-20020adffb87000000b00207982c7f4dsm4349655wrr.67.2022.04.15.08.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 08:47:53 -0700 (PDT) From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= To: emma@anholt.net Cc: mripard@kernel.org, laurent.pinchart@ideasonboard.com, airlied@linux.ie, daniel@ffwll.ch, p.zabel@pengutronix.de, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Subject: [PATCH v2 1/2] drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi Date: Fri, 15 Apr 2022 17:47:44 +0200 Message-Id: <20220415154745.170597-2-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220415154745.170597-1-jose.exposito89@gmail.com> References: <20220415154745.170597-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once EDID is parsed, the monitor HDMI support information is cached in drm_display_info.is_hdmi by drm_parse_hdmi_vsdb_video(). This driver calls drm_detect_hdmi_monitor() to receive the same information and stores its own cached value, which is less efficient. Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi instead. drm_detect_hdmi_monitor() is called in vc4_hdmi_connector_detect() and vc4_hdmi_connector_get_modes(). In both cases it is safe to rely on drm_display_info.is_hdmi as shown by ftrace: $ sudo trace-cmd record -p function_graph -l "vc4_hdmi_*" -l "drm_*" vc4_hdmi_connector_detect: vc4_hdmi_connector_detect() { drm_get_edid() { drm_connector_update_edid_property() { drm_add_display_info() { drm_reset_display_info(); drm_for_each_detailed_block.part.0(); drm_parse_cea_ext() { drm_find_cea_extension(); drm_parse_hdmi_vsdb_video(); /* drm_display_info.is_hdmi is cached here */ } } } } /* drm_display_info.is_hdmi is used here */ } vc4_hdmi_connector_get_modes: vc4_hdmi_connector_get_modes() { drm_get_edid() { drm_connector_update_edid_property() { drm_add_display_info() { drm_reset_display_info(); drm_for_each_detailed_block.part.0(); drm_parse_cea_ext() { drm_find_cea_extension(); drm_parse_hdmi_vsdb_video(); /* drm_display_info.is_hdmi is cached here */ } } } } /* drm_display_info.is_hdmi is used here */ drm_connector_update_edid_property(); } Signed-off-by: José Expósito --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 6c58b0fd13fb..ecdb1ffc2023 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -216,7 +216,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) if (edid) { cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid); - vc4_hdmi->encoder.hdmi_monitor = drm_detect_hdmi_monitor(edid); + vc4_hdmi->encoder.hdmi_monitor = connector->display_info.is_hdmi; kfree(edid); } } @@ -255,7 +255,7 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) goto out; } - vc4_encoder->hdmi_monitor = drm_detect_hdmi_monitor(edid); + vc4_encoder->hdmi_monitor = connector->display_info.is_hdmi; drm_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); -- 2.25.1