Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp494772rdd; Tue, 9 Jan 2024 10:13:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEu/uENd8cRT3f2XqWy578K9fccIBeuERQYvgU06t247cs/xe3rX/tD1wru81UZLPV4KieR X-Received: by 2002:a17:906:39d0:b0:a2a:d108:7883 with SMTP id i16-20020a17090639d000b00a2ad1087883mr813773eje.135.1704823985642; Tue, 09 Jan 2024 10:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704823985; cv=none; d=google.com; s=arc-20160816; b=ktEl1xW9oMh98TT5rzxrxiFKn0iMWqA54EeKVnojDzOnvrtGTYQuTnQUsnLw2UEJW7 M6AOXbahwv/pH7jkgMOZFhbUgw5q6Wd59sYuxAMZTnzJNlYE8sQqp1ximXEvemZshHgp T32o0XIWH1JlfF+CGPPTCVTIi6kaw6TvphXJoBdAqL8LpRpi9yJEuzTG04eXpbobkGV0 Hapf+ifQ3uWWd+wE86S/GheQFZgXUpEu77E7Xn1RtqLzBx8Ue8IReIfAwP1PFV8fHG9A zmHQUWtY3z0/WoTYdxX6xxT20eyVvhUkevF4mmf96Iyub6lp28yeflTWdMlsOeitJw8K 8rKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xEKXGZp6/dSPIf69wGEjjsLtzr50iEJJm//VReGTJdM=; fh=vnyRExF+TaZcJXA/e4cgSa3m5Xa+Ng4WaJ7mAJU0CoE=; b=YPvxac12XGxZvJ6zkYKoqmId1vpW5I0sVlBdmoQGvqlt09xXE3Us5JcPjrpUKtK7T9 upvdKZ7XwtQTrHWFUkN5k+iiGKfXph2L6fQPItU5ndvXF7ExxGjxTq6KJWr38w+TM9SW LVkNj9qQ5qT+qaG+mfAvvhvkH/1+u2BXTl2bQe4vTRA5ms/B8Q3dakmL4OKl8bgChUiS bEAADeKatXRdfwQJIRj1s74bH6Nfkssakc40y9xciJJ1QrdT06t9mrYG2STHTHqGp/MZ FHr6cU4qA8OL7A39apvWwyZDAzmSO2KeSsE2BPaTOA8wlZJQNs8d29KiEAdvapeKAOXg GtWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yngvason.is header.s=google header.b=Y+hn9Ho4; spf=pass (google.com: domain of linux-kernel+bounces-21222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=yngvason.is Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z18-20020a170906271200b00a2b1db54f7bsi994024ejc.39.2024.01.09.10.13.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 10:13:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@yngvason.is header.s=google header.b=Y+hn9Ho4; spf=pass (google.com: domain of linux-kernel+bounces-21222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=yngvason.is Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E31211F25F93 for ; Tue, 9 Jan 2024 18:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 048AF3D3B6; Tue, 9 Jan 2024 18:11:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yngvason.is header.i=@yngvason.is header.b="Y+hn9Ho4" Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AEDE3D3A3 for ; Tue, 9 Jan 2024 18:11:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=yngvason.is Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yngvason.is Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40e43fb2659so26945385e9.1 for ; Tue, 09 Jan 2024 10:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yngvason.is; s=google; t=1704823897; x=1705428697; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xEKXGZp6/dSPIf69wGEjjsLtzr50iEJJm//VReGTJdM=; b=Y+hn9Ho4Qqq4Alp3DzfcBQo9TQGkabKoNzHpPdWb4reuKCxWeA/a+Q7xFX3jTAXrrA eus97KfjbJjdwZD9WaCHliDJCrvegVNZ+b4cBesVDSoRL9j5UYBwyLJo/rUmrWa4lm0u Bf4mU4qREOAZOxnkIu+JhM/rDfVd7NXi+CuTQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704823897; x=1705428697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xEKXGZp6/dSPIf69wGEjjsLtzr50iEJJm//VReGTJdM=; b=ePBnLS6qOklA3VAqaeVBttGeKFIkZfZD48eoWefFg0Nj726wgZ0C/qu5g193RrDTuf fHPB8Ou4kEC1LHIxx1zoCEr6qwP6BTBxnp2gIOLh/RPuNPrSj65zkUuyRmAwDGWMlX6S ufsyR//cdbI+abZY1n3BxTkv39NGcK0flDyGkbJpWBCjpPHi6dtGAz7PiTT4KWrwOvvQ 5dhVOby4o9xsyfwnPs4sZQrqxj/IQX7NOcEAV0gxEjtStwCVi86HgM3cpKk3JXR6LHxD my+fyhow+IaGF1mLvk1ogfCDeC8OHP08bSeQ8P1smKtuA7iJvbq3PuywtCeCNcAkiUQG 6AYQ== X-Gm-Message-State: AOJu0YwOVmxDTpBRzgIftUZpGE6obj7xMMLe5k2cOKUeSDdnY1yFL1FG cA6qhWshfk58EeZVH1noK+67T/SOSgNJRg== X-Received: by 2002:a05:600c:228d:b0:40e:4579:9eb1 with SMTP id 13-20020a05600c228d00b0040e45799eb1mr2208339wmf.1.1704823897680; Tue, 09 Jan 2024 10:11:37 -0800 (PST) Received: from andri-workstation.turninn.appdynamic.com ([2a01:8280:aa07:ad:7285:c2ff:fef0:4baf]) by smtp.gmail.com with ESMTPSA id n25-20020a05600c3b9900b0040e527602c8sm2104579wms.9.2024.01.09.10.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 10:11:37 -0800 (PST) From: Andri Yngvason To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Simon Ser , Werner Sembach , Andri Yngvason Subject: [PATCH 4/7] drm/i915/display: Add handling for new "active color format" property Date: Tue, 9 Jan 2024 18:11:01 +0000 Message-ID: <20240109181104.1670304-5-andri@yngvason.is> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240109181104.1670304-1-andri@yngvason.is> References: <20240109181104.1670304-1-andri@yngvason.is> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Werner Sembach This commit implements the "active color format" drm property for the Intel GPU driver. Signed-off-by: Werner Sembach Signed-off-by: Andri Yngvason Tested-by: Andri Yngvason --- drivers/gpu/drm/i915/display/intel_display.c | 33 ++++++++++++++++++++ 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 | 4 ++- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index df582ff81b45f..79cc258db8f09 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -7167,6 +7167,21 @@ static void intel_atomic_prepare_plane_clear_colors(struct intel_atomic_state *s } } +static int convert_intel_output_format_into_drm_color_format(enum intel_output_format output_format) +{ + switch (output_format) { + case INTEL_OUTPUT_FORMAT_RGB: + return DRM_COLOR_FORMAT_RGB444; + case INTEL_OUTPUT_FORMAT_YCBCR420: + return DRM_COLOR_FORMAT_YCBCR420; + case INTEL_OUTPUT_FORMAT_YCBCR444: + return DRM_COLOR_FORMAT_YCBCR444; + default: + break; + } + return 0; +} + static void intel_atomic_commit_tail(struct intel_atomic_state *state) { struct drm_device *dev = state->base.dev; @@ -7438,6 +7453,9 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state, { struct intel_atomic_state *state = to_intel_atomic_state(_state); struct drm_i915_private *dev_priv = to_i915(dev); + struct drm_connector *connector; + struct drm_connector_state *new_conn_state; + int i; int ret = 0; state->wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); @@ -7506,6 +7524,21 @@ int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state, intel_shared_dpll_swap_state(state); intel_atomic_track_fbs(state); + /* Extract information from crtc to communicate it to userspace as connector properties */ + for_each_new_connector_in_state(&state->base, connector, new_conn_state, i) { + struct intel_crtc *crtc = to_intel_crtc(new_conn_state->crtc); + + if (crtc) { + struct intel_crtc_state *new_crtc_state = + intel_atomic_get_new_crtc_state(state, crtc); + + drm_connector_set_active_color_format_property(connector, + convert_intel_output_format_into_drm_color_format( + new_crtc_state->output_format)); + } else + drm_connector_set_active_color_format_property(connector, 0); + } + drm_atomic_state_get(&state->base); INIT_WORK(&state->base.commit_work, intel_atomic_commit_work); diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 62ce92772367f..c40fe8a847614 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5910,10 +5910,13 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect intel_attach_force_audio_property(connector); intel_attach_broadcast_rgb_property(connector); - if (HAS_GMCH(dev_priv)) + if (HAS_GMCH(dev_priv)) { drm_connector_attach_max_bpc_property(connector, 6, 10); - else if (DISPLAY_VER(dev_priv) >= 5) + drm_connector_attach_active_color_format_property(connector); + } else if (DISPLAY_VER(dev_priv) >= 5) { drm_connector_attach_max_bpc_property(connector, 6, 12); + drm_connector_attach_active_color_format_property(connector); + } /* Register HDMI colorspace for case of lspcon */ if (intel_bios_encoder_is_lspcon(dp_to_dig_port(intel_dp)->base.devdata)) { diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index aa10612626136..e7574ca0604e6 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1210,6 +1210,11 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP MST init failed, skipping.\n", connector->name, connector->base.id); + connector->active_color_format_property = + intel_dp->attached_connector->base.active_color_format_property; + if (connector->active_color_format_property) + drm_connector_attach_active_color_format_property(connector); + return connector; err: diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index bfa456fa7d25c..ce0221f90de92 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2611,8 +2611,10 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c if (DISPLAY_VER(dev_priv) >= 10) drm_connector_attach_hdr_output_metadata_property(connector); - if (!HAS_GMCH(dev_priv)) + if (!HAS_GMCH(dev_priv)) { drm_connector_attach_max_bpc_property(connector, 8, 12); + drm_connector_attach_active_color_format_property(connector); + } } /* -- 2.43.0