Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp408826pxy; Wed, 5 May 2021 05:20:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxRditfez/aRpcZYAl76IJXnKfmKoDWKlOqo/TxkCAws4fuBaE6NZE+BIyG0oa6mZg00yG X-Received: by 2002:a05:6402:b55:: with SMTP id bx21mr32445135edb.281.1620217215267; Wed, 05 May 2021 05:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620217215; cv=none; d=google.com; s=arc-20160816; b=Itf7Q1m7gRPcLrFrc4mb7jJEpt+66nSq+TBE9ko3ouPPZDJMePFPRjweRC5BdiTJRm e+Ti/SGDuO/lvuSMUQW124XV/R2EGHAt/9FfaPbgZvFEhkyl2H7jrcxe/s6j47J1srik D7RnEhoPf3r/tkGsde3PQfblg7dIbQi4U/NU9Hu5SsZqZntWxeiMLRgc/Qo+sTyc8IdH BlJ3yVepqNlfPYcykgcuDAVIxLu09RMf5faWnnMrU+BJNB5+842S+U1IzYTdsd9on+L7 Ee8979nrIGU25gzGIHuSOcsu+oIUxzC/6HBI5mdBH/Yw5VExdpO2JfeM+8DdZTJSNBIw Fa4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=RK0lIpH8dP2xnx9eqCjn6hmQyFD2CtI1S4ou2pERAek=; b=xcpeodcfDqQbr/4vGifJ9tUY/vlyWhcppru3JisEdcjs1ASflD1PVeTT/v+poMQCji 45g2YxnJzKektLaTt3E0VDwPhzGxmhDaGQToJ1oj33ix1BPXmy5gza4k5/2vANigsC85 zX9BlhYXmrKA67K1EmVaKyw9G6Oig1qGJiZV7NrF06PZN4EXIDGot7eODOQ9EG39v2mZ YCJHjLKi/IBNImarcR5hVz9AZ8dETCNf+UgDNaeHaKMGYxDgzcIpkCZHxaQEpD9y0KAa Pq3kt0o36AD8oixHivKCAP0a3gdHXqCFzhfhQE5POItPnkSr2A5kmhWDdjwT1BypUatg O5VA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si5525190eji.286.2021.05.05.05.19.48; Wed, 05 May 2021 05:20:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232440AbhEEMTu (ORCPT + 99 others); Wed, 5 May 2021 08:19:50 -0400 Received: from mga07.intel.com ([134.134.136.100]:32318 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbhEEMSd (ORCPT ); Wed, 5 May 2021 08:18:33 -0400 IronPort-SDR: mDUob3K7O6o9TG30q+lfEwsrEPEOH5uOlgxhG/o2x+B3gpvPAcdcuN9L/61oNj8iyTpAtq/M83 gwyeeKFcU0eg== X-IronPort-AV: E=McAfee;i="6200,9189,9974"; a="262139246" X-IronPort-AV: E=Sophos;i="5.82,274,1613462400"; d="scan'208";a="262139246" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 05:15:28 -0700 IronPort-SDR: 2qvZIvm1j2cVwQyuy1ZCdITMWsNBOwR7bSL9a4ha/ewAeUbw8ExIKx4bMshD1mQPdoT6385dwk L+WLN91syKvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,274,1613462400"; d="scan'208";a="463855330" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.171]) by fmsmga002.fm.intel.com with SMTP; 05 May 2021 05:15:25 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 05 May 2021 15:15:24 +0300 Date: Wed, 5 May 2021 15:15:24 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Werner Sembach Cc: airlied@linux.ie, daniel@ffwll.ch, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] Restructure output format computation for better expandability Message-ID: References: <20210503182148.851790-1-wse@tuxedocomputers.com> <20210503182148.851790-4-wse@tuxedocomputers.com> <41aca960-7595-8fed-228c-3b9347c64dc6@tuxedocomputers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <41aca960-7595-8fed-228c-3b9347c64dc6@tuxedocomputers.com> X-Patchwork-Hint: comment Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 05, 2021 at 11:54:35AM +0200, Werner Sembach wrote: > Am 04.05.21 um 11:54 schrieb Ville Syrj?l?: > > > On Mon, May 03, 2021 at 08:21:47PM +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. > >> > >> 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; > > Slight change in behaviour here since we used to reject 420_only modes > > if ycbcr_420_allowed wasn't set. But I think this should be OK, and in > > fact I believe the DP counterpart code always used an RGB fallback > > rather than failing. So this lines up better with that. > > That was actually an oversight on my side and not intended. Does a RGB fallback make sense? > > Now that I think of it get to 2 scenarios: > > - The screen is really 420_only, which causes a silent fail and a black screen I guess? Where before at least a log message was written. > > - The screen falsely reports as 420_only and using RGB regardless makes it magically work > > I think at least warning should be printed to the logs. Something along the lines of: "Display reports as 420 only, but port does not support 420, try forcing RGB, but this is likely to fail." I would just put it into the "user has decided to override the mode and gets to keep both pieces if it breaks". Typical users would not hit that since they will only use modes reported by the connector as supported. So I think the RGB fallback is totally in line with existing behaviour of the driver. We have other cases where we just ignore the reported limits of the display if the user overrides the mode manually. -- Ville Syrj?l? Intel