Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3721424pxj; Tue, 15 Jun 2021 07:18:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx21jLHKzwUa0WGhafeb2wuXMZUlGWT7IYWUGnQ8jo1Qg/jfEcg0g+j0rVSqqzFLpZ1XnqZ X-Received: by 2002:a05:6402:35c8:: with SMTP id z8mr23435150edc.348.1623766699176; Tue, 15 Jun 2021 07:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623766699; cv=none; d=google.com; s=arc-20160816; b=EtH5s1gDyuZOO0dLi/A1+iteJL5ymuiTz9elSIH/dSRYFbU0mBdaXjfKM5ezT8bamj KO0sQcZJLTEXBv3BYDi2A2GQuim0AfEs90+g1hQEc9WiEUKKaa144ZuGuESpoxI6qdPk arNeFfRBsGqmehh/kzuC+9D1YFtVA+dEvENj1e+s0xRCB+9jpCfQCiGF/2XRN3sRALNR fPdrvQMzklYTttcTceLlAjSz7zDEPVcZLBqbS+zgPhDoJluEmPPnYARkfyq58fQsxapT bTOniNO2XQxiYP5L1Ck/qji0EzZQ2LtDuAFyPT3qS/mxmHDZxpXwfkXvG1I11YGdadBd YsTw== 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; bh=XHkjqvlcTNKQRspajfVuZbHE2gwAoD3CtyknjF2vQko=; b=hK1zZMjIEpJEp1tJNS0QeSVMkofxI++B4NfZZ0G9zjAWGO8CjmJrJf0cThTyXvyIoE xYgW7151Gl04NHBu4CFgqf8ZBSYHKp7QDde56cCMLOl8wv0a5e6F9MzAoXxOQlxxi1Am 5cYBJW1ZWWtJ5k8adn4MqzLQPrMOomn20cFnvWD8T2ZfDFpYMZ1+9MikUF6wIW1+wEjJ OjIz4TrgZyOV5ipvzDQUXEo0bmo928qg2Jf/0Ob1jgUVLdZoMLbnym2FTdS3KK2d/i+X zY756S0UosFCd631SYI6Aftyv7gfpl1CZv6I3bRSl3HGbiC8beldJ0yna3rchscQlUow iK7Q== 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 w22si15938557edi.259.2021.06.15.07.17.56; Tue, 15 Jun 2021 07:18:19 -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 S231672AbhFOOSa (ORCPT + 99 others); Tue, 15 Jun 2021 10:18:30 -0400 Received: from srv6.fidu.org ([159.69.62.71]:48280 "EHLO srv6.fidu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231421AbhFOOQz (ORCPT ); Tue, 15 Jun 2021 10:16:55 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by srv6.fidu.org (Postfix) with ESMTP id 4669AC80095; Tue, 15 Jun 2021 16:14:39 +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 BuHW6cdI2jkT; Tue, 15 Jun 2021 16:14:39 +0200 (CEST) Received: from wsembach-tuxedo.fritz.box (p200300e37F3949009F7CF2Abd5Da2787.dip0.t-ipconnect.de [IPv6:2003:e3:7f39:4900:9f7c:f2ab:d5da:2787]) (Authenticated sender: wse@tuxedocomputers.com) by srv6.fidu.org (Postfix) with ESMTPA id D584EC800B9; Tue, 15 Jun 2021 16:14:38 +0200 (CEST) From: Werner Sembach To: harry.wentland@amd.com, sunpeng.li@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, airlied@linux.ie, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org Cc: Werner Sembach Subject: [PATCH v3 14/14] drm/i915/display: Add handling for new "preferred color format" property Date: Tue, 15 Jun 2021 16:14:25 +0200 Message-Id: <20210615141426.6001-15-wse@tuxedocomputers.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210615141426.6001-1-wse@tuxedocomputers.com> References: <20210615141426.6001-1-wse@tuxedocomputers.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit implements the "preferred color format" drm property for the Intel GPU driver. Signed-off-by: Werner Sembach --- drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++++- drivers/gpu/drm/i915/display/intel_dp_mst.c | 5 +++++ drivers/gpu/drm/i915/display/intel_hdmi.c | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d648582d0786..5c83ae624ad1 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -616,9 +616,12 @@ intel_dp_output_format(struct drm_connector *connector, { struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); const struct drm_display_info *info = &connector->display_info; + const struct drm_connector_state *connector_state = connector->state; if (!connector->ycbcr_420_allowed || - !drm_mode_is_420_only(info, mode)) + !(drm_mode_is_420_only(info, mode) || + (drm_mode_is_420_also(info, mode) && connector_state && + connector_state->preferred_color_format == DRM_COLOR_FORMAT_YCRCB420))) return INTEL_OUTPUT_FORMAT_RGB; if (intel_dp->dfp.rgb_to_ycbcr && @@ -4691,12 +4694,14 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect if (HAS_GMCH(dev_priv)) { drm_connector_attach_max_bpc_property(connector, 6, 10); drm_connector_attach_active_bpc_property(connector, 6, 10); + drm_connector_attach_preferred_color_format_property(connector); drm_connector_attach_active_color_format_property(connector); drm_connector_attach_active_color_range_property(connector); } else if (DISPLAY_VER(dev_priv) >= 5) { drm_connector_attach_max_bpc_property(connector, 6, 12); drm_connector_attach_active_bpc_property(connector, 6, 12); + drm_connector_attach_preferred_color_format_property(connector); drm_connector_attach_active_color_format_property(connector); drm_connector_attach_active_color_range_property(connector); } diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index cb876175258f..67f0fb649876 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -856,6 +856,11 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo if (connector->active_bpc_property) drm_connector_attach_active_bpc_property(connector, 6, 12); + connector->preferred_color_format_property = + intel_dp->attached_connector->base.preferred_color_format_property; + if (connector->preferred_color_format_property) + drm_connector_attach_preferred_color_format_property(connector); + connector->active_color_format_property = intel_dp->attached_connector->base.active_color_format_property; if (connector->active_color_format_property) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index dacac23a6c30..0d917d61482d 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2153,6 +2153,10 @@ static int intel_hdmi_compute_output_format(struct intel_encoder *encoder, crtc_state->output_format = INTEL_OUTPUT_FORMAT_RGB; } + if (connector->ycbcr_420_allowed && conn_state->preferred_color_format == DRM_COLOR_FORMAT_YCRCB420 && + drm_mode_is_420_also(&connector->display_info, adjusted_mode)) + crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; + ret = intel_hdmi_compute_clock(encoder, crtc_state); if (ret) { if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420 && @@ -2516,6 +2520,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c if (!HAS_GMCH(dev_priv)) { drm_connector_attach_max_bpc_property(connector, 8, 12); drm_connector_attach_active_bpc_property(connector, 8, 12); + drm_connector_attach_preferred_color_format_property(connector); drm_connector_attach_active_color_format_property(connector); drm_connector_attach_active_color_range_property(connector); } -- 2.25.1