From patchwork Thu May 25 19:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13255595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 198D9C7EE29 for ; Thu, 25 May 2023 19:18:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4947510E11B; Thu, 25 May 2023 19:18:41 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C65910E110; Thu, 25 May 2023 19:18:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dqp3aqfZO2kllbntt9gKGB47UQUH8skYLdQ0KYbvurk8UHgIoJxkiBbgjejQjgbqIF9p4bQL0HxcWtD9u3n6LS+bwVlqccwXaqEiQ6luybRy2NI7VJobKjMjHYX9T6XcA+o5z7Yh2ysYWQbykM9uwYJYXPGaxIlE3wiCV5T25nDzEF6yOv2D+x3UkuTOf/h7bPQQTXAqYbw0s0hQOnd2Ye8al+7WOKrEr92w00k7PEe7Wjio9CFU6hsC1eHE4hyVmvG9ItTgvTzE2fQh/CkAv226bmVt0Jcu2vJOWtfUWrpXfYO+QniZUE2El9bB0W8rMC1TYoOGq+6kNidIqsWDkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PbOfjTJcpLn3YVPkOZiGN3nJVesWMlHfuTSuFQFCsbk=; b=W8wxycJNo1P/0/QzFjP9+Hahs5VYBZqIrAiCqp+r8Dmcwb8ehSgDZjyKwpSt90lbJ8bF7zfB0zSxz+FMFeoPTPby4gQGcejAyGTFI/o4J+G0X9POTc3JLrLmnZvT5aYyTg6kcGnJ7JnTjRZ1rX6V1xq0cz87YJrdi3BtaTbHbhgGRpf8vO6X9XTCYzJL5E+cqsTBTpdFFZV0zqS1KtNfC8CjvJlJGPZgOCZnT8ey5T5VPbNtDyiLGFq1xbM4REOWEodZ2GJnet00UV7mruyNZlDB0EgYFq71yXLbOQw89rAjK/IYJHKcn74o1RMY5xR/jhKtzEAMLn6lYs0nr3zrZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PbOfjTJcpLn3YVPkOZiGN3nJVesWMlHfuTSuFQFCsbk=; b=XupKvOcXawd/NA2efkZCPf+Y13Aop4YulOXcmvFJrKQBR6m4qzvvB3oGrMiGUTKLalquWkOam9g4nrss1waE426Ms3gv8UisamvrA6Qdv8ZVz9+flcOMifMaTzjGzpm4XE1JRSuyY3HC/YiFpgdN0HsQHKDUyWOeJP3tDpWJPZk= Received: from DM6PR02CA0060.namprd02.prod.outlook.com (2603:10b6:5:177::37) by MW3PR12MB4586.namprd12.prod.outlook.com (2603:10b6:303:53::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:31 +0000 Received: from DM6NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::2c) by DM6PR02CA0060.outlook.office365.com (2603:10b6:5:177::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Thu, 25 May 2023 19:18:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT099.mail.protection.outlook.com (10.13.172.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:30 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 14:18:27 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:27 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:25 -0500 From: Harry Wentland To: , Subject: [PATCH v4 03/13] drm/connector: Pull out common create_colorspace_property code Date: Thu, 25 May 2023 15:17:59 -0400 Message-ID: <20230525191809.3524-4-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT099:EE_|MW3PR12MB4586:EE_ X-MS-Office365-Filtering-Correlation-Id: 888b31c1-c5c4-4143-78f3-08db5d54d375 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JvksSEUyMNVUAsU0D7v6egGNmbROIXcpFyOZtpqFlXKXhSr3T1FTGw0QILAh0DQr0CHurnA5x+8Zwl9lZ5MeLpwwomV6xIQVKa9Z+4pnkH2NNb06f+OS149naCwE6lNlHhL1yqTVcLNaQ/S3GfZ23PtO6OYWn2KDASJEsoKJIX6MN+qrOERbz3IrPlO64vOLcnl44N9nRROjjFS08T2tpWoPrwwYLeSCF4Uiy3X1Fq6eFYb1zR2g6UEKeG/vP3/PCMU+ubjaDW2IUGE1dYZpgzV2dXb1Ts5+ReHpTYJnluEIbw/pqzOr+ub7yJG4Av0vvJ8/rFhcfUeOz1Vwx0aPpUWz/tUnYYgxqmS1U68HUHTkemWioZkvIxxxBhAu7EPJYjo9B4bYzn3tjhopPh+guUwJKBDiU7PWQtNvNHlxvPS1vWiSjYcoDOZuoM4AANqb+OT+BSA/FpIJaI7KmdJSKodUqYarR9XXe7IcQN5CIC8hqY3scCXCE6yY51to7Zu2jDI9iJ9hlrYyEMPC0L0Q54vHkC52/12tOVRpmNbVk1rfMykrHoiSk0nNmt5yHh3Mk0CI846omyvyvcML/CB4Of/WSSthEI+RUL3jVrPzsecwWKfBD3H3w77dU4Oq2otL7a9VaNo2LkIdRqC47BlTgQdLH8tPgFhfhMRNaPQwnEYDH8neTerG8xD9DWK8HlceemZzuGUW57yyTJ31lfAnKEJmrwlxbYEVue7vgnhLZqdrCrvktavxmi5IyFRohk6xVAqxrNm+AH8/tRMjXGvdUatJ7AveLzLT0dMtVvSPwOZe/mE2w8BniVGi1IBGycfU X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(426003)(82310400005)(336012)(2616005)(4326008)(5660300002)(82740400003)(356005)(8936002)(36756003)(8676002)(7416002)(81166007)(86362001)(40480700001)(2906002)(44832011)(83380400001)(40460700003)(316002)(47076005)(66574015)(41300700001)(36860700001)(54906003)(110136005)(6666004)(478600001)(186003)(70586007)(70206006)(1076003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:30.8447 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 888b31c1-c5c4-4143-78f3-08db5d54d375 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4586 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Jani Nikula Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/drm_connector.c | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 547356e00341..9c087d6f5691 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1975,33 +1975,44 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); * drm_mode_create_dp_colorspace_property() is used for DP connector. */ -/** - * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property - * @connector: connector to create the Colorspace property on. - * - * Called by a driver the first time it's needed, must be attached to desired - * HDMI connectors. - * - * Returns: - * Zero on success, negative errno on failure. - */ -int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) +static int drm_mode_create_colorspace_property(struct drm_connector *connector, + const struct drm_prop_enum_list *colorspaces, + int size) { struct drm_device *dev = connector->dev; if (connector->colorspace_property) return 0; + if (!colorspaces) + return 0; + connector->colorspace_property = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace", - hdmi_colorspaces, - ARRAY_SIZE(hdmi_colorspaces)); + colorspaces, + size); if (!connector->colorspace_property) return -ENOMEM; return 0; } +/** + * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property + * @connector: connector to create the Colorspace property on. + * + * Called by a driver the first time it's needed, must be attached to desired + * HDMI connectors. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) +{ + return drm_mode_create_colorspace_property(connector, + hdmi_colorspaces, + ARRAY_SIZE(hdmi_colorspaces)); +} EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); /** @@ -2016,20 +2027,9 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); */ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector) { - struct drm_device *dev = connector->dev; - - if (connector->colorspace_property) - return 0; - - connector->colorspace_property = - drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace", - dp_colorspaces, - ARRAY_SIZE(dp_colorspaces)); - - if (!connector->colorspace_property) - return -ENOMEM; - - return 0; + return drm_mode_create_colorspace_property(connector, + dp_colorspaces, + ARRAY_SIZE(dp_colorspaces)); } EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property);