Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp541159pxj; Fri, 7 May 2021 14:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxICj+MztrYf3WRppKH71DaSYQH+JPKBZvBzZ1TqszgbXsOVXqX8ngbVXhCNVkbU1b/qP2v X-Received: by 2002:a17:90b:84:: with SMTP id bb4mr22066148pjb.60.1620422740183; Fri, 07 May 2021 14:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620422740; cv=none; d=google.com; s=arc-20160816; b=gz3Cs2qzjVDj/ERDQcNXkgDQSqiM/VhYx2WLlWBBPDL6sqtVP1EFU8ib8LLEh20W7m Ue74qGTXwe3rxSYBOIEB02H/UJD+eUSOLKFE75Q7Wfmmvsj+XP/oFXJQUePNd5k7iYUT N4qyF5LZahw3rTHURIDXzUf/Utc/i1Ye3ETOQwK18ngQUcn+Owdmq0WMlaURki42iggn vO3ec8v3HrPq3h1dfd9J/E6oS3KACYMOedfadsCMhVwUBpDASe0wBOab4m3Cn3EYFk3e DdmuKK5KJHJaD/qMS7FWWjv06xXUenQNhuqXZLdqloypN7jAZYTq5bB1325BCfzRqI7B 6zEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=AENbS6HcurhA4EZ8+/k2mtsBfm6j3LusHRx3s2KEBOk=; b=laSOZ2Hx4Uu4ZBRKwau8uqhHbzDmsEcdPw+v4RaMFjYK2ihgO/rtuh3C2WNu8sdo2D Yq9kLIYBxrsyHp3646e8JbC3xA0ySm8HdJsuhneGJsSAHFXPOwGUnf8SKsn/floTmbE2 /I39yj8AaFyUGRsaUtN+yFbffRl8liC1PvDWqaQ0t6jPOmkFNmFGX7jT4Q34uhZxrqO/ 9wp0DSEF80iF+uZQj5RB+57DwNh9LIZn10qjf8+cxZYhRKDGDVySs/vy7KwuMbEPP3// 23C/5L7LbI6+hJdnvDKM3pWStLZHstl7QpY2zHH/j1r8MBkNaYFBR3J/oWe7o8UV51Oy giEw== 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 r16si2061520pgv.383.2021.05.07.14.25.27; Fri, 07 May 2021 14:25:40 -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 S229635AbhEGVZ5 (ORCPT + 99 others); Fri, 7 May 2021 17:25:57 -0400 Received: from srv6.fidu.org ([159.69.62.71]:52536 "EHLO srv6.fidu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbhEGVZ4 (ORCPT ); Fri, 7 May 2021 17:25:56 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by srv6.fidu.org (Postfix) with ESMTP id 2905EC800A2; Fri, 7 May 2021 23:24:55 +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 10024) with LMTP id kG2Ru1_ixux5; Fri, 7 May 2021 23:24:54 +0200 (CEST) Received: from [IPv6:2003:e3:7f12:f200:d51b:e97d:b8e4:23b2] (p200300E37f12F200d51be97dB8e423B2.dip0.t-ipconnect.de [IPv6:2003:e3:7f12:f200:d51b:e97d:b8e4:23b2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: wse@tuxedocomputers.com) by srv6.fidu.org (Postfix) with ESMTPSA id 882A9C800A1; Fri, 7 May 2021 23:24:54 +0200 (CEST) Subject: Re: [PATCH v6 2/3] drm/i915/display: Restructure output format computation for better expandability To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Cc: airlied@linux.ie, daniel@ffwll.ch, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20210506172325.1995964-1-wse@tuxedocomputers.com> <20210507084903.28877-1-wse@tuxedocomputers.com> <20210507084903.28877-3-wse@tuxedocomputers.com> From: Werner Sembach Message-ID: <38ff8510-9509-b807-fdf0-ea1c653263c5@tuxedocomputers.com> Date: Fri, 7 May 2021 23:24:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 07.05.21 um 19:52 schrieb Ville Syrjälä: > On Fri, May 07, 2021 at 10:49:02AM +0200, Werner Sembach wrote: >> 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. >> >> A slight change in behaviour occurs with this patch: If YCbCr420 is not >> allowed but display is YCbCr420 only it no longer fails, but just prints >> an error and tries to fallback on RGB. >> >> Signed-off-by: Werner Sembach >> --- >> drivers/gpu/drm/i915/display/intel_hdmi.c | 65 ++++++++++++----------- >> 1 file changed, 34 insertions(+), 31 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c >> index 576d3d910d06..9f3da72dabee 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,30 @@ static bool intel_hdmi_has_audio(struct intel_encoder *encoder, >> return intel_conn_state->force_audio == HDMI_AUDIO_ON; >> } >> >> +static int intel_hdmi_compute_output_format(struct intel_encoder *encoder, >> + 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; >> + int ret; >> + bool ycbcr_420_only; >> + >> + ycbcr_420_only = drm_mode_is_420_only(&connector->display_info, adjusted_mode); >> + if (connector->ycbcr_420_allowed && ycbcr_420_only) { >> + crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; >> + } else { >> + if (!connector->ycbcr_420_allowed && ycbcr_420_only) >> + drm_err(&i915->drm, "Display only supports YCbCr420 output, but connector does not allow it. Fallback to RGB, but this will likely fail.\n"); > We can't let the user spam dmesg with errors freely. So this needs > to be a drm_dbg_kms(). Also a bit long, so going to annoyingly wrap > always. Could maybe shorten a bit to something like: > "YCbCr 4:2:0 mode but YCbCr 4:2:0 output not possible. Falling back to RGB." Done, but I don't have time anymore to test it today. I will test and submit v7 on Monday. > > With that sorted, and the intel_hdmi_port_clock() stuff restored, > I believe this series is good to go. > > I think you confused our CI by replying to the old patch with a whole > new series. It can generally deal with a whole new series as a new > thread or replies to individual patches with updated versions of > exactly that patch, but not full series as a reply to a patch. > So I suggest just posting the final versions as a new series. Thanks. > >> + 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 +2153,25 @@ 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; >> >> + if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { >> + 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