From patchwork Tue Jun 6 20:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269732 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 52DDDC83003 for ; Tue, 6 Jun 2023 20:26:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 900A910E3B3; Tue, 6 Jun 2023 20:26:20 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2069.outbound.protection.outlook.com [40.107.243.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF1C810E3B0; Tue, 6 Jun 2023 20:26:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NxRhbDbMJ356/WVp1P1C90lmdnLBeY3qqZEp9QoFIq0/HOAAxL0stJdzpHmyVU1H+3Zl2boEkQkrWzPN/VEMHCx0tKQ2uNwDbEYx0cJHpSEIDK5Yh+2zTsqjrt+wjvDn2kuYTZBmhg2GV+1g8Ar0dpP0PsQPm8cRuCtgDki43KROhq3uoLAmnHPO6NZIkSCoa0CAlQlxi+Z+OFW5wy9QfdnLQVx9PsNkQh01wX3vofia/Y5Fy9vgPj/PSYFPFT+/tAz18TaoQMUaFyRmYwBK6pwLBJp6Wwd+IW6j+O/+copsc1xHtg9ZV+BsGhAZhi6z0F9y5GSQHnEDXSw+UgMsyA== 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=ZIN0/SKkxZnfTVNzOeU/i3NodKVfBXcBL2MKg5tjtsY=; b=bcmXylKkkCCGyqHz2EWEsSQlRqPI18Ca9f+siV7pS9pCveLtynRlvXnNHiU6S3iQ4VplvLTdEWVd5hGJ0aqf1StMmi/ieyfFY7dce2x4LL4wCJZsVtS7nMaJ5ZCmDHSFblbKdAlRyWxt51oJJ/mW0sOPZmsRo8CZUm4RgV23e3kcIzBkrNtLgiHSMLN1jVOgJ1VMabb2Ha2yc7nuTaFWKsjqRQuCxnA2oqGssit0+7SnM4Rig2TMx8BKWDwcKMAHZ+GlPEkgtQKDqN/wIMcXYUiE+mj6WEpZ3VQmLPDtPFjYGJo+lYBAkm/lgpW+yJWlq9Tasdwi5iIqU9p2nkaLog== 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=ZIN0/SKkxZnfTVNzOeU/i3NodKVfBXcBL2MKg5tjtsY=; b=qPLCVR3UVMVMzjy5zEvV2/91MDWhU3DJOIHiDXfx8dzvhSXbfwi0NMW2M8sZ+sd684B7WnubyYk9RF9r/kaEeHL5iSwh64tkOXxVBVrOZDjcB9wIWGCmhHo4GM/hl1LRB7iYtkaJG9aBlxXqoIt9uT0KeszX437COsQNubBIdf8= Received: from BN0PR08CA0017.namprd08.prod.outlook.com (2603:10b6:408:142::24) by DM6PR12MB4138.namprd12.prod.outlook.com (2603:10b6:5:220::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:13 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::80) by BN0PR08CA0017.outlook.office365.com (2603:10b6:408:142::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:12 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:12 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:12 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:11 -0500 From: Harry Wentland To: , Subject: [PATCH v5 01/13] drm/connector: Convert DRM_MODE_COLORIMETRY to enum Date: Tue, 6 Jun 2023 16:25:55 -0400 Message-ID: <20230606202607.122914-2-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|DM6PR12MB4138:EE_ X-MS-Office365-Filtering-Correlation-Id: c8e7f859-cfd0-44ac-9171-08db66cc455d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GhiHHWi9bmyRjjRFqYOeAXoeFpcBlNnIixgOo/iUIq9xj9/5u6OsHuyetFCOA8bD1ZUGnLmzMpngrEr5VC3TU1ctE5vTXIU0Ol5u489RSBdyMeND+HZMqvcWuQFl3t3kHOERC4fDxnEuxXgNmMZhRKg8pX1Ef5sUiRc9bKz2uWLodxItzJtn3Acl+nRIJdr1VcFvDgksuuVIwoClSgkEoalX7jTU6pvFzLhi8fB/eaHaz7DJhpespnx5EmIXMLFoYoXfSXvHuEK/g91gb+WKfOXlFXNHyksqpyKj2Z4ZdUn4pBTO8dxJm2/GquGk7Sg/6o3lLHeGgb3gcwA/b1OlHpqlVUDr0vz8wfgobZqzzfLXPjcde+m/i3KDvAQgLkcc5uXAmopbPT0q2WgPEYCUUQM4W2u7j07XG9JY4uD3rykX2PKE2IdLyE6JLQHteBUYpP8v7hwFl/KNI6EvESs+uMgf/4xxOoNnygAOrtJOAJl/Ekl76Lm/QmZ2YWr9fmhKAOO72gK2CjDYgw7M9k9uI1Rnue7iyn9cgGjj5BMqHffTF1E6I276aRUH0zFp+NQc9j94h2jQQIH1nS3iii1ekU97/8t928PE7m9VaGAm11QszWrWss7TngJV6jfRqdhD7lLvEbNkwH2BFwoLzH00OOWYpsy4L+C6Voy4IamIVALUsqgCvS7Fclkp8DbLa0rbt3avTuLiyRNYLOTcdE5PQJ6so0oG4ISEgvqfMBT3R6WXZ6qEy+ZL51joptG+1v3co+hoMOf9dGOnCMJIKeaVtA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(36756003)(2906002)(82310400005)(86362001)(5660300002)(7416002)(44832011)(66899021)(40480700001)(6666004)(40460700003)(83380400001)(1076003)(426003)(336012)(36860700001)(66574015)(26005)(81166007)(478600001)(356005)(82740400003)(316002)(54906003)(110136005)(70586007)(186003)(41300700001)(4326008)(2616005)(70206006)(47076005)(8676002)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:12.4928 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8e7f859-cfd0-44ac-9171-08db66cc455d 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4138 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 , Pekka Paalanen , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This allows us to use strongly typed arguments. v2: - Bring NO_DATA back - Provide explicit enum values v3: - Drop unnecessary '&' from kerneldoc (emersion) v4: - Fix Normal Colorimetry comment Signed-off-by: Harry Wentland Reviewed-by: Simon Ser Reviewed-by: Sebastian Wick Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Pekka Paalanen --- include/drm/display/drm_dp.h | 2 +- include/drm/drm_connector.h | 49 ++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h index f1be179c5f1f..7f858352cb43 100644 --- a/include/drm/display/drm_dp.h +++ b/include/drm/display/drm_dp.h @@ -1626,7 +1626,7 @@ enum dp_pixelformat { * * This enum is used to indicate DP VSC SDP Colorimetry formats. * It is based on DP 1.4 spec [Table 2-117: VSC SDP Payload for DB16 through - * DB18] and a name of enum member follows DRM_MODE_COLORIMETRY definition. + * DB18] and a name of enum member follows enum drm_colorimetry definition. * * @DP_COLORIMETRY_DEFAULT: sRGB (IEC 61966-2-1) or * ITU-R BT.601 colorimetry format diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 565cf9d3c550..77401e425341 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -371,29 +371,30 @@ enum drm_privacy_screen_status { * a colorspace property which will be created and exposed to * userspace. */ - -/* For Default case, driver will set the colorspace */ -#define DRM_MODE_COLORIMETRY_DEFAULT 0 -/* CEA 861 Normal Colorimetry options */ -#define DRM_MODE_COLORIMETRY_NO_DATA 0 -#define DRM_MODE_COLORIMETRY_SMPTE_170M_YCC 1 -#define DRM_MODE_COLORIMETRY_BT709_YCC 2 -/* CEA 861 Extended Colorimetry Options */ -#define DRM_MODE_COLORIMETRY_XVYCC_601 3 -#define DRM_MODE_COLORIMETRY_XVYCC_709 4 -#define DRM_MODE_COLORIMETRY_SYCC_601 5 -#define DRM_MODE_COLORIMETRY_OPYCC_601 6 -#define DRM_MODE_COLORIMETRY_OPRGB 7 -#define DRM_MODE_COLORIMETRY_BT2020_CYCC 8 -#define DRM_MODE_COLORIMETRY_BT2020_RGB 9 -#define DRM_MODE_COLORIMETRY_BT2020_YCC 10 -/* Additional Colorimetry extension added as part of CTA 861.G */ -#define DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 11 -#define DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER 12 -/* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */ -#define DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED 13 -#define DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT 14 -#define DRM_MODE_COLORIMETRY_BT601_YCC 15 +enum drm_colorspace { + /* For Default case, driver will set the colorspace */ + DRM_MODE_COLORIMETRY_DEFAULT = 0, + /* CEA 861 Normal Colorimetry options */ + DRM_MODE_COLORIMETRY_NO_DATA = 0, + DRM_MODE_COLORIMETRY_SMPTE_170M_YCC = 1, + DRM_MODE_COLORIMETRY_BT709_YCC = 2, + /* CEA 861 Extended Colorimetry Options */ + DRM_MODE_COLORIMETRY_XVYCC_601 = 3, + DRM_MODE_COLORIMETRY_XVYCC_709 = 4, + DRM_MODE_COLORIMETRY_SYCC_601 = 5, + DRM_MODE_COLORIMETRY_OPYCC_601 = 6, + DRM_MODE_COLORIMETRY_OPRGB = 7, + DRM_MODE_COLORIMETRY_BT2020_CYCC = 8, + DRM_MODE_COLORIMETRY_BT2020_RGB = 9, + DRM_MODE_COLORIMETRY_BT2020_YCC = 10, + /* Additional Colorimetry extension added as part of CTA 861.G */ + DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 = 11, + DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER = 12, + /* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */ + DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13, + DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14, + DRM_MODE_COLORIMETRY_BT601_YCC = 15, +}; /** * enum drm_bus_flags - bus_flags info for &drm_display_info @@ -828,7 +829,7 @@ struct drm_connector_state { * colorspace change on Sink. This is most commonly used to switch * to wider color gamuts like BT2020. */ - u32 colorspace; + enum drm_colorspace colorspace; /** * @writeback_job: Writeback job for writeback connectors From patchwork Tue Jun 6 20:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269734 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 9EE83C7EE45 for ; Tue, 6 Jun 2023 20:26:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 262E110E3B8; Tue, 6 Jun 2023 20:26:22 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id A39AA10E3B0; Tue, 6 Jun 2023 20:26:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DdWJhIzxP+C0UKGY5RGXeyhd2okoVjrfHMm5BbABI6gyktJNR355xbl0dSsnIYWS75KbvSY2EaZnB2Aw6yRqF6V+ybG79ubYadyL+bOhRPJtqB0vkfbOMf/I9eFTId4rQLRG6TsZVrd0UB6yYxXLkLKEQUlpQmKmoy+2za8RHYDAxWe9ghmRFtqF9suofQP71AGO2V6hkafs7LjaUERmBwUVriS9OiThHh5g7NU99dQHCI5umTl72+Od8z/5CuEpHXSFFtyQpj5CEFqD/YJEkWZ6AT74AiXtBV+mwAwVy4SC2z3ffnKWDzb6WfJhYWU/nfyoFc6amoJHZ5w12aStJQ== 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=dpoDThbFgL/dq0K1vV2TWgr2FFpAW2XvxwC50PIpZcE=; b=Z673JHFgj5G5RsEdGREc7UxSf8fognW4BeleaL7pnhsIQ6QO7EYP0Xf5zGPWmct86lZUXDGNP9z6lky8js6DzKEL2Nms69R56Yh0BHANWdPJ8htv6XuZ0rwOeAG4Zq/pkmTxAACis3Z0J7eiQucO2YJOrk/grIJp26Qx1sien9YpbLsAgFygfZMgjvBmhNj0HtTcQ7/XvocKGLVeFoMV+H+INqYJlGBxLXZN79N1PJkO0tWnZRdZTi2TpTKx5h0nhjQlqASj0ULArX0r/3H0/SywpPlVKAf7d/FvWwrmEC/OgI6LAeWL9z8ScMvAolV0HKIPrBgsQ3cC0/2pSfsHTQ== 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=dpoDThbFgL/dq0K1vV2TWgr2FFpAW2XvxwC50PIpZcE=; b=fU4QQfd8m/tdNoIc9znkNxd36RoEBseLNolMxni5vPTA3N8+9876gkxtoeQwdGO8lS0Bbmf/JT7sz0CbEXl+gUWuIFcmF2F0v4yNRoZ7xywfdDal6ea2Im5bQjFEmAaEEN1LwRY6WQTGwm8xUKASsdSNjoQ2TmgA9RjGTkElPos= Received: from BN0PR08CA0019.namprd08.prod.outlook.com (2603:10b6:408:142::12) by PH7PR12MB8825.namprd12.prod.outlook.com (2603:10b6:510:26a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 20:26:14 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::f) by BN0PR08CA0019.outlook.office365.com (2603:10b6:408:142::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:14 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:14 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:13 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:12 -0500 From: Harry Wentland To: , Subject: [PATCH v5 02/13] drm/connector: Add enum documentation to drm_colorspace Date: Tue, 6 Jun 2023 16:25:56 -0400 Message-ID: <20230606202607.122914-3-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|PH7PR12MB8825:EE_ X-MS-Office365-Filtering-Correlation-Id: 17e1b66b-3de4-49f3-c40e-08db66cc466f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1LEU1UGPAhOj+JXv9g+JuYhY44kVjlLTjNyY5Ip91bj8gLwe1bQ7vNygvBaTEJ8NSO0/TbUw3T7udn1w8LCgD1CRRYZUK8nqMKNL/Q4GUypTWn7ENq+Gu5Qe+OV2RpEG2kHml55bqAfaT8u7KP0r/q6xXHeCd0nVAVDEmOmtwdMMot1LZR2uV1A0iLGORnILiQQuSH+poV0BpJYOXX1WdmjKQyMghQmb9XwMnJ7Jin7y/P/8LDCAzf+QsLUKXH3Le+YyohJxZjhD/F+66WVLxoLZzDjGwhGiRq+bmcjT1EqaSw84lzdk5gIW55V40LISgIcfHHYCK5N1ZA+hs0JFPhMWMrXm03oD7JxepoH6nwVhIYk5l7nUcTV00lkGPHO6wdpJbd9u+Ysg3e9ZRbsBAztTDTEJ9i1lHOBeDABHVVo0idmgpFuMnKXMR18x/d1FplbwAQNUn9l3J+xmxgr6sWuzl/94twc0dnnO53ELwBayUQ3fbIWDW3b/ghNuo9PssKShUL+EQIwPIonsDanVdaNDNlmcoSQ9DwflHPRfuNjIHRLYWcAj8SgM35fKYxipNtucmzuUls0OfDvQUi95UAb5mTuoGrlWwonRem0jt1280e0epIMo39SoKCaBRgsr0G4e0pxkQ0OFUmbEAjz9JWfko3XXZXn7iRvtK+8onlfZVoOrfl80UJQQMz6Sa5QLw6zGU9UdiijsEC/9UNUZCmV2oAuxgjJLMu1OvTFDH21Fpw/qauE08zbCH49Z+IG7TfQfMrb6nm1QThmNNUx/1g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(376002)(39860400002)(396003)(451199021)(40470700004)(46966006)(36840700001)(8676002)(8936002)(54906003)(478600001)(41300700001)(5660300002)(316002)(6666004)(1076003)(26005)(44832011)(7416002)(186003)(110136005)(70206006)(70586007)(4326008)(66899021)(336012)(83380400001)(2616005)(40460700003)(47076005)(2906002)(66574015)(426003)(81166007)(356005)(82740400003)(40480700001)(36860700001)(82310400005)(36756003)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:14.3367 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17e1b66b-3de4-49f3-c40e-08db66cc466f 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8825 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 , Pekka Paalanen , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Joshua Ashton To match the other enums, and add more information about these values. v2: - Specify where an enum entry comes from - Clarify DEFAULT and NO_DATA behavior - BT.2020 CYCC is "constant luminance" - correct type for BT.601 v4: - drop DP/HDMI clarifications that might create more questions than answers v5: - Add note on YCC and RGB variants Signed-off-by: Joshua Ashton Signed-off-by: Harry Wentland Reviewed-by: Harry Wentland Reviewed-by: Sebastian Wick Acked-by: Pekka Paalanen Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- include/drm/drm_connector.h | 70 +++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 77401e425341..907f40851e80 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -363,13 +363,79 @@ enum drm_privacy_screen_status { PRIVACY_SCREEN_ENABLED_LOCKED, }; -/* - * This is a consolidated colorimetry list supported by HDMI and +/** + * enum drm_colorspace - color space + * + * This enum is a consolidated colorimetry list supported by HDMI and * DP protocol standard. The respective connectors will register * a property with the subset of this list (supported by that * respective protocol). Userspace will set the colorspace through * a colorspace property which will be created and exposed to * userspace. + * + * DP definitions come from the DP v2.0 spec + * HDMI definitions come from the CTA-861-H spec + * + * A note on YCC and RGB variants: + * + * Since userspace is not aware of the encoding on the wire + * (RGB or YCbCr), drivers are free to pick the appropriate + * variant, regardless of what userspace selects. E.g., if + * BT2020_RGB is selected by userspace a driver will pick + * BT2020_YCC if the encoding on the wire is YUV444 or YUV420. + * + * @DRM_MODE_COLORIMETRY_DEFAULT: + * Driver specific behavior. + * @DRM_MODE_COLORIMETRY_NO_DATA: + * Driver specific behavior. + * @DRM_MODE_COLORIMETRY_SMPTE_170M_YCC: + * (HDMI) + * SMPTE ST 170M colorimetry format + * @DRM_MODE_COLORIMETRY_BT709_YCC: + * (HDMI, DP) + * ITU-R BT.709 colorimetry format + * @DRM_MODE_COLORIMETRY_XVYCC_601: + * (HDMI, DP) + * xvYCC601 colorimetry format + * @DRM_MODE_COLORIMETRY_XVYCC_709: + * (HDMI, DP) + * xvYCC709 colorimetry format + * @DRM_MODE_COLORIMETRY_SYCC_601: + * (HDMI, DP) + * sYCC601 colorimetry format + * @DRM_MODE_COLORIMETRY_OPYCC_601: + * (HDMI, DP) + * opYCC601 colorimetry format + * @DRM_MODE_COLORIMETRY_OPRGB: + * (HDMI, DP) + * opRGB colorimetry format + * @DRM_MODE_COLORIMETRY_BT2020_CYCC: + * (HDMI, DP) + * ITU-R BT.2020 Y'c C'bc C'rc (constant luminance) colorimetry format + * @DRM_MODE_COLORIMETRY_BT2020_RGB: + * (HDMI, DP) + * ITU-R BT.2020 R' G' B' colorimetry format + * @DRM_MODE_COLORIMETRY_BT2020_YCC: + * (HDMI, DP) + * ITU-R BT.2020 Y' C'b C'r colorimetry format + * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65: + * (HDMI) + * SMPTE ST 2113 P3D65 colorimetry format + * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER: + * (HDMI) + * SMPTE ST 2113 P3DCI colorimetry format + * @DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED: + * (DP) + * RGB wide gamut fixed point colorimetry format + * @DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT: + * (DP) + * RGB wide gamut floating point + * (scRGB (IEC 61966-2-2)) colorimetry format + * @DRM_MODE_COLORIMETRY_BT601_YCC: + * (DP) + * ITU-R BT.601 colorimetry format + * The DP spec does not say whether this is the 525 or the 625 + * line version. */ enum drm_colorspace { /* For Default case, driver will set the colorspace */ From patchwork Tue Jun 6 20:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269733 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 39DECC77B7A for ; Tue, 6 Jun 2023 20:26:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C907310E3B0; Tue, 6 Jun 2023 20:26:21 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B47B10E3AF; Tue, 6 Jun 2023 20:26:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iT/4z5qF49sOGFXh39QaqW6Zvgtftn32Sb65hcRzf0Di+NpY088v8C8FKbKO4110o9MKBH//6yUCfNahCG9HdxSO537x66Qhr2SdcKDkHMb3wGlkpMUG1JfEZmdtYEauptTzz8tMI9ftn8iL3XR57sYKvhfWbaTLJoncMukMBsKWWR/m4PLTEJt0elPDr8w6B0dCNvr9OosX+Omc0w3kR5XImdBf2KR1W9ZOSm6L4tQYt2/GjWqt9qlvMqWHJ2ZeKyND517oZ7VYCCeuaV4a+x/xlG7tm0lLlvKLaH2X0823o4DDNr+KLAOrC1stRIechnTIeKygdT6CoSx8vtoAig== 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=JGs6BQd2ndqdv/jZo8ca7c3wADzxVv4YTq9Hshj6MhU=; b=XqicojZ8+cHcbs80LCFpxqSCMo+qaaLG92mgGPh0tIl/T+1nIl6viN2pjOHrCl9TG97plO9vv6gNfaU2yN3vhYrXt/v+cHw+kDeqdSvwWNHzdG6ENDEsSUBQDIJUqXLroAIiMxylBR9OPXjo3TZSjH3+7B3Y+XarXS8++t8V8ktqHlobN6j8H8RGbbjJXqrdkBhQh8eQsEDSoZ152o/jHySnSU1cNCjU5el9RxM2fqtwvyVM3scVJKkniqpH2aLuYgC2g04uWm3kbeJ6hG5xa5WJhrlicaWpYdZSXzXAaMU3mnDB5Sq0Hn8+SpkfCUWc2BC0xr/tRg5OMqYVAehf6Q== 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=JGs6BQd2ndqdv/jZo8ca7c3wADzxVv4YTq9Hshj6MhU=; b=E0PReXWQKEcLwGB2jgWhX+fP7yvaPRFqCR/o0IdxzHPfz/wJW5KsXYpZ0I/YvugD3EZ+OQJqGx+z73ajOAZV17Gnrq6NqoQIih59+YKqYfpkIzz1ckbBSNo6OsFSQkgo71d4D8kNrJb5pKYhhxX+9GlAIWbgbBuM1keUxMGkkuE= Received: from BN0PR04CA0072.namprd04.prod.outlook.com (2603:10b6:408:ea::17) by DM6PR12MB4171.namprd12.prod.outlook.com (2603:10b6:5:21f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:15 +0000 Received: from BN8NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::b5) by BN0PR04CA0072.outlook.office365.com (2603:10b6:408:ea::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:15 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT046.mail.protection.outlook.com (10.13.177.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:15 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:14 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:13 -0500 From: Harry Wentland To: , Subject: [PATCH v5 03/13] drm/connector: Pull out common create_colorspace_property code Date: Tue, 6 Jun 2023 16:25:57 -0400 Message-ID: <20230606202607.122914-4-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT046:EE_|DM6PR12MB4171:EE_ X-MS-Office365-Filtering-Correlation-Id: e3f5f278-3fec-452a-1345-08db66cc46dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kziuVMm9Y/TZT6lZHtli/qXdDCXD6En51q3SkCkdya9JctPH+FlRviQ3GxpaTgzCt1/f6hrfZUVKcanTN5V2x6Fqz/dCZ2iMRDat7PmVkveFFkR2B6JA1T/hB8anODawD3j76e+7OLO7PiYJm3sapMV2SY8UVUDL1HxfX0FPyZ6F/7CBA39vjznY6Qkv4Ve2kybLlKEP/beKujmcNoKNCZI8SHCZ3g/hu3MQYxLnn2quDzNpD2eO8Bd91EEhl7jfNi68HOoSZ/yQzub3AIef02sXV9Oau+G5uo78KAR9ESzknaOGc1UKh4YnDO0SsZ0Xbh+Jo87ULk1NfBSkbAa+jS5DxQL1Aioi54BRfnNbQM6bCdGkQk6VbDMkxwKGUQ+IlSkxYuqYmxk23GzC0weLBbl8I57g01pWNz7sG87oyq5+3DHsZtLq5vJHzJjUKAtJgddmmu6fW4txdOLDB4L1IXvUabfmhbQd44pA9U2bs5Fit2TB+Gcg+ajb+lub4OwVpxQyNJnpKHIlgr/frlfjBXqdBRE9Z2nG+w6X01UmbOsHICUDGFwJeIp2NfPPGHGrdVWaAQH25P9xy1Xhn99dAhkiKk89flFHXlv8sTgficilPbX8u5HRTfjvVyCAKiprCAqTFThopAZT9865thxqXOkwZZDII4KOeMhr/EMmpxu0ocoGHDE7SGwYGgP/NJ9wKJoK4r16Tlfg3V0boxblYjmAoet5cVe1q37mEOAE04kWtunpHSKHEyFwNDADP2kyAn9K6h69oxOnlpnzA0GIjg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(39860400002)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(1076003)(2616005)(41300700001)(426003)(6666004)(336012)(36860700001)(26005)(47076005)(66574015)(83380400001)(186003)(40460700003)(40480700001)(478600001)(110136005)(54906003)(81166007)(82310400005)(4326008)(356005)(82740400003)(70206006)(70586007)(316002)(7416002)(8676002)(8936002)(44832011)(86362001)(5660300002)(36756003)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:15.0999 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3f5f278-3fec-452a-1345-08db66cc46dd 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4171 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 Reviewed-by: Sebastian Wick 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); From patchwork Tue Jun 6 20:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269735 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 D6EC1C77B7A for ; Tue, 6 Jun 2023 20:26:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBD9D10E3B7; Tue, 6 Jun 2023 20:26:22 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFB8410E3B0; Tue, 6 Jun 2023 20:26:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PRDADy+zX0CIOX6shYNSJqTAoKqJbYCan8m2wxUNz0m9c500AwmX3ReO5ALwnWYAv6caVckPhlk+ZKDhEDDcQyRd9+NtUUaXyns5ra45/2nUOAaEHKt0aM1cL9bwWQvGsaGM//ZkEKUX3Mxow41MSLSveYOzzC0+Q2Tf0IKmyp82Ew4p6TlOZCmwHNuMR+E3w40zLpSz3sA1nFHvSok6lGR9sXSxgeXFqbVfBAOprmLLI3Y/d7+tCkBzFDQAaMbMV9Q2EMxX70KMTAtCVmG1l4GWcmsJ86zDvGVYYUyQfuBLJtBNQ7XBcTdrZWvaVwyJPJ6bHkF0o/VfGqK+WMbT4g== 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=12TmfGqEzpwdH5qOZwibR55046Lhg5OzL5JgP4yQ5s8=; b=ZEnNLuFlkI3lOEzDobs/ZU8a6EVdQ0F5AAODs8t4+JDcNQRSX39hBjO2pdCydyym4aQdpcbJ72Qz3dXZlmiUlw9l7JHXnX0z0I0d+cAUd1LzNpgZEmVkwSR6fHXQoNkpbmLaHw2U0cIcNM96ppEECVm26lI0QIavn8B/CSnQpEhDWrcH/9kSjBTW6CbsLQ7n40npKaFns1RdOc2wTPvAchjHA2Z57yWFSubuy1K9EqbRxH4sP3qhuwPXeYUn0EmNMifCuaOnzxsiZEvx59WOWGOOtLl0+6OoExwKrbJXJH+xNqt44Rxx981VxRuJRAwGuV9NFFfRBdPmgkILqWxk4w== 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=12TmfGqEzpwdH5qOZwibR55046Lhg5OzL5JgP4yQ5s8=; b=SN6uwDiPfm9yP2wMAtLvSqDmfbZqffRuKm+f1IamjuEyhZ1qp2iU2mdnpdkZQvNvN9SNQRnqrelldYWuZMlKzHmZB6dlqVU6wdLoYtVi+j7q079SMYp+8H5Bz3++GZyIzGtnhNKfbX3x8qn2sHJSXicH7FH7MXoxI/IKYXcLQTU= Received: from BN0PR07CA0013.namprd07.prod.outlook.com (2603:10b6:408:141::19) by IA1PR12MB6627.namprd12.prod.outlook.com (2603:10b6:208:3a1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 20:26:17 +0000 Received: from BN8NAM11FT108.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::a7) by BN0PR07CA0013.outlook.office365.com (2603:10b6:408:141::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:17 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT108.mail.protection.outlook.com (10.13.176.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:16 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:16 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:16 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:14 -0500 From: Harry Wentland To: , Subject: [PATCH v5 04/13] drm/connector: Use common colorspace_names array Date: Tue, 6 Jun 2023 16:25:58 -0400 Message-ID: <20230606202607.122914-5-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT108:EE_|IA1PR12MB6627:EE_ X-MS-Office365-Filtering-Correlation-Id: b8a61595-dd48-427b-4260-08db66cc4801 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jiwPp+xjGqWFw/ZrgIZvXlQsss1fX6F0yAbiC08WVFKBwMqJ/6VtJqlOC/TqEjrgvGFg4vpcE15Op2gKSHqyxO99k/z5kjzgy2EKzC4/WYexBSRdoc9KVIhrCScUE08VBlNEKHvNtyfvY5/Lg0Vf5teZPBddgHgVgkcOiyDkorzjI5fEvanDjgRsXZSwRhxNrzAcZyCcI32w19GVv53/olBHpgVrPo4AThsXibKnR3bXZDFKJ2viqLeyWH3z/n6G6Pv88y9DKPJFAktIyQa/f4izvYhVKSQsz9mpEUpsZlNqNMCgunv618ybwl5scgAI11+AFznxgWVwfRLdLfMAcAQqjTT/fURDpos7lIo0Igf84ZNmlkpkDWj9ud09VESPY5GXMEArNqtbXPCVuieODyd7yA84WAX2GNhTM2zp3yqFojGWNJDeV3FGM8V9I+snsYifxyLtPc4NCrBWcBQxFAgB+8WZlMYWF9H2Vu2BSbSadoazwELp3HCUwxc6BWGi7JzXsM5dpaTnstRIpy6DWkrTgu2Kp9y63wU4AvHX9rNcjT4aIg4CRXsnnHMeOF6pmZ+6RQhfDmZSeejQR8bkkqjyzlPBfVWxQcYF8NZKENAhzPTmI34YDqxYkCAl5tjQNb55Py0w7NPCVW01DJ4g6pqLhxpCoQm/JGVLIpVZ5tPraDVRtKphZdCSnx4efzqJN+MFe5EArjj80y+2CtmoPWMn9tc+X69GTUPWgmqy6h6j4wFGctYSjevJonPaHjK6Sibj8VsRb44/Q0RjlDZ2AQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199021)(36840700001)(40470700004)(46966006)(86362001)(5660300002)(66899021)(186003)(8936002)(110136005)(26005)(40460700003)(1076003)(36756003)(2906002)(54906003)(316002)(7416002)(44832011)(8676002)(41300700001)(40480700001)(4326008)(356005)(82740400003)(70206006)(70586007)(478600001)(426003)(6666004)(2616005)(82310400005)(83380400001)(336012)(81166007)(36860700001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:16.9992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8a61595-dd48-427b-4260-08db66cc4801 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT108.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6627 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" We an use bitfields to track the support ones for HDMI and DP. This allows us to print colorspaces in a consistent manner without needing to know whether we're dealing with DP or HDMI. v4: - Rename _MAX to _COUNT and leave comment to indicate it's not a valid value - Fix misplaced function doc Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick 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 | 125 ++++++++++++++++++-------------- include/drm/drm_connector.h | 2 + 2 files changed, 74 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 9c087d6f5691..8d24a5da4076 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1016,64 +1016,70 @@ static const struct drm_prop_enum_list drm_dp_subconnector_enum_list[] = { DRM_ENUM_NAME_FN(drm_get_dp_subconnector_name, drm_dp_subconnector_enum_list) -static const struct drm_prop_enum_list hdmi_colorspaces[] = { + +static const char * const colorspace_names[] = { /* For Default case, driver will set the colorspace */ - { DRM_MODE_COLORIMETRY_DEFAULT, "Default" }, + [DRM_MODE_COLORIMETRY_DEFAULT] = "Default", /* Standard Definition Colorimetry based on CEA 861 */ - { DRM_MODE_COLORIMETRY_SMPTE_170M_YCC, "SMPTE_170M_YCC" }, - { DRM_MODE_COLORIMETRY_BT709_YCC, "BT709_YCC" }, + [DRM_MODE_COLORIMETRY_SMPTE_170M_YCC] = "SMPTE_170M_YCC", + [DRM_MODE_COLORIMETRY_BT709_YCC] = "BT709_YCC", /* Standard Definition Colorimetry based on IEC 61966-2-4 */ - { DRM_MODE_COLORIMETRY_XVYCC_601, "XVYCC_601" }, + [DRM_MODE_COLORIMETRY_XVYCC_601] = "XVYCC_601", /* High Definition Colorimetry based on IEC 61966-2-4 */ - { DRM_MODE_COLORIMETRY_XVYCC_709, "XVYCC_709" }, + [DRM_MODE_COLORIMETRY_XVYCC_709] = "XVYCC_709", /* Colorimetry based on IEC 61966-2-1/Amendment 1 */ - { DRM_MODE_COLORIMETRY_SYCC_601, "SYCC_601" }, + [DRM_MODE_COLORIMETRY_SYCC_601] = "SYCC_601", /* Colorimetry based on IEC 61966-2-5 [33] */ - { DRM_MODE_COLORIMETRY_OPYCC_601, "opYCC_601" }, + [DRM_MODE_COLORIMETRY_OPYCC_601] = "opYCC_601", /* Colorimetry based on IEC 61966-2-5 */ - { DRM_MODE_COLORIMETRY_OPRGB, "opRGB" }, + [DRM_MODE_COLORIMETRY_OPRGB] = "opRGB", /* Colorimetry based on ITU-R BT.2020 */ - { DRM_MODE_COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" }, + [DRM_MODE_COLORIMETRY_BT2020_CYCC] = "BT2020_CYCC", /* Colorimetry based on ITU-R BT.2020 */ - { DRM_MODE_COLORIMETRY_BT2020_RGB, "BT2020_RGB" }, + [DRM_MODE_COLORIMETRY_BT2020_RGB] = "BT2020_RGB", /* Colorimetry based on ITU-R BT.2020 */ - { DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" }, + [DRM_MODE_COLORIMETRY_BT2020_YCC] = "BT2020_YCC", /* Added as part of Additional Colorimetry Extension in 861.G */ - { DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65, "DCI-P3_RGB_D65" }, - { DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER, "DCI-P3_RGB_Theater" }, + [DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65] = "DCI-P3_RGB_D65", + [DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER] = "DCI-P3_RGB_Theater", + [DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED] = "RGB_WIDE_FIXED", + /* Colorimetry based on scRGB (IEC 61966-2-2) */ + [DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT] = "RGB_WIDE_FLOAT", + [DRM_MODE_COLORIMETRY_BT601_YCC] = "BT601_YCC", }; +static const u32 hdmi_colorspaces = + BIT(DRM_MODE_COLORIMETRY_SMPTE_170M_YCC) | + BIT(DRM_MODE_COLORIMETRY_BT709_YCC) | + BIT(DRM_MODE_COLORIMETRY_XVYCC_601) | + BIT(DRM_MODE_COLORIMETRY_XVYCC_709) | + BIT(DRM_MODE_COLORIMETRY_SYCC_601) | + BIT(DRM_MODE_COLORIMETRY_OPYCC_601) | + BIT(DRM_MODE_COLORIMETRY_OPRGB) | + BIT(DRM_MODE_COLORIMETRY_BT2020_CYCC) | + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) | + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC) | + BIT(DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65) | + BIT(DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER); + /* * As per DP 1.4a spec, 2.2.5.7.5 VSC SDP Payload for Pixel Encoding/Colorimetry * Format Table 2-120 */ -static const struct drm_prop_enum_list dp_colorspaces[] = { - /* For Default case, driver will set the colorspace */ - { DRM_MODE_COLORIMETRY_DEFAULT, "Default" }, - { DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED, "RGB_Wide_Gamut_Fixed_Point" }, - /* Colorimetry based on scRGB (IEC 61966-2-2) */ - { DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT, "RGB_Wide_Gamut_Floating_Point" }, - /* Colorimetry based on IEC 61966-2-5 */ - { DRM_MODE_COLORIMETRY_OPRGB, "opRGB" }, - /* Colorimetry based on SMPTE RP 431-2 */ - { DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65, "DCI-P3_RGB_D65" }, - /* Colorimetry based on ITU-R BT.2020 */ - { DRM_MODE_COLORIMETRY_BT2020_RGB, "BT2020_RGB" }, - { DRM_MODE_COLORIMETRY_BT601_YCC, "BT601_YCC" }, - { DRM_MODE_COLORIMETRY_BT709_YCC, "BT709_YCC" }, - /* Standard Definition Colorimetry based on IEC 61966-2-4 */ - { DRM_MODE_COLORIMETRY_XVYCC_601, "XVYCC_601" }, - /* High Definition Colorimetry based on IEC 61966-2-4 */ - { DRM_MODE_COLORIMETRY_XVYCC_709, "XVYCC_709" }, - /* Colorimetry based on IEC 61966-2-1/Amendment 1 */ - { DRM_MODE_COLORIMETRY_SYCC_601, "SYCC_601" }, - /* Colorimetry based on IEC 61966-2-5 [33] */ - { DRM_MODE_COLORIMETRY_OPYCC_601, "opYCC_601" }, - /* Colorimetry based on ITU-R BT.2020 */ - { DRM_MODE_COLORIMETRY_BT2020_CYCC, "BT2020_CYCC" }, - /* Colorimetry based on ITU-R BT.2020 */ - { DRM_MODE_COLORIMETRY_BT2020_YCC, "BT2020_YCC" }, -}; +static const u32 dp_colorspaces = + BIT(DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED) | + BIT(DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT) | + BIT(DRM_MODE_COLORIMETRY_OPRGB) | + BIT(DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65) | + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) | + BIT(DRM_MODE_COLORIMETRY_BT601_YCC) | + BIT(DRM_MODE_COLORIMETRY_BT709_YCC) | + BIT(DRM_MODE_COLORIMETRY_XVYCC_601) | + BIT(DRM_MODE_COLORIMETRY_XVYCC_709) | + BIT(DRM_MODE_COLORIMETRY_SYCC_601) | + BIT(DRM_MODE_COLORIMETRY_OPYCC_601) | + BIT(DRM_MODE_COLORIMETRY_BT2020_CYCC) | + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC); /** * DOC: standard connector properties @@ -1976,27 +1982,44 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); */ static int drm_mode_create_colorspace_property(struct drm_connector *connector, - const struct drm_prop_enum_list *colorspaces, - int size) + u32 supported_colorspaces) { struct drm_device *dev = connector->dev; + u32 colorspaces = supported_colorspaces | BIT(DRM_MODE_COLORIMETRY_DEFAULT); + struct drm_prop_enum_list enum_list[DRM_MODE_COLORIMETRY_COUNT]; + int i, len; if (connector->colorspace_property) return 0; - if (!colorspaces) - return 0; + if (!supported_colorspaces) + drm_dbg_kms(dev, "Driver is not passing supported colorspaces on [CONNECTOR:%d:%s]\n", + connector->base.id, connector->name); + + if ((supported_colorspaces & -BIT(DRM_MODE_COLORIMETRY_COUNT)) != 0) + return -EINVAL; + + len = 0; + for (i = 0; i < DRM_MODE_COLORIMETRY_COUNT; i++) { + if (supported_colorspaces != 0 && (colorspaces & BIT(i)) == 0) + continue; + + enum_list[len].type = i; + enum_list[len].name = colorspace_names[i]; + len++; + } connector->colorspace_property = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace", - colorspaces, - size); + enum_list, + len); 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. @@ -2009,9 +2032,7 @@ static int drm_mode_create_colorspace_property(struct drm_connector *connector, */ int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) { - return drm_mode_create_colorspace_property(connector, - hdmi_colorspaces, - ARRAY_SIZE(hdmi_colorspaces)); + return drm_mode_create_colorspace_property(connector, hdmi_colorspaces); } EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); @@ -2027,9 +2048,7 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); */ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector) { - return drm_mode_create_colorspace_property(connector, - dp_colorspaces, - ARRAY_SIZE(dp_colorspaces)); + return drm_mode_create_colorspace_property(connector, dp_colorspaces); } EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 907f40851e80..fad38cdf4f79 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -460,6 +460,8 @@ enum drm_colorspace { DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13, DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14, DRM_MODE_COLORIMETRY_BT601_YCC = 15, + /* not a valid value; merely used for counting */ + DRM_MODE_COLORIMETRY_COUNT }; /** From patchwork Tue Jun 6 20:25: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: 13269739 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 CECD8C77B7A for ; Tue, 6 Jun 2023 20:26:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DA9610E3C4; Tue, 6 Jun 2023 20:26:31 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2057.outbound.protection.outlook.com [40.107.244.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8B4A10E3B4; Tue, 6 Jun 2023 20:26:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SjOHzkurRXR6UHXqqUlVm7zZfUN8sEvLBaUah029BBj/WBt7OHDHCMz4d2K0syyCVIqxYGUzLQyTOTbHWVH3t4GgsJGsQMg22ImJx8FcPVG6E6n2O2BtD9i+k0LIu4Xjp/00HZ7fQrXAfFRxfjAYH48+T4jrxLkYfm1ucEDX3TFz05gn37aU0/O3yN0R5+L6s3djxDXdVTTy6zp8ATQPXFOzYBMu1eM31YCbVI9rhjVFCectXku9Vi6c6n6NL+JWaIJsUjPm5Pen/czrrpWzTpJHlK2BP2zkdL8Us11kywREzjkRV2lIdCGIqSHvupwLM5dbtqfh4LjLXNXlyd8yyQ== 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=aBZb8aCcnKiTYjN605PHlphR0OuL2NprPcfTQ/NC3ck=; b=eYQKKDG+751zahT64Sqb1laQJ4Y259zgGSBxout+ZRyw9Ans2Kq2OXvKxt29Phm0GHL1bpzWk7bEgm/ZucFxNMQVmZLNdOf3S4gOzsm3zvbKcvHvk+QaE1zVjfhqIo6WZar7p7ylazGcJ+ciFI0Zy4WZfONuDZykde+10iCKe1XcBlGS8EmzuL/X5aRY1WYcyTPAFP35vIDkOd8bK2HMBX0ok2LEFvH6kM1ObyMxtBX9O3qOQczY8k3V86BMtCY71LoaZFx1hqgV/9uTj6kzlEgJcD1MODjcFPobIdR+3Vg5QSw8xLizkdC9qIKfqgYoQJS2GmnxESYdSiDGyfQv1w== 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=aBZb8aCcnKiTYjN605PHlphR0OuL2NprPcfTQ/NC3ck=; b=RdWbyaNyKcH9qfSSbirSmiS9ihFFWJSq3eriuLq84tOI9m5FYzvg4jO7bgupqCnAG6wnwSDW5wBNKa1ENWserQdfkjfBR0EUF1SoONIBGO5inzt4n4ww25aLu+bRFBiYbX4siOhnvmih7D4iQFY6CD76IrYGZyh4OjFFN1mWPNY= Received: from BN7PR02CA0011.namprd02.prod.outlook.com (2603:10b6:408:20::24) by PH8PR12MB7351.namprd12.prod.outlook.com (2603:10b6:510:215::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.21; Tue, 6 Jun 2023 20:26:18 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::ec) by BN7PR02CA0011.outlook.office365.com (2603:10b6:408:20::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:17 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:17 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:17 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:16 -0500 From: Harry Wentland To: , Subject: [PATCH v5 05/13] drm/connector: Print connector colorspace in state debugfs Date: Tue, 6 Jun 2023 16:25:59 -0400 Message-ID: <20230606202607.122914-6-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT034:EE_|PH8PR12MB7351:EE_ X-MS-Office365-Filtering-Correlation-Id: ea2b19b7-a810-4f2b-bfb8-08db66cc4877 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VBzo9CAKDBVW4G9jMYgLW6CIeqROOfEtC35xNBl52azf27CMT2tYUQw7R15Bu/l86/CmmsT8VUyOEKPIRF9xfFjLGSRfhlyBoq39wYGyNxZs8kRN2wSQGgXpgv48aHWY25A0YYVIQzzApBfk/MkXjK60RouFmDKt0DnVbVbT1VyEk5ILpPzVbVNeMSU9qGttG+KDsqoIkK8rjeYvoydmLl5RpmTgJWSUPuzVs1epgDohdkgCjznO+nfiaNg7hmHf0rP+jVLnyEipQzvJBk8x1mVqnXEjHJQ7nMdewxs/tpI2aG4MfGTfFVdQWcS6bG5hoJfTNr8O+Fqazopbngr2K4RZIFfJXIcW8cMb8lg92/iuaVThz6P7D0vBziY0aEn9COMqpOcFXVK2+gvPz7eOfAZx0R4WShoZKmLJInt4zd5ar0bKNUL2kQkBG9eVGYVrpTV2Fv50WZpBQaCMkCl/lKd4b76pUxZfTHTuw6OWlLUQqxwyIfdYcBswLwTWs98mhjdQ/lu8R59htPuyPGBJtt4qp3jE4CUoqOZkzuY4rdUAKOXXKAJT/5UrZhPWTnYUxev3IhKvXRRjt8i9owmgGJzqLZP4zmDwv1SnEbQJ3S+iVwPsZDnxiB9kp7YIoYPFHFCjpuip9+PfbYCGvBsW5nGhxlSPPIWaM3B/0rY9wg3y2s9S6b19mVOu33dfCJ4tHAiE994zAN0ez21VrXHHnm/nDuSNlo8BPpi0AM1Lv91ouy0L15FwEh6pWXUDA4mNiNlM2Tqopi+1nYtugKxBOA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(316002)(82740400003)(40460700003)(40480700001)(81166007)(41300700001)(356005)(110136005)(82310400005)(36756003)(2616005)(44832011)(7416002)(86362001)(36860700001)(186003)(54906003)(83380400001)(4326008)(47076005)(2906002)(336012)(426003)(1076003)(26005)(5660300002)(6666004)(478600001)(8936002)(70206006)(70586007)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:17.6976 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea2b19b7-a810-4f2b-bfb8-08db66cc4877 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7351 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" v3: Fix kerneldocs (kernel test robot) v4: Avoid returning NULL from drm_get_colorspace_name Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick 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_atomic.c | 1 + drivers/gpu/drm/drm_connector.c | 15 +++++++++++++++ include/drm/drm_connector.h | 1 + 3 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index c0dc5858a723..d6d04c4ccfc0 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1071,6 +1071,7 @@ static void drm_atomic_connector_print_state(struct drm_printer *p, drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); drm_printf(p, "\tself_refresh_aware=%d\n", state->self_refresh_aware); drm_printf(p, "\tmax_requested_bpc=%d\n", state->max_requested_bpc); + drm_printf(p, "\tcolorspace=%s\n", drm_get_colorspace_name(state->colorspace)); if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) if (state->writeback_job && state->writeback_job->fb) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 8d24a5da4076..69480385eaf3 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1048,6 +1048,21 @@ static const char * const colorspace_names[] = { [DRM_MODE_COLORIMETRY_BT601_YCC] = "BT601_YCC", }; +/** + * drm_get_colorspace_name - return a string for color encoding + * @colorspace: color space to compute name of + * + * In contrast to the other drm_get_*_name functions this one here returns a + * const pointer and hence is threadsafe. + */ +const char *drm_get_colorspace_name(enum drm_colorspace colorspace) +{ + if (colorspace < ARRAY_SIZE(colorspace_names) && colorspace_names[colorspace]) + return colorspace_names[colorspace]; + else + return "(null)"; +} + static const u32 hdmi_colorspaces = BIT(DRM_MODE_COLORIMETRY_SMPTE_170M_YCC) | BIT(DRM_MODE_COLORIMETRY_BT709_YCC) | diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index fad38cdf4f79..9d9e4d6f0449 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1988,6 +1988,7 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter); bool drm_connector_has_possible_encoder(struct drm_connector *connector, struct drm_encoder *encoder); +const char *drm_get_colorspace_name(enum drm_colorspace colorspace); /** * drm_for_each_connector_iter - connector_list iterator macro From patchwork Tue Jun 6 20:26:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269741 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 044D3C77B7A for ; Tue, 6 Jun 2023 20:26:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 905A010E3C9; Tue, 6 Jun 2023 20:26:32 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20618.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::618]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04D5F10E3B6; Tue, 6 Jun 2023 20:26:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JqWPiwfkhKiSunkEMrOjQMbmx7uAAxTGuVast7qZcaKncI/0lXV7GPbraAioOz22keYzEku8U+sAIJIWL/bC+VnKHswPwU0yoVtmpzCgSb5yxPNs7kdkvVMutKgnoAAQKNKtNj5yEEoceC6iu+nVKJ8NuJ2Rx5auDTN+XWRb+flEIIW6sNG60Kg6nptJSeNWUzToMeHi4B6mtqN2XV/ZrNmhW20o/V1Z08YBlsDCrWV7TLCoaXZaML1zJ/GagJbHJECNL+vWbnN6O6SfOpRFwNlMGmN/ozKCvaPm6Spjwcve9cUy03dryLe72I18LIz0WR7AIthpD1IYisgCd4wcmQ== 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=z9tnLWF5JKJdSMyreIrj7MZQXbPVkprrvbVCkeZsfpA=; b=nn/kly235fuFAu0l8t9nhybRRy3AvKyrR8S0291HDb4AaR2zpTpDYvURL75v357Gb6BiV59einPB8NP83Ouo9bJPStkGT4+lfyEIxTi/5r7L34Qd7tfHODRFKyO8DHoo7rKSOg1DCejsZV0bUZH0MgfYe560WjMJGz3pqc52IwvqAZ9vYruOyisHBtvHvCn+NIzsc4hI/geWct+sMAnctWLcPJsWE1KNuwANmunNYRIkWuDn/tFlZj3BicuP3tjL8EsvwY3oHPUFVDUI+c89ORYBxJPoZdZQVd9Dxh9HG++VUOGSp678DoaPkuQM3aXtIPD4vdS6w4aqXDmLLWag8w== 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=z9tnLWF5JKJdSMyreIrj7MZQXbPVkprrvbVCkeZsfpA=; b=E1WvxZkgEPOf1Bvxxy4djddKn+EeRrOPg6j4H2ube1YTxSJu9d6AVcCg4VawqqJyDcrS0iTulsWBoCJPAO5B9dpRGuZ/0VcBkqa9mgwGrlxI8zvQKKDR3kXmrBH4G9qnIhS3pModRTyJ2JCvwHbE0nHSGgdodcQGHmxqsRjUEGI= Received: from BN7PR02CA0007.namprd02.prod.outlook.com (2603:10b6:408:20::20) by BL1PR12MB5729.namprd12.prod.outlook.com (2603:10b6:208:384::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:19 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::96) by BN7PR02CA0007.outlook.office365.com (2603:10b6:408:20::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 20:26:19 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:19 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:18 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:17 -0500 From: Harry Wentland To: , Subject: [PATCH v5 06/13] drm/connector: Allow drivers to pass list of supported colorspaces Date: Tue, 6 Jun 2023 16:26:00 -0400 Message-ID: <20230606202607.122914-7-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT034:EE_|BL1PR12MB5729:EE_ X-MS-Office365-Filtering-Correlation-Id: 43294df7-6ed1-4489-ea70-08db66cc496a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BxqcoAx/XDYlPBI14eZW67Q0fNJJ8gSC3jTMLWVy+JQEwYt82bvH0N+IcsllvgLKKBBx56yiJAtbZVQQuEOXuvMr6yZNBB/s9lDHl6INN++p04ATEvPOWj567gkTYF8pnwuxUoakZeXM5eK1YVBTtlCJB6bQMIsC8DTH/mbz8uGfvTEJXe/PqMISPqiM1oxVUzbkFKm5oozI59T6nogz6FsBB3KwtrYg13hCKwjL8VLwwn/SFu9MM2sSEhRyC5yFDR5WvB8KuEeg67PzYdLZsO3gwFGSg9yo3nghONcZTINS6vAveTgnvjKDxS3Z1i3XG5YZn6uvE9r6tVDzQb/VB2hnBKw7yj74bIpdRFYT5aFP9NsNPFEIVgcGGpQjvW4OtyrPX8AOAwqn/tCLssGqS1V5pjBLtddiCi07QqrX7wRi0CpzTcZVaJNyF0dTk7lOUl2EKUijCcxTzzLNYCkrBDKDCM3CgKzYvQ9E0SmOdVZ5kDmz2lwKiw5AQmXaMjQPQOQpgJqqKf5UAA4rEA5Pyuwm23tH91GxtJPSAkZ/zh85bDJbJT6vs5ixmtqXB8uGOfiCatW6s1njoRU3tohwyecTdKNZBRzrTF0ewTIRd11401bYmJW08YqAHwtHv4DTG4F75KoK217FxsOdekIUKYj5BUKZA/2r+/ea/7GP62bbrPJLENjxqpjPeFRu+ednd0B5npNgm4dOcPl6+dFPBpvv84mSLDk1GKjpl5E+wevIUf7pbRrY1eLbV03sZG5LOE2SMSe3EFdZeCy4p3wOPQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(376002)(396003)(39860400002)(346002)(136003)(451199021)(40470700004)(36840700001)(46966006)(70586007)(478600001)(4326008)(70206006)(316002)(2906002)(8936002)(41300700001)(8676002)(44832011)(54906003)(110136005)(6666004)(5660300002)(7416002)(26005)(40460700003)(1076003)(356005)(82740400003)(2616005)(186003)(40480700001)(426003)(336012)(66574015)(83380400001)(47076005)(36860700001)(81166007)(36756003)(86362001)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:19.3224 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43294df7-6ed1-4489-ea70-08db66cc496a 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5729 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" Drivers might not support all colorspaces defined in dp_colorspaces and hdmi_colorspaces. This results in undefined behavior when userspace is setting an unsupported colorspace. Allow drivers to pass the list of supported colorspaces when creating the colorspace property. v2: - Use 0 to indicate support for all colorspaces (Jani) - Print drm_dbg_kms message when drivers pass 0 to signal that drivers should specify supported colorspaecs explicity (Jani) v3: - Move changes to create a common colorspace_names array to separate patch Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick 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 | 14 ++++++++++---- drivers/gpu/drm/i915/display/intel_connector.c | 4 ++-- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +- include/drm/drm_connector.h | 7 +++++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 69480385eaf3..b63b3e3168a1 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -2045,9 +2045,12 @@ static int drm_mode_create_colorspace_property(struct drm_connector *connector, * Returns: * Zero on success, negative errno on failure. */ -int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector, + u32 supported_colorspaces) { - return drm_mode_create_colorspace_property(connector, hdmi_colorspaces); + u32 colorspaces = supported_colorspaces & hdmi_colorspaces; + + return drm_mode_create_colorspace_property(connector, colorspaces); } EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); @@ -2061,9 +2064,12 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); * Returns: * Zero on success, negative errno on failure. */ -int drm_mode_create_dp_colorspace_property(struct drm_connector *connector) +int drm_mode_create_dp_colorspace_property(struct drm_connector *connector, + u32 supported_colorspaces) { - return drm_mode_create_colorspace_property(connector, dp_colorspaces); + u32 colorspaces = supported_colorspaces & dp_colorspaces; + + return drm_mode_create_colorspace_property(connector, colorspaces); } EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property); diff --git a/drivers/gpu/drm/i915/display/intel_connector.c b/drivers/gpu/drm/i915/display/intel_connector.c index 6205ddd3ded0..e8b4a352a7a6 100644 --- a/drivers/gpu/drm/i915/display/intel_connector.c +++ b/drivers/gpu/drm/i915/display/intel_connector.c @@ -283,14 +283,14 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector) void intel_attach_hdmi_colorspace_property(struct drm_connector *connector) { - if (!drm_mode_create_hdmi_colorspace_property(connector)) + if (!drm_mode_create_hdmi_colorspace_property(connector, 0)) drm_connector_attach_colorspace_property(connector); } void intel_attach_dp_colorspace_property(struct drm_connector *connector) { - if (!drm_mode_create_dp_colorspace_property(connector)) + if (!drm_mode_create_dp_colorspace_property(connector, 0)) drm_connector_attach_colorspace_property(connector); } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 55744216392b..eee53e841701 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -618,7 +618,7 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, if (ret) return ret; - ret = drm_mode_create_hdmi_colorspace_property(connector); + ret = drm_mode_create_hdmi_colorspace_property(connector, 0); if (ret) return ret; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 9d9e4d6f0449..f799cbd755a3 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -1904,8 +1905,10 @@ int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *conn bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state, struct drm_connector_state *new_state); 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); +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector, + u32 supported_colorspaces); +int drm_mode_create_dp_colorspace_property(struct drm_connector *connector, + u32 supported_colorspaces); int drm_mode_create_content_type_property(struct drm_device *dev); int drm_mode_create_suggested_offset_properties(struct drm_device *dev); From patchwork Tue Jun 6 20:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269736 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 B0C5CC83003 for ; Tue, 6 Jun 2023 20:26:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CED510E3B9; Tue, 6 Jun 2023 20:26:27 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 06A1110E3B9; Tue, 6 Jun 2023 20:26:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iFAJfPTBld75Qro8QOdrVWTDxOzcw3XFq5ly9NeKvrysCTYLSWQrcE5Vax8z5HdE4zGcQzWE1ZDyvFwIHplwOl1O0bIxlsk+NDTsMHy/uLOvHybSkcF46V8lzaKxgTH/Ym0bHhXm9wmjFLgfFE1KXnmIkVW2L+/JqLLjZTtdFAIVX5cpbXgsUDYz4+M98gkoIY93gXPXqjUW0l1AVhznmePJ/eTJQJ9/A1CqDiFW/mnFGEx8EcSh/FZIM3xM9lo1KopDeHuw43Qly6JE4Dvg08nGDgd5p/yAIuLv7RH/1bOKI1SzfVS/YmVQCFMcv+MorJrodpRS5bOq1TqJSoYCCQ== 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=AjhEsAhU2tyC91VWPc1ULSci3zJ+KMdmFy2sPGjQ/bo=; b=Pr+1hoCZev5vQsuG+gtnli3O4Sy1z4vZEpol1jwUzOpM4JNgAdoO93fkHcl3BRkmiJD3a2kfurlyrkMX+3jQKZwQH6grzRLd3+tbB9BW/SZjLbtDJ+15fPpxdM2nWus6GkjJhOlGSk+ZkQP4lbD/x6ywIo2T9MnQhzApOiTSejoTOwP7X2CKSxUGTK01zhr6GQTV1bOW8cJE5X9/AOFJCN8egs2N608EfACfhQ74/hpF1Xn7kyJLyXvKBQp7yGfmINMSxHG/PcDzuVaCYhklAeLRfvCPnQAMR5emcEzuTMaeGHZ2zBJEZw4cccsmGwVGFN1zkPt9+wRW6jbkdHndPQ== 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=AjhEsAhU2tyC91VWPc1ULSci3zJ+KMdmFy2sPGjQ/bo=; b=bCSgz6vG3MAIuFHeQrl/+5Iea6L+tslCUJvX/omV9cImyCjVH0dKCXV7OtCoCuf1WknnVq4wjKVZ3HeHThjiK0pP1De407j+Y6jrs3ikXRCtBn7ppQiRjakbfqgNBC7uOZTmETsC+Sy5LHsRLjxMmgipFP/nR/53jKkD7F0bZwQ= Received: from BN0PR07CA0003.namprd07.prod.outlook.com (2603:10b6:408:141::15) by MN2PR12MB4045.namprd12.prod.outlook.com (2603:10b6:208:1d6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 20:26:20 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::34) by BN0PR07CA0003.outlook.office365.com (2603:10b6:408:141::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 20:26:20 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:20 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:19 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:18 -0500 From: Harry Wentland To: , Subject: [PATCH v5 07/13] drm/amd/display: Always pass connector_state to stream validation Date: Tue, 6 Jun 2023 16:26:01 -0400 Message-ID: <20230606202607.122914-8-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT064:EE_|MN2PR12MB4045:EE_ X-MS-Office365-Filtering-Correlation-Id: fccbbcf0-5c10-4450-7e48-08db66cc49e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QCSGRv6HHznl0IdrvXcm+dDX6e9FEyZK7Pift0NKXU0QLDFS1PQUdIEyX0m3FnXw864PFowFG+XyPV+5u6O95P8UIMICB7EcfTK2Cpx2ImjW47Es0ny0JY+MkBsQRVNK4FSlEMRQ0yET0P4N1nrTgQHcoVW4rsUpKzACuCLgY2mS/YKGzE3OPQAR7MKqI781iOvBmlTdALkzfrdexvCdX4AoDYUxSsd0DfgM/iVJC0G/7oTnqY4FVDhsQNkyk+AXp6Mt4cNwdKmfcLjCjR0hUaAMPs0F7Kuck1JvLRSoGWIo8RXBlY2dIcphJxxMTUD3heG0aeILR5e+utjJvEHkV6XyHEfxL9a9P/MKS0WxVT0+lSts4SKxcWTK7VCS6w5C1wyGENI3iqVPtpSSYXFwrR5QklbSz3I+zNf7DUR1TCesAYZ1LyUwACLQr5ArcPAxAnQP0yNU2bI19TojxMQ3r07dNOISCSzbzRBMeCm+x3BWD4QQ2zVdJ+V1TJcc/cseKUk1O1a5gbkOGlZmgiTtXb63HZBO5gjcdeNegJRxu1J8TVaxCjR125Vu6f85IE5wcV1Pb25zwbQTCPKo2oLplOpUIbz9slshrkXTGA+gMo4sBxqC8+TrJakEiqORI2C1lSxi1vf0LOQDTUwK8Wruh8BQwMh0fO/mv2dn8JxoNKQbJszfyL8d+zxCoc79M2qxFGsrrAnWVheFH5C29SuzEr7vZs1q8UDO7LXOSLGd9Cn+l+TvZaKiEgpd1/4hmpwRKTiG+TiQXQ7kcZJMSiLcRg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(39860400002)(376002)(346002)(451199021)(36840700001)(40470700004)(46966006)(54906003)(110136005)(40460700003)(478600001)(40480700001)(8936002)(8676002)(5660300002)(44832011)(4326008)(2906002)(36756003)(86362001)(81166007)(70206006)(316002)(82740400003)(70586007)(82310400005)(41300700001)(36860700001)(2616005)(356005)(1076003)(186003)(26005)(47076005)(83380400001)(6666004)(426003)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:20.1036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fccbbcf0-5c10-4450-7e48-08db66cc49e4 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4045 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 , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We need the connector_state for colorspace and scaling information and can get it from connector->state. Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 90de0d37f1d2..27868dbb09f6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5954,15 +5954,14 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, { struct drm_display_mode *preferred_mode = NULL; struct drm_connector *drm_connector; - const struct drm_connector_state *con_state = - dm_state ? &dm_state->base : NULL; + const struct drm_connector_state *con_state = &dm_state->base; struct dc_stream_state *stream = NULL; struct drm_display_mode mode; struct drm_display_mode saved_mode; struct drm_display_mode *freesync_mode = NULL; bool native_mode_found = false; bool recalculate_timing = false; - bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false; + bool scale = dm_state->scaling != RMX_OFF; int mode_refresh; int preferred_refresh = 0; enum color_transfer_func tf = TRANSFER_FUNC_UNKNOWN; @@ -6604,7 +6603,9 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec goto fail; } - stream = create_validate_stream_for_sink(aconnector, mode, NULL, NULL); + stream = create_validate_stream_for_sink(aconnector, mode, + to_dm_connector_state(connector->state), + NULL); if (stream) { dc_stream_release(stream); result = MODE_OK; From patchwork Tue Jun 6 20:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269737 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 71C99C7EE43 for ; Tue, 6 Jun 2023 20:26:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B6BB10E3BE; Tue, 6 Jun 2023 20:26:27 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id E214310E3BE; Tue, 6 Jun 2023 20:26:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JhFW5ARaTtmSzOHp6c66xXtovx1b0E3kygGiCceSrQXTsiME0OwmiyYipt1bw/VIy1meFNPOrvJ7DPUBojkK5SrCqw6PNn1HuxhLMPDezQfhNzahqzRMBAuT8y3Ajb2SKg5f5+EwBZGWBRB9XO2WhdVQOVWTqHNQwlbOVMV9BBnoCqbdzN1lpx86lBBcWHL8HF6itRPq1sEamzHmZyQDAYx1JQaBgPRddkc7hc9JVdgcAPcH9gjBQ4bCjl+GWg0LQc4yv/OO5SqEIIHmcPx4FNYtfXDugqHOTaDUx2wqsDhz7/ZIO8lUMGmnYM5/0dEfW/555xlbbL2GbxZugPqRNA== 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=cJsHN1QLfZtF+LsAlfKGb7rcED5TYdwSoxYYvKHtvl8=; b=Hd5oZ1jf3c+KD02KYFrHGyZ+Pc8bze3Ag/ZbMYSukmsfNeZLFxXQt/MTWo/Go8DY6ZxvxgiASOokIf7Z4GeGGeiEOrurc2N9RoKjIsHs/TFDMHJyEAn+TezCkHxclDN53o1uvCyn8QHZyF4wHD7kQysvBdcMwLC3hrNB9DOYbLh0xtlDvtAqtvD7j6f5U2ae8+PChP4ZtxDFKPBHQvspFlLsoIiGWGJpLT9M8r9kZ6NdSaYC2TX99Mo8fZbvv89jbl1H2qc+X9eDXadwwHZKKyU/jsTrmtxgeiaDtEkd2Qbk/heaw0ULgqRAt0PM/YI3Uz5vtU1hvHDs1Nw6//Rjgg== 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=cJsHN1QLfZtF+LsAlfKGb7rcED5TYdwSoxYYvKHtvl8=; b=MoifG1BgI7hzZjFDVA9zQUFvh55ihS//m5Bfhfo9TARRXjj29ufr3bLpYM/m6/i7b1cPRK2UY9iJ6C625Ox+yD6uzx9kV+lp7J4WSG+Nw2RpaRnd6xtV3ms1VUc/qjwSUTCzSxsFO9Dgh1kJMV8cbRyUvlcyIsHnpgR246GoOlQ= Received: from BN9PR03CA0445.namprd03.prod.outlook.com (2603:10b6:408:113::30) by CY8PR12MB7242.namprd12.prod.outlook.com (2603:10b6:930:59::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:21 +0000 Received: from BN8NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::47) by BN9PR03CA0445.outlook.office365.com (2603:10b6:408:113::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:21 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT105.mail.protection.outlook.com (10.13.176.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:21 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:20 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:19 -0500 From: Harry Wentland To: , Subject: [PATCH v5 08/13] drm/amd/display: Register Colorspace property for DP and HDMI Date: Tue, 6 Jun 2023 16:26:02 -0400 Message-ID: <20230606202607.122914-9-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT105:EE_|CY8PR12MB7242:EE_ X-MS-Office365-Filtering-Correlation-Id: e97d9816-252f-4fd4-e9ba-08db66cc4a7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eQd3w4jZyz1uPJNmLMtqkbzatjjjIzuLpXYM0obn11SDIOzvcpwii+Nm0Cv7na9NZXVG9JxsJk9knWIv2a4BPh2wkr2vO1BPjE61t34VKgQBBbpM14kWC8IXTBDzdS4XHQwiQ5VdpmOeG0t2G7+C3FNkApJ6lJUwY/Ef23LcnQdbyNCmMM0jKHT2q/mGuoRzLCQpGl26FAjl1Oio3bfUmn6TWOJSsOMjYzpCTSrg+zF9oTZz3DI+UHMSWPr5w9ZbcbcRe51fYP5vfXMTZSCO4oPS3gPJMw0T+ErVtzMCnhT90hJgvsC1nhiCcqNETIagnLxJUg8BE5rK6HF7X36wP5Kul2dEa4NObE+AOUxtpMWdRme+HCx826XNagRcFj/8kjg2CwDxfq49h0uxVt1xUjz3WQBLa9565EnF3edRe8CRoQCxVdes1zr9J9r05HbT88GDEkKaMXlEZjCqdoro6wiSMyH+YLRKD9L1kcWfM/kNc/LLLvpIWRTcMHnReetDy2sXmHrDKVGYi+roBmAr2RledMawFMz7h/phyXK3F0dhnOKxuxomd8kl/9gF8Kg4UDV8jsYNyXb3pTMc5QoNn2+IgZJ9CXZWPCkljdjTwg6z+NHyaJhAdWAxYvm4wieI4+z5ssEFQZDaWFTwiXn30/1HVd2zMdBg7/bCTy93dFAC+CYSl/26mjzHUe52yB4MJxIFAhBpxlZJZXs272AK2dNt2YQ0LhGGd1255dmPGe7vwcQpXV6v1L8u/1xbHlPkHhz+mLECXyIxCTrf111qpQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(39860400002)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(1076003)(2616005)(41300700001)(336012)(426003)(6666004)(36860700001)(26005)(47076005)(186003)(40460700003)(40480700001)(478600001)(110136005)(54906003)(81166007)(82310400005)(4326008)(356005)(82740400003)(70206006)(70586007)(316002)(8676002)(8936002)(44832011)(86362001)(5660300002)(36756003)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:21.1872 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e97d9816-252f-4fd4-e9ba-08db66cc4a7d 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7242 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 , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We want compositors to be able to set the output colorspace on DP and HDMI outputs, based on the caps reported from the receiver via EDID. Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton 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/amd/display/amdgpu_dm/amdgpu_dm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 27868dbb09f6..bdda136235af 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7246,6 +7246,12 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector) return amdgpu_dm_connector->num_modes; } +static const u32 supported_colorspaces = + BIT(DRM_MODE_COLORIMETRY_BT709_YCC) | + BIT(DRM_MODE_COLORIMETRY_OPRGB) | + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) | + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC); + void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, struct amdgpu_dm_connector *aconnector, int connector_type, @@ -7326,6 +7332,15 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, adev->mode_info.abm_level_property, 0); } + if (connector_type == DRM_MODE_CONNECTOR_HDMIA) { + if (!drm_mode_create_hdmi_colorspace_property(&aconnector->base, supported_colorspaces)) + drm_connector_attach_colorspace_property(&aconnector->base); + } else if (connector_type == DRM_MODE_CONNECTOR_DisplayPort || + connector_type == DRM_MODE_CONNECTOR_eDP) { + if (!drm_mode_create_dp_colorspace_property(&aconnector->base, supported_colorspaces)) + drm_connector_attach_colorspace_property(&aconnector->base); + } + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || connector_type == DRM_MODE_CONNECTOR_DisplayPort || connector_type == DRM_MODE_CONNECTOR_eDP) { From patchwork Tue Jun 6 20:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269738 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 64A9FC7EE43 for ; Tue, 6 Jun 2023 20:26:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAFA010E3C5; Tue, 6 Jun 2023 20:26:30 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2060a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eb2::60a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62C1710E3B9; Tue, 6 Jun 2023 20:26:26 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N4x0ej0uhKpHVmfro2vW2tGfGkkTlC5C61YbzPNPhJzxLmVq67VORkhbZJ2LLnpRjU0kiUKXanFgovrIGd4iHsu5/bJDTOOSHOiIfOL6Pd+WDM9Ilmzt/7n20Ulb5mRsvt8KvGmi7Ws6SEYRt+r8gggtOK96gikYmC51odmaSwdpdj7/PCr2FQPujjJTrE2T0aQcHNzXLOehgqI7axsuFrTR2JOigrCQmjB71nU9yhoR52ZFCnbPZI2XOs8Bgu+a8iu/lwq4EJOzbcUOb8J+DOrgkGZQqsH3tv2b+smnlRxOPn9NSOTxrLKEvezuFQw10oK0SRsV+9nOidUvxqPqlA== 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=V6a7a/Ni+xFltNrVmB8jZ7XmETc89MCsBqaKOUqaiHE=; b=AEinCfI2BrTsvcWiaPBHDOsNxDocV0imADHf4HvmFnFhZC4AGfThLnvGSlti0D8XidQcZdC5cnpf2FAa2LrrF+yTlbQOYvEN4i+nL8dGFTkukT/wVG34Uq7BuILrfu6HJB1nS1B9K3Q01kPTxQDOwuvtKLvtJCTsVqNz4w/lKxfEp+QrodRMntAZ7CqQSAg2WALNr2GoHr3D/Fs02YDticO917XoTQsocMUD6CjPxdG0f+HsYazo8JcE+WHK8O7zR2AU7Fv6laeylV0CPSOgMzWLZU1PI8IInH414nKJZXTYegOH6sH39O2SGow4YE4r3jwFVCtCvQN7/GAtqlqGRA== 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=V6a7a/Ni+xFltNrVmB8jZ7XmETc89MCsBqaKOUqaiHE=; b=dcQ089P/C/btmN2YSlMRz2ikITNOPrqtbK7Yh2hhVksy+rDAcBfVUzmqmije9e4eY1GaxcASaDDtuKaD9YwvCpyJkKw1dKYIpdbmT6sG0iN0TJ8XJJz3yycmO2A2KfW1bNCiTVA1gIwJ/bASFLifWHCbMQpyzzggFgDzPUyjjpM= Received: from BN9PR03CA0225.namprd03.prod.outlook.com (2603:10b6:408:f8::20) by BY5PR12MB4050.namprd12.prod.outlook.com (2603:10b6:a03:207::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:23 +0000 Received: from BN8NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f8:cafe::88) by BN9PR03CA0225.outlook.office365.com (2603:10b6:408:f8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:23 +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 BN8NAM11FT022.mail.protection.outlook.com (10.13.176.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:23 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Tue, 6 Jun 2023 15:26:22 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:21 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:21 -0500 From: Harry Wentland To: , Subject: [PATCH v5 09/13] drm/amd/display: Signal mode_changed if colorspace changed Date: Tue, 6 Jun 2023 16:26:03 -0400 Message-ID: <20230606202607.122914-10-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT022:EE_|BY5PR12MB4050:EE_ X-MS-Office365-Filtering-Correlation-Id: d9d685d0-ee9e-40e9-2f47-08db66cc4bb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mAxFLy7vSrIGz1H8aDlGRsdlPdfmP0Stf14XLhW6ZaGi5JlUjvzgzxo9WdJtRrs/S0QPS+aJEdO1uPx4bBF31fvRCYk94U3ibIglbz7ZapJD+4MzGlr0aw6+QKLXB/Vt9UI1H+sOkkCwz6BfngktzEsqP8sUg1dRA8yIWkviLcQHkAUIR21DLDH0DThxKJOYQV8xIfBOdDrfxsZssM1qkfFzW7ox7bBwKxRX4Obgnvqk13ULsW2H5AOWyb0aEu0m78RP6kfHT3zKrVoekuDaMonVXp0q72jjsGtqiFesKoTOrOqffYyOOBWulofR5tXSNSNX79AZmZAAPul5V52xMlvV/VZQWnIUF5xjVK5R6Ve1IcBhP13td5Pxsmf3irBikeA1bzVgzKJoCHf61ezD5ZWG4oiKDiLX3c3YdqMCvKqVEQgkQjzoZN/zbUJG8/LnW6AnbQeh9jmOd6iuU66N0Ha3Pka/+eKPMHd8UvGNJr/0ATjMmB6Vz9Ko956pHMmNewEbgpeBpnu7JAeBT2CpGSmrKe5siGzWAi4Da+1NOM3jbN26qtk1kanuXSOulzDZaLTNe0HsIkf3i4BYHqv/sC2vgorxk24V4+T257Gjdp/Z2h8UNb0KL8bwyz01aIyLVOKTXi8ke9tjHIw0YQpB8cbKwX4EDd/Bm6AjUFWl59F5j6P746gQnGY40yd+T/CrfswpI3btvJejfw1GQlLAbM/WVOR9ai6ifslugTh6j2mjD7F90dJ8mlf2XnU554uf8BLZhKOCpC9wlnz6QynfZw== 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)(39860400002)(346002)(396003)(451199021)(46966006)(40470700004)(36840700001)(6666004)(5660300002)(86362001)(186003)(26005)(110136005)(40460700003)(36756003)(2906002)(316002)(8676002)(54906003)(8936002)(40480700001)(44832011)(41300700001)(81166007)(4326008)(356005)(70206006)(1076003)(70586007)(82740400003)(478600001)(2616005)(83380400001)(82310400005)(36860700001)(47076005)(336012)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:23.2140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9d685d0-ee9e-40e9-2f47-08db66cc4bb3 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: BN8NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4050 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 , Leo Li , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We need to signal mode_changed to make sure we update the output colorspace. v2: No need to call drm_hdmi_avi_infoframe_colorimetry as DC does its own infoframe packing. Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Leo Li --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 bdda136235af..793ea29b4cfe 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6699,6 +6699,14 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, if (!crtc) return 0; + if (new_con_state->colorspace != old_con_state->colorspace) { + new_crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(new_crtc_state)) + return PTR_ERR(new_crtc_state); + + new_crtc_state->mode_changed = true; + } + if (!drm_connector_atomic_hdr_metadata_equal(old_con_state, new_con_state)) { struct dc_info_packet hdr_infopacket; @@ -6721,7 +6729,7 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, * set is permissible, however. So only force a * modeset if we're entering or exiting HDR. */ - new_crtc_state->mode_changed = + new_crtc_state->mode_changed = new_crtc_state->mode_changed || !old_con_state->hdr_output_metadata || !new_con_state->hdr_output_metadata; } From patchwork Tue Jun 6 20:26:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269740 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 B4513C7EE45 for ; Tue, 6 Jun 2023 20:26:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A26D10E3C8; Tue, 6 Jun 2023 20:26:32 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD2A910E3BE; Tue, 6 Jun 2023 20:26:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jNvNDFyGlPpaRq+Why3wvuXF3CK2DgLN5hLi5l21+l3/5F++ZkO+RXFK33m91gWhaR4lVfkvqld25bM3HisJWdBBJPsb1KEsChGVZye12NKmtJ5taTPCN6rk2aTTA0JbxAtv6+ZAxZV0wU7uXsih32YzlBd06W+5sELfpqA7mn9GRLKzHjEH7UASFcmx+a5Blzlxsy5LKvIu4BcG73cGZir4GkR0AOWJm2QHlMAmeg3IH1C5hRx+HnVWhgYaKvA6Q6f5tmGGPLm8X5JVmsn+ql+pn91FkZKTfrRIJVYR9R/OkL0YQAZnR+GJaR4LFmucIrcgKBM9NVzrjEj1iFAQ/A== 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=jI0zVDnV6LWrwtWM5TNbeGDiBQucB8/oKUQoyawWXxI=; b=chJg+Z9uB7mWF3xcirfUTEJmdNqXVtMcrJWgwbtPFSYkRDAVzpRmQZjXSD5WvD/t3/9B7tpCHk7LH+h1F6P+vw4zgeBMMsDiZO5DaKBU06YONsWurnNWhse3nxP061FVUOtNTmNF9PraTXYDaqcpT1tTPxIbZpfvdNRzUlbh1nCKvazvxg78RsRkjg3gqSOszs/IZaEZi/Ew5ActD6Ejv3/lyb3BTsxNZps2prC88x1OIFasaQhVhEQf3+/HFDVSkNcdX6bZBvPNI2KDcBE1pouKygURixXgrssUxEaBVaag7Ppf9FpgucOwX4dq/iN/oNU9CnqiKlOwMZ9mBxe4yw== 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=jI0zVDnV6LWrwtWM5TNbeGDiBQucB8/oKUQoyawWXxI=; b=5UBQykUiupj5AedlX04381fBiQwdNdAdB6SrpJAtfoTpYagqOslxIyOR42Rm4CtuUagoq37TG2asuWLRmm93JPK5QUvBavUdTw0bnqN+FCV5/ie1wOfTOd/SYPYJTmoCT5Zcbu7XWAAMNELtbMjlK3fmgDpqDFxFueRQhIsUI8I= Received: from BN0PR07CA0028.namprd07.prod.outlook.com (2603:10b6:408:141::27) by IA0PR12MB8254.namprd12.prod.outlook.com (2603:10b6:208:408::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 20:26:23 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::70) by BN0PR07CA0028.outlook.office365.com (2603:10b6:408:141::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.34 via Frontend Transport; Tue, 6 Jun 2023 20:26:23 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:23 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:23 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:22 -0500 From: Harry Wentland To: , Subject: [PATCH v5 10/13] drm/amd/display: Send correct DP colorspace infopacket Date: Tue, 6 Jun 2023 16:26:04 -0400 Message-ID: <20230606202607.122914-11-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT064:EE_|IA0PR12MB8254:EE_ X-MS-Office365-Filtering-Correlation-Id: a7f14711-8239-4ede-aaf8-08db66cc4c01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LFmtfy2Eto6MMmWQxtWeIlmLThjF2/2rSS85pwTNQYEVdNehD4LOmrMNE22Lm/ksuEyrFu2fBv7tGuJF6sZtIQ1nQSlnnMYoAh+v55xBP3QiT7f5GVEHd2Xh3LmIOwDTL7UEAVRZBLP4iJOQXWIaLp58ABpprYM1BWjJ9cqHL6HwZ0mQACQxYMckk4exzC91xKW5lq65fJ7DB9vABgxEIghCeMB2JV29iUjEiYmkjH7kymv6mJIrKYX5BWQeRDAngxvkUOkWVBR2kxRkAbpq8khgqAv1aM25m3ooKKiMFUHaYYD0yPJeKMLuvUlWi3msfwaa5+KEMEvIHdHMpzwD6tzipT9tcA9B8hZnnEEjFgfbSXDqK+U/2hwrwQ++iaqenqlUCFiiw+LgO05lOwPjloXGWIZWi42uAJwML4qQ7nOZPhV4ZWsuBlfNo4JwEhm72B5Nl/t0KtHjmI1Qibs1WaJTuXrSw4Q9e6WZok6tPv3+QcPmdhbMtJYu7LmE9eJNopTYivSokCwEcx8AKQGFBZ9IMwGkYiYhjGoeQmm8NVqHFsbOyRWUpZdKSReNY/F8SDZSVZcI6YzaGKPY54qaews6uZnjqv/4EPdSGqwArNUOiZvC4nm+LtkcdgxCXDdheWItkcyBaS5aJULKzIMirZMyM14plWYZhtIBqsV+0kv/krMJQwflsolX9w8mCzdA99NT/2kjKIC/0YL3k76MDt5I48p+t9BYsFAFfd2J2WiuhSfTlTV0tvLoYE9F0u9f3uHLI0lONMFAlGd8r0Sobw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(396003)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(70586007)(70206006)(2906002)(478600001)(316002)(8676002)(4326008)(41300700001)(8936002)(110136005)(54906003)(44832011)(6666004)(5660300002)(1076003)(40460700003)(26005)(40480700001)(82740400003)(186003)(356005)(81166007)(2616005)(47076005)(426003)(336012)(83380400001)(36860700001)(36756003)(86362001)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:23.7127 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7f14711-8239-4ede-aaf8-08db66cc4c01 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8254 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 , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Look at connector->colorimetry to determine output colorspace. We don't want to impact current SDR behavior, so DRM_MODE_COLORIMETRY_DEFAULT preserves current behavior. Also add support to explicitly set BT601 and BT709. v4: - Roll support for BT709 and BT601 into this patch - Add default case to avoid warnings for unhandled enum values Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 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 793ea29b4cfe..060a975f9885 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5338,21 +5338,44 @@ get_aspect_ratio(const struct drm_display_mode *mode_in) } static enum dc_color_space -get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) +get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, + const struct drm_connector_state *connector_state) { enum dc_color_space color_space = COLOR_SPACE_SRGB; - switch (dc_crtc_timing->pixel_encoding) { - case PIXEL_ENCODING_YCBCR422: - case PIXEL_ENCODING_YCBCR444: - case PIXEL_ENCODING_YCBCR420: - { + switch (connector_state->colorspace) { + case DRM_MODE_COLORIMETRY_BT601_YCC: + if (dc_crtc_timing->flags.Y_ONLY) + color_space = COLOR_SPACE_YCBCR601_LIMITED; + else + color_space = COLOR_SPACE_YCBCR601; + break; + case DRM_MODE_COLORIMETRY_BT709_YCC: + if (dc_crtc_timing->flags.Y_ONLY) + color_space = COLOR_SPACE_YCBCR709_LIMITED; + else + color_space = COLOR_SPACE_YCBCR709; + break; + case DRM_MODE_COLORIMETRY_OPRGB: + color_space = COLOR_SPACE_ADOBERGB; + break; + case DRM_MODE_COLORIMETRY_BT2020_RGB: + case DRM_MODE_COLORIMETRY_BT2020_YCC: + if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) + color_space = COLOR_SPACE_2020_RGB_FULLRANGE; + else + color_space = COLOR_SPACE_2020_YCBCR; + break; + case DRM_MODE_COLORIMETRY_DEFAULT: // ITU601 + default: + if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) { + color_space = COLOR_SPACE_SRGB; /* * 27030khz is the separation point between HDTV and SDTV * according to HDMI spec, we use YCbCr709 and YCbCr601 * respectively */ - if (dc_crtc_timing->pix_clk_100hz > 270300) { + } else if (dc_crtc_timing->pix_clk_100hz > 270300) { if (dc_crtc_timing->flags.Y_ONLY) color_space = COLOR_SPACE_YCBCR709_LIMITED; @@ -5365,15 +5388,6 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) else color_space = COLOR_SPACE_YCBCR601; } - - } - break; - case PIXEL_ENCODING_RGB: - color_space = COLOR_SPACE_SRGB; - break; - - default: - WARN_ON(1); break; } @@ -5512,7 +5526,7 @@ static void fill_stream_properties_from_drm_display_mode( } } - stream->output_color_space = get_output_color_space(timing_out); + stream->output_color_space = get_output_color_space(timing_out, connector_state); } static void fill_audio_info(struct audio_info *audio_info, From patchwork Tue Jun 6 20:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269742 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 C7A9CC77B7A for ; Tue, 6 Jun 2023 20:26:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BDBA10E3CF; Tue, 6 Jun 2023 20:26:38 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2080.outbound.protection.outlook.com [40.107.223.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBF9D10E3C3; Tue, 6 Jun 2023 20:26:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j1XJc/mQ8D/t4iDKYzKS3OG7ZuJ4jv0HOSdbGJ36M6Qm+rwdWgewAttOH9gw0PE2EY2bwQHrjpe/lZisjmCgesprazqjz4533eQ/S4HzjeUQvBaNVXh+qX+C0GLkB/N6L78HR9Dop4CXuU/jCeh5I5c5UyKRj5iWlh7hNL7O2bXzhH9QAV6XMn8OLvtY6Jmtd+4leIFPpZyoQnrlaR1Vx997HbVQxMV3WnO8E4MwEgk9jH0QumQUw6Ls4XrW2713iq/zdLydzVF6Rfyj3iLsnmJQa/sDQhINJ0nisnCU99n7bD2KxG4BP3Tl0bZzR+qhxOlEEGHvIqjyVZ5rEalITw== 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=2+rPeG4zSesJMWVH+q+a4CTowd2JeHgre8BXEdcfuyU=; b=PljBF+EnHQKiV85W8WvVbTkfcSs6DDQsgkdY9Pf8PmyzSzlbdmQQ9uH/QHGG6b7HutIsMpCnuo7jxPCdFztHXp34jsNpQOo/UgIMmgqLS76OTVF1JGeorQv0+Yh+YEl2HpiqtqT6Cd8l87UJSWTdQ78wF9cwxopxRW4d3WP0Mq2LoBF92AQ0FkjmfvmMHlBX1SNsqXAfWUfYce2cBpFyDC/5np6QMPFAfwGeJwtoliWElb1ADy9FSwlD6fcDfsefO188NFRBebrfz8DgaSU0PoykloDhXWR1QFYjOeQ352A0/UulsQoAUoCNLDS3V6BIvU2/lBbLO9t2rO3dbejWVw== 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=2+rPeG4zSesJMWVH+q+a4CTowd2JeHgre8BXEdcfuyU=; b=zEX/n/Af7qTdjnkjK/LeL6TDTaoeibR3h9K7GELMvkzDfdgelERtMVeZ5pnX7t0NEe2kKBCUQUuQaMIZyIyplpIwmpRYOx11BYQwIRi+OiYRJugZ2HDL5nj5o3ghduGJdgHaSUd+nc2OtYJ6wvAlThFfPg+teD7/JPaeC8mPWoU= Received: from BN0PR04CA0101.namprd04.prod.outlook.com (2603:10b6:408:ec::16) by BY5PR12MB4129.namprd12.prod.outlook.com (2603:10b6:a03:213::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:27 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::ac) by BN0PR04CA0101.outlook.office365.com (2603:10b6:408:ec::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:26 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:26 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:24 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:24 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:23 -0500 From: Harry Wentland To: , Subject: [PATCH v5 11/13] drm/amd/display: Always set crtcinfo from create_stream_for_sink Date: Tue, 6 Jun 2023 16:26:05 -0400 Message-ID: <20230606202607.122914-12-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT063:EE_|BY5PR12MB4129:EE_ X-MS-Office365-Filtering-Correlation-Id: 34ed2cba-7498-4b89-04d0-08db66cc4daa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FOa+BOJoWagj7z/3p8J4dtjnOyWG7BKBaxGSBWdGzCBXOmNSEkGipbdmc1Kny4CvF8UMjAM/7QEQjNBff+Iv1v3dnFktLqr8oYLkhbDD5OWqDeKtRA5NDkZON4CZJP0q7H79GIBc4+M2FtJSJs5AYolOdARgAowOW3pqOBnq9ZdsA5Jh2uqRXoTwdtWxxU9cQYEbYf2hnXteoyyCXGGfvOp0t0QSExA5QINfwb1qrUdEH0BxTMU0jFoxorBhmsIx7enSCbXMZx1Lk6oWQWjIlPXagfsgxCmtvnNUbxyVvTuhKFxaR8mCuLH75197T+INqQgKKZhW+79Qg1oMnRY6jy0B+CqWyMGKIkgqh9rhg7dUGsEsvyyDHjiKyZIO/knjU76Kwg51DNlrc3w1LfpJKUcSJuSJzLL6zYhVciZEWy3belFzLZF1CTw+dji+Gv7plzxWdeJzi7xsxEnCQlqZh6Gpj9cAJAgggdXnV8m0ATiynyHdZRsQaLIIOQq2cr/gBmdKIeYdnKGDh+oqG+uPHFSMJKgvSaqLqAKCunI3bslec5rwdwZWI0uCDVXsaAOSZHiT5KfCdJdCa7bQRkOzBFyYM5touaX5reV5A4Hrjm7KIzIfbO/z2Q0u4UDU8iWAVzKrP3lq7FlTOjFzgyXKq2Tm5wFqYqJ8XMhoTVLPuDvocSX0ovTMw73mP3r2UJJxrtdzgWCKA4cRowOBmxCJkfGc8+Evx+j8X/TdkrrpcQa1z8XKtXCI13bYQBRSr22+79C6iZy4URIArge7QFb26Q== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199021)(36840700001)(40470700004)(46966006)(86362001)(5660300002)(186003)(8936002)(110136005)(26005)(40460700003)(1076003)(36756003)(2906002)(54906003)(316002)(44832011)(8676002)(41300700001)(40480700001)(4326008)(356005)(82740400003)(70206006)(70586007)(478600001)(426003)(6666004)(2616005)(82310400005)(83380400001)(336012)(81166007)(36860700001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:26.5094 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34ed2cba-7498-4b89-04d0-08db66cc4daa 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4129 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 , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Joshua Ashton Given that we always pass dm_state into here now, this won't ever trigger anymore. This is needed for we will always fail mode validation with invalid clocks or link bandwidth errors. Signed-off-by: Joshua Ashton Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Reviewed-By: Harry Wentland --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 060a975f9885..e17c8afce2f4 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6054,7 +6054,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, if (recalculate_timing) drm_mode_set_crtcinfo(&saved_mode, 0); - else if (!dm_state) + else drm_mode_set_crtcinfo(&mode, 0); /* From patchwork Tue Jun 6 20:26:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269743 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 E4F6FC7EE45 for ; Tue, 6 Jun 2023 20:26:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 175A810E3D1; Tue, 6 Jun 2023 20:26:39 +0000 (UTC) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2058.outbound.protection.outlook.com [40.107.96.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BC0510E3C3; Tue, 6 Jun 2023 20:26:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EVB4XWbMybD+o7h0JU2HCspE5xCxkcjJYfwb/sOIi3BqLMJKibGTWSl6avvjHXaOjj1eE144X68JTvge6LaKPHURxS56Iki0LnrS5zVUj0wSUCmHxk4AemYIRV8XpzaT+niSeVQjAjMnaaw287GYoltlBBieBagP9uzxqQ07wcBWS8FnrP+oeIiFpR6BF2z3k5O8HsJevJOrdO/SWUyZfzaAiEi4Hl/hXAoYx1lUybUd2oy5dcWXC+HgRdg64UeWnqiTa2YPWlbD7nuY65fxikV11i/4W0p9JhLqYCLVPCz6WYdhZl3Npx2BA7PXRsyliRrhfsXh5+7x/xnkkPMbHg== 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=EOIaxi2xBCKUKc9JeC9I6qADLCCZVemIcloGzCYBGZQ=; b=XmqIxTJvV4hNNYXhLqmLSjLvIquyLgroF5aZyAW+U7L01NOCDjUOi7U2TM88jQixz3llRajMnc0HXZHB2iIsJQI2oL6lcboaayfVhGHyd8tnEyfzgYAE0qkl/piMa+f+LYRsK/mNsrq5h1or62e9ceGvUvXsBOIHEiDLctluI4q61qpe6Pa26Az0o3ky8smyrMTV59y0p3iMR8FBmDq9Z27MXK3Mcso/3i3BMmhGiN0qaa42d4uWZt2DNCwhBhGmk585ST/dVTurKsIeMvCZmAyVu2/YuJ9G1L+gZXwSZLEgVkWTZi9Xy1foKJV9DSXY8WitubwWCuTWSO4iN75c7g== 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=EOIaxi2xBCKUKc9JeC9I6qADLCCZVemIcloGzCYBGZQ=; b=t/hQo7kAUL2ncWJi1deVaExz5C1AIf8O7ewe47fIm/duLZoQ5iI1+bsSfqrhBeyNfFWCiiax3BNf0stDBRhrH2agCJmVUctyPxka9fvntjUiVX2xMyG/wR8kqt+hpWIMU0i9fSrWJV9pPPfjkGAL1wrVoTbZrJqfCQH9mTvzPUI= Received: from BN0PR08CA0016.namprd08.prod.outlook.com (2603:10b6:408:142::35) by BY5PR12MB4917.namprd12.prod.outlook.com (2603:10b6:a03:1d1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 6 Jun 2023 20:26:26 +0000 Received: from BN8NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::d1) by BN0PR08CA0016.outlook.office365.com (2603:10b6:408:142::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 20:26:25 +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 BN8NAM11FT026.mail.protection.outlook.com (10.13.177.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:25 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Tue, 6 Jun 2023 15:26:25 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:25 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:24 -0500 From: Harry Wentland To: , Subject: [PATCH v5 12/13] drm/amd/display: Add debugfs for testing output colorspace Date: Tue, 6 Jun 2023 16:26:06 -0400 Message-ID: <20230606202607.122914-13-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT026:EE_|BY5PR12MB4917:EE_ X-MS-Office365-Filtering-Correlation-Id: 515741f1-033f-4876-1d66-08db66cc4d4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Id7R28tCqk6FryRQyBezwD+axRYMjxWWk0E0GO9ldckLDrr1rGM2RotmlOAlfdOnFv1Cj4lGSAVFkdp2PUbgrAmSwcRkB4QZ7cNn5n78v9ATSEOKV4QiLRdyqchfWuB3O7U2W0z2u/7lbYXbjDQpVO2FP223NreWpm/ArGmnkzO1f1a3EXk7wgOe4LFJ9MEjDAu+n0sqoRcc2Z8GnclWeOr7MjWOQWrys+c5reSaFhZ76TFrJOjpm8ctl5b3FekUvH8/lq/eQ5qJAC0ANdeXRDlpzhLkys3J/wcvb92n4sJZ3ivFSroq4bTLrfocutR5YjbGSyOh/Jnc+alW7lJ9O9a/i/aXgJyJEt0X0kfgNSdjDLENZARJauEnvS/kp+JB8CeBv3rdiShm6+/ZpnbW0tagCkyTvkvlYQSU7i6qo9azzGdQ/RrAiSVKh9NpbuVtRCvuu6Wzc9bGZpcaRLs1bMJ1N9sPHL4P6cVBkZ6Wabra4DNwdQ7fanAyroBz1K1jo89AWoMoGM7x+nm9RcAulb2r4OOazIrp5wZArFzSfAiNEwHN8Yt6kj10UluKUmp8kpuhRhMXw6o7TltPxFuKYgNSDlknNawUQuTr9nUXatl7TBG7OvSot7I5Zn0mPEcrcNJJZ0SYRNeMG9ZcG/IZoKC5WOBcAByxv8bXhOXcC6aU1UVYzhvrZcQP5+QEiR3xbNYNNFVskb+k0CdY8/TIMHSSzd9tk4ZDEK7jJBgiRLTqnjcpuO95ElzK7DJuHpHkHtfwNCU45MYuqwZCrBU91g== 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)(39860400002)(396003)(376002)(136003)(346002)(451199021)(40470700004)(46966006)(36840700001)(41300700001)(316002)(478600001)(8676002)(40480700001)(40460700003)(47076005)(2906002)(36756003)(82740400003)(44832011)(356005)(70586007)(8936002)(5660300002)(86362001)(81166007)(4326008)(70206006)(110136005)(54906003)(6666004)(82310400005)(36860700001)(426003)(186003)(336012)(83380400001)(2616005)(26005)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:25.8718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 515741f1-033f-4876-1d66-08db66cc4d4b 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: BN8NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4917 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 , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to IGT test colorspace we'll want to print the currently enabled colorspace on a stream. We add a new debugfs to do so, using the same scheme as current bpc reporting. This might also come in handy when debugging display issues. v4: - Fix function doc comment - Fix sRGB debug print Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 82234397dd44..caf13b2e8cb6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -906,6 +906,61 @@ static int amdgpu_current_bpc_show(struct seq_file *m, void *data) } DEFINE_SHOW_ATTRIBUTE(amdgpu_current_bpc); +/* + * Returns the current colorspace for the crtc. + * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/amdgpu_current_colorspace + */ +static int amdgpu_current_colorspace_show(struct seq_file *m, void *data) +{ + struct drm_crtc *crtc = m->private; + struct drm_device *dev = crtc->dev; + struct dm_crtc_state *dm_crtc_state = NULL; + int res = -ENODEV; + + mutex_lock(&dev->mode_config.mutex); + drm_modeset_lock(&crtc->mutex, NULL); + if (crtc->state == NULL) + goto unlock; + + dm_crtc_state = to_dm_crtc_state(crtc->state); + if (dm_crtc_state->stream == NULL) + goto unlock; + + switch (dm_crtc_state->stream->output_color_space) { + case COLOR_SPACE_SRGB: + seq_printf(m, "sRGB"); + break; + case COLOR_SPACE_YCBCR601: + case COLOR_SPACE_YCBCR601_LIMITED: + seq_printf(m, "BT601_YCC"); + break; + case COLOR_SPACE_YCBCR709: + case COLOR_SPACE_YCBCR709_LIMITED: + seq_printf(m, "BT709_YCC"); + break; + case COLOR_SPACE_ADOBERGB: + seq_printf(m, "opRGB"); + break; + case COLOR_SPACE_2020_RGB_FULLRANGE: + seq_printf(m, "BT2020_RGB"); + break; + case COLOR_SPACE_2020_YCBCR: + seq_printf(m, "BT2020_YCC"); + break; + default: + goto unlock; + } + res = 0; + +unlock: + drm_modeset_unlock(&crtc->mutex); + mutex_unlock(&dev->mode_config.mutex); + + return res; +} +DEFINE_SHOW_ATTRIBUTE(amdgpu_current_colorspace); + + /* * Example usage: * Disable dsc passthrough, i.e.,: have dsc decoding at converver, not external RX @@ -3139,6 +3194,8 @@ void crtc_debugfs_init(struct drm_crtc *crtc) #endif debugfs_create_file("amdgpu_current_bpc", 0644, crtc->debugfs_entry, crtc, &amdgpu_current_bpc_fops); + debugfs_create_file("amdgpu_current_colorspace", 0644, crtc->debugfs_entry, + crtc, &amdgpu_current_colorspace_fops); } /* From patchwork Tue Jun 6 20:26:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13269744 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 2066CC83003 for ; Tue, 6 Jun 2023 20:26:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1909710E3D2; Tue, 6 Jun 2023 20:26:40 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20630.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::630]) by gabe.freedesktop.org (Postfix) with ESMTPS id 971D310E3C4; Tue, 6 Jun 2023 20:26:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W31kHQDGYKScRnmEgzuJzhlU6nCBe2tgdo+XV6mvlQxE62DAXToblDt7czLrkPql53mOHvipO1dP3u9GhzOfPx1lz1Wt5HMmhUaWNrLEytbFTNNaWkNn4M8+2zpyNjlVaJV7Wcrb3s8VOkU9ycfQZrtZLQY5tlAm1Ax2JaVMdTpaHLFgoRxQgnrYvB4FVZEbjd8E+9zZRbJQQxfQegzfHMqTjICeNP++DFo+PbiQHPYp2UcvtiGmYdRSKaMF2+HLPOY3JNp92mysQrZGFUkJfJMQdRnO6lq7uphQgc84VNRJEHx5/i45ZnkTFBEo22SVIM4tMwXRizC289eHZmOrwA== 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=tKi9iXX/dXKQa24jRy34TfLWZNEd8lVzVj+flWI4uQE=; b=Uf2nwp5A1i5YF4bEcSp5WGemaLVFViE8LKOmzQXS9h0uZLSDNslE3Rf8uFmnwazsAVAitSkkXbSzHPm3ZNYy/EwMJAkyXnlvMEqsuums/FCu7fKethSNSY56guyFvGenC3X3P5tvyhACdK5ZtvVxTUk10h9GUXByzLM/ij1QwR3FSurV2jenVY6Fn5XnpS25tejCgDyZv5l930M1Kh3bc85+rIjG7t8uh+j4GrvhyHC1HpvZe07RwX+eFTRYUpXRcz35Gps/O3S8rCWTat+JajNwjQWYixZgaWTiQlqefzp0DOoSN3u0iJIT0hzuJzLWk7YwqeMgm4Fmpry3T12dhg== 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=tKi9iXX/dXKQa24jRy34TfLWZNEd8lVzVj+flWI4uQE=; b=TsLelJ1zleZDKxsnOTxg81amWweLqzcKkacKuQzn9Exlu9ad8q0PAsrk/1bmYqc9bVa5/ZCXziBTAcX5Oekc0qkFLM3lXZQzywYN+9c0pd/SF566OKNG8Nw/7V7Gb4IGkTiOMSieKVsoJNu5v4VodMEm6/y/At7ksB95l4N+iEs= Received: from BN0PR04CA0118.namprd04.prod.outlook.com (2603:10b6:408:ec::33) by PH7PR12MB7966.namprd12.prod.outlook.com (2603:10b6:510:274::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 20:26:28 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::23) by BN0PR04CA0118.outlook.office365.com (2603:10b6:408:ec::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 20:26:27 +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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Tue, 6 Jun 2023 20:26:27 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:26 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 15:26:26 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 15:26:25 -0500 From: Harry Wentland To: , Subject: [PATCH v5 13/13] drm/amd/display: Refactor avi_info_frame colorimetry determination Date: Tue, 6 Jun 2023 16:26:07 -0400 Message-ID: <20230606202607.122914-14-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230606202607.122914-1-harry.wentland@amd.com> References: <20230606202607.122914-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT063:EE_|PH7PR12MB7966:EE_ X-MS-Office365-Filtering-Correlation-Id: d90fd614-cd54-4d71-5cbf-08db66cc4e47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 11yWzzaH/a5xUzqTM0peaRZPHPNRF1f0KqkzNKVfh+1yXu4opq/eJOkVERnv+XzeP547ZQuw2w8MmofemEDvIlb3pCaArUegucx5PuYi6k6+ckbh9kRcekkQKYnljrr0OS4VERtt//vI4XR8CQb3FPtXwGh/1hW6Z9DW+d36bLG+pe1QpMq5uOexw8uy7TOfos/mZC0l5rKfrlG8f90schZh5M6mhTo3RjM1yHIHSFXvAp91f06rEnsTdDr+imEl7t0amqSqw27xR0iB5j33Ti86keMnEOa1e4O2Y2UCG6yLxDH0/XHKw6UkXb2RNL/WCCzbv6fYbWpVAeqvnz3ZiBe71vONnrHr8my8gaTEFcJuVdNJ8zKXKZTM44y9PtO95TzZn3FeqydBbH+RMs7aVCnRPFuwtzQ3WZll8w0V1jNLdu+7M6QbVJ1ERv1CCnsVPUg1MzLvWHlnsI5HAcH1IkhZHQz8lfHHbwu+zV2+c6VnGBNlll1286bDkN0EBbo6lBNx53DHqUZ9pf9K6obyngcyU5DCAtuJIOPic+UFagNUMJS2Wm1LXiwumzlNUVtScPQk7KtUPuuc5osnKpvr3OpjfoW64Wwh6RFg+hJB7Ro60neWCcuh4/dppII4GIT1PHhZ6XMLZCtrJOaiviQmp+wlekU0E+MmbPTCDp/Xf22Km63oBtqsls4QUUQfrH7yWh/R8k29NZvrvk2MLrhs+5vnIHtNyiz5MM2Kl26TxRGQ0yDyt0Usgm+N9IT5RGaAwWXi1fM4LZ/ugdFFuxYPLw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199021)(40470700004)(46966006)(36840700001)(2906002)(70586007)(70206006)(478600001)(8936002)(4326008)(316002)(8676002)(5660300002)(41300700001)(54906003)(44832011)(110136005)(6666004)(1076003)(40460700003)(26005)(40480700001)(82740400003)(186003)(2616005)(356005)(47076005)(83380400001)(426003)(336012)(36860700001)(36756003)(81166007)(82310400005)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 20:26:27.5249 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d90fd614-cd54-4d71-5cbf-08db66cc4e47 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7966 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 , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Joshua Ashton Replace the messy two if-else chains here that were on the same value with a switch on the enum. Signed-off-by: Joshua Ashton Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Harry Wentland --- .../gpu/drm/amd/display/dc/core/dc_resource.c | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index c72540d37aef..2f3d9a698486 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -3035,23 +3035,29 @@ static void set_avi_info_frame( hdmi_info.bits.S0_S1 = scan_type; /* C0, C1 : Colorimetry */ - if (color_space == COLOR_SPACE_YCBCR709 || - color_space == COLOR_SPACE_YCBCR709_LIMITED) + switch (color_space) { + case COLOR_SPACE_YCBCR709: + case COLOR_SPACE_YCBCR709_LIMITED: hdmi_info.bits.C0_C1 = COLORIMETRY_ITU709; - else if (color_space == COLOR_SPACE_YCBCR601 || - color_space == COLOR_SPACE_YCBCR601_LIMITED) + break; + case COLOR_SPACE_YCBCR601: + case COLOR_SPACE_YCBCR601_LIMITED: hdmi_info.bits.C0_C1 = COLORIMETRY_ITU601; - else { - hdmi_info.bits.C0_C1 = COLORIMETRY_NO_DATA; - } - if (color_space == COLOR_SPACE_2020_RGB_FULLRANGE || - color_space == COLOR_SPACE_2020_RGB_LIMITEDRANGE || - color_space == COLOR_SPACE_2020_YCBCR) { + break; + case COLOR_SPACE_2020_RGB_FULLRANGE: + case COLOR_SPACE_2020_RGB_LIMITEDRANGE: + case COLOR_SPACE_2020_YCBCR: hdmi_info.bits.EC0_EC2 = COLORIMETRYEX_BT2020RGBYCBCR; hdmi_info.bits.C0_C1 = COLORIMETRY_EXTENDED; - } else if (color_space == COLOR_SPACE_ADOBERGB) { + break; + case COLOR_SPACE_ADOBERGB: hdmi_info.bits.EC0_EC2 = COLORIMETRYEX_ADOBERGB; hdmi_info.bits.C0_C1 = COLORIMETRY_EXTENDED; + break; + case COLOR_SPACE_SRGB: + default: + hdmi_info.bits.C0_C1 = COLORIMETRY_NO_DATA; + break; } if (pixel_encoding && color_space == COLOR_SPACE_2020_YCBCR &&