Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2943560pxy; Mon, 3 May 2021 11:23:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmSgG2Ve83xZJRCYEfhF8U9X6ICOsQ/flsOh+RZpgXQ0LgJtRT3l4enPi/EmjqRxPQzYW0 X-Received: by 2002:a17:90a:b78d:: with SMTP id m13mr33429256pjr.47.1620066214577; Mon, 03 May 2021 11:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620066214; cv=none; d=google.com; s=arc-20160816; b=c9gN9WArDQosNw0S2QhEWvrxTCmuh0z1MRpsWwtDxwJkTHSqUHwsSmoy52YtuUerj4 SuFhZwpD1TrdgYLpqS7PVAzo4TlE67Eed/u9e5qXZQ655kp4QdUBoc1Po+gMUqNzCa7j KsLXjw0gPYGocjiV9o0FBA+WeorM5SNkEw4VcBkqD8G5plC/d7V09UI1R4ravVzVaw2t x0FS12AlR1F3jrsLJpwJeIixTni+9yWi1aBFv5h9mDh9pHd7uODMe6aJyB0eVybqnIcj Im6WzVmD+hYTKWt056AAgs4+zGDmQVOSFPL83BDBa7y39lvcPTFzz87gHV+PgJJUwS1P jacQ== 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:to:from; bh=50dzDMj9JmljLIV4/S99N4XD4bhBVfi654THravp024=; b=gtb4/w59sBdLUpq44xTNNXdDK8qrJJGz41c6QvpZl4FGzgRpi7qceKYpZ8Bmii3ERs Hfbu6WaV9zsMrAVimrx8jx7E5rfC2k+WiSweUvjgr8w92wzht9O2VxT8ysG/wlmof/bc Z+Q/3YLm6EF9t1sgDMdTEtYyTr1mc82Yxab03CZTs60PGbp0Sp4zsJbo8c3iO+5I4hfm PgZiLXO16WH9OM1gYVx04bKV7cvh6Amx4ZQ5946ikQy0EoFS8+ZZNlLzAowlQg/1QppT lx6hiPi5ijeDs2qFxMp6Bw56bfoxyu8/9tT7EV8qCK5L3TboTMKcjuFjFCAAinzyAbCk 0uxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t7si6435658pfh.14.2021.05.03.11.23.21; Mon, 03 May 2021 11:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbhECSXC (ORCPT + 99 others); Mon, 3 May 2021 14:23:02 -0400 Received: from srv6.fidu.org ([159.69.62.71]:56472 "EHLO srv6.fidu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbhECSW5 (ORCPT ); Mon, 3 May 2021 14:22:57 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by srv6.fidu.org (Postfix) with ESMTP id 1C499C800CE; Mon, 3 May 2021 20:21:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at srv6.fidu.org Received: from srv6.fidu.org ([127.0.0.1]) by localhost (srv6.fidu.org [127.0.0.1]) (amavisd-new, port 10026) with LMTP id GFqK7KxpKa2j; Mon, 3 May 2021 20:21:53 +0200 (CEST) Received: from wsembach-tuxedo.fritz.box (p200300E37f3986001A8B79e0b24CB29D.dip0.t-ipconnect.de [IPv6:2003:e3:7f39:8600:1a8b:79e0:b24c:b29d]) (Authenticated sender: wse@tuxedocomputers.com) by srv6.fidu.org (Postfix) with ESMTPA id C8629C800D3; Mon, 3 May 2021 20:21:53 +0200 (CEST) From: Werner Sembach To: wse@tuxedocomputers.com, ville.syrjala@linux.intel.com, airlied@linux.ie, daniel@ffwll.ch, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] Restructure output format computation for better expandability Date: Mon, 3 May 2021 20:21:47 +0200 Message-Id: <20210503182148.851790-4-wse@tuxedocomputers.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210503182148.851790-1-wse@tuxedocomputers.com> References: <20210503182148.851790-1-wse@tuxedocomputers.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Couples the decission between RGB and YCbCr420 mode and the check if the port clock can archive the required frequency. Other checks and configuration steps that where previously done in between can also be done before or after. This allows for are cleaner implementation of retrying different color encodings. Signed-off-by: Werner Sembach --- From 57e42ec6e34ac32da29eb7bc3c691cbeb2534396 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Mon, 3 May 2021 15:30:40 +0200 Subject: [PATCH 3/4] Restructure output format computation for better expandability --- drivers/gpu/drm/i915/display/intel_hdmi.c | 57 +++++++++++------------ 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index ce165ef28e88..e2553ac6fd13 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -1999,29 +1999,6 @@ static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state, INTEL_OUTPUT_FORMAT_YCBCR420); } -static int -intel_hdmi_ycbcr420_config(struct intel_crtc_state *crtc_state, - const struct drm_connector_state *conn_state) -{ - struct drm_connector *connector = conn_state->connector; - struct drm_i915_private *i915 = to_i915(connector->dev); - const struct drm_display_mode *adjusted_mode = - &crtc_state->hw.adjusted_mode; - - if (!drm_mode_is_420_only(&connector->display_info, adjusted_mode)) - return 0; - - if (!connector->ycbcr_420_allowed) { - drm_err(&i915->drm, - "Platform doesn't support YCBCR420 output\n"); - return -EINVAL; - } - - crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; - - return intel_pch_panel_fitting(crtc_state, conn_state); -} - static int intel_hdmi_compute_bpc(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state, int clock) @@ -2128,6 +2105,24 @@ static bool intel_hdmi_has_audio(struct intel_encoder *encoder, return intel_conn_state->force_audio == HDMI_AUDIO_ON; } +int intel_hdmi_compute_output_format(struct intel_encoder *encoder, + struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) +{ + const struct drm_connector *connector = conn_state->connector; + const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; + int ret; + + if (connector->ycbcr_420_allowed && drm_mode_is_420_only(&connector->display_info, adjusted_mode)) + crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; + else + crtc_state->output_format = INTEL_OUTPUT_FORMAT_RGB; + + ret = intel_hdmi_compute_clock(encoder, crtc_state); + + return ret; +} + int intel_hdmi_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, struct drm_connector_state *conn_state) @@ -2152,23 +2147,23 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder, if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) pipe_config->pixel_multiplier = 2; - ret = intel_hdmi_ycbcr420_config(pipe_config, conn_state); - if (ret) - return ret; - - pipe_config->limited_color_range = - intel_hdmi_limited_color_range(pipe_config, conn_state); - if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv)) pipe_config->has_pch_encoder = true; pipe_config->has_audio = intel_hdmi_has_audio(encoder, pipe_config, conn_state); - ret = intel_hdmi_compute_clock(encoder, pipe_config); + ret = intel_hdmi_compute_output_format(encoder, pipe_config, conn_state); if (ret) return ret; + ret = intel_pch_panel_fitting(pipe_config, conn_state); + if (ret) + return ret; + + pipe_config->limited_color_range = + intel_hdmi_limited_color_range(pipe_config, conn_state); + if (conn_state->picture_aspect_ratio) adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio; -- 2.25.1