Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp163355pxy; Fri, 30 Apr 2021 02:45:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVk9IV473wuh/FQfqZvrWA0ol1+rlMH9JNJruaBkacUI5OWgmpr2oWlQ5eZL2H6dN7Hqw1 X-Received: by 2002:a63:5066:: with SMTP id q38mr3959018pgl.119.1619775947113; Fri, 30 Apr 2021 02:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619775947; cv=none; d=google.com; s=arc-20160816; b=EMj0LmGU/H+xhoywHXvh2lrgNt5Wge11BGhj8m2oZ3w+9JHK/8p+IUMuWFHrm7JVZX hFyFJeRzDE428KZ2OtQi+xMXOm7jIHpTBxCJI/VVdQ0m4f5+rp+QJt7G0Lwq64rfoUVT pFOYMt9ipSh1f12P3cH7f2KhmFKj+KG6PwtR2fveKvjiBRPJHZqP+h7X8Snxcqev5Ur7 f0Y0NgBzReK0X6bWhx71DMHimZJ0dkttztKy4DS8s4ivRsdXNEwO11IHkjnqwxDNIma9 E9qVR92BZMtKqmON4Jvb+LurrUQnwmdFMz8sZCeQyFj+G9xUos5wgGV0tCsAjuaLjoe0 inzQ== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=JjDK5rsfeA5jH5e+etU6Pjpkhk5S/nK7Bq9hIE+7SHU=; b=r8YdQqMh/dBE894wMAcpl+QLmvvG2swcBikT4/0Pnlxp0Z8+ELsskxgsnN2U8CZXIY dz0nkUqJcSPBleFLGfobYByQom1pnebyXFUjGFejrn9BqpUA8UhbZ6sN5sdFdoI/lqP5 kaDQeGfnI6pRTl/S5MBN1xOXkcs9/i6dayCpewA6aS6VsYl+A01fQz7hoTqzMllAlHyi vgA16Vu0cZ9+tGItq4b+Fll92TZXWLD2dc/LjdAfAklkZdBMGXE0OrocMh8sPFW1vv4E UoTflz2PSRkqlpLEIoFuIFTxEQRFqVTm5BwHKATJqtJhm0lCxS4PNzS6KLo6fYqfcfPm zrng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=G5MH0nX6; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=UJglAWk0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 142si3230313pgf.532.2021.04.30.02.45.33; Fri, 30 Apr 2021 02:45:47 -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; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=G5MH0nX6; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=UJglAWk0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbhD3Jpq (ORCPT + 99 others); Fri, 30 Apr 2021 05:45:46 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:53975 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbhD3Jpp (ORCPT ); Fri, 30 Apr 2021 05:45:45 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 4ECFF5800D2; Fri, 30 Apr 2021 05:44:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 30 Apr 2021 05:44:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm2; bh=JjDK5rsfeA5jH5e+etU6Pjpkhk 5S/nK7Bq9hIE+7SHU=; b=G5MH0nX64Vc+BlpsE/u9dRxE1C6dnn3jwLCFHfECQ/ 8XlmOIUFxm+sq5y0KYFfgwJGWctYEA0s6uBf6kXYVWap6VYI2G6Sljm2MdUHyKlA u90Yl96iuXZAEoGu9SUGwV137vbEEUSdWbMSpgIZmt4kmXF53UCHB7HFLqQo5JFI vIyBaEHMzYjeihmNFweOywkyVF4/6/nMRdhPhGeOTuPxk6S+5SpXYu6GTDdNtmLi s1qwyiIlfAwtDZruHg3XdfSwql2CH4J36qRbY8OvjMUGWifFxau/uPARZOoEcerN Io7pZgM2EwxLr+6I+aVBlXUAqAj0p9NiNh5hZEPpDmBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=JjDK5rsfeA5jH5e+e tU6Pjpkhk5S/nK7Bq9hIE+7SHU=; b=UJglAWk0rRtYWZAZLgRbvJx9FnQ5lbdNz 7KZ4+XVUMTl13prIFGYFNwQ7D4l6fzGCWZJ/g1wxw9K/+ABJh3kRs837G3emdAGQ z18MoxjsetTK6C+n9c+ASwDpMmfWyFIhfPjcgA/AecwBNVLrlG8P3xORJDK8dcdJ oeZWq5x6/EZM5R01W3uZR+u0ngQ98tDjEAV3zSlAIG7zEpEZ9PUBB8Xdf4dBPPOq bNxWAkjLbmAU7O7gKhfJS5jffZdn/YosfBaS8/ZlPSfL5x+JHx5I+Uqd4I3JkliL YTuYO0HqMfHC57phBRWaPCCqz46+TBDFOGpjF6RRUyTQ9P0I7cVWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddviedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhmvgcu tfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrthhtvg hrnhepjeffheduvddvvdelhfegleelfffgieejvdehgfeijedtieeuteejteefueekjeeg necukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Apr 2021 05:44:53 -0400 (EDT) From: Maxime Ripard To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: Maxime Ripard , Rodrigo Vivi , Daniel Vetter , Laurent Pinchart , Neil Armstrong , Jernej Skrabec , linux-kernel@vger.kernel.org, Leo Li , Jonas Karlman , Andrzej Hajda , Jani Nikula , Robert Foss , Eric Anholt , Alex Deucher , Harry Wentland , Joonas Lahtinen , =?UTF-8?q?Christian=20K=C3=B6nig?= , amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley Subject: [PATCH v3 1/5] drm/connector: Create a helper to attach the hdr_output_metadata property Date: Fri, 30 Apr 2021 11:44:47 +0200 Message-Id: <20210430094451.2145002-1-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All the drivers that implement HDR output call pretty much the same function to initialise the hdr_output_metadata property, and while the creation of that property is in a helper, every driver uses the same code to attach it. Provide a helper for it as well Reviewed-by: Harry Wentland Reviewed-by: Jernej Skrabec Signed-off-by: Maxime Ripard --- Changes from v2: - Rebased on current drm-misc-next - Fixed a merge conflict with i915 Changes from v1: - Rebased on latest drm-misc-next tag - Added the tags --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 +-- drivers/gpu/drm/drm_connector.c | 21 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_hdmi.c | 3 +-- include/drm/drm_connector.h | 1 + 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index a0c8c41e4e57..c8d7e7dbc05e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7498,9 +7498,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, if (connector_type == DRM_MODE_CONNECTOR_HDMIA || connector_type == DRM_MODE_CONNECTOR_DisplayPort || connector_type == DRM_MODE_CONNECTOR_eDP) { - drm_object_attach_property( - &aconnector->base.base, - dm->ddev->mode_config.hdr_output_metadata_property, 0); + drm_connector_attach_hdr_output_metadata_property(&aconnector->base); if (!aconnector->mst_port) drm_connector_attach_vrr_capable_property(&aconnector->base); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index ae97513ef886..dd7f6eda2ce2 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2492,8 +2492,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) drm_connector_attach_max_bpc_property(connector, 8, 16); if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) - drm_object_attach_property(&connector->base, - connector->dev->mode_config.hdr_output_metadata_property, 0); + drm_connector_attach_hdr_output_metadata_property(connector); drm_connector_attach_encoder(connector, hdmi->bridge.encoder); diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index eab8c0b82de2..c5e2f642acd9 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -2151,6 +2151,27 @@ int drm_connector_attach_max_bpc_property(struct drm_connector *connector, } EXPORT_SYMBOL(drm_connector_attach_max_bpc_property); +/** + * drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPUT_METADA" property + * @connector: connector to attach the property on. + * + * This is used to allow the userspace to send HDR Metadata to the + * driver. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_property *prop = dev->mode_config.hdr_output_metadata_property; + + drm_object_attach_property(&connector->base, prop, 0); + + return 0; +} +EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property); + /** * drm_connector_set_vrr_capable_property - sets the variable refresh rate * capable property for a connector diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 9c172dd6fb5b..3c767bcc47b1 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2459,8 +2459,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c drm_connector_attach_content_type_property(connector); if (DISPLAY_VER(dev_priv) >= 10) - drm_object_attach_property(&connector->base, - connector->dev->mode_config.hdr_output_metadata_property, 0); + drm_connector_attach_hdr_output_metadata_property(connector); if (!HAS_GMCH(dev_priv)) drm_connector_attach_max_bpc_property(connector, 8, 12); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 1922b278ffad..32172dab8427 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1671,6 +1671,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, u32 scaling_mode_mask); int drm_connector_attach_vrr_capable_property( struct drm_connector *connector); +int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector); int drm_mode_create_aspect_ratio_property(struct drm_device *dev); int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector); int drm_mode_create_dp_colorspace_property(struct drm_connector *connector); -- 2.31.1