From patchwork Thu May 25 19:17: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: 13255592 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 AA7E7C7EE29 for ; Thu, 25 May 2023 19:18:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4580010E041; Thu, 25 May 2023 19:18:30 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2082.outbound.protection.outlook.com [40.107.93.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id D02EE89BA3; Thu, 25 May 2023 19:18:26 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T8ncMnT+OudNBHuz4S8DBLcW6pnlwXASd7WdUqfB9ezydu+ijqAA22PiXYxt2oJcRIZyqce/9qLVfno0gP/zB1o9b1AqeHr8dSeZBJelhmXxcvRNaiz/S0l/R8yDtlWyiOFQmUfxa2xv9thVpzEF68bvsvImS7pjoVoCfW/LW+KTo2lTSmVK/BGUElehb1GiDk07FgyuDwzEwA1UE13WmUyhWAmDgmEQqvCeBABGXTLmCtmLrXnJXoclgr+yJ+qFGlr4ydUeITHeDBNfj9EThLdj3EDCwAumBwMeNlHG+TdcFde1fxUzWqHtNPE/m7ozvC7RTbtZpl9rR7OvR3FKng== 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=QD9EOo5Yp5nCPf5QL6AS1SbQdT/nsZr1xxSyDY8JqZY=; b=g0RTM0WSgAMJVaEtDuydRQmRrHAIpnpZP1f7SfkcYmn4QBWrq3EaSLHubvq81KF3tGhbKkGaIb70l7WhfBHUpKTW48PBC7tQiWFMhjKZ5M7mSA90yrqN4FgOCpr4XLiXSw7pDyxQdAx9DL+u9JYC47drBZypXr7M/jbLq69gwifUvBD4fEpQzrpVvjKXOE2cFysOKSgXLKeWFnmmvt3zkXUIcv+Q6Mtwhw2Pn6/At/S2F4R0MDQKe6VLjL8cokY2+B+hTQ/IdNJelZtO+njJEeQPYKI4TK8i2/Ymo9qCM1WNsUMMMBDG5O4B1YQgLbASa0rfkDHd4GY31xQ+xh8v1Q== 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=QD9EOo5Yp5nCPf5QL6AS1SbQdT/nsZr1xxSyDY8JqZY=; b=mRHlsmLVyW+teFECqj1Z5jiQLBOZsSwqTHFnQEDvrcH1XYufYqiLFrAo4MaVy+3ZJ4mWit9HV8AoIQ7IP1ppps756yg9rEiQOSaSH+J/XACUI0jF0eV4BIFGNhh1y4db16+twVBGLM4mRd51Xx+fiXcvej7urXOZOV//mIOsV/Y= Received: from DM6PR11CA0029.namprd11.prod.outlook.com (2603:10b6:5:190::42) by DS7PR12MB8203.namprd12.prod.outlook.com (2603:10b6:8:e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.16; Thu, 25 May 2023 19:18:24 +0000 Received: from DM6NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::eb) by DM6PR11CA0029.outlook.office365.com (2603:10b6:5:190::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:24 +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 DM6NAM11FT078.mail.protection.outlook.com (10.13.173.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:24 +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; Thu, 25 May 2023 14:18:23 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 25 May 2023 14:18:23 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:21 -0500 From: Harry Wentland To: , Subject: [PATCH v4 01/13] drm/connector: Convert DRM_MODE_COLORIMETRY to enum Date: Thu, 25 May 2023 15:17:57 -0400 Message-ID: <20230525191809.3524-2-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT078:EE_|DS7PR12MB8203:EE_ X-MS-Office365-Filtering-Correlation-Id: 743304eb-2a54-4ac3-a3c9-08db5d54cf69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v7tvYjKei5nfLsv8El3Sckct0vfzaAEjv3zBuLaCLaJb26OUawEEvHpG2um9JLr14MiG3NBlOdPANPvk11tLSQ6kX8fDv/Kt2PXHDRudsF0pTFybhJf5BHzOdbFqIU76MlEqXICf6qE1DwFC58LX+CaineCWuvuMogCylzQhHbYJTXsZl42ifMwxiXUamGO/qMcj86J7sBb3njmxbFGnqaGWqF1G6nhwXDKp1tQPYPOTA7agwzzkvl0Nc2GLDf4lMx5xFFbdtQmaT1PtCXYB5+geUAoojk8UcXn24IYv/pWyF5zAE4q4ThKPZfUnbR14y/H3bQmbViUZ5WuAFzQ32JNywM98shkFB9mXA2AVJoYPm7gG8BgcW+8BMN6fSa0kTFl86xjJTHePuiUIwWw9UxNjTpvLlTB46vYKonL3WphESYjmDjdrORZCMRPUNZD+do5Ls9jsLTAUAHf+PMlrjlC6QA40rZqf6eWgr1WOJeNnMD7/2SkjP6kOh2wXStkqsTyw3Ep4cWt1k/RlgvNXcw0zY7n9Dvf9CIZJanvVVuw6qsEPgJDGiwRzZI09kIxvp/uGs1NYDGTce9cXO1WBCiQSy9UtVBN8q+GFJx9zcgU2igc0MbNbtAk9sMsd4lUePtRNwLBYD2A2D4lMvTsZW17rRCXMgML3Z1K2H+cXR6re89p1v+WjCSPJicB349J8gRt8xljmDUPvpG0OJP7Qfrs/Ja3VfVmaw1xIn6w+1wREUmEcSVfvrkwN7CmZPzdf/jcGHugW21TdWQZGBYIVAQ== 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)(396003)(376002)(136003)(346002)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(70586007)(70206006)(4326008)(110136005)(40480700001)(82740400003)(66899021)(316002)(54906003)(478600001)(426003)(40460700003)(41300700001)(6666004)(186003)(86362001)(356005)(81166007)(1076003)(8936002)(8676002)(26005)(44832011)(7416002)(83380400001)(2906002)(82310400005)(336012)(66574015)(47076005)(36756003)(5660300002)(2616005)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:24.0718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 743304eb-2a54-4ac3-a3c9-08db5d54cf69 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: DM6NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8203 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 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 Thu May 25 19:17: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: 13255593 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 84CA9C7EE2C for ; Thu, 25 May 2023 19:18:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8267310E121; Thu, 25 May 2023 19:18:37 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6867510E110; Thu, 25 May 2023 19:18:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Go70EgFRdvjiFzIDV4QED+KzZzhMFK3n1FqAmLQ8ZKogJZA3pW6J0o/8AAs+NUYUlazcGUQ7FdSjhhYKkmFzVD++qN7T5ETMFhDvSW8x9wAuRY6c7U4C1sSuK1equS4fFNjHWJGRpYKefrmdQ0lXnlK7eXLig47wMxs+10uNuX97WhnM11VZVFBvUikdBJB583+CDWZmAVCOJL8XwQlMmrjPyoeH8NTLWxGFPFYTdWCnF5C+6cInbXghaocxH9i2FKJAp8XztrDqSiodwDBrjpEE2ypcf3YGIsTUsxShNyzUvzuTtOnpd6PV3jcUd6BVRVHZkTjRAMiBNAh3job4Sg== 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=giS9uUXyRByxXY81LUUZ74QkTKJt/25n1Fa381frW9g=; b=JejQ3UmroVTa4kN8RKgheEP6dAHAN1VXLWWTloEOIVPeE+HDZMrWaDtDafdYI9cReQAJOqsV5jOgT4Q26/Sa74FNGRDkHRuBIVTGdUGaPhp6GF1QrUd5ySz6GE4wQkBBKPZiVihUDOzQsO9N6ekWlHIPRq1jo1Ohq2+6JH5tFE/syO3ChKEVTK7Ntk2BFikFtkyJPq7Z6G5aMcOG3Tlxq32G+tYX75JTA6OaDRPP0tc1UdY5orFmFNN8sGS94iu68UCAbhvZsJ6GJweXnUTvV4OE12iaT1VWniAuqmeieCA7Kb/T3grEQ1fBpbOWlQTnXF2HHnqmBgIPhyy1rMgXZQ== 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=giS9uUXyRByxXY81LUUZ74QkTKJt/25n1Fa381frW9g=; b=g5re32NNvk9lkH4G4NCpUv1bsI5q4+30zRhBGG9vR5b0gTzAn/cXFPjWRS+bLs3NOLc3qUhrMEEMY/9w6zrfWAgfWTyK7roWSsYlawD0D/HY1d4Y0EFHFKMcXdsuKfpUXP2LzakCUjorzb76uQ5uWnpQ89Wr6hf1sQYr1O4PThw= Received: from SJ0PR03CA0208.namprd03.prod.outlook.com (2603:10b6:a03:2ef::33) by DM4PR12MB7720.namprd12.prod.outlook.com (2603:10b6:8:100::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:30 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2ef:cafe::3) by SJ0PR03CA0208.outlook.office365.com (2603:10b6:a03:2ef::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Thu, 25 May 2023 19:18:30 +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 DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:30 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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; Thu, 25 May 2023 14:18:25 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:25 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:23 -0500 From: Harry Wentland To: , Subject: [PATCH v4 02/13] drm/connector: Add enum documentation to drm_colorspace Date: Thu, 25 May 2023 15:17:58 -0400 Message-ID: <20230525191809.3524-3-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT014:EE_|DM4PR12MB7720:EE_ X-MS-Office365-Filtering-Correlation-Id: 160703d6-556c-4422-fb26-08db5d54d302 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TEw8pquP24poof6/KScIN/VdphpmW9nVGSBva5GueigQ60Qo8fL0zVIxonA/pGGJyzLZJWIvCuQwA6xnHylbRHstI2MWMMOrE//FtSwvbzyzc2gPe/4l7CkISYQq4DujclQh4UGKOcQWFHBjKkFDulFmz+Uh9YD+WMui6hENODE7qVTI9NNzhk0zzb9uUUVdRDe325fmyfGB46IqzgaFFU+GNLZqZflbeUA15G4hqtD3wu6Bn7bcrsUfLtwB+PtTBUKg53SLw16eWH7hInp4W2VgQVK71uk+hJe3Cbt476V7VxV2umW4vayILy9vW+GTCj0XjV++/ij3bKsEzywS8H0FK2hRw5yYcWxPsdfqEL6pNxjeEqt4V2CiqdE5TC4UeUuwO4S7/Btv/dfxn3swG95D4vYpSu0BFmKwK4Pe35Y3NAL0t54Z1QPGqF1c1VYUs/DgOiAJKs5GpxgFTPbfqs1Tsk0K4bZI11P3K/SQFnGz2iCVq+mOowTkiF8bTwgQGHMpV7Eq4uF2vZWQ88Kp35/6JmPJcHe8rzO/02bu0k6J+pK0N2zMUs9ZztiI04+RaP1va2CDuXHmNsTXTEZ6RixhsO3wHZc1r/CINxVa4NzzoN9zub8RUm0aY/vRzYOJcj7cM9j8rpRhVLP2mvuC2rP7stx7u8L0y6AMWQyHH250yY9PZYjOod3oiiC3Uqkk5a8isCWtgCV5f+ooEGzO/cvmtx3uonESSjGxT21H0Du+evYpZ+Q+jO1KjGwYVRIu9U3KC52XfUZ/ZWnpUFq7og== 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)(346002)(136003)(396003)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(5660300002)(82310400005)(2906002)(8676002)(44832011)(316002)(70206006)(66899021)(4326008)(54906003)(8936002)(478600001)(83380400001)(47076005)(2616005)(66574015)(110136005)(40460700003)(70586007)(336012)(6666004)(36756003)(26005)(41300700001)(1076003)(186003)(86362001)(40480700001)(36860700001)(426003)(82740400003)(356005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:30.1099 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 160703d6-556c-4422-fb26-08db5d54d302 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: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7720 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" 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 Signed-off-by: Joshua Ashton Signed-off-by: Harry Wentland Reviewed-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Acked-by: Pekka Paalanen --- include/drm/drm_connector.h | 62 +++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 77401e425341..ee597593d7e6 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -363,13 +363,71 @@ 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 + * + * @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 Thu May 25 19:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13255595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 198D9C7EE29 for ; Thu, 25 May 2023 19:18:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4947510E11B; Thu, 25 May 2023 19:18:41 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C65910E110; Thu, 25 May 2023 19:18:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dqp3aqfZO2kllbntt9gKGB47UQUH8skYLdQ0KYbvurk8UHgIoJxkiBbgjejQjgbqIF9p4bQL0HxcWtD9u3n6LS+bwVlqccwXaqEiQ6luybRy2NI7VJobKjMjHYX9T6XcA+o5z7Yh2ysYWQbykM9uwYJYXPGaxIlE3wiCV5T25nDzEF6yOv2D+x3UkuTOf/h7bPQQTXAqYbw0s0hQOnd2Ye8al+7WOKrEr92w00k7PEe7Wjio9CFU6hsC1eHE4hyVmvG9ItTgvTzE2fQh/CkAv226bmVt0Jcu2vJOWtfUWrpXfYO+QniZUE2El9bB0W8rMC1TYoOGq+6kNidIqsWDkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PbOfjTJcpLn3YVPkOZiGN3nJVesWMlHfuTSuFQFCsbk=; b=W8wxycJNo1P/0/QzFjP9+Hahs5VYBZqIrAiCqp+r8Dmcwb8ehSgDZjyKwpSt90lbJ8bF7zfB0zSxz+FMFeoPTPby4gQGcejAyGTFI/o4J+G0X9POTc3JLrLmnZvT5aYyTg6kcGnJ7JnTjRZ1rX6V1xq0cz87YJrdi3BtaTbHbhgGRpf8vO6X9XTCYzJL5E+cqsTBTpdFFZV0zqS1KtNfC8CjvJlJGPZgOCZnT8ey5T5VPbNtDyiLGFq1xbM4REOWEodZ2GJnet00UV7mruyNZlDB0EgYFq71yXLbOQw89rAjK/IYJHKcn74o1RMY5xR/jhKtzEAMLn6lYs0nr3zrZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PbOfjTJcpLn3YVPkOZiGN3nJVesWMlHfuTSuFQFCsbk=; b=XupKvOcXawd/NA2efkZCPf+Y13Aop4YulOXcmvFJrKQBR6m4qzvvB3oGrMiGUTKLalquWkOam9g4nrss1waE426Ms3gv8UisamvrA6Qdv8ZVz9+flcOMifMaTzjGzpm4XE1JRSuyY3HC/YiFpgdN0HsQHKDUyWOeJP3tDpWJPZk= Received: from DM6PR02CA0060.namprd02.prod.outlook.com (2603:10b6:5:177::37) by MW3PR12MB4586.namprd12.prod.outlook.com (2603:10b6:303:53::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:31 +0000 Received: from DM6NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::2c) by DM6PR02CA0060.outlook.office365.com (2603:10b6:5:177::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Thu, 25 May 2023 19:18:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT099.mail.protection.outlook.com (10.13.172.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:30 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 14:18:27 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:27 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:25 -0500 From: Harry Wentland To: , Subject: [PATCH v4 03/13] drm/connector: Pull out common create_colorspace_property code Date: Thu, 25 May 2023 15:17:59 -0400 Message-ID: <20230525191809.3524-4-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT099:EE_|MW3PR12MB4586:EE_ X-MS-Office365-Filtering-Correlation-Id: 888b31c1-c5c4-4143-78f3-08db5d54d375 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JvksSEUyMNVUAsU0D7v6egGNmbROIXcpFyOZtpqFlXKXhSr3T1FTGw0QILAh0DQr0CHurnA5x+8Zwl9lZ5MeLpwwomV6xIQVKa9Z+4pnkH2NNb06f+OS149naCwE6lNlHhL1yqTVcLNaQ/S3GfZ23PtO6OYWn2KDASJEsoKJIX6MN+qrOERbz3IrPlO64vOLcnl44N9nRROjjFS08T2tpWoPrwwYLeSCF4Uiy3X1Fq6eFYb1zR2g6UEKeG/vP3/PCMU+ubjaDW2IUGE1dYZpgzV2dXb1Ts5+ReHpTYJnluEIbw/pqzOr+ub7yJG4Av0vvJ8/rFhcfUeOz1Vwx0aPpUWz/tUnYYgxqmS1U68HUHTkemWioZkvIxxxBhAu7EPJYjo9B4bYzn3tjhopPh+guUwJKBDiU7PWQtNvNHlxvPS1vWiSjYcoDOZuoM4AANqb+OT+BSA/FpIJaI7KmdJSKodUqYarR9XXe7IcQN5CIC8hqY3scCXCE6yY51to7Zu2jDI9iJ9hlrYyEMPC0L0Q54vHkC52/12tOVRpmNbVk1rfMykrHoiSk0nNmt5yHh3Mk0CI846omyvyvcML/CB4Of/WSSthEI+RUL3jVrPzsecwWKfBD3H3w77dU4Oq2otL7a9VaNo2LkIdRqC47BlTgQdLH8tPgFhfhMRNaPQwnEYDH8neTerG8xD9DWK8HlceemZzuGUW57yyTJ31lfAnKEJmrwlxbYEVue7vgnhLZqdrCrvktavxmi5IyFRohk6xVAqxrNm+AH8/tRMjXGvdUatJ7AveLzLT0dMtVvSPwOZe/mE2w8BniVGi1IBGycfU X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(426003)(82310400005)(336012)(2616005)(4326008)(5660300002)(82740400003)(356005)(8936002)(36756003)(8676002)(7416002)(81166007)(86362001)(40480700001)(2906002)(44832011)(83380400001)(40460700003)(316002)(47076005)(66574015)(41300700001)(36860700001)(54906003)(110136005)(6666004)(478600001)(186003)(70586007)(70206006)(1076003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:30.8447 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 888b31c1-c5c4-4143-78f3-08db5d54d375 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4586 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signed-off-by: Harry Wentland Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Jani Nikula Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/drm_connector.c | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 547356e00341..9c087d6f5691 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1975,33 +1975,44 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); * drm_mode_create_dp_colorspace_property() is used for DP connector. */ -/** - * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property - * @connector: connector to create the Colorspace property on. - * - * Called by a driver the first time it's needed, must be attached to desired - * HDMI connectors. - * - * Returns: - * Zero on success, negative errno on failure. - */ -int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) +static int drm_mode_create_colorspace_property(struct drm_connector *connector, + const struct drm_prop_enum_list *colorspaces, + int size) { struct drm_device *dev = connector->dev; if (connector->colorspace_property) return 0; + if (!colorspaces) + return 0; + connector->colorspace_property = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace", - hdmi_colorspaces, - ARRAY_SIZE(hdmi_colorspaces)); + colorspaces, + size); if (!connector->colorspace_property) return -ENOMEM; return 0; } +/** + * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property + * @connector: connector to create the Colorspace property on. + * + * Called by a driver the first time it's needed, must be attached to desired + * HDMI connectors. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector) +{ + return drm_mode_create_colorspace_property(connector, + hdmi_colorspaces, + ARRAY_SIZE(hdmi_colorspaces)); +} EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); /** @@ -2016,20 +2027,9 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); */ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector) { - struct drm_device *dev = connector->dev; - - if (connector->colorspace_property) - return 0; - - connector->colorspace_property = - drm_property_create_enum(dev, DRM_MODE_PROP_ENUM, "Colorspace", - dp_colorspaces, - ARRAY_SIZE(dp_colorspaces)); - - if (!connector->colorspace_property) - return -ENOMEM; - - return 0; + return drm_mode_create_colorspace_property(connector, + dp_colorspaces, + ARRAY_SIZE(dp_colorspaces)); } EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property); From patchwork Thu May 25 19:18: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: 13255600 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 90CB5C7EE29 for ; Thu, 25 May 2023 19:18:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A825410E73B; Thu, 25 May 2023 19:18:51 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 013AE10E110; Thu, 25 May 2023 19:18:34 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eTYacyj9qZyrarKVMBSf+D04K6Ym5xfIFPyruC+Y/ZE0bErX3dUrWgo1sBo4XK+2YKDUmVX6hXgSdW6kWQWvk1VEL13/KiD18qQUCedJFju1ZLP/MqbXe0DSvG4ZeqBIcjKv2OMKuIsNiRkgg45apmZmtR09kNThABW8MeHn4nl0O3IjLSU1J03WAlz0bhpLQCe9XHvWHwBqddxtgYvfoKKN8C0HtjPesuwidACIKFp/8rlcpcC1L+lYjAse5p7jLRQ9l01WoK5NcA7Ksk6fJZFsVZ9JM5sa64ih+QOAHscsLLLskaLTwuWyIBGKRD+AOf0OibEaHXsTto5kGXp05Q== 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=jt7o+KeQqGbJ2T3VAiKrfGTGtqSEZssui4xI73o1pmI=; b=jZkmFZWXI6dJiTzOJMGo9Tk3sQCUqfPQrwtMkzBjqPxW++wvLRvmycHa+bIVXDjkZK40jcpXElWO1uMy8CocokMTtLsu5G7LBGC2re98yWogXBz0Lv4hyA6oMT0M6Ih1uE42RzzVPmSEd7RprgYU5GEiDtTG3WnSZCtEjB/XI0N1IU2RlwHt+aArtJc+4WwzfvVEnoTOKB7nJYXqDPObH0JTD0yNFRYA10mHm7umpJOGBrqo3e9kHldHCdY7jVkMFwEF3if4tcPgyPMIKKwKdbqNor5NC2qTkewUySyR522K//23k6fb+2SWocqQ8klSk+KoZYcUHAAjogbxpsps9w== 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=jt7o+KeQqGbJ2T3VAiKrfGTGtqSEZssui4xI73o1pmI=; b=F0Utg/0RUDLkmx2YTVqSpeQxklPgKzJ54/+SbB9HmmdKP8CybfErViQTD53FcBJ4rKbDZC8H/pf+VoksmWDTa33XKAeZSndn/sO2IFmO+fvkPUi2aGRxy+W7KYznlWs+sCfsvQxXvBF8wUSWMCKbjVWVceaI3H18jRh8fIKtao8= Received: from SJ0PR03CA0185.namprd03.prod.outlook.com (2603:10b6:a03:2ef::10) by PH8PR12MB7231.namprd12.prod.outlook.com (2603:10b6:510:225::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Thu, 25 May 2023 19:18:32 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2ef:cafe::2b) by SJ0PR03CA0185.outlook.office365.com (2603:10b6:a03:2ef::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:32 +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 DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:32 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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; Thu, 25 May 2023 14:18:30 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:29 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:27 -0500 From: Harry Wentland To: , Subject: [PATCH v4 04/13] drm/connector: Use common colorspace_names array Date: Thu, 25 May 2023 15:18:00 -0400 Message-ID: <20230525191809.3524-5-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT014:EE_|PH8PR12MB7231:EE_ X-MS-Office365-Filtering-Correlation-Id: d4160460-ad58-4d53-e7fe-08db5d54d438 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V5zfR45QxJm+r1Z3CeIiWj5eQtE3OxhUpr15GhfMFn5aZA8UgclaCnRFhYDQHLyZO0wMn4A6PYl3pjnOpM3rFWM2otsj9J0K8O3q0sTpSqq2syr9qPSgJAbwmvbLIsMWbmsIQKBypomdnVsZygZ0lV8nMK6pJ33TyFF9QcoY864xuHIH9jG6mKlo7ZvAQIg3tuGeLNOFOjBHtGFH4EWyV6wkdxvjiHSJKit0dYJ/MD3MU927KRimoewtMSos4fPtrzSvGFhUBG+nLCwns2cgTEPxc7vvoeFFq49FPhs0wF4VS1ER8vaPGhJPQvt2iOPE8VdX/ENN1Dw+pCbCBY1TOj+IZBwCv9t8CTrehvSPdO3BoLB29WoEwfbNxFB8v1rFEowBtGQftikOasZpssDXvb12HTQUk21GAd4+l37qrakauezhubX6INICnpE4KjEr4dQKUG7XqPs823N52Ip77sTbGSXFpINDnZQZJ1sY7IgrlRWjsrhuottFohc2mKtb3WUt60fDHBOL3pN0TCeEXnxwPFvrATKcpz/cF+GNX4ditroHWl7mjonjnfU9DFs0+NxdMpx4bk/6wMhMt9buE4R0p3CSb5tQLLVm5ZZIaZyWjVMPobSDMTsDAUzBDGdnbYJKVYgPniZkvm/WhkrQqkF9QGNOw5iXdpG3gNZgRlWHIoaz8V7FRGRt5HGSwCgKmxwahL1a7tav2hXRWucMTzVrciQ2rqVabzsJpOsjXIEfhdv05WKQYO1JQhxEjlstf20JRZ2zvjdHQQ1Jq5zIqA== 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)(346002)(39860400002)(136003)(451199021)(36840700001)(46966006)(40470700004)(2906002)(54906003)(66899021)(110136005)(82310400005)(5660300002)(47076005)(36860700001)(7416002)(8676002)(8936002)(44832011)(426003)(6666004)(41300700001)(478600001)(70586007)(4326008)(316002)(70206006)(40460700003)(40480700001)(26005)(83380400001)(81166007)(1076003)(86362001)(336012)(2616005)(186003)(36756003)(82740400003)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:32.1411 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4160460-ad58-4d53-e7fe-08db5d54d438 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: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7231 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 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 ee597593d7e6..565311e194da 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -452,6 +452,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 Thu May 25 19:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13255594 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 6C336C7EE29 for ; Thu, 25 May 2023 19:18:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16C1810E124; Thu, 25 May 2023 19:18:38 +0000 (UTC) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2054.outbound.protection.outlook.com [40.107.100.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id D16EB10E110; Thu, 25 May 2023 19:18:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXR3yym/NzE402Qv3zc+q+iFcel2H2cl93LXHdocv34XH8PzdjiPdw73R0RgWtALbx6PSYwx1Wg12Qphek5xBD7JZ588lGGV8aBgZYZx2B2Ger7g0q7dol9Odv+BA9l/nBUfTClS0vYnyQPqu8dEvEVENl50sjTiFkwIb93UlCwVN8PFDnutoLLiGQsLl56Z5X84/4vCDeliz5O86Mh75X2NZYdGaF2ZVV2oco+T+X4q+kx4kkvNxuWgod5E+Et+fijmY/Rip2RoyFNswEFowP3D5Oqt7RvF2EvP9mDIGxyJiJ23wZylN5OEgVOKPRr9xhlVhIBQwQDiAi2nvqRATg== 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=k7poHcbsHTBQNqHvSfSaKY9q0F/ODq1J0sQ0wn7WT5Y=; b=YoT1LgEJ7mJFdvj+0ghBBYtMm1xaE4QpNcr51oZbB/zDcpqDa9Rp+enUZaKmaxnzbFwlPd1iHThars7iY7pgz6Ful3ahd6aGS1neVmtI17RwLBo0lyn0yo4eWAaXwj8Rwd23BqaTrZIX3knJzoFizMcwm4YX9geIAFLb1YeOtxVnsjDil7zCRv5UrYblzJnuMveoCrSLobJbnKLxunaG78I/suG5Uj3cq5+UmyPkFWIiMrwlLmeEf/OHEvajQdhAOg66OzjIgbXVw3EwlNmhm5GJJWTljHURImne2kh7kubTcStecRnbfjsRbr9/TEDoG1Vxht40JRKFRj7g0h0EGQ== 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=k7poHcbsHTBQNqHvSfSaKY9q0F/ODq1J0sQ0wn7WT5Y=; b=V4v/CVYBgDrR98BDp17PMAbzQJ9UvV7Pwo04x8zWU/vRFY1habeEc2S7N40pkcGLov+7EkMcascdgzsJL6wAHKVMcPPWSNLks6MR8Tfo5roqN2Gw1gQjIfeOZcD8aqWAUpQB/5PqvMKm6xCQ7EIMcLYK9/lTMn9pNVhuqf8fwQQ= Received: from SJ0PR03CA0210.namprd03.prod.outlook.com (2603:10b6:a03:2ef::35) by DM6PR12MB4330.namprd12.prod.outlook.com (2603:10b6:5:21d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:33 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:2ef:cafe::3a) by SJ0PR03CA0210.outlook.office365.com (2603:10b6:a03:2ef::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:32 +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 DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:32 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 25 May 2023 14:18:31 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:30 -0500 From: Harry Wentland To: , Subject: [PATCH v4 05/13] drm/connector: Print connector colorspace in state debugfs Date: Thu, 25 May 2023 15:18:01 -0400 Message-ID: <20230525191809.3524-6-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT014:EE_|DM6PR12MB4330:EE_ X-MS-Office365-Filtering-Correlation-Id: b0860c27-d755-4df8-a6e0-08db5d54d49a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W+k6dlHLopg5nDW6erROA3DbJZ+ufDd12wi5TOQHR73Iwbmxo8sleS1cHMQ7zonQ1vyEc+3w9enaoBe2jH4YfWFdbuMp9kx85nQIx6db6VtBUpz/i2vmcOHYRHJh5kWu8swAgttMcrm5F2vBUxahXxgYxRojWYQO3qVdnPCBuS9+e/ttCW2cX71AftDifFlFd65PYf2Oa/2oCSMtle1HgdJFkR0lo+z5FsjH/iNmO3oU1c69fVzpD7a5M8x2k5BTpB+8CEZeiQ2hZ7rdeoUw/IVyw4MLLcC41zPV0wi0Xiw33lYoBzFBkSd+xVwdw0uWzV5QGOOs3ITdx98L1kGBiAwnfu6sBLclz5QWCRvboPatwC2SMhYCNc9vOb5sNQpb3OYNsY8xXovc9Ps8Jghu5b2K28TYupf4ZZZy3AxNUmdDsrv0/NEnE3be9pnTZAd6uYntYsackffrqO6OSWl92Q0Wv1Jv3o2b1/ho7kX/VqlrDq/JBxCk1cQMrcZwhCJSm1bJbz0y9V97DxaqcFDJ5nJy5BxUTRdWl2AWC/If3AiKjOYRnZd/hBS+UJDiTLWc6vZ+Pz9kRg9JWrU0aq0gA+UnydDWisPZFT0GDOIC8Qla3FbHeOkwNjGWZSAFyVkSLxXF2wvhCbd/Ok81fjGhNgywmIq+a0v/cC65Gzib72ncF25iGv6sD1rZvB6T0/Bl0MTPccoDPXOwxFpjwG9+5i5k79ygMBqbAosgtgVjhfz8rjPtYrP/f3nd/ry8GB//6u9FNG9QQXwPwwLM1Be6Ew== 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)(346002)(376002)(39860400002)(396003)(451199021)(40470700004)(36840700001)(46966006)(1076003)(26005)(40460700003)(5660300002)(44832011)(7416002)(40480700001)(8936002)(8676002)(478600001)(86362001)(36860700001)(81166007)(356005)(54906003)(82310400005)(6666004)(110136005)(82740400003)(70206006)(2616005)(41300700001)(36756003)(426003)(83380400001)(4326008)(70586007)(336012)(2906002)(186003)(316002)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:32.7817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0860c27-d755-4df8-a6e0-08db5d54d49a 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: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4330 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 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 565311e194da..ae0b1ee5b99a 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1980,6 +1980,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 Thu May 25 19:18: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: 13255599 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 21CA3C7EE2C for ; Thu, 25 May 2023 19:18:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9678B10E1B0; Thu, 25 May 2023 19:18:51 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 349FD10E173; Thu, 25 May 2023 19:18:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eZjio8M7cutbU5PFLmSOAGW4hLKURp1DuNTKEfTe1P5pKm0u/dLKG0k8LheXw3/tHomSslPmZ6IMtF/EVzNqPHsLFbO2wVAsQhGXZbzzTRTfxbv6YKCQLpv6wHN2UCHL4rwE22Mp/qLq9sm0OVBKJ3A5Kkao+7YmZpI3UQkUnGfHJWf9T+P939Hf+C8u+mZykY0j6shMCinQ7jrYLIsEdPLTPOz0xK9H3V+iK6QKwGdzmlQpb7w4xy+Qbqf1oTziPGVMtQNz1efZmxmy/FZsqsrP4nhkYhBnhEIlIOKkJlMvCjFxYOS8jJGR0cG7zmB7gg1yDQ88MosjKBLmxVlRew== 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=dXmpsiOgg8pLlUlQcSAxHu2f7PYjAQ38vk77Xmu4LXk=; b=a5VBmhC0B82E92gqQ79QUMG44uQ3txK4dzX9F95YR3vRsgmGdSNVm/bc58QS7OHt2FKD4T0HV1E8C2pO9NEhSdhVT42SmBOZNNqhEefLXhXhVkHYGIWLZXewaNCMkXSUbzUmRP32Fr3wd1SzahX5OEtUm8VHgmruJ5stkxfu2nvwsV5ccQYXUXQllGcKofWGmeK49DHhpQKU/cvwISyjM4DbQXztXrL7ReUq6moJv3efRsmdXQmtGBsyl93eafef1RSB3laAGIfT2XrG2EpqjcuTNSu77xsic30BGHkUeAd8eHOiL4+jPoJRYUJs32A/9Sf9S3OVbhJSS7ZP2gyvjA== 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=dXmpsiOgg8pLlUlQcSAxHu2f7PYjAQ38vk77Xmu4LXk=; b=x8Idp5HlfSfFV8lpSK2NZx6CMCoBa17CH9+KSRqv/bWxgPqY7c9H8NadY48xCo/dCgqPr/3VjTnMKz1ZLdS+mQoxABWZWlzq3RCsuduv2Uq6ZPwOeCsO8KGO74x3JmeSH7IpgZ34GqITl586ZapSve1PMIUQiIfbIVuvtMstJXY= Received: from DS7PR03CA0110.namprd03.prod.outlook.com (2603:10b6:5:3b7::25) by SA1PR12MB7101.namprd12.prod.outlook.com (2603:10b6:806:29d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Thu, 25 May 2023 19:18:35 +0000 Received: from DM6NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::1b) by DS7PR03CA0110.outlook.office365.com (2603:10b6:5:3b7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:35 +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 DM6NAM11FT057.mail.protection.outlook.com (10.13.172.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:34 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 14:18:34 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:34 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:32 -0500 From: Harry Wentland To: , Subject: [PATCH v4 06/13] drm/connector: Allow drivers to pass list of supported colorspaces Date: Thu, 25 May 2023 15:18:02 -0400 Message-ID: <20230525191809.3524-7-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT057:EE_|SA1PR12MB7101:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c2d1860-7726-4dea-02d8-08db5d54d5d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZMEhnHV9xOnF2orfFCgWjVF7DUCMQnJ+BSvUldEgbUB6dtgkkUJEYOWvxg0OMJVh2TG063cpP3pfZCqbUH2Sbnm1o3E6GzSI8ojr7pO72xxx1FgiW3uhe8HtYwxwkBx9PFjuHvDd0FW9B5zRmMS1CfNznufFZqOuRYuVrs3K8wveLmWWppBbIW4Vq6gRonQH9H6tJDeOVS968Exp55PaqBG9Q0ssIPphTX7fQbZ+6eVJdA9aZ+6p/FUucy//VbFT9f/weff4LDpnuuZPpYUax6xP2dyorMxLAyh+yN66xWXUCFMuNQqwUECEckZqPM5QwWd0sAzy27NTXjnbKX+p8Z3vsC+3eZ+KgUXC/gQEor/JwHaLuT+P6zJixEkint9wU6TxcfYQixa2Y7Yexc1z1eMeC4t8Wha2Swz/DEgRpWhQ5OpygyutiHB+Bb2AcaG+P8Vur0MmZ6Y1UpsahED9VDp3esaKJgXK/dpyiDkZ8RiCZLG3nv6SaDONloUgPXq4lz2yyrs7Xj/nLuqoFn0pFFVV/PP3UQrdl8zn7jdL5IePYJAN01R722qKMbKfTVi4UTOMY0oZnvz1XI7UXiZOG7MsNoohJUY+bpjoa0tHCqV2Hrpc+jFfrHJFhZtazZWN+QOskZedekf8AVSYBQpF9AKJvtjoGguGNwURb+qO1595uczsRuWtAn5WBSTrGulEHHujfiJZu0kIOOS3IlN3+xJB+ir9bexUyp1H843rxIm+1XIkeOVzrnVfV0vlTRiACpN+xd6SHbIcJdsU7A0Lvg== 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)(346002)(136003)(396003)(39860400002)(376002)(451199021)(46966006)(36840700001)(40470700004)(41300700001)(2906002)(40460700003)(316002)(6666004)(82310400005)(5660300002)(82740400003)(40480700001)(81166007)(8936002)(8676002)(36860700001)(2616005)(356005)(186003)(36756003)(7416002)(86362001)(26005)(1076003)(44832011)(110136005)(54906003)(70586007)(70206006)(83380400001)(478600001)(426003)(336012)(47076005)(66574015)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:34.8353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c2d1860-7726-4dea-02d8-08db5d54d5d4 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: DM6NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7101 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 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 ae0b1ee5b99a..abe775e1382f 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -1896,8 +1897,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 Thu May 25 19:18: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: 13255597 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 B6A84C77B7A for ; Thu, 25 May 2023 19:18:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E37F810E19C; Thu, 25 May 2023 19:18:50 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 80A4210E11B; Thu, 25 May 2023 19:18:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NsgCT6UFhIKokSMEChwdi3aH5WZ30cjNDOLLyQjfaaVfyyur0sBvwViWmz0pubd9uwdaSOODfW54rSaAxE1u2YLGQco8TzqvOmnrhq/I7TqR4X3JaWZmNFwJjH02fgMkry2J0zF8GYsKlRWak23SScwCsYmFc+x4f5L0GKzbm5otisdvaFk3asmiRVzzho4PPKSDNHu4dudJpiTsWZzQN5sofUWvIQ1bw7xLja6SMohiQp4Sn1gfdNOo3qouYBRxLsSfWu7XJee8YjHZ50zux6+xHCaJq0TT96l/y4cpcdB12jGqmQgzV4MnSfxvIOTix24cs89kcjGrs123u7qkLA== 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=/TGgDLlQGop/8Pba+oLnlxyrUfbDWpKkKoPAY7IEfn0=; b=dLP+8GF4VLm9X7H/RimHmNm5TdhXQFP+491IiGcB35wy/cEOjj8AMUHw8XjgH1F7ZxWlOurGSF0S18Roq4MQvW/8zRzKyJNtrpSHSiknVQAssC0mgk1H1FJyACU2L3P410Th73b7vBBYVL335bKnD1IsSrDOT/2b7d/42UhjB2YW9nLHJR0ce0sWS1Muhsg1phRN/7bP5CX1m5u6XWkg2IWg21IIPH9EhzL6Go4QeXbsorCuJgmeQCEZBHnuk9Wd6oL3GgnE/oPWYlznC6fGou435HlzzOes7sF05BOouv4HhZP/mS4yedNiu7uBD7XfBgpMEDd8toWsBFTG84xyHA== 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=/TGgDLlQGop/8Pba+oLnlxyrUfbDWpKkKoPAY7IEfn0=; b=EGYwqOk6QLpXsQ4rIttgdHSJ2a/4T7UMlGIQyl2qbYnDfsyPPVydmwj4A4uST9WoUs7bont4Lm56ECrJ6LtWY70UBPPKBOnWMRCpaRdSgyIhvzBuRBJ6MpRsSv9aC/pa4oX7LjFeK67rPde49KdnZUUO1xy0zqSEk1zKTQwDB3Y= Received: from DS7PR05CA0055.namprd05.prod.outlook.com (2603:10b6:8:2f::15) by BL0PR12MB4961.namprd12.prod.outlook.com (2603:10b6:208:1c9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17; Thu, 25 May 2023 19:18:38 +0000 Received: from DM6NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::aa) by DS7PR05CA0055.outlook.office365.com (2603:10b6:8:2f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:38 +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 DM6NAM11FT094.mail.protection.outlook.com (10.13.172.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:37 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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; Thu, 25 May 2023 14:18:36 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:35 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:34 -0500 From: Harry Wentland To: , Subject: [PATCH v4 07/13] drm/amd/display: Always pass connector_state to stream validation Date: Thu, 25 May 2023 15:18:03 -0400 Message-ID: <20230525191809.3524-8-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT094:EE_|BL0PR12MB4961:EE_ X-MS-Office365-Filtering-Correlation-Id: 4161c961-1131-4f06-b125-08db5d54d7a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8a8okNqnoRAp1QLX/8dh+yn6yWvA70MeJ9bjwn3MfMlpbL33qYA+09w1/FPhDxNx5FpbYYL6T9h6l1Xkw+PkXjoIANPBwoTaUqakPsCCJd88ATKAgTOUKKRtZABLuhb0eh/Uc97w9EBXIMnnzsxl4vNZPmohAMnB4mVLmFIm/Bi51rT0Bzk+entYlKBi9tDjixhwuHBOfEmF8PPalMBJYxQHXbeytVIH0/e/SDCxHL5YW5SA18zYHjxgBDzuul9qDBExQbpc93yj6gTKCUzHK6k/fbD9LYm+ZLkR6PhoPTR6lcVqUbOZiTm+afKqoYV0VGdTV43B8xNSMrfJAKyYZKtf1wnRt3kWOWJAEEVEuZQkQDVPlu89j4D3t9kD7Y3kwZLj6Ouk2i1OO4UzZonvSTqWO+jKGL9tSvJL0dCDnjpV4eHJgwZc4ICfZVn2VNbeR1O2/mIrb264PsqmGtKI2fI2gLcs+vOivBbnqoIhef2UHCt2KoEH9hyv5xjPFKXW+rxhz8N7A8M4ziI6rjFVYRJDBaArIR+LyqS1woS3yric51P/N8UkDTESh/G0Ks1QwOL+mECNx0ysxIG2pSoSgcaTbOgoXdwnKkbg7suFABrHpPO+hkqyDu6rIhCetZqEMAB4SyFIfiWrJGahBjGBIGLcsGcUdWmkE066AOkCe8dG1niWQokaPlsUW+pbTfOpXYWC9Fh0QVy9HdzGY3ieA9Lb3KV5YQj6Yfp/AZsTsLlkv9AVkHE8nCOTgtcls/DKla1KXTJogDCV6Pnq80S4Ag== 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)(136003)(39860400002)(346002)(396003)(451199021)(46966006)(36840700001)(40470700004)(110136005)(41300700001)(70586007)(70206006)(54906003)(40480700001)(8936002)(8676002)(5660300002)(26005)(1076003)(44832011)(316002)(4326008)(6666004)(478600001)(186003)(40460700003)(47076005)(426003)(336012)(2616005)(2906002)(83380400001)(36860700001)(81166007)(356005)(82740400003)(82310400005)(86362001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:37.8741 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4161c961-1131-4f06-b125-08db5d54d7a3 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: DM6NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4961 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 a69f4a39d92a..ca093396d1ac 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5946,15 +5946,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; @@ -6596,7 +6595,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 Thu May 25 19:18:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13255603 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 D40D6C7EE31 for ; Thu, 25 May 2023 19:19:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9F6D10E740; Thu, 25 May 2023 19:18:52 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::60c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5787C10E198; Thu, 25 May 2023 19:18:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFIeW1bbNt0PXMffqB+B+5N5vF0Auqh35nxPCijci93h2PDVAH8i1o8r/O+kkJZf2+Q7DxB8dj5yAOfLOlsk5YI8cP02WM2rKuNrFDjYQ0V/P4R1IP7UTemflkL3ozKfZM1D2LMkrJZjTHJGITyhMInwfMaOI+2S2G6ysUJePnldtaDSInQ5Gs637exIKqMkoony45KcdEbw65wqwh0ny5mRNDQ2dGU13RdsRXc2A7vw3MDN3uk46+6QbmDEDajiBw9Y2SOeHXK1TUrLDHyaFOQbtCLHQiVq5NPxrC0SCktgNnl6IrbNMcRkgSSYmKwEyfjvlJVdnnCB9CIrP85cIg== 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=/WmRgpre+KfPjs2P3HDEMwQfwHlhytjuqJyIRhm5X1w=; b=mtwNPI60njBwUqH7ecMfIhKIFv2vlzeQevEOkH5WbrRqxExvLEK2ENg6N2K8+xB9DwAe61E2xIkVaONuHdfxNgP9UV+mJlInH0/1HuwNkEb0OP5jPo0QYdKag1Nu8P5Mw6c+XGFIM9drW+lkEDhIiqlgfu5L1w5nN4j2azIk9Q16t2uX9kTRC3xs1z0sZ2Z8ZmX9XINPpdcpZRaqSpa0Bmski71xsPyLtAl1aOzlh8O7bDpAd2H3yMInYrcR005hPQpZF62phK2qeKK8cRYQygSc6TFrZro4ofx2qQOwxjNPWtqqwfH/r4VcUXckUFV389k7PYA8ebAeSwE5WMGRUw== 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=/WmRgpre+KfPjs2P3HDEMwQfwHlhytjuqJyIRhm5X1w=; b=3qvukf9FYQZTqENdbzXyIGUtWMw2fKm6A2kTOfmgQcqxLqtlZCR0h4WA+MPpIAVo3np0sOaJChPv50ZKWogJPe0raCkKOe4hbc05IeVaRWxaS64OLyWGMlz6mtQD6/Xb8tRWv0iietVW0jXeGhyFXLmcghXf4ZKyTw156L4FCzc= Received: from DM6PR02CA0144.namprd02.prod.outlook.com (2603:10b6:5:332::11) by DS0PR12MB7945.namprd12.prod.outlook.com (2603:10b6:8:153::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:41 +0000 Received: from DM6NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::51) by DM6PR02CA0144.outlook.office365.com (2603:10b6:5:332::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:41 +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 DM6NAM11FT036.mail.protection.outlook.com (10.13.172.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:41 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 14:18:37 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:36 -0500 From: Harry Wentland To: , Subject: [PATCH v4 08/13] drm/amd/display: Register Colorspace property for DP and HDMI Date: Thu, 25 May 2023 15:18:04 -0400 Message-ID: <20230525191809.3524-9-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT036:EE_|DS0PR12MB7945:EE_ X-MS-Office365-Filtering-Correlation-Id: 3292810d-f6cf-428f-1505-08db5d54d9ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QrTEVZObMhiYv9SG8Kr1UgZhumZqhBrxGqVu3L7R+z1yxjeUZL+P/FshVcaFEv85jT5K/IOzip1PaHGiv2/fCRgkW5WknfNWF8cWwHgKfY8miYeyx7oVvjKynCi9WxUpYDnEGDzqJN9mQg3EPumgbeqga0Y/g14wyXOSFn31V22IB0KXSOu9EiPfKMOug5bhJk52mllbHvJthGchW1X1AzPOxln+KtFkQk+uhozVU677p57spM46+7ouhjMTEL8H9JnZ+RRDG4QhBKnukf4BZ9ipYCvHDTderHDuMLk+cln88hXDHwc2Av+lHL1tKRqUwKAxqqkbYFbFZhS8t/UxVZLsNpFFOkLlIwh0Pcvr7YkkhJeJMFBUB+d2RTT7Bikr4s/MhXZXpdWh3Tm+0oqm/lFU0hpBWaRXhe2bCOZ4Y7AuOXFfqejLjBewMf4jmQ4KmXaupQb7EwwhBqdXr3j9/6MTX+n77huwsMU8sEysyZAQ39AfJWacazBShsNkd68R79o3vhxe9gyi/TIsFLIravoMoTrc1JexLamY94VMojgLvIecmkKY8gRY6Bs+ykCN8VmBQIU9OkysRobtO/F5msHfZiiQ10SleO5z9t3S+gjFvHo7jSipB7KVJ69zmltPd9P3QQrPyZUM72Yu6z7tWyxgw6XEbXTQlt6wPPLG1iKx1H342kotjyGYNxHTFrtbmzTLHU0ys/MdiDidtpDfn/MXyMa0KZoB+YBZmZTpTyQyfPP83+wPi16xuSkjJYkWEpcZDVLbyQ4x2pAJy6b+6A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(426003)(82310400005)(336012)(2616005)(4326008)(5660300002)(82740400003)(356005)(8936002)(36756003)(8676002)(81166007)(86362001)(40480700001)(2906002)(44832011)(40460700003)(316002)(47076005)(41300700001)(36860700001)(54906003)(110136005)(6666004)(478600001)(186003)(70586007)(70206006)(1076003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:41.7105 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3292810d-f6cf-428f-1505-08db5d54d9ed 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: DM6NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7945 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 ca093396d1ac..dc99a8ffac70 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7238,6 +7238,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, @@ -7318,6 +7324,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 Thu May 25 19:18: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: 13255598 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 79036C7EE29 for ; Thu, 25 May 2023 19:18:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64CC410E1A0; Thu, 25 May 2023 19:18:51 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2063.outbound.protection.outlook.com [40.107.244.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id C49F010E198; Thu, 25 May 2023 19:18:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bkS2f+9DCk8md5/k92X+VIDBeDSpFdPg3Tr5p1s/hkXYXqgIlyDshdKT+ssHaZNMGUGzD9RC9A9EE6O0s473SETPvZwd+bekmxfnesmZQse4nCOhSIKPSPJmA8IZQJ8EJJo+ebPmuLYwCIpbm0ZzCBbuCujj4WP+AiTt5s5TSI8Pl8haK5CDbkpUQVOMWUKZ6uZl9qf6xTQckr8pYewEiwmv0y6BxWLGuxH7SpanzlCkUga2C4Y5FUWwOL9zQwKWkTFabqUm/Mv1AkQ3K+v0RDfGPvPtV4fJ1rwKYGb9G428yZJmaFFP8xaNe+20e3sEEMwM1nextKvzOmIb2VnA8A== 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=76WrIfdzw+EEEFvnQT0xOobgyxZnF2Eeb4GP0umFxhQ=; b=Hs40/IwNLfNzmku6UcAelbgfCy1/e+PCSZ7SzG95vU19PbmOnRqRjO7b30eTTdLvKtNb3fNFP1fDvVrc/oW6SkGAxAOZ5vINfqrEK8xRpxH/E6FFXSoxBEygfePQmQmX3XFLWgdMg01a1kYNPKYFo9ishVlXUwqE0Vdfb2aUTS3hWPk1XWjDxd9RcwBtIxAcsUwCP7RhsSMdlyk9s7PQJgY46Hs2zkBFZaNzcdJsN6ObCDZLJPELJ9Rq46JgfuZpB5DS39XYJcC4fwv/iU8zchRYgo7uhGCYOrwXW010URxnl6X2KFDFU+Hlz2QdVXGOxIlXtImDFPrnsCuQMyAYEg== 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=76WrIfdzw+EEEFvnQT0xOobgyxZnF2Eeb4GP0umFxhQ=; b=37eE1iIBXA+tIu5HQvqvYBr+Pjb9pZEEW1deHoXlTkdPMDv6ZI+IOnpp8GE1bi5WRl+TnaLDXNc/9zgKPi6RoE0fdCWqsTc6sGfykf3y1wSNwRbPHQ4MFfKgmd1acDgIXxyFSnjOPnHN6ksqQ4f/SwTFPXTO5i7xw/AXhAlLAxM= Received: from DM6PR02CA0141.namprd02.prod.outlook.com (2603:10b6:5:332::8) by IA1PR12MB8407.namprd12.prod.outlook.com (2603:10b6:208:3d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17; Thu, 25 May 2023 19:18:42 +0000 Received: from DM6NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::56) by DM6PR02CA0141.outlook.office365.com (2603:10b6:5:332::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:42 +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 DM6NAM11FT036.mail.protection.outlook.com (10.13.172.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:42 +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; Thu, 25 May 2023 14:18:40 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 25 May 2023 14:18:40 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:38 -0500 From: Harry Wentland To: , Subject: [PATCH v4 09/13] drm/amd/display: Signal mode_changed if colorspace changed Date: Thu, 25 May 2023 15:18:05 -0400 Message-ID: <20230525191809.3524-10-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT036:EE_|IA1PR12MB8407:EE_ X-MS-Office365-Filtering-Correlation-Id: 15923766-50f3-4064-4c65-08db5d54da26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dXg3uYeGxBHz6lMYp+8LZxIJurh5XZ9zK5h6DQP/2Wgq05lnBemmAFFx5n9C3v6Gp7iZdi1O67qdZpzwZvlCDWDcrFIil1SYfS7R+5vLu9kZglb+HEEqeoTFWoL7E1ofgmAZYAgSeT5dqsDlrtWvLwGceKb0jJjDWXIDz7vDlNsxXH5PPSkXywVQ9g36hKWZhtcvyLohIOpSV/xmtekmQEHbH0U0ukDiKNJd2sZcAtAE0DAVDBwoi8t/6GP4M1z65bIxqnMFfHfUF3YMLAPL7GKUDEBw/uvBkR/g/GlRVz3Eh27ixyYMT7xFSXefbZkm/YXrqGMwEDYhY5tRlam5SC6ukRyKYgSzDC65l7LgrmaWcuHrJUKwN7QTZOhP2W/Kax2wK9JRkex5PDwUMpOoMdglpTEMZDSEvTlM0KxCamu5FRi+e3b/ewAkxW2MGqfvw6kQWhuMyuTMXiyNuSC00/Wq2Oxq8RZ7S3/r040mBt2HobBsJN0ljn7ajGkYcAeZRjxYpb4+y20fA2xw/eVJ5oGTq1biE2FlmxgbgHqiZNkumPNqWe2KCkc3SvtJjJu962QrllKOrI97yjLyLZN7DOBV1vFcAYBwmVXJqMjKkIEV9n2J4ZibKg2vt0nTX+3g4Nwghd1l+5Q1afjwivKxErQEm1uSlbOsXgNX6c3XtLIAonFId63MR5KWC0N+egUSEflDky3XhbrOL2A0y/mVVeX3ES0Ruxh0g/sn3sYyd382itPJt/6sVW/mYdoeEwzQd6B5s0Z2Fa7ims+GHO7krQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(44832011)(81166007)(356005)(186003)(82310400005)(1076003)(336012)(26005)(82740400003)(426003)(2616005)(36860700001)(83380400001)(47076005)(2906002)(478600001)(86362001)(6666004)(40480700001)(36756003)(110136005)(54906003)(70586007)(8676002)(8936002)(4326008)(70206006)(41300700001)(316002)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:42.0855 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15923766-50f3-4064-4c65-08db5d54da26 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: DM6NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8407 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 dc99a8ffac70..5c290e6aac46 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6691,6 +6691,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; @@ -6713,7 +6721,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 Thu May 25 19:18: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: 13255601 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 E4F45C7EE2C for ; Thu, 25 May 2023 19:19:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB20110E73D; Thu, 25 May 2023 19:18:51 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2046.outbound.protection.outlook.com [40.107.223.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62E0C10E198; Thu, 25 May 2023 19:18:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AywUekmcKMnjj20R6Gw/KKF5V6pf7F9GoFlnwJmrWTenCAAdfoW4QkYj1AYwpPzaonlJxonX6vcg6DkNDQ/KDiaqY2Y+wedMM/aOAB3Lk+aSpFfv1dX6nuaMobc8Q+qzdwVBQhM/i/GFLKXjZzHlH1GyvF9Iy5Y7ptajHvCmDerRk9oNx72nQTU12USAPpGNon2rYZJ7ZocIqE/C30+feEZVuv7c7gba255P+g3eU7UPF9Fd+IYGZ771Cj3haRgg33Hu60MzPy6nf2vRonZp0YMtG+/lFhuz8xvkAqLfIq9JXSqLgVARyz2xCfpAihHQUq8F+AWKsbJRJJJz5CJUPg== 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=Z2sHMYY6fGX9wd6o4g7CA/0EkHznV9Lk/kF8S+WRegw=; b=K+EBibk3FetFebaz4KMIAduDvMhUXzSU3jKhDqO4gA/gk20Tx9y2BNoUf/XeDgZ2JrSDAhFO7nscKxmOhSRxnsF83dlx3b2A/3gTAiAF3O6DtadQE6U69l6u4LwPhWD/xzvbBN8ZTG1Ra0mesyD8UlCkr/4MRQaT9SBDDmrsk+ivD9LwpOcdd8bFcaKCu3TKbt70yxavtYgnc2zDPKTyHmfxN2UmyEx4Iq5GIElamXIkqbkr9HGoBX2xpIu2x6t23CzM9ABV1qNNjp7zh5pXdTedlm4ZJCmi5qsv6w4S3r6hYHGlciYrBumj9h2PA1ESF38CCGIZu91Qs3zGv3GNlQ== 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=Z2sHMYY6fGX9wd6o4g7CA/0EkHznV9Lk/kF8S+WRegw=; b=TJROhZdSkeTbtIJzRfYUx1+RQt3VB76EOIwU28MzfbaToH1rmkj+Qg8iV49zABISrAFxellxnBPwZ8shxpwTu0YpuwD1VEbKmWasBEeXvnv6mLJss7X8XhhrlVZOUoOXlX7U0heWE/PAaDx2MUyEa+d3hdbl7SvqFvRzJhcZWnU= Received: from DS7PR03CA0186.namprd03.prod.outlook.com (2603:10b6:5:3b6::11) by MW4PR12MB7430.namprd12.prod.outlook.com (2603:10b6:303:224::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:43 +0000 Received: from DM6NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::d0) by DS7PR03CA0186.outlook.office365.com (2603:10b6:5:3b6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:43 +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 DM6NAM11FT103.mail.protection.outlook.com (10.13.172.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:42 +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; Thu, 25 May 2023 14:18:42 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 25 May 2023 14:18:41 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:40 -0500 From: Harry Wentland To: , Subject: [PATCH v4 10/13] drm/amd/display: Send correct DP colorspace infopacket Date: Thu, 25 May 2023 15:18:06 -0400 Message-ID: <20230525191809.3524-11-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT103:EE_|MW4PR12MB7430:EE_ X-MS-Office365-Filtering-Correlation-Id: 1de5f83c-79d2-43c2-f62a-08db5d54da80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bJ94TAnQ9Rl7fYthYvNYu8V8jfI8+ENEpEqNbgqTSx4Fh97mb2/AQBN5luMPyva55w3CytXmxHvm1yxrKAHOw6PzicA7vKdsIsgaeXxgBV7F+fpnB2/xQLKciWx9chIu0yG2pphj1olQyEWohkOYZIgCx3KkHatpXZzFkQHFP4LD6ZQVGO3sQLxg8Z+m5p6A6Y4Kd7uMH2EacxTEXT9mb9qewqe6/qHEfwd8kt20htVgejBoZ3M3LqSOx+kX+SZDz5tJxFfhTDsknEym/H3iloYg8AF0OVyV7lb20Qoi0Gfxue2eh9UtwaeXwzroHQ9EFUeMbB3EUJ9UpG3xBQZ3VKob1hBE4X7uMWnZzWJ5qYqMgRcsr42S/w1dPbahetJUzKiDJnF1OKW49N/z/Og8NTwCKemYuY57N/WbQ0wtGyDa3i+8Ij3UFfWT3KqRaf33nhZtPs9r85O4alJCBXf+7JkpgMWSOuV7Knhax7L7ZRDghQQQAYR8YmY3z58bkmrpzGA2ngKMTFRs2O4GhczELooZanbepw/XsC92VeJoozGF+DzRQZukjidPb5SfaO/Wq0sofG4nIDJHiyhWPSaqFBr4zNTLS1QiaBmHYcPqcVP5CgabnT8t2Ai4lHwnzUie7lCOxHikZVE/cBWO0ShQoQZzNzcrr1z9c4Jt936N4bxzl+hgDpogRTsS+3PITfZjSMWenOa3rofby17O143m6JO2watWqTonDLFnpva0hdk2YMb/7HeCdOI0Ie8syK9qIEn6X8cQR0DTEGlycPR0cg== 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)(136003)(346002)(39860400002)(396003)(451199021)(36840700001)(46966006)(40470700004)(8936002)(8676002)(82740400003)(40460700003)(81166007)(5660300002)(356005)(186003)(36756003)(2906002)(36860700001)(86362001)(82310400005)(426003)(336012)(47076005)(26005)(2616005)(83380400001)(44832011)(1076003)(40480700001)(316002)(54906003)(110136005)(4326008)(6666004)(478600001)(70586007)(70206006)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:42.6796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1de5f83c-79d2-43c2-f62a-08db5d54da80 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: DM6NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7430 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 5c290e6aac46..a8de26f09806 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5330,21 +5330,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; @@ -5357,15 +5380,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; } @@ -5504,7 +5518,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 Thu May 25 19:18: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: 13255596 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 EF1C9C7EE2F for ; Thu, 25 May 2023 19:18:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5CEF10E198; Thu, 25 May 2023 19:18:49 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 40D2410E198; Thu, 25 May 2023 19:18:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=knVbVjl8bdhgcntWoa0pKFiKTEBG9fjabT0UmUC3uNpraXDJmsqxrIBmhv/3mpmtEucmEM75nJtL63u1l5kJfy0vBD0g+EPLPXnJy9FBk6TigxqX2TIkZqVi0tGTCa25ERvE6mum4Sdc8ocnktumlHsd/D+TP4SWaCP+7kjSRjyO4d2+FdBu5ahfZ7rGGv4Q6fstOZrxGPt8jZZ47W1YEPlIc5BFaLKZiv7i6OZJTUnlUaWIS7SeOpf6xM6K5XE/KQs/0dALYzlzFt2bmZI7w72TTU16KjkpC2g7NpPCYL3lSmNJegsbjwbEP8Bxg0E5yOlGtEcZ3rtkYEzo5Ea9aw== 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=Mnd+lqY4iPtExegXG4xgCzFilvq0CDTJj12ri14AR0Y=; b=Xh2aXyIw0LU5XSabc4C70k0WFN9w3ipjWA7ixQCmevQ5uFUfd6qauazX0gOaHI7wkpJJ8TUg9FC5UGvOyKFspy0YbYK6zf8eQpkrVz7DcDR8eKAOpUji0p+xziMPofPtlBxwhLU9Fmj6KrG7oi9n9KZ8oUGV83ModWsiifUON9m/v1jjUE7NQYNURuh+cojHJAiomvMx8THAo6lIdH+/PZyMuKlpsrTL41oSNWdRlKjvWCm+o6ibWjlUiccMIOXqIqQ3D2j7SibpPWzhjEmME/DpW2zignJb0f1NKD4hwu2tpQxEqTvzQNhM2CmPe8LXF2oxCEsMhgyLQA3/AHtWdA== 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=Mnd+lqY4iPtExegXG4xgCzFilvq0CDTJj12ri14AR0Y=; b=4P3ExYCSm1ehQRtlYixhmnyQRh51+FyDbxHDO2g2psdqRHkUBa+Q13KaHuHPpq2Gtps0gmKT53FDQEBCM86ailCF9WisZ3YgKrs8Pl+bAbUVHyJlOXfGYRtvEkoeiRztGzfbRDJCudB0Jmwd7kapY7TjBA9N8NKsrBKXchM8tHw= Received: from DS7PR05CA0045.namprd05.prod.outlook.com (2603:10b6:8:2f::7) by DM4PR12MB5309.namprd12.prod.outlook.com (2603:10b6:5:390::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:46 +0000 Received: from DM6NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::79) by DS7PR05CA0045.outlook.office365.com (2603:10b6:8:2f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Thu, 25 May 2023 19:18:46 +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 DM6NAM11FT107.mail.protection.outlook.com (10.13.172.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Thu, 25 May 2023 19:18:46 +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; Thu, 25 May 2023 14:18:44 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 25 May 2023 14:18:43 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:42 -0500 From: Harry Wentland To: , Subject: [PATCH v4 11/13] drm/amd/display: Always set crtcinfo from create_stream_for_sink Date: Thu, 25 May 2023 15:18:07 -0400 Message-ID: <20230525191809.3524-12-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT107:EE_|DM4PR12MB5309:EE_ X-MS-Office365-Filtering-Correlation-Id: 7848b3df-ef5d-4fd1-e3c0-08db5d54dcbb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2OJuI+IAucuY0fMg3B81UoJa16Zk4uA+fIK4LGddZSIZGe1t/hDtWMIphGjR0gXWPK44pq3ms6gRDPEInfZpB9wfSNATRNTALnpjX5N3Xl8bHmrQHlJ2CpLjHj71EMPFeNvKSEJP6QyXLh5pj2DW7vnH8mwWj0PoqYPCcP7vAj3pjwDGlz+zvFw46k/nq00AYz9qY9H6pySKGrwI4d1rFkLvYp3lBnG0/+H9V0ykX0f6N4Wcbb8GvuoafxDwgxcwO+cM44IcGoF/stecCr24b37NfXjqdX/gP1rduQ6+8g51g5/NvqpHtPmZSGqlEqHfIKeqtzUDKfF3vkjj8/dbKZ+uZf/uXcW5H6w0EFkcGBIFey41Dxe82jMgR7aOREIuVmSe9b4ki8IT34Mkx60A1ofAvvHcqP7Vi3QFZ373PSIteLByuF5DhPqlKCjNB4SdfAi1bqz0b2OJ+C64etauXNMQnqBQrMEXmRTpQN51MsJEfu2dJs1SYyGjY1AXuTlDbenUi9ByUnK0hc1FpMgH+LHLaRTIMdNYke8xIbCX8J8cWb7Zo8IIbCNVGnOahBHgSARouFQRZZVD9ts4rPoC8zkAZM7x6dLf7ZOpK7dDEtBx0PD6XJEwRZz3QbLrpKZHwUPbFW9vrM8zKl9FvqGOTRt3ytXhv8FXj3MVIZjJpEvwog5DdS/3sgNbEUC8hf0CWuoQ90NR+a4G9IkKfuP0DY8S4IBfsgWNbHW+xQjwoAcT41V4uF11X7WWklENYTe9qtTwUpuqFKw4WF0Lqpt6Ww== 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)(396003)(39860400002)(136003)(346002)(376002)(451199021)(40470700004)(36840700001)(46966006)(8676002)(6666004)(478600001)(110136005)(40460700003)(83380400001)(47076005)(2616005)(426003)(40480700001)(36860700001)(86362001)(82740400003)(356005)(1076003)(26005)(36756003)(186003)(336012)(41300700001)(81166007)(8936002)(316002)(82310400005)(5660300002)(44832011)(2906002)(54906003)(4326008)(70586007)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:46.4213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7848b3df-ef5d-4fd1-e3c0-08db5d54dcbb 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: DM6NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5309 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 a8de26f09806..4e96a34148cc 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6046,7 +6046,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 Thu May 25 19:18:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13255602 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 CFF0FC7EE29 for ; Thu, 25 May 2023 19:19:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF25910E73F; Thu, 25 May 2023 19:18:52 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2040.outbound.protection.outlook.com [40.107.220.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 328CA10E198; Thu, 25 May 2023 19:18:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eP9XF4i0gSXLcu1t0nnpo3NmVAXIDPBYxLeuplRNnKEsjCGwrQqlx5opT3OrnH4kFtSgOaB/ulPhkeCa8+HV4PhOZIKblusiTs/zdk6ixU/C6M+Cgz2WVUirbIfRPhpOSk4n+ZAVea/b7f4qu8v8Aeoh055VeFy37XWeVTOq45NHB2ryKTZSDrZ6+nxe4OoV+EKFswX6QWNiSKBAnhxwnIflgUpKjecbdEAU3fOeJw02b26/stYYmi5xg9BEEzoDQ1tNZ2E/tdo/2VDkLaii7zJrq+JEUHyHuG5rmZ0E6ylaQcoNUr25l15bhFrP+dPGYvvLAybk0qcP6/+SIC8CLw== 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=UGkKQhkxkuYZmj5Eh9KNYBFQbS7/bk3BbIlCZLMoNwI=; b=iOdUugGo3sf379yZGU7+lbeBPtmC4YbPCIz+DOGDnlLTge2y65hEEAyvasX2hKtPA7VrszET93gyDzv35Gkuu88L+1oCbOU4YDmzTe/7mdcubgUYRkws4xYkOh5TZRVFRWSMrKdYAjX5llWGuT2SoEy100MMjfyo7IzgptZMD25DDHGoJuuG6TVfDieiFTMUwlzg0LwsATRB2Ide8EclXBqe7slehwwPw1He5q1O52ideQi1KUEmyJio0kdSoIUfRU/I+e9apedB7WsfHQNmObdOSMrBA4jITm2eiegAVR1VdwqaVcD5f47PT814ZYmREKL1LD5f5yk6NzqIL7ZrSw== 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=UGkKQhkxkuYZmj5Eh9KNYBFQbS7/bk3BbIlCZLMoNwI=; b=dsza9sy8/7uYKcj6YRb7tKD/wR67JFRTYkTbY9hJF06oxHe2yrZyNWXUJVihaxKnKbqXRo8UG7CC1AaFn1fJflqpzPKCSOD8rmt96hUZbeGNf8Yyxo4dA+OwMydGzRxcFaoIqxgdEXdYDxH9sfLSP/jDXC09MJde6RVptFQAfNI= Received: from DM6PR12CA0030.namprd12.prod.outlook.com (2603:10b6:5:1c0::43) by DM6PR12MB4418.namprd12.prod.outlook.com (2603:10b6:5:28e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 19:18:47 +0000 Received: from DM6NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::60) by DM6PR12CA0030.outlook.office365.com (2603:10b6:5:1c0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:46 +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 DM6NAM11FT104.mail.protection.outlook.com (10.13.173.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:46 +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; Thu, 25 May 2023 14:18:46 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 25 May 2023 14:18:45 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:44 -0500 From: Harry Wentland To: , Subject: [PATCH v4 12/13] drm/amd/display: Add debugfs for testing output colorspace Date: Thu, 25 May 2023 15:18:08 -0400 Message-ID: <20230525191809.3524-13-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT104:EE_|DM6PR12MB4418:EE_ X-MS-Office365-Filtering-Correlation-Id: 46b882d4-a5b1-4410-86bb-08db5d54dcd3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1sR8yLYDsD4FLBZkP9lyG3WyArmRcOWdQ1Bv5VvHmgihmNsl7ta5ISm3JKA5fsm+A+uo/i1QEny3JV85bszycB+WENmv0P5E8z3PPThvN1os+dnmnJy5Vxz1HjCr2OjkbdUtHFUTxcgCrqzxSIxpIGoD6bamvHEnOIasMqmy91OorRj+q4SdTwii3CgyDb2rgLWqJuADpJdgR7SMGKLdua4rNjvBge1D0ttKB0nFfRgCIGGygSp/K8iwF5hDuMBWKPgdBcvxYTH3BAo4cYowL15C5IAUxMEcq9N0gGYxA1D/LaFRIufdi8D/aLwwTN5Fy0NEdb8lfV1OG4nMvQY/Hw/L6ZSHRZAxnUoQA0uNwh+fIuqyhxaUhJvLsQfTbXwlwhwo7zMp9Lwetg+s3PSJO4Ct+B/hOOfmYBkS9bLI35Sh84utI1BeVXOAK/aUGWGqoSInhFMOlpFNaQ10bAolCaTxjMDUMirwglV/eDrKwe9b0sUBHiMFQRj6PL9r8tnPaoiDHvlf8CQMXXQMXqGkihF6LachON2jYylBd6jZOOcw4lggW1Mrfz6EhZzfn8EKzAoYsT2NEXMTfOU8JS9kq/UdoiFqkWYIuZ2z40klfD4mFLHuk7xMZLANU4zFVYUlc+0I/RMRtCIfhrtxhY1v8j3H+WAplk4AGE6tuAPkBJSKO4MXaCKnw3EagtarYYtjkoG40cDgcHjKZ/LOEQ2ZeJUSJ6TgZm8hCpmlea+KKM1F5c4wtPBEO3E5qeyS3ZHWT/qisribyXqJcBnGRbzgLA== 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)(346002)(376002)(39860400002)(136003)(451199021)(40470700004)(36840700001)(46966006)(6666004)(110136005)(478600001)(40460700003)(83380400001)(2616005)(336012)(36860700001)(356005)(81166007)(86362001)(40480700001)(82740400003)(26005)(1076003)(36756003)(186003)(41300700001)(47076005)(426003)(8936002)(316002)(82310400005)(5660300002)(8676002)(44832011)(2906002)(54906003)(70206006)(70586007)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:46.5762 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46b882d4-a5b1-4410-86bb-08db5d54dcd3 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: DM6NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4418 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 827fcb4fb3b3..9a885e2effec 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 @@ -3246,6 +3301,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 Thu May 25 19:18:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13255604 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 D500EC7EE29 for ; Thu, 25 May 2023 19:19:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35FE010E743; Thu, 25 May 2023 19:18:53 +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 2360010E19A; Thu, 25 May 2023 19:18:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F9sE/nPAZLcaqSmKLiHUB1lBMTzKIw+/2vufHJxGUZ/69Tiilw2LoyajURrzIWspby3gGE0XpuZu7p4+/Z3m5yMaq0Ob7IH5qiCUGhPh1Fy7tTB9W/1k3xoLN96e/dm8aBi1tkdlo7YOcCKauV8lyH1kwitX3hDTQZN/Y3nVi23YtO+357XoqC5xa/JOORnMw3PZs+auajMJlX+abtjQWGz6dOYGenlr/9ERsgXWvPeSHJErcSHaKCxP7tcGzLe/bbwpy6MZibhr//xTLREvwZXqy9bINRu4OYG9LwU8cFR4nR7mNAnPEMeaUz1NNdJWBtKE4cmx7QurzGFbK+OgGw== 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=A3IFFyKLIqVskxFTKGcJsEhFMdN0DeWDJvmyy/K5RKI=; b=Xiy+8UCmfqaUKKQSbqlgEDG7BO5LuHmaoetjzuj/PlzdbcSqaGRpRqxQdXgoHh9NOoFmDKAQHRyGTmWZ8HBsNPlDdkFChNMVIzGOJFvoErxCcWA1QlysfTDYNhefVM2EDYU5HpniFTZwe/ofe/PzS3ZXWjv/x4zc8lGvKfKyJ5moFCX3hBwumV7xBS+vzrFu7m9IVp8lPHanw78C/FXoPG0Fe/8erlJTSU3B6cqdPg9rTtlOWaHz17uzCEe3aMwD+0op7WC58veCYiY/PmINK7Bt8pPn7GpfMDeoQh3C4kRNE+nNIkQ10ZL0d93QdPJoVnT67/hEBxo9zxE2iqoMmA== 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=A3IFFyKLIqVskxFTKGcJsEhFMdN0DeWDJvmyy/K5RKI=; b=s4v+GEMBS44o4jzhMDMuNe02ybF6AQBgZ5yTJ98hVafjF8u/YErnf9tBovdPGUoXmoTgd8yoVWhSKOc8Hd1LSq0Q5v2EIrfP7TJ9Cdstvy5womwWDVW/OxjXnzns/MSlXdL4LtxKoFwaGPc2MA5dH+1A+tIUVq+i27PWkv9Dnek= Received: from BYAPR05CA0088.namprd05.prod.outlook.com (2603:10b6:a03:e0::29) by DM4PR12MB6661.namprd12.prod.outlook.com (2603:10b6:8:bb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.16; Thu, 25 May 2023 19:18:49 +0000 Received: from DM6NAM11FT092.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:e0:cafe::e4) by BYAPR05CA0088.outlook.office365.com (2603:10b6:a03:e0::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15 via Frontend Transport; Thu, 25 May 2023 19:18:48 +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 DM6NAM11FT092.mail.protection.outlook.com (10.13.173.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 19:18:48 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 14:18:48 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 25 May 2023 12:18:47 -0700 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 25 May 2023 14:18:46 -0500 From: Harry Wentland To: , Subject: [PATCH v4 13/13] drm/amd/display: Refactor avi_info_frame colorimetry determination Date: Thu, 25 May 2023 15:18:09 -0400 Message-ID: <20230525191809.3524-14-harry.wentland@amd.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525191809.3524-1-harry.wentland@amd.com> References: <20230525191809.3524-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT092:EE_|DM4PR12MB6661:EE_ X-MS-Office365-Filtering-Correlation-Id: dd7e6c08-fc2a-4f39-099a-08db5d54ddef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fu23e92ERSgXTkVXUK6NgsguUsE7+BHBaw7yYqQAwCpJHjCcAwqRgB19sHWzpeDO+XvktQx1hHpHQ0ZF3ighKQy5bn5o2rajFx3sM+0swMYFknKJ4ArIjFw7xW4j4OyMiws5G03Tqh8ijNSvtBmZ8PK2X5PMgGGxYO32DJRAjL7sDPoXTtBnPTV9MbNnU0pxPUt6EsYIXzEAa8el51FA1yNitRoIaigI2BKU6BfqToPw4hTaPx83pBwtCHZPAo6uBU1SpAdz/gFeAfIDRebbd/X4rZpHKWgWUYXLYdxGXCacQwfpl3X36xYI0Vl06LrpqhXQIMmvcmDwDcfsLcPNJrexNN4SGm4HF9/vJgE95ujYo9Kk/legJGzFXW2peBOxtXT/dAz8wlcIhf3F7rTKNZM/1gYZqrnjcMbPEjSYZsxOqcnGO4XxlN4jLXIJntM1uX6PXlEmtmjBVTYUo0wexEO86N3T75LAMpbnYqTjHvhaMLPUAPGf13X0IUxujSfqMdsld5gWkPa13d9u/kKzmoP5h0yXFF10BXQ2WT45omuRmSAJbmgSTdVsTY8TYBlMYGnoODPjjw/UNXqlFWPRaUCJKA04s7soWsQdNtlSPXmBDHXAUFbeb8dvuYFixlTX1MLFEEX4bOpWUeOwzsDOKqmm3N5KQpkew/0PDsfdCW+nlYVPYdec6Jh+MK8eAzHThbLIIMNTiY3Y/QtePR3zcvUXYxA43lIObcBacvwA9TFDkVCSbY3a0ZGFcymP3xTkuMm62jxGDrSPoamJBGr+rg== 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)(346002)(39860400002)(396003)(136003)(376002)(451199021)(40470700004)(46966006)(36840700001)(36756003)(86362001)(54906003)(316002)(110136005)(4326008)(70586007)(70206006)(478600001)(6666004)(5660300002)(40480700001)(82310400005)(8936002)(8676002)(41300700001)(2906002)(44832011)(81166007)(82740400003)(356005)(2616005)(336012)(426003)(26005)(1076003)(186003)(36860700001)(47076005)(83380400001)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 19:18:48.4342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd7e6c08-fc2a-4f39-099a-08db5d54ddef 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: DM6NAM11FT092.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6661 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 7e1e5532f88f..ac3062abec51 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -3015,23 +3015,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 &&