From patchwork Wed Jun 7 15:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270896 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 7B201C83005 for ; Wed, 7 Jun 2023 15:26:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F2ECC10E50E; Wed, 7 Jun 2023 15:26:28 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2077.outbound.protection.outlook.com [40.107.212.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C46E10E16B; Wed, 7 Jun 2023 15:26:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B7cZXkhjS8eznZLL01iprMHmun2FWdEqCohqZ+hbiSFAnF6L837Za+QT+s4nTL9CQH5YXrNwcW+tT07gs7Jm1ABEw0NJdraecxu60y1NRM0h3oFwD5C1oEAqFIjw3ovHEJ8E0oi6MhbluIOpE5vDiazQLVAo5AifJeQeOVEdzjUGwSs8c9OFrfCPgSyqEgxaBHUqzbVc6RCHckHXxkOXXpKBegaGFhtdi45DJ5fPN3F3LVmRy1/8csSdr/3DDuABywKYSL6A4AEXtgspXHNgxlhKziMW6sJrUbxJ19fXxdcoZJOA6YbQh8RDSOZhFDOTTrUgzzvZwzdOdEzP5tq58w== 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=pnSjvk0QnkXeJ3C8gHlaUqYPH6eYPumOkutvCPRrEGs=; b=ES4BeUAoD3/JZbfKj2PWHIx2Jbq4ZuKmtzq/o3OIRFX/Qdywpppzw+QCQkgYfkt+daD353NvgMwThayB1n+5j80wxzqY2gCaiy2LlDCl9Kt7/s0kfS+M9BbYCNDepLKSnNe4tqyby7Ex1ET4eUhVdVgSqLblR8BQ6EPYP2nlHDUi0toR5rsUrfsyuX6UHODWlgdFysWPzARo7zvGpyoZx+B6WMw39Soqe6M4ZIjnu/W6T0AO2aOOCJoZL34JCMRXoc0X9y3bX1jZylRMLaYr8PTJm7TVyx+0vswZgS50OmG42rvbS0tvvjxOT+heptPYVcd0LLSQPgvEg56fRqJ1Mg== 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=pnSjvk0QnkXeJ3C8gHlaUqYPH6eYPumOkutvCPRrEGs=; b=HMrZLpXgUNrAmixSTI7qfLOC66ArIUGLK6a5/2USlrkipenvPiFhZZkqNMZ9ut6lWgRI5KIhLat1gckVvrzef2cOsb6DeCjTTo76PHeKqNepu13bq0XwLb1aFmHvW2+hw8si8UUbGLfidU+SSkzpP4o53UBhivnHxEnzHWKyLCs= Received: from MW4P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::28) by MW3PR12MB4588.namprd12.prod.outlook.com (2603:10b6:303:2e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19; Wed, 7 Jun 2023 15:26:22 +0000 Received: from CO1NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::64) by MW4P220CA0023.outlook.office365.com (2603:10b6:303:115::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26:22 +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 CO1NAM11FT104.mail.protection.outlook.com (10.13.174.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.35 via Frontend Transport; Wed, 7 Jun 2023 15:26:22 +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; Wed, 7 Jun 2023 10:26:21 -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; Wed, 7 Jun 2023 10:26:20 -0500 From: Harry Wentland To: , Subject: [PATCH v6 01/13] drm/connector: Convert DRM_MODE_COLORIMETRY to enum Date: Wed, 7 Jun 2023 11:26:05 -0400 Message-ID: <20230607152617.997573-2-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT104:EE_|MW3PR12MB4588:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e8bbdce-c32f-4ba8-9ab5-08db676b8cda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +V4GXeFwAN9SjBnvVCkQWE38SuLDaaHBW9Me3+eW84P38Emw3PSkKW7RafcRbYbMLwlQPDpJJ5Q1c2399SJRcnmknGgtHH0iJIRWLRHB33OyGuHWFbtRpBdS+Ea+hUwBXugp7XrftqxJI2JRUUJhZKnrCn42JU17QQnn/HHaRikYYpLyeUJP0iISvAtETuBO45Iwayg6KpajAVdDkniLix/aZH4o/euBot+Ba/gHXyrT0TVI8n3qlIbqZ7ikay65OLyJ8G1JYoCb6YN2bxfUP4yep4UirOKC4X+lKUl9XVoXm6gG8UPWwyIsAA7dWulhp/xlNuNBnMQnqDgz/mtYSWNTQKx0+Tx7IcKva4EWTD9t7n+GphnMLze9KqVrC14RIp7JSzKrLp0jPwP4H14aE5GJNOsduTaC4MdOD+3AnqtyuLFEzphGcQ53BhvTo1h4kPsUSBC3T2oUDvwBEJjOEb2EiL+J837f4yHKE5OjEBmuZ4UuSSIpPSmnNFLnpprLEmSYqCChkGsBM3GBRA2NAOP6+El4XFkEXfuj/Gw0R9nINDzjgu9xL7iMvDegfTZ3wMcdwuxkTTxRO3qHT/7qRtWli8AYVoJdzkFFY8m84W/PpA1yHsETookTRhVQHoDr0Rjqpe8e54xHITfrOOu10+39JEDDyRS+2Avmh3iRA5xw9YXuBjXAezD4UbC5jef0udi9xomx0DSn3jPfoMtuwyg+vWKVdqfJcmGln++45bU6Uq1fnhV2k4Y7+Pc1VCTNFz/6tKcnpGd1MQ1zDENTaA== 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)(39860400002)(136003)(376002)(451199021)(46966006)(36840700001)(40470700004)(54906003)(110136005)(66899021)(40460700003)(478600001)(8936002)(8676002)(5660300002)(44832011)(7416002)(86362001)(36756003)(2906002)(82310400005)(4326008)(70586007)(70206006)(316002)(82740400003)(356005)(81166007)(40480700001)(41300700001)(66574015)(26005)(47076005)(1076003)(186003)(36860700001)(2616005)(83380400001)(426003)(336012)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:22.3793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e8bbdce-c32f-4ba8-9ab5-08db676b8cda 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: CO1NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4588 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , Pekka Paalanen , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This allows us to use strongly typed arguments. v2: - Bring NO_DATA back - Provide explicit enum values v3: - Drop unnecessary '&' from kerneldoc (emersion) v4: - Fix Normal Colorimetry comment Signed-off-by: Harry Wentland Reviewed-by: Simon Ser Reviewed-by: Sebastian Wick Reviewed-by: Pekka Paalanen Reviewed-by: Joshua Ashton Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- include/drm/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 Wed Jun 7 15:26:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270897 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 A8A2AC7EE23 for ; Wed, 7 Jun 2023 15:26:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5475010E50F; Wed, 7 Jun 2023 15:26:30 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::60d]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA12910E50A; Wed, 7 Jun 2023 15:26:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QlXjiTVd8UR/EquVE5Zlro0TrEQMczYh+lcP0/FB/2Kbn8wP/v349hLNWfEmwlkE8Tss5uzGVsvjOeMBIK1PcbCHUKgXnOIVicxttiaUhViqSii0IwQtIc0Lo6PGdZ5BUkvRfcchc2HYY22LkQYx7AFF0kvHHjsYacGxi5vbwjGsoXkeJywoDTU0yFt7WyJzodW432sbv0PB5w0E7zqNIPoRGDjunOQ2Z8UmyuWZX/MgNQ4uO+WAnC4SVndpMC6Il9aqJgXf7T2nFXl25ISy8tvWmNTlxo29wURgwrj4sRjTcxiipFipqNTBA8JQ/FUHxHmbKncqAmqvGq6P+RYUIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dpoDThbFgL/dq0K1vV2TWgr2FFpAW2XvxwC50PIpZcE=; b=ENnTbHqW5dJowGTTbndr2VOp4ecDypQU44BBHV7rrDrC6YxgNzj080LcWeRf8Hfoo7Rk85lZ8ELU0OGQTAf/NxGN54k0ISB/7TWM8z5ix6I0hmXpY9v7sr3VsYG5WrYON2MV3MljyEAx55LbXL3o9xgyDAQbWC7sWP5yCggWHWE0Ub3O4Car3ataBtdke0FSld7Tieosb3rvoqNYCc5oMnOJFugpIf5iKKOESE0Doj4LTses5yKkh4hV1xK1/v/le0yQP8dcoLpLa1IKY4KHO+QxEwkLkokKARQsDp39mtUk6LsVopM9wqG+lTK9w/gveq8IU1MVqAqONaj4DQEF+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dpoDThbFgL/dq0K1vV2TWgr2FFpAW2XvxwC50PIpZcE=; b=WCopbdxgC8F5CuFkNngcLEVellpTpfyYM90NLwlM8AApbUtVlfqYX+L5f3LSXO++ZDTfULUUUIscUAi+iyHFodXJi0g54n2o85wk8oB9+pIQB3Dh/GXji4WSC4TNDcpvqZ8stk0BQbCMcs5D/bfI8+8F4emmn5Fz3v/x53p04/Y= Received: from CY5PR15CA0119.namprd15.prod.outlook.com (2603:10b6:930:68::27) by SA1PR12MB8860.namprd12.prod.outlook.com (2603:10b6:806:38b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:23 +0000 Received: from CY4PEPF0000EE31.namprd05.prod.outlook.com (2603:10b6:930:68:cafe::ab) by CY5PR15CA0119.outlook.office365.com (2603:10b6:930:68::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 15:26:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000EE31.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 15:26:23 +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; Wed, 7 Jun 2023 10:26:22 -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; Wed, 7 Jun 2023 08:26:22 -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; Wed, 7 Jun 2023 10:26:21 -0500 From: Harry Wentland To: , Subject: [PATCH v6 02/13] drm/connector: Add enum documentation to drm_colorspace Date: Wed, 7 Jun 2023 11:26:06 -0400 Message-ID: <20230607152617.997573-3-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE31:EE_|SA1PR12MB8860:EE_ X-MS-Office365-Filtering-Correlation-Id: 8934fdab-202e-4fba-1634-08db676b8d3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dOAJ+S72su7uBY0+x0U1ghAv9j0dX3QK6SBhTZ6C2ibQiiWAZi1j8Ad7ChDsq6dBvR6alqCDck6slUCwkXQ2qMmcC584MTcLa95PuoFkDjspjlz98vg0rZGjzPWeggtS7WSls/ZmirJ2nv2y6LGt/7GL1GzI+VqVrsFthbEMV+59wmsFc2lHkGpNZsEggg3H7ndp/rJqwyufKIo5zpxke/vKXdlbYq8a/xJMlGXr6OPt9aguKyiD7VFwsAZmLUWWh/TTuqK4mzoqQprmY2VCaTk6cw6kunrmu7rhbb+0p7DR26F/Bke9t0b+irXUKvKV0Sz7gytWKSWyjHvtE2yX7wXGWjv/2m0ADecd74gxXe8HuiTo6M8HmV+/N2PKNAFZB/gL9pFC1OiTsA7iDSbf8XGN6tQSi/OPryNztq9m0lFIxF4yQryqDMOG9Sr3x77kDPXcSlvXVaFjTo+2bPUEUs8id53wcMrCAqq7teauEX33RsubunOPnOFdVhG2fJzkSbjqYNpVybAqykb8lou0fMpl9jAffx2dFRF0o4s5jvTGguPt00MV5rp4MFBSBqhA7JlCKMtwABd1pV+C2rJEHTsVlhfDruM0u/ITL2nSQAxhgK8SPb9te3N2ZNwl/owpRf9xtI4qBgcGGkdC+QziybD9V5pbJK1liEQjBOhfPygkhVvBE4HLIwtSszRmxpI9G1EnoOBB6EuN0x3mGGhHuJQjmYFSTVKa4pfGZUyPH/n/hfooHVVcjCPlFINWu+vT2hinYxZIlT6KUtpR841hMA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(376002)(396003)(346002)(451199021)(40470700004)(46966006)(36840700001)(36860700001)(47076005)(66574015)(83380400001)(86362001)(40480700001)(81166007)(82310400005)(82740400003)(40460700003)(478600001)(356005)(110136005)(41300700001)(6666004)(54906003)(8676002)(44832011)(4326008)(70586007)(5660300002)(8936002)(316002)(2906002)(70206006)(7416002)(2616005)(66899021)(26005)(336012)(1076003)(426003)(36756003)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:23.0650 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8934fdab-202e-4fba-1634-08db676b8d3c 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: CY4PEPF0000EE31.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8860 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , Pekka Paalanen , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Joshua Ashton To match the other enums, and add more information about these values. v2: - Specify where an enum entry comes from - Clarify DEFAULT and NO_DATA behavior - BT.2020 CYCC is "constant luminance" - correct type for BT.601 v4: - drop DP/HDMI clarifications that might create more questions than answers v5: - Add note on YCC and RGB variants Signed-off-by: Joshua Ashton Signed-off-by: Harry Wentland Reviewed-by: Harry Wentland Reviewed-by: Sebastian Wick Acked-by: Pekka Paalanen Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar Cc: Ville Syrjälä Cc: Joshua Ashton Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- include/drm/drm_connector.h | 70 +++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 77401e425341..907f40851e80 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -363,13 +363,79 @@ enum drm_privacy_screen_status { PRIVACY_SCREEN_ENABLED_LOCKED, }; -/* - * This is a consolidated colorimetry list supported by HDMI and +/** + * enum drm_colorspace - color space + * + * This enum is a consolidated colorimetry list supported by HDMI and * DP protocol standard. The respective connectors will register * a property with the subset of this list (supported by that * respective protocol). Userspace will set the colorspace through * a colorspace property which will be created and exposed to * userspace. + * + * DP definitions come from the DP v2.0 spec + * HDMI definitions come from the CTA-861-H spec + * + * A note on YCC and RGB variants: + * + * Since userspace is not aware of the encoding on the wire + * (RGB or YCbCr), drivers are free to pick the appropriate + * variant, regardless of what userspace selects. E.g., if + * BT2020_RGB is selected by userspace a driver will pick + * BT2020_YCC if the encoding on the wire is YUV444 or YUV420. + * + * @DRM_MODE_COLORIMETRY_DEFAULT: + * Driver specific behavior. + * @DRM_MODE_COLORIMETRY_NO_DATA: + * Driver specific behavior. + * @DRM_MODE_COLORIMETRY_SMPTE_170M_YCC: + * (HDMI) + * SMPTE ST 170M colorimetry format + * @DRM_MODE_COLORIMETRY_BT709_YCC: + * (HDMI, DP) + * ITU-R BT.709 colorimetry format + * @DRM_MODE_COLORIMETRY_XVYCC_601: + * (HDMI, DP) + * xvYCC601 colorimetry format + * @DRM_MODE_COLORIMETRY_XVYCC_709: + * (HDMI, DP) + * xvYCC709 colorimetry format + * @DRM_MODE_COLORIMETRY_SYCC_601: + * (HDMI, DP) + * sYCC601 colorimetry format + * @DRM_MODE_COLORIMETRY_OPYCC_601: + * (HDMI, DP) + * opYCC601 colorimetry format + * @DRM_MODE_COLORIMETRY_OPRGB: + * (HDMI, DP) + * opRGB colorimetry format + * @DRM_MODE_COLORIMETRY_BT2020_CYCC: + * (HDMI, DP) + * ITU-R BT.2020 Y'c C'bc C'rc (constant luminance) colorimetry format + * @DRM_MODE_COLORIMETRY_BT2020_RGB: + * (HDMI, DP) + * ITU-R BT.2020 R' G' B' colorimetry format + * @DRM_MODE_COLORIMETRY_BT2020_YCC: + * (HDMI, DP) + * ITU-R BT.2020 Y' C'b C'r colorimetry format + * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65: + * (HDMI) + * SMPTE ST 2113 P3D65 colorimetry format + * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER: + * (HDMI) + * SMPTE ST 2113 P3DCI colorimetry format + * @DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED: + * (DP) + * RGB wide gamut fixed point colorimetry format + * @DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT: + * (DP) + * RGB wide gamut floating point + * (scRGB (IEC 61966-2-2)) colorimetry format + * @DRM_MODE_COLORIMETRY_BT601_YCC: + * (DP) + * ITU-R BT.601 colorimetry format + * The DP spec does not say whether this is the 525 or the 625 + * line version. */ enum drm_colorspace { /* For Default case, driver will set the colorspace */ From patchwork Wed Jun 7 15:26:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270904 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 4478AC83003 for ; Wed, 7 Jun 2023 15:27:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5629010E518; Wed, 7 Jun 2023 15:26:39 +0000 (UTC) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2074.outbound.protection.outlook.com [40.107.95.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F1C910E512; Wed, 7 Jun 2023 15:26:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tyhn5ZZEVkC3MThiAGqlRO4pTHXlSHO4Xa+KBbIC9rFTQ8Vn3qVyQltI628xDRmWC0XH/mPE4k83MTyyGGxM5NA5PCSIwGZ2k//wVhQGJvb9lO3w+1A4eP+2QwHUAGrkpxg0+PPawa2VgJRz5JZWyVIGnQlbIuenIYJRNenFpoZ/dMYdyvd3eYy7hLECa4T4zWJZH3sfn3bcsZKzmCEUOkvzF9Z1R7aYhFuZ5tdIy34Nxe0OkEDHj3wMb7beugx2QBsn2ZVZ/gltu+gP4SfrM8lu44ECjZG+6Yk9bql9eUtlkQLY4bOg70Ijog0NWbXSsn138Z0HKeGwNOZKGwnLtA== 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=gfn6TZ18hfZRV0HpmLrkPdT2mUe8qhhaKif+hBeac+Y=; b=Sx1TtZGFObrJZqa1Jj68xwb7/qZgBQPifUe4L8RrGmq3CdDazBP67goRd0rZbnc7kJH7uCEAYZd7dSZpOGcnGvvbCLv0I7gePPuksGjDhQNgpPP6KETlC+KAab81ZAGZeXDZ5/g6cwhZNz3ZUT7JGOpJv0jSaqo2sYgO6YAtxNnEQUdqDIpjY3lhTY4yWSWwK22nWcxCNqVhDIw8FcmboXy1QdWL3h7yJCNPZ4rtci6I80AGgZ3Ik2/AiAUD/qHXf+1E8i1d5rNCH/5bpQb5auXrn1DL8mt7c2e5TzVVURfrkGSwA3Q4A6Qf+HEkLPjlDKLw60ue+o6KxGX72Os+xw== 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=gfn6TZ18hfZRV0HpmLrkPdT2mUe8qhhaKif+hBeac+Y=; b=MQVITS0JZ6Aieev4fmcIqKCVhMyPkJY09m/8VeXZ61LZVwHBpByUC0vCWO42n/bEs7EflepR+QBay9D/HfffkfWDfqRS45G/TXqw5vl0wtDtMm7+TZqRLOigEMI6LpQzA21uSKB8jzjk64vi+ECb/Jk9oTqzbFexOVKSaym8LUc= Received: from MW4P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::15) by SJ2PR12MB8011.namprd12.prod.outlook.com (2603:10b6:a03:4c7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:24 +0000 Received: from CO1NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::c9) by MW4P220CA0010.outlook.office365.com (2603:10b6:303:115::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26: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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT104.mail.protection.outlook.com (10.13.174.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.35 via Frontend Transport; Wed, 7 Jun 2023 15:26:24 +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; Wed, 7 Jun 2023 10:26: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; Wed, 7 Jun 2023 10:26:22 -0500 From: Harry Wentland To: , Subject: [PATCH v6 03/13] drm/connector: Pull out common create_colorspace_property code Date: Wed, 7 Jun 2023 11:26:07 -0400 Message-ID: <20230607152617.997573-4-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT104:EE_|SJ2PR12MB8011:EE_ X-MS-Office365-Filtering-Correlation-Id: fe7db6f0-ea30-4dc9-75b0-08db676b8dde X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WRYMNRlmngJn/MIRD6kU+VeOEaAjFehpcb5YbpoiFXRkb6pi2cB9ENDrLgoUbblc0n6ytpfmoJxAldv6jqAlKAOmdW48fQ9e+uNbRrpxRErCBB+pn4ZN7UTXVKuxz8U01nzJfbk43HkhR7VUxGeL2SDjpkcKo4G3Ib6bUa/qETpweWNWF69TUgcJGL8IGMOR4Yyze5WMhFnI89ZGiQAyPkg+NCaTxC/ySrx2gfTOh1vvkEgFCxOqPnXN7wt99RAHU5PXtXfyrEJneIMbftsBUWQOxPpJSFgFV6A4TcwnqlpttYQfrbbqqaOXo74OIbA9FAkSX5dg0oN3brHZEWWAVrP9wufwJK/GMe+NhqtynxLCXNk03j8ywkOmqUuucViq8Yz3g1Rmg/Frpe54GR8UppdSnzLAPvL2pO+O2f7t3I7WyYTbapUwM2yxD4o6iTbv2M0cb5JCn8Z71ZJhbr4ZC+DtO6Ayq4wj6+hhaAJ5tdJh3/voWZw6G/JFigSpIg1y/uGUXnIG7rD1R5HEozx94XruwT/bbDiVCJfqmpxp+vFRiUk7KZOXRlrGPM6eiNNmjaiP/aO7j4j4Q6spqrEzsk7hN+7jfRC8ry7lTEukSBgjP82lhZphLhEBgctvMDyLgYuoKqHiZ3ItYFrsxszGuhnaBTXLC1BJKADgPBArvUSudnGM+dnbH7P1r27kTXUgJ7h87wdwTpvK/ToVjbnTgGCutxDVgnqhUU9Ka2gnS0b47mP520sL2fncwcHnB5Op8yMWtKvQK+bHtpnJ6ZkToA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199021)(36840700001)(40470700004)(46966006)(36756003)(110136005)(40460700003)(2906002)(54906003)(478600001)(82310400005)(86362001)(7416002)(41300700001)(8936002)(8676002)(5660300002)(82740400003)(316002)(81166007)(356005)(44832011)(40480700001)(4326008)(70586007)(70206006)(83380400001)(47076005)(66574015)(1076003)(2616005)(26005)(186003)(336012)(426003)(36860700001)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:24.0822 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe7db6f0-ea30-4dc9-75b0-08db676b8dde 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: CO1NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8011 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick Reviewed-by: Joshua Ashton 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 Wed Jun 7 15:26:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270905 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 E429DC7EE2F for ; Wed, 7 Jun 2023 15:27:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFE4B10E52C; Wed, 7 Jun 2023 15:26:40 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2043.outbound.protection.outlook.com [40.107.223.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3C4710E510; Wed, 7 Jun 2023 15:26:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h9ufxk2ruxT7BbhX68ixscfFBsHckx1BSD95MRNMBf5f701LFtBsGOsP7xc2rKfFD8rfO8f0dKLX2CWZxi68XTMduDZg4bg3yn6p7R9nezKZhtWpZM8Pvhlks1QTCDezwj9F5yhfeuga36r3+mlJ0QP9Z8E9cOFNn9OnbZyFpnsTsi5OMX1TefIig7bCjrq/ENBmXDduJVOiM323TwWL47LQDQaj1va0ImPW/b2ijVOJqyuL3/kYklMvxfu8PFxSrRHVEaREpyLONK8SQEJ9es48cxg2JrTwfIC0aeAfHWfuwTLFc8G4cTfQLkacOLKrX8Ll8dC/gPAWh9OOgXAPcQ== 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=5vXmsMhsPUcl7tDkQTUDcLNgxOn39ab/n/TcXmWWWoU=; b=i5I7oDobxGjcvQEo4XuN9H0CKjcaMzphW73zHjSpGGgzdm8CyhsLmvjBuPoYQ4D1f80Zk1Ba9eAxEdl/RxypHsx6vlPjzeBhdRN/rFzuriJRkILBK70aXn+cEGrNkAQY10m2YlmhJlXc8ZCcHQ58PPLVGo4740QUSGbNuAwbTpYvYUW962fy2qbE301AE4DiJmeV5CJCVXeVSF/N1y8KQQwRMV5mdKe3/qpFuMvWYxVb7HRbq1p8DDhFzJArvuOtbrwX6FevsFBPajfWijtuiS8uWVd2Qkr87dZBE0UvQ/fj47mIZip7ercNdMrmxLqyaDpCA6xELdKlKwCn7SlJcQ== 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=5vXmsMhsPUcl7tDkQTUDcLNgxOn39ab/n/TcXmWWWoU=; b=b+L8J/9+akSCgaG9WVJQBDTq8BGJZ7j9+KiVtFvYl/r2BuvuF2eyAlpuKPBHqNIquBIkbB6N0IhzEiPXa5LoEVBV1/XeF5OAJSgbLmD5rx5c9uICEudS/HOb2z/eMbZMQRymjL34+YIbXBzzkN15/fnsSQbqcau5cBfxQDhFTdE= Received: from MW3PR06CA0019.namprd06.prod.outlook.com (2603:10b6:303:2a::24) by DM6PR12MB4387.namprd12.prod.outlook.com (2603:10b6:5:2ac::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:26 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::b) by MW3PR06CA0019.outlook.office365.com (2603:10b6:303:2a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 via Frontend Transport; Wed, 7 Jun 2023 15:26:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.24 via Frontend Transport; Wed, 7 Jun 2023 15:26:26 +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; Wed, 7 Jun 2023 10:26:25 -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; Wed, 7 Jun 2023 08:26: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; Wed, 7 Jun 2023 10:26:23 -0500 From: Harry Wentland To: , Subject: [PATCH v6 04/13] drm/connector: Use common colorspace_names array Date: Wed, 7 Jun 2023 11:26:08 -0400 Message-ID: <20230607152617.997573-5-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT070:EE_|DM6PR12MB4387:EE_ X-MS-Office365-Filtering-Correlation-Id: 7753b237-4cec-48c4-edd2-08db676b8f0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O4JKQpZeS/2qCVRDNLfQDk77Jx6Sc7dlYFnsUO3pZ3SFkYIZtItQUNWtOCPO+Q8a00rbT3vVb7jrJ7QMhDevp446hERw7oUmYuqDYuappwvOk3OQoVLFP3bqjs0DWr0GwZuzU3M0Xy4eM2Buevp8v0Vtojt2OvBsmrgdWXWXaFy+PzL+2a40Y7D2F5Wu+dwwFvT0iPi3qvbWX//dCy1PuubQldomHDVCkrSw/CkASxOomo6jxstLX6SLgJO4sNCiZ7bAZGks1ORx7UG1+QnAMKtsvbuNG/RRhimra2ySg0Yuc/M3nF2o7v5PxKKHTZ98AJ0EKSKBStioeR/jl300Q+y3MuDTcG5OVomZIGv8qCjtd0iHpdHebQyrCRU9eoQfkDPQluui6NG2y5vjwlH0lSsTaKdIXEGIkYHELHWXbiXF5f+EIkiA/hBX8Wl4hFxKT/4eVyb77zscvJ/lYmno14u6+FRdZKQWjCh3rV2vPbVMydv/YcXIqgHaLtUN4gTOCzF4FPWAir3BdMENTYH6c8TWlPrGDyctTGgfbg4sjQtqwwsqVaBPsOhFsrJnIYgqqpQECSf4b/T8Zy2stcjRLCWyJJW3aP9NKQuXQDO8i6ceQpvEDGq3OKlpxPH6a+LFi84y7u0ShabA7aLKcpdTQUmRno1+LNwO/+j1/7QK752OtFbSNK+fmezzzcLsFfvHdyNIzhQsOjSQmnR1oljYYU1BnnN4NAU4LxTDA5FN7H43x1Zw3IbjPy4xPbE/fqcLb8hjNMEj8PMoITofbFF1nA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199021)(36840700001)(46966006)(40470700004)(47076005)(26005)(1076003)(2616005)(83380400001)(41300700001)(36860700001)(6666004)(426003)(186003)(336012)(40460700003)(66899021)(478600001)(54906003)(110136005)(81166007)(82310400005)(356005)(82740400003)(40480700001)(316002)(70206006)(70586007)(4326008)(7416002)(5660300002)(8936002)(8676002)(44832011)(2906002)(86362001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:26.0867 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7753b237-4cec-48c4-edd2-08db676b8f0d 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: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4387 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 v6: - Drop magic in drm_mode_create_colorspace_property for dealing with "0" supported_colorspaces. Expect the caller to always provide a non-zero supported_colorspaces. - Improve error checking and logging Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick Reviewed-by: Joshua Ashton 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 | 130 +++++++++++++++++++------------- include/drm/drm_connector.h | 2 + 2 files changed, 79 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 9c087d6f5691..484effc731df 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,49 @@ 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_err(dev, "No supported colorspaces provded on [CONNECTOR:%d:%s]\n", + connector->base.id, connector->name); + return -EINVAL; + } + + if ((supported_colorspaces & -BIT(DRM_MODE_COLORIMETRY_COUNT)) != 0) { + drm_err(dev, "Unknown colorspace provded on [CONNECTOR:%d:%s]\n", + connector->base.id, connector->name); + return -EINVAL; + } + + len = 0; + for (i = 0; i < DRM_MODE_COLORIMETRY_COUNT; i++) { + if ((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 +2037,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 +2053,7 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); */ int drm_mode_create_dp_colorspace_property(struct drm_connector *connector) { - return drm_mode_create_colorspace_property(connector, - dp_colorspaces, - ARRAY_SIZE(dp_colorspaces)); + return drm_mode_create_colorspace_property(connector, dp_colorspaces); } EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 907f40851e80..fad38cdf4f79 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -460,6 +460,8 @@ enum drm_colorspace { DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13, DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14, DRM_MODE_COLORIMETRY_BT601_YCC = 15, + /* not a valid value; merely used for counting */ + DRM_MODE_COLORIMETRY_COUNT }; /** From patchwork Wed Jun 7 15:26:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270898 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 63AABC77B7A for ; Wed, 7 Jun 2023 15:26:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 354E110E52F; Wed, 7 Jun 2023 15:26:36 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2089.outbound.protection.outlook.com [40.107.237.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1190610E513; Wed, 7 Jun 2023 15:26:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gHZMeI0EQs7o1436Iazgw0YYIDNexAxDekVbMqRIM9DIJ5f2i7TjgpISjHT5weS1TNfdVQPt8v3a0OAYgV97EnnDPH2/1CGDknZ6AqcMW+xHhy/jRbDeljyJiLNukEsxsK6Ih7Uzo9jQ7C0Sk13Yl1oIgQiIGyQmXwWA9/ranToYYLZMXBvLLHX3VPOWgzaIN0UC+CCtuFA4BY4lg3fPrlvlZVoBw7WZRGf1TC+tziRHA8Rrh8MZnwYZGm6HurSyCVFqQslX8n0LZr6xV/7VfuBNGcm/ZsaWKCnUaiTME6bGWRk0YiKDmjz2XwogIcpZafp9fnh4xTp6ZRdbk/snOg== 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=dFbcwafi8fkfnE/bxl7EzHSoSPJlKrJeUKORp++tlxc=; b=DmiKIjaFkPt9vvZUZoLkvAzcsFzKAJI87yHWiFOMuIDveW2y8EzHscFy+U2bc3HKt9A8+BdcHNftB1ze5OXjBjA7fO4Ir0y+3d1Ods7vEoOX7vcvuDFI5uGgjJAhrIToodb127J9FRhZNqNHdwGsQfK0U4S5Yf7FikhFfgG9UUNjQFNNdKU2vVsuaRj3dRGu2rII3oil1Q6dMHEBgVkD0E1rjekFY8Ki/0wP+e7u58TgZz/4UPQAmJ3Eb4RAj2agbCFBPTc8u9v7RolwUr9/uzM1qvKmzO26qOS7JmBVa3nMNgyVh843vV3iFEleuUeFdOIKeFgyH93fGOYPcNxvFg== 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=dFbcwafi8fkfnE/bxl7EzHSoSPJlKrJeUKORp++tlxc=; b=CRxGcdI8mZY6alvLwx1atYgZfoTpCZ4Q4hs6WFtbCGMfJi+o4W/ASpWKlrT4ZWPY+eobhc3xuKVTJx21PV6TfaRm6GXBHTGuVC4GHyV6teZJbTn15Oh+gzhiwniNyoa82VWRj9MCYHpn9ZElBroZZrQxPzziQos7V6U8EVsKl4U= Received: from MW3PR06CA0007.namprd06.prod.outlook.com (2603:10b6:303:2a::12) by DS7PR12MB6047.namprd12.prod.outlook.com (2603:10b6:8:84::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:27 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::bc) by MW3PR06CA0007.outlook.office365.com (2603:10b6:303:2a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32 via Frontend Transport; Wed, 7 Jun 2023 15:26:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.24 via Frontend Transport; Wed, 7 Jun 2023 15:26:26 +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; Wed, 7 Jun 2023 10:26:26 -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; Wed, 7 Jun 2023 10:26:25 -0500 From: Harry Wentland To: , Subject: [PATCH v6 05/13] drm/connector: Print connector colorspace in state debugfs Date: Wed, 7 Jun 2023 11:26:09 -0400 Message-ID: <20230607152617.997573-6-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT070:EE_|DS7PR12MB6047:EE_ X-MS-Office365-Filtering-Correlation-Id: 086e1902-bcf4-4529-d1a7-08db676b8f95 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RctQ5kOgbZDK/pGwffOf3lS6Bo5OtNXQ0HqtsBmvR8i3BKRJ6coxdCX6xOfHIJR+OrZP3YNugdowHYWIUHnTq2yr2KyFtGSZAI26d/KUJiwmpq7i7dRIaZTm7AkLFt1jSQDd6YScwhwcz+ZS4AgKrg35LXbu3LFBQeWEh823sgktZWQAVTJsT07bOAhSiU8xJGFgxXaxS716quxZvWwvGHUiP8Jry7l+aKXlUhUjItEunt9A2Veg5g8woOTBffX/z2gSYTMUe0WLzUs6XqLn1Aw1/Hw4DLEaTce3gas9dtJSPKodfoB6MbiQNVj4RK9NL7tAybrGx3OZdDrAKD4C+bmUtBTexmfnN6V7oqlZEh17g4++1nunmIT5e8GTvYd9HsufURsbSYPLNBWow+FwyCwkqh9BMWCfTFrQNXOnSKDtYMC7CWGSC0it3vB/EzZqXgkv4qFUPYRMX5kbUNqM9ghcP4xj73+IzQg1PqeBvXeCsvOLxu7GSgbD4M/GCuuTk649JDhiWA11HjWkZhmDsrMI+1XuLME3AORmvi92Nl5SNd+3JowXT9BikAndYIhKRIrK6gudzahbzZUN+IyHPrtzopM66JUXxXJ6zGj+Y0h/OhSa1OkSrCQJft1nngJXFolV5inZkMafxlSdgAt9nsluwPGZUZd4vgDnbUUEEbqtqvusnxkhVMqKNyBmNwR1bLfwyseRd0FQuGk82o2Jmc6xelhins3HeYYKBd/Pd5TEvCxMuiPdgDMnevk/DKGFb5z6ZOVvvsN88cGXfe6iMQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199021)(40470700004)(36840700001)(46966006)(70586007)(6666004)(82740400003)(2906002)(356005)(70206006)(81166007)(110136005)(54906003)(44832011)(7416002)(8676002)(8936002)(36756003)(5660300002)(86362001)(41300700001)(316002)(40480700001)(4326008)(478600001)(40460700003)(426003)(336012)(2616005)(1076003)(26005)(186003)(82310400005)(36860700001)(83380400001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:26.9773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 086e1902-bcf4-4529-d1a7-08db676b8f95 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: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6047 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , Melissa Wen , Pekka Paalanen , Uma Shankar , Vitaly.Prosyak@amd.com, Joshua Ashton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" v3: Fix kerneldocs (kernel test robot) v4: Avoid returning NULL from drm_get_colorspace_name Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick Reviewed-by: Joshua Ashton 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 484effc731df..46bf1f2ad535 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1048,6 +1048,21 @@ static const char * const colorspace_names[] = { [DRM_MODE_COLORIMETRY_BT601_YCC] = "BT601_YCC", }; +/** + * drm_get_colorspace_name - return a string for color encoding + * @colorspace: color space to compute name of + * + * In contrast to the other drm_get_*_name functions this one here returns a + * const pointer and hence is threadsafe. + */ +const char *drm_get_colorspace_name(enum drm_colorspace colorspace) +{ + if (colorspace < ARRAY_SIZE(colorspace_names) && colorspace_names[colorspace]) + return colorspace_names[colorspace]; + else + return "(null)"; +} + static const u32 hdmi_colorspaces = BIT(DRM_MODE_COLORIMETRY_SMPTE_170M_YCC) | BIT(DRM_MODE_COLORIMETRY_BT709_YCC) | diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index fad38cdf4f79..9d9e4d6f0449 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1988,6 +1988,7 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter); bool drm_connector_has_possible_encoder(struct drm_connector *connector, struct drm_encoder *encoder); +const char *drm_get_colorspace_name(enum drm_colorspace colorspace); /** * drm_for_each_connector_iter - connector_list iterator macro From patchwork Wed Jun 7 15:26:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270900 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 12415C7EE23 for ; Wed, 7 Jun 2023 15:26:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F45010E51A; Wed, 7 Jun 2023 15:26:37 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 724B310E50A; Wed, 7 Jun 2023 15:26:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BvDopRdNyitVugLFHE9bKOp8y4cbLXYDXeNt+J/Rd788+RFuN5o+n9Fk9E9ew5Wsqg8uPXnbX8nENWqn6Dj5Do8NewXbbNfBEnLDibxR1OPyO3HgoDAdleDqWspJu78W2qZKaWvoriTJ61ENr8CmG+7D1mZEsfWFbT/IBGogyfGwpvaKhwshPJhvVpIrVaadtw3gBVjZRJXibT6M76yXgBziqYk8Yg2l/bdVw8rM+/PpkQTC2pkNFsgnUd18QmzEzToW/eFEslH+c8NpKhom3Gpha64fSYGubtZ6MM+5f3/NWE/2rjJvCC9i3NChnfpb8oi6dEqZ8w+zPlGKIvn9fw== 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=EkN1nCr/9IQqaJ1FtAHMgEeHdOcMaqtSlRWufTHLl9c=; b=Qn18w69bbWCtLx7obu4mSjA/Wj6zHMHZLi2nGa+GkoONi+mg9fZL37U57UVyDxwZAAcAAC9lGIr5nHP/dXwNQCi9TRpjNhd4iCtS5JD/ppm23D3LFjqEu76V1pwH33F7jn98JjBZdGhkPKOHasPsyW7HeOm4aPYtBzTRXpgRyQv5fkwdiOXuJZiE5k6DxkR7ykxd5dP69bR++KuQi8VBIQNnFq1KtMJD+/MAsC8gnvq+VKpolNu5FYxdyRS1J8PxJHCWs6uBZioCmXsVDhpSZkEKx3x3sWcnukrIQP3iwSAu5jKBA5DwQskHWwFzB2s/gm011F+Rwp4elb7lMClm0A== 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=EkN1nCr/9IQqaJ1FtAHMgEeHdOcMaqtSlRWufTHLl9c=; b=MRO8aLUvNnuo1PdUnRC1mRnqfNPW+Zku7H62zI2DUVwKcjYppy4v22w0FI1ey4mQeJf10gv68pyYEOPmq1rVWZ+MdMfg0zQVb5TlINiNPWqldYbC/Bwh4L7I0z1aetVTQrVuDK+9RijEG8rzjJpb2CCba8wbM9K9cFgzeLx68YY= Received: from DS7PR03CA0347.namprd03.prod.outlook.com (2603:10b6:8:55::6) by SJ2PR12MB8110.namprd12.prod.outlook.com (2603:10b6:a03:4fc::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 15:26:29 +0000 Received: from CY4PEPF0000EE36.namprd05.prod.outlook.com (2603:10b6:8:55:cafe::90) by DS7PR03CA0347.outlook.office365.com (2603:10b6:8:55::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26:28 +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 CY4PEPF0000EE36.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 15:26:28 +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; Wed, 7 Jun 2023 10:26:27 -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; Wed, 7 Jun 2023 10:26:26 -0500 From: Harry Wentland To: , Subject: [PATCH v6 06/13] drm/connector: Allow drivers to pass list of supported colorspaces Date: Wed, 7 Jun 2023 11:26:10 -0400 Message-ID: <20230607152617.997573-7-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE36:EE_|SJ2PR12MB8110:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f53df88-dada-4564-4050-08db676b9066 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dCKgX9TSlLqe/0Ja0KipLO707w+VsRdIudELuveztWBn6C3xAuZOYYhpu16JQ+xXna0Llrc56AZxgiOXlAcaPojPnnBDJ0wraWUskt2VSpoYUHb38vnfHx5LS0luZf0QQGBfaqL6AVMViJr4NzN/Q47aE6Rrukc0zBFyjb0eMwhUDZZNJnybOV53TcJO1OTFHpbD4EEQdHOJ3hf+8m+yoAy/6SztCd9aJk/Hg9jnEuj68e3eJ4PsTV1FGriCOF6KR001OdGQgvfNRSDQkrvjm6TiBWPgKwOmGvVnqf+UFsREEsJYyU+ZYvhVAPlIxUJB7Fa/HWpJBsseBu4n+jdOBCihgFUIER5CegYABZ4pX4JZSah2TO8B7MB3RFw6r5rrdvQC1FXwR6sfM+bZGGSJamiudd7C2lkDfQXwa8jmUyzrZjAx9x07/+ZyZnsz2U4V8okDT1gqulUULybBKw0mKCv6v+8cOGCDmLA+OLkX7YUVY78PDhAVhxNxV4Hp2vxS/4X+4Ez7Fofy5Wm9ip8kBTpVrTgNxqI5bkZOxNwh9NyTJ7ZaY+WQXoGl5Bem+FWyKrp9mJm8JvjN/3Y28X5xH2lsL9coCZEeOnhKWL4gOzIJosgpfn8T5OIzz2hjO40axaH0W0q8jrSRytfN/etyrUCtZiBBZg91+RH8z53Ni0VtcQyNtJ8nguUKlcZi6d5TA9e+gFoh+PljaFuIHZxx+rskGOaf/v92VUPrzDWzY4KoXQsM/R1FfdXGlCo+bzTAiC4fg3bZ5LlfwHWyzpl2kA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199021)(36840700001)(46966006)(40470700004)(40480700001)(478600001)(2906002)(40460700003)(356005)(36756003)(6666004)(82310400005)(47076005)(2616005)(36860700001)(336012)(83380400001)(66574015)(426003)(86362001)(81166007)(26005)(82740400003)(1076003)(186003)(316002)(5660300002)(110136005)(8676002)(70206006)(70586007)(7416002)(8936002)(4326008)(44832011)(54906003)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:28.3745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f53df88-dada-4564-4050-08db676b9066 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: CY4PEPF0000EE36.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8110 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 v6: - Avoid magic when passing 0 for supported_colorspaces; be explicit in treating it as "all DP/HDMI" Signed-off-by: Harry Wentland Reviewed-by: Sebastian Wick Reviewed-by: Joshua Ashton 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 | 24 +++++++++++++++---- .../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, 28 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 46bf1f2ad535..8fe695047ced 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -2050,9 +2050,17 @@ 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; + + if (supported_colorspaces) + colorspaces = supported_colorspaces & hdmi_colorspaces; + else + colorspaces = hdmi_colorspaces; + + return drm_mode_create_colorspace_property(connector, colorspaces); } EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); @@ -2066,9 +2074,17 @@ 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; + + if (supported_colorspaces) + colorspaces = supported_colorspaces & dp_colorspaces; + else + colorspaces = dp_colorspaces; + + return drm_mode_create_colorspace_property(connector, colorspaces); } EXPORT_SYMBOL(drm_mode_create_dp_colorspace_property); diff --git a/drivers/gpu/drm/i915/display/intel_connector.c b/drivers/gpu/drm/i915/display/intel_connector.c index 6205ddd3ded0..e8b4a352a7a6 100644 --- a/drivers/gpu/drm/i915/display/intel_connector.c +++ b/drivers/gpu/drm/i915/display/intel_connector.c @@ -283,14 +283,14 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector) void intel_attach_hdmi_colorspace_property(struct drm_connector *connector) { - if (!drm_mode_create_hdmi_colorspace_property(connector)) + if (!drm_mode_create_hdmi_colorspace_property(connector, 0)) drm_connector_attach_colorspace_property(connector); } void intel_attach_dp_colorspace_property(struct drm_connector *connector) { - if (!drm_mode_create_dp_colorspace_property(connector)) + if (!drm_mode_create_dp_colorspace_property(connector, 0)) drm_connector_attach_colorspace_property(connector); } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 55744216392b..eee53e841701 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -618,7 +618,7 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, if (ret) return ret; - ret = drm_mode_create_hdmi_colorspace_property(connector); + ret = drm_mode_create_hdmi_colorspace_property(connector, 0); if (ret) return ret; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 9d9e4d6f0449..f799cbd755a3 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -1904,8 +1905,10 @@ int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *conn bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state, struct drm_connector_state *new_state); int drm_mode_create_aspect_ratio_property(struct drm_device *dev); -int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector); -int drm_mode_create_dp_colorspace_property(struct drm_connector *connector); +int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector, + u32 supported_colorspaces); +int drm_mode_create_dp_colorspace_property(struct drm_connector *connector, + u32 supported_colorspaces); int drm_mode_create_content_type_property(struct drm_device *dev); int drm_mode_create_suggested_offset_properties(struct drm_device *dev); From patchwork Wed Jun 7 15:26:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270899 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 218CAC83003 for ; Wed, 7 Jun 2023 15:26:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E36E610E516; Wed, 7 Jun 2023 15:26:36 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20601.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::601]) by gabe.freedesktop.org (Postfix) with ESMTPS id A54C510E516; Wed, 7 Jun 2023 15:26:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bAVUroknK8Yqxdp8BArF5ESVAetqL60498E2qcyeCIEdZBKs93nTWL8da6gtC6TedQL4N3vzr7IhtgfHMrwUcsIN70MdmwAsMqMmUGTy9rDvbVXfoAA+TC6+c2vCCgg+5JapzzFbjvPMTO7/zSOqU9h0e3UOhRfzcS+XQYrYGB9uv9AoIhRh8w5w3cK2U/eLP5uGYK18roVI2yeBo6NCrZpmZkMUs2qzRVIjbYgmPdKqTSrZGlh78J+/s5d+P28wLRnWIAasXlTRDM43S4/mSjO7kYZdNBLOr2dGFvdMuWS5zKb9n8T3X0OWtKIdybaafb+Vqd8D1Yq7nQ+veTOQuQ== 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=9/NS+1vGteSclDYENuOwBvcc/JyQ/ozH9y5WdFiuEtc=; b=XNg0Zz2OHfySCE3nKtsOzaJDcj6iYlz6aRhMqycS4pARtTIiO55PIudOoesfaa4mATfvqdcfDHMIaMlOUi92LttAjl3rT2ECHFnPXww64OxsW8y16KZfjPNhCnQ2/3kcekppixqY9K6rSZvI7ESdK6Ylf68HZW0PhsaKqQPst3YTPEc6FGeLR5cNMsXC8HBGBvN1U26QJikX2xyd6AT9MC4r2mdzjRhqeFLIWSDu5opAdE8KOYK+64MXQSsPX6kn0+hl0JwUNOdr9hAgiYyQM0HAoDG+p5kH63Sah6sLEjbrWOF84IWKwbfgis5wbmL/E/RPCiNX9eSuMnEDT29Gsw== 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=9/NS+1vGteSclDYENuOwBvcc/JyQ/ozH9y5WdFiuEtc=; b=Je8VeERscnhiutu4UUfdbvj0GpEXdg2VBs3GFO7KnilYxmO6+efAp+3HALAJ5+yvRFcs22Xsk9De7cxc8eBC3B2HhG+Qj+ZjPmylFA64hKWfAclBDFRk1Wmr5/4WbaBJyz0+92SaXzWaaZQveRcJFDtjz8k58lVNFPMqLqICymI= Received: from DS7PR03CA0343.namprd03.prod.outlook.com (2603:10b6:8:55::17) by BL1PR12MB5271.namprd12.prod.outlook.com (2603:10b6:208:315::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:30 +0000 Received: from CY4PEPF0000EE36.namprd05.prod.outlook.com (2603:10b6:8:55:cafe::2e) by DS7PR03CA0343.outlook.office365.com (2603:10b6:8:55::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 15:26:29 +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 CY4PEPF0000EE36.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Wed, 7 Jun 2023 15:26:29 +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; Wed, 7 Jun 2023 10:26:28 -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; Wed, 7 Jun 2023 10:26:27 -0500 From: Harry Wentland To: , Subject: [PATCH v6 07/13] drm/amd/display: Always pass connector_state to stream validation Date: Wed, 7 Jun 2023 11:26:11 -0400 Message-ID: <20230607152617.997573-8-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE36:EE_|BL1PR12MB5271:EE_ X-MS-Office365-Filtering-Correlation-Id: ac5f2844-03e3-4122-fe2b-08db676b9105 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2hrCo7b0OnVr688qjzXwmUNK6/e5jc+pYXgT+2cKa2okIseVw6itJDcu2THsGYH7vK7dXBkP3VvtWRUBPF/AIMMAFl2I9UoRElxLekpwJD2H74mzkPXdejisfDActfItLpuZnKkqQkAexThDdhLyzVGyXRCFTew4qJVpxHJSKuhy5cR7BsYA0mdiSXCz5+Q5Q1KqNlL2Tx5xNpcwbzoIrQgZ7jjBrGMdk9RSGu/bVY9cay28F7MqwuOULm9VUIztCNYxfuNr1YobG00Yn9NFSjA7DIgmaigWkUZIcErEHnwU/Qt0H4lgl3Cdmqtsqcrxpt8hipUPENnLZubJ4jkgC11LmQbaBEJewJobpwOG8YIV+8HV+IDvcSFGMdUEAl4M2WDZerFb3kmLTeMESc81Keo+gKrkw8EP2wACJn49XlTnmZo8CfIaRxh2lviNREfyOXaEzxpxbuHRUkYU/SP53Loym5wC8ZUYmjVu2IXgSxT++7iOVEIRblyTqhOoEWTXwicuzmpQTjfpTUZYPixmtiT/QfdTMJgEoxpDNN621K+tZxZJU73lU0nXtrwYQ1DI8EdUJgbkuK+eXU+s3gc+htG/r6bfJci/JVXL5c1ZtI+hzHbA745K0+AVPaBbl2uMPWHcL7anlcWkZlRorFwW0Dy4YCKTk0eSwPcJ6rQs2pHIKs6sB21p5f8o3gL+VcEkcoJ63FrxqKtVWF3/WszvYTo4fLqYUZq93SHqmii+xX6zrqB9uuhCfmpQN1T56QGFUe7mSEd7ex+ji+TIjN2C4g== 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)(346002)(376002)(136003)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(26005)(110136005)(70206006)(82740400003)(70586007)(81166007)(356005)(4326008)(1076003)(36860700001)(83380400001)(82310400005)(47076005)(336012)(426003)(478600001)(2616005)(36756003)(2906002)(40460700003)(41300700001)(316002)(44832011)(8676002)(8936002)(40480700001)(54906003)(186003)(86362001)(5660300002)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:29.4370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac5f2844-03e3-4122-fe2b-08db676b9105 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: CY4PEPF0000EE36.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5271 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 Reviewed-by: Joshua Ashton Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 90de0d37f1d2..27868dbb09f6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5954,15 +5954,14 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, { struct drm_display_mode *preferred_mode = NULL; struct drm_connector *drm_connector; - const struct drm_connector_state *con_state = - dm_state ? &dm_state->base : NULL; + const struct drm_connector_state *con_state = &dm_state->base; struct dc_stream_state *stream = NULL; struct drm_display_mode mode; struct drm_display_mode saved_mode; struct drm_display_mode *freesync_mode = NULL; bool native_mode_found = false; bool recalculate_timing = false; - bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false; + bool scale = dm_state->scaling != RMX_OFF; int mode_refresh; int preferred_refresh = 0; enum color_transfer_func tf = TRANSFER_FUNC_UNKNOWN; @@ -6604,7 +6603,9 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec goto fail; } - stream = create_validate_stream_for_sink(aconnector, mode, NULL, NULL); + stream = create_validate_stream_for_sink(aconnector, mode, + to_dm_connector_state(connector->state), + NULL); if (stream) { dc_stream_release(stream); result = MODE_OK; From patchwork Wed Jun 7 15:26:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270903 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 BB098C7EE23 for ; Wed, 7 Jun 2023 15:27:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E7AC10E50A; Wed, 7 Jun 2023 15:26:39 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2043.outbound.protection.outlook.com [40.107.93.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3AA5710E50A; Wed, 7 Jun 2023 15:26:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FdZfb5x+pqVVfuqdrZH24echC0tBdGTIicZGffVyT+ZJNVuHMcWvfSw/Rcu3JJdk+mVgtGOCUvenJDC2rwdn0DqXksVkXd0H2K75SZwSKUKp0lW+Rl5gciE5mdY+MZgpZ/2aqSFaEh4b+aJtiKHD8IuoTMlko3XFkIFC/e8HMo+kB/laTfRB6P7KesGycyMuVZvDc2gLi9Vt44FCEVIn5EmYFl8TYiYzWev087iXq6q8zYCxu158bLu+2uw56iv8lfdRaOd1HEYps29aw9fnVSRxiII0pHo+JkBEvkaJs+3wP3HxVnyxFsZD37kBz8gcAsMXuGFYkGnoePYUQ+ZpNQ== 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=aC1Db0hRmfs7dV79ObnT9GB6DImHJQqa7qezPimMmRU=; b=aBLr8iRYb8u63OP2xQPz6Lj5RpoQ3Dfu1plNY2bCOfGxlfg77oLHBij1G8EQHlYyGTbtEUWgt2G4I0U5QaRKshTyyebzo1wnBA5o4gopNYSW3aNuqTH/XzgcPKtM3mJ1DSPfHDL5LgkSFmIHm5XUu1hra9sYtpHXA046hiFZH6JGRPAghzZ02BbY/IKVTss798MVEQHo/C/6R9oYgIdY/BqnKyk5bl9CglMzmQZEwLCOjS+YFIeHcUDetCziCumcvwwB+rBqsdh1JK6b8sUAnYPrvw/K+KuKhp/1A0pjJsUH3Nef4jMO1KwwTBeRfhAFoGOSkt2Ys9jt0dv5daxlZw== 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=aC1Db0hRmfs7dV79ObnT9GB6DImHJQqa7qezPimMmRU=; b=CU7dextATkNUzNYeFCUWb2ft9VuNmYKitns5E9TgaMp/r3CE8wCESV7CNColMmqBAK5zNPPHYB0kCV+ENl9tyHSeZd95QKC4HGYEP5QAFVTywZZlBA/ESYW9letcso2RBzgVTvfhdB80EUprVUM39D9nrLQr9lKY6utS/P2Q3/Q= Received: from MW4PR03CA0100.namprd03.prod.outlook.com (2603:10b6:303:b7::15) by DS7PR12MB6288.namprd12.prod.outlook.com (2603:10b6:8:93::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:30 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::a7) by MW4PR03CA0100.outlook.office365.com (2603:10b6:303:b7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 15:26: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 CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 15:26:30 +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; Wed, 7 Jun 2023 10:26:29 -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; Wed, 7 Jun 2023 10:26:28 -0500 From: Harry Wentland To: , Subject: [PATCH v6 08/13] drm/amd/display: Register Colorspace property for DP and HDMI Date: Wed, 7 Jun 2023 11:26:12 -0400 Message-ID: <20230607152617.997573-9-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|DS7PR12MB6288:EE_ X-MS-Office365-Filtering-Correlation-Id: 088e4a2f-a813-4200-3286-08db676b917f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WG/F7Zap3iYaoAGHW0EcKFhNWWqeGXfA+WS3epvS2qd7OGUbnrCRUYPSwTeCLRkDpH27MLdZkyEr2Vk8WjCWjZMefC6Jj3uDNbw9c1C2vUgyBuMmhetUmwIK3GOxbNZUynLiI/v379wxtLkOoN1xRhVyPPFjFq7hZ8ihnxwoHiZ/QuQJ7PJcIFQscdpewjrC+svGAjdDofpIIaUkFfJuDOJvFJVyMhJyLJHT3vjgI5eLr/FE6nLugbQTaOYPbO3lujMAPXXnx1gy9WxLbcWeQhStJWmDrjHb6TmS5wiZgqwtOyuoTFPPo6P4Ium7HNZpWO41P1e6QU1uuwDwdpppkRPMru/lgYiDM5R0lvkYIzjFaAc3gQCwQRhYsMpb33K/lERKP/NFOTeSVNC0BdUZIqsvTjLeB/B8a+OKQpOyYBw4gtb7h/wCeof6z+j+3nNEYCS4+AfEubJi4uii5arUS/Uqd0FBLacLuMqz5p01Hb88QLjpLGh51LKgUKVnSNZh2hVvDaHuOgRVQjsGhJ1ka9jRFkm5KT+K/gOg6H5AH+w8QOBP8yuP7HJqq6U7JyrEUbURDxGTzvdwWPOsKLX2T7k6oeYcKiMi92JnSaqL0N6/W0V4qJ4IX5+dWEuJwMNMAGDJVXmjVQXJITyn6jK4A7gdi+eB73o2kwM3CBvi7bbSYUEeceJqCfYyv2f6fYYF6TMjmhOhTVm6Zl6qcWRWNMVLOMNl7d4s8nFInq+JYUAdAhWpmwUmW6SPwA6js3pOnVfGE9j222guZ0sKpVyLyA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199021)(46966006)(40470700004)(36840700001)(40480700001)(54906003)(110136005)(186003)(81166007)(356005)(478600001)(40460700003)(70206006)(8936002)(8676002)(316002)(4326008)(70586007)(2616005)(41300700001)(36860700001)(426003)(6666004)(1076003)(26005)(336012)(82740400003)(47076005)(44832011)(86362001)(5660300002)(82310400005)(2906002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:30.1844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 088e4a2f-a813-4200-3286-08db676b917f 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6288 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 Reviewed-by: Joshua Ashton Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Ville Syrjälä Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 27868dbb09f6..bdda136235af 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7246,6 +7246,12 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector) return amdgpu_dm_connector->num_modes; } +static const u32 supported_colorspaces = + BIT(DRM_MODE_COLORIMETRY_BT709_YCC) | + BIT(DRM_MODE_COLORIMETRY_OPRGB) | + BIT(DRM_MODE_COLORIMETRY_BT2020_RGB) | + BIT(DRM_MODE_COLORIMETRY_BT2020_YCC); + void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, struct amdgpu_dm_connector *aconnector, int connector_type, @@ -7326,6 +7332,15 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, adev->mode_info.abm_level_property, 0); } + if (connector_type == DRM_MODE_CONNECTOR_HDMIA) { + if (!drm_mode_create_hdmi_colorspace_property(&aconnector->base, supported_colorspaces)) + drm_connector_attach_colorspace_property(&aconnector->base); + } else if (connector_type == DRM_MODE_CONNECTOR_DisplayPort || + connector_type == DRM_MODE_CONNECTOR_eDP) { + if (!drm_mode_create_dp_colorspace_property(&aconnector->base, supported_colorspaces)) + drm_connector_attach_colorspace_property(&aconnector->base); + } + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || connector_type == DRM_MODE_CONNECTOR_DisplayPort || connector_type == DRM_MODE_CONNECTOR_eDP) { From patchwork Wed Jun 7 15:26:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270901 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 F0551C7EE2F for ; Wed, 7 Jun 2023 15:26:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1C0F10E51D; Wed, 7 Jun 2023 15:26:37 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2075.outbound.protection.outlook.com [40.107.244.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26BBB10E513; Wed, 7 Jun 2023 15:26:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOw0OUmbnONYgiQPFdy4HAdtHIZY3NhE4/3rucw3w1/upVl1vykiwPZ3NpW/JzKaox8yHh86xkPomWJvjYDumDSWHfHQ9rq/s9e0Y9CAUWfjTJAuF1+gNQQT5+3vgNepVgiP24UbBaUg2WHNHP+CGb7LlnpOb9xYLPoIBAgDAMazfnBJfJ9p6CLS9rXfF00tGEgHQ4AyGgb06uuw8/ZPY3JR//+Jn3FeWTyduovh4M2sEydohRBuMF1/gMW2LUB8aJKgQajB6XCLuDvpSl02nP+wzPY33Jl22X/6BQpJXwgHa33iDEdLGrXtws4LWCaje+AcTjeixjIbKKryZDsssg== 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=bt3z4BK8+37vBHrJstFWP7dmn12+R4SgDmQvyeyiJAE=; b=Ns2OTRdSSmmlEi+Q+5az5RKDaZPX5+qkCPHmj3olCzUCMl52BQ6hwM2Hefo7AfUVNRONNbsViw8EZAr1dAVfG3NlB7ThL85DsZusegBxacVdMX08yNgdDH8tfElOmwRL3w8oBIsGkedjTdelXWNlwV/pmC8xSMTAssP0taKxubO6JZNN2xSxeuA/jCURqbF7yGkGlrJfPjtFjofXid3Yk0sWha6mKLT04cCQpg/YPgUHBNqD5nm0Dyy7a1P3Q+7Cg97Kw2IFnzCqsq0vOxy98hk4NdKAZe1S/aInkyDMxhDQOx2oVXyAoAnsD2rqsG90qMTZg0xO5dXrwj7//SMeNg== 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=bt3z4BK8+37vBHrJstFWP7dmn12+R4SgDmQvyeyiJAE=; b=e6Ux9t1NRk9x/q4F/u+HcI7gchRTs0CZ66HbaECpNl8fIuQWMEI00MImANMKxyOS78DLZsTaAfzAbzZ/R4IpO1MNrvBqEfre+3QhhGp/bioI4iKCIANJFEpUNLSM+Z0LxZ4KYwH7ozXYIjCJb3gH8aWCBSyS5s1cI3hhB4Z5EmA= Received: from MW4PR03CA0104.namprd03.prod.outlook.com (2603:10b6:303:b7::19) by BN9PR12MB5307.namprd12.prod.outlook.com (2603:10b6:408:104::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:31 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::41) by MW4PR03CA0104.outlook.office365.com (2603:10b6:303:b7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26: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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 15:26:31 +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; Wed, 7 Jun 2023 10:26:30 -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; Wed, 7 Jun 2023 10:26:29 -0500 From: Harry Wentland To: , Subject: [PATCH v6 09/13] drm/amd/display: Signal mode_changed if colorspace changed Date: Wed, 7 Jun 2023 11:26:13 -0400 Message-ID: <20230607152617.997573-10-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|BN9PR12MB5307:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b88648b-a506-4d44-3cbf-08db676b920e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rool3GdTNO1Fu/6Fz4Mc+qvUbxyq/9GjJuDqVQTCmTgR0rKyyIDmfzcSX51FNtu/lRpcVnJSfUWCiInefaGTsLvv5O6y7TFDfENbO282LUVmk/4u9P0kcUjcdfnd/+bHWiCAODnHt22O4cJdjwO+vIZSBxiK8U3Rcotu7HnO6h01wvSxZ3uuTF28AxrpLZolR0ZCU6iTowVlTrdaZL6pa7HuG+/ksGDh30AUuscar+bnsf1NeEoPIDYCqmOEZJO7WuGNiK3Y7/y+Jd5iFebpPuLAN8Z5neattF/DXUMSy2cwBvmVWPNB5p1DcnUOQV660acVLRE6GI0gly+PC+nRwymDWSB4RKC+n75/vIqw6ndB55stwtbUb2QhHgmhkNgxj6dYyJ5I5palY09G/FoyC2xdYniHneLlH8RQ1kVFp2qF8aZD6HJepQxTT/n/WAifnjvVRxCVPszMpYSodI4p71E0shOUTgZ1iIeJ9wzhU8K7tTBkom5/8ta6oshAeQo1LCORwv2PUuwzi/yMOFsnoSqb7XafRvA46EoV/4IcjLns0Qf0Ctmlqhrk4yJg3QMYF4FImc1edQGzk4twuyuNVx4+LqcRd0v+l0I6js718aO2rHXOWMvxzvbEANBzziIAR/5pvxu0I38SmDopuMPb3mYTmSex9/wkwaiGEBMVMuzQTJbR/CvfNSfOFKXWJlOInGPqwdMjPQ6o/OlSxyg138Qupn1FcDz8mMnWrZIFNWYPAPx2wF1ffPOxy87XovNjeDu8b0/G5B1GPfcmM8QPHg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199021)(36840700001)(46966006)(40470700004)(40480700001)(54906003)(110136005)(70586007)(82740400003)(478600001)(81166007)(356005)(316002)(47076005)(8676002)(8936002)(41300700001)(4326008)(70206006)(2616005)(186003)(426003)(336012)(36860700001)(6666004)(83380400001)(1076003)(40460700003)(26005)(86362001)(44832011)(5660300002)(2906002)(82310400005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:31.1219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b88648b-a506-4d44-3cbf-08db676b920e 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5307 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 Reviewed-by: Leo Li Reviewed-by: Joshua Ashton 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 --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index bdda136235af..793ea29b4cfe 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6699,6 +6699,14 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, if (!crtc) return 0; + if (new_con_state->colorspace != old_con_state->colorspace) { + new_crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(new_crtc_state)) + return PTR_ERR(new_crtc_state); + + new_crtc_state->mode_changed = true; + } + if (!drm_connector_atomic_hdr_metadata_equal(old_con_state, new_con_state)) { struct dc_info_packet hdr_infopacket; @@ -6721,7 +6729,7 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, * set is permissible, however. So only force a * modeset if we're entering or exiting HDR. */ - new_crtc_state->mode_changed = + new_crtc_state->mode_changed = new_crtc_state->mode_changed || !old_con_state->hdr_output_metadata || !new_con_state->hdr_output_metadata; } From patchwork Wed Jun 7 15:26:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270907 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 9EBABC87FDE for ; Wed, 7 Jun 2023 15:27:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C08FF10E525; Wed, 7 Jun 2023 15:26:45 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2076.outbound.protection.outlook.com [40.107.243.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id F080D10E518; Wed, 7 Jun 2023 15:26:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWdlfv0AV/ISF0K+J6IIh+jPzKGspoMuC/Wg/gQxsy79TpEP+4Wjoug3wgKG4IoJKM3pXbAemZPf7aOFlh7DHysxh3sIGMmXMDScsNrATuAuWMOXYq/sWmW/LTqC6ctdFc+AC+cgbJeWOBX8HlL3wv8/9YZGCb2oGkyIB4/Q7G+YpfKbt2j/1KzrAttiH35/Xa5i3NTfbLV7CI4chbSZJq94LqnwZz3ol7DqXf9cA4VEvpquxqXVgBUaMzvXWW461VsITH4ZX/mV+SQo0mHlzZvUoU9Bmgzqr9pvkujl1agziMWRyHFTAnRvl9ifsS/IMajeZBCnBHJZiPjcLy+DaA== 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=XI6rX85qWCG8xdxG9241UZgLcIXPn83yl7tl4MzmMTo=; b=DTx0Ok+xILCkzo3gqalySyBJlf27fOBLBJ5roHYs2XZcKt0Lq+XTQ38RfSqAX7hXJyvJMb4lorXACvwlNSo3bBtMG/YV2xyZJvGWB6dLRPcTZon9Xn1b4/Jp03psURZh8IeIMgDOlD+C/TP7QXBx6e2JS+Mh6X3BqH8uaJzFtncdUP0xiMG6tTuKhNWZcfzzBhhBCuyXhh0fhbdUT7Ki4jzVNnF9oruaNM3tvP7qAkuPCXIgqLrEp/rcO5d995xLaEG5RsB5z0Dn4PDrKXiaeTdGvuvApQ0VZR2Kwwh86PtYQUNI8LQh/A7vUW6zw8EJhvV6BJ6GUlnkd+nUQg2Edg== 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=XI6rX85qWCG8xdxG9241UZgLcIXPn83yl7tl4MzmMTo=; b=Wb66lHr/jiiLS2F8uypKJYV4cP17YjY3jCGjm5EScaPZ8K/7fPi3P02jXB7LaVmab1dxLtAqE6+quTojzAZ58QAgSq8TKWaz/RW96Zo4RjLi5YiMjdPfOYT+QMNNrsbkloPCSYUxq9JSmZ31rqWxg0gk276N/pOkXfGnky/eCwI= Received: from MW4PR03CA0115.namprd03.prod.outlook.com (2603:10b6:303:b7::30) by MN0PR12MB6294.namprd12.prod.outlook.com (2603:10b6:208:3c1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 15:26:33 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::d3) by MW4PR03CA0115.outlook.office365.com (2603:10b6:303:b7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26: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 CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 15:26: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; Wed, 7 Jun 2023 10:26: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; Wed, 7 Jun 2023 10:26:30 -0500 From: Harry Wentland To: , Subject: [PATCH v6 10/13] drm/amd/display: Send correct DP colorspace infopacket Date: Wed, 7 Jun 2023 11:26:14 -0400 Message-ID: <20230607152617.997573-11-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|MN0PR12MB6294:EE_ X-MS-Office365-Filtering-Correlation-Id: d73088da-d04d-4cdc-b5a5-08db676b930f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9WCwaOYgZEU7qNQPAAN319kKTPbOF8bDY/Ct6UDHvzahD9Zy3lqz6p9DfHrSfM33bIjc9T2Exyik4j368gYoYunSYVq/cQj2jmssN6RdFBnwysnfr/CVSkG6cU4OuLGAyXke3qJ2eJbVSk1LpWWrtYYMqi9jU11KLD41HPlzTB+GV1QswhKbQDl6h8aZq9uL6Ggbvs5IYqkTPrB/PZGTQQIvSvdi2oRFV7gfVdOG7kscSEol57ZbpaR3jGeQlV4qdHBuSfAOzRzxA2LlJoKiTY4W42ABsy+j1WIPOWZwyPHqi0+RHJ65ukcPrXf2G3ZHQdxFion5nBFCqKm1fqgLavyJtXP+Ks1gyWZjFEqsMq/eS84p7ifKPta8gYQTTGbMA/sLridSTa+f0Gz6Zo+1fxY6dCkSJ0M65kNU0RBJ+v0VDOiqbCEerMdx/HSvOPYYXHdVzYQ30FvlDU+xz1ic6aJVksCCfEA0k88AZmj1iuhkkSHiw6WPMNuwfMR98JW3Un+vyRUN8SfFMi0YJ1BHGQyRULMAxOSnI6+YlGZ1qou5bTBWVv1LBy5hCAojFHSNeq2qh4ss94YMRay76EVBS7zrbkFPS5AffUixv1HnvVJ/YCmqsVS99zP674ffrroMX8pWspcSIWg7bISJi6Ff4K3aj1KW4BuahVGw/do5F9l8xFil8OK+65H/43eNqMZ6IgD8ebORDAhVND8P9supE1m1xIkA3gNIjjTnYwFG/fvvoRkCernk2LpJ9oJu/BC3dqTAUv179LEWq9OT3NGC/w== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(396003)(136003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(70586007)(70206006)(82310400005)(8676002)(8936002)(4326008)(5660300002)(86362001)(54906003)(316002)(110136005)(44832011)(41300700001)(478600001)(2906002)(81166007)(356005)(6666004)(82740400003)(40460700003)(1076003)(26005)(40480700001)(36860700001)(186003)(36756003)(2616005)(47076005)(83380400001)(336012)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:32.8092 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d73088da-d04d-4cdc-b5a5-08db676b930f 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6294 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 Reviewed-by: Joshua Ashton Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 793ea29b4cfe..060a975f9885 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5338,21 +5338,44 @@ get_aspect_ratio(const struct drm_display_mode *mode_in) } static enum dc_color_space -get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) +get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, + const struct drm_connector_state *connector_state) { enum dc_color_space color_space = COLOR_SPACE_SRGB; - switch (dc_crtc_timing->pixel_encoding) { - case PIXEL_ENCODING_YCBCR422: - case PIXEL_ENCODING_YCBCR444: - case PIXEL_ENCODING_YCBCR420: - { + switch (connector_state->colorspace) { + case DRM_MODE_COLORIMETRY_BT601_YCC: + if (dc_crtc_timing->flags.Y_ONLY) + color_space = COLOR_SPACE_YCBCR601_LIMITED; + else + color_space = COLOR_SPACE_YCBCR601; + break; + case DRM_MODE_COLORIMETRY_BT709_YCC: + if (dc_crtc_timing->flags.Y_ONLY) + color_space = COLOR_SPACE_YCBCR709_LIMITED; + else + color_space = COLOR_SPACE_YCBCR709; + break; + case DRM_MODE_COLORIMETRY_OPRGB: + color_space = COLOR_SPACE_ADOBERGB; + break; + case DRM_MODE_COLORIMETRY_BT2020_RGB: + case DRM_MODE_COLORIMETRY_BT2020_YCC: + if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) + color_space = COLOR_SPACE_2020_RGB_FULLRANGE; + else + color_space = COLOR_SPACE_2020_YCBCR; + break; + case DRM_MODE_COLORIMETRY_DEFAULT: // ITU601 + default: + if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) { + color_space = COLOR_SPACE_SRGB; /* * 27030khz is the separation point between HDTV and SDTV * according to HDMI spec, we use YCbCr709 and YCbCr601 * respectively */ - if (dc_crtc_timing->pix_clk_100hz > 270300) { + } else if (dc_crtc_timing->pix_clk_100hz > 270300) { if (dc_crtc_timing->flags.Y_ONLY) color_space = COLOR_SPACE_YCBCR709_LIMITED; @@ -5365,15 +5388,6 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) else color_space = COLOR_SPACE_YCBCR601; } - - } - break; - case PIXEL_ENCODING_RGB: - color_space = COLOR_SPACE_SRGB; - break; - - default: - WARN_ON(1); break; } @@ -5512,7 +5526,7 @@ static void fill_stream_properties_from_drm_display_mode( } } - stream->output_color_space = get_output_color_space(timing_out); + stream->output_color_space = get_output_color_space(timing_out, connector_state); } static void fill_audio_info(struct audio_info *audio_info, From patchwork Wed Jun 7 15:26:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270902 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 2AE97C83003 for ; Wed, 7 Jun 2023 15:26:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0002B10E52E; Wed, 7 Jun 2023 15:26:38 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2077.outbound.protection.outlook.com [40.107.220.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B5E110E53A; Wed, 7 Jun 2023 15:26:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KVQ1Q6xqtrUWSnkXrwrtF2dIs8k9Tjsd13lunXaTroPJA4j7+f8rZOs4JFRJEilj/vSjEyMI/y3bCW6Op9gg/DQs/+PjQ2JceISeT8jmcAeH06d1kdnDYJZo7knr2nLFOCzzTbaSsa9DUw3Sd97X/DnuolhkIekX8OeWn3RTRwcn7BHJv5ADvTF8eMHOytSgvf05q4KoklDd8DFuyadD8GnAwKQe5HNJ/nuSEUbLbLJwWFZTgSK34I2C0YGiPVlZDXniic37shjNcVUop4/nV+8kUm2rE3jA4NAWOMiUf/GgE1z4mVLyxE2bN/z7+ULrEj97ocO18hwp2NUNtex2HQ== 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=vBwm/EljCgeiFmD0D8VHZAQSDNrZi5SvPsZvHFB2/JE=; b=VFdnej4AummmzX8xGUyb2AHs31ZD8elgkYOlrxxp7+mP2KrqK3ROHbSX1sFbmeuMarpsoxBQyiB9N9WQxpv3sh/oVRooqAFRdTFcoQ0BdCBwoWEjw7J8s0IdKlPr+XTJiy1jR+Rev8IGiiEa1ieszWEEdA73xUqfQ48ASxkO32O6ws5+8jpOaNVd49z61yAAGyNygtnOrOeeTeD+REOLfaZe35/DhFzqidYZxGKFhvJh5BQxNMogPF8kgxB+P3qdwp+YuEs2QVMwP759MU07BZEC3dLSCT+V8ZD2URH6PdqdTViC79L7Aaupn9nYS1sczZGBm4HsFy8XhddJhdq+oA== 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=vBwm/EljCgeiFmD0D8VHZAQSDNrZi5SvPsZvHFB2/JE=; b=CE6qGzoRjmqufEGO1yCaqaQmfyCo/cgeQWKdyqfsQ0kACnbTKzSBMOTUSH1QN7T5fTg9txahuhiqfAgtBRDnW5iLAAjQvUBjd5EereNxwHuoyD6qffQYheVaYWode9tbUieJ0i12ui09xYtAZmnK+3bmEc6K7gVVYGgk+prBLk8= Received: from MW4PR03CA0111.namprd03.prod.outlook.com (2603:10b6:303:b7::26) by PH8PR12MB6891.namprd12.prod.outlook.com (2603:10b6:510:1cb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 15:26:34 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::dc) by MW4PR03CA0111.outlook.office365.com (2603:10b6:303:b7::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26:34 +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 CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 15:26:33 +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; Wed, 7 Jun 2023 10:26:32 -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; Wed, 7 Jun 2023 10:26:32 -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; Wed, 7 Jun 2023 10:26:31 -0500 From: Harry Wentland To: , Subject: [PATCH v6 11/13] drm/amd/display: Always set crtcinfo from create_stream_for_sink Date: Wed, 7 Jun 2023 11:26:15 -0400 Message-ID: <20230607152617.997573-12-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|PH8PR12MB6891:EE_ X-MS-Office365-Filtering-Correlation-Id: 97e66252-284d-4126-e4cd-08db676b93c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FJdJLJVTsnHI4mFbZUPXLDUJcOIymLmtsJc+j9UJDBrRvY4ABg7XX4zucnMWPXgBEFSdFuQ5QltixWb8wDx+7RbKDmZKVomB/j/yfry67Z4ZTZoXztYqlqvKzcxrdA+sOI/oJ9MdR/7ZGtDce48m5j5onyAN8tgjmH0SYI2N3ueg6Z2z7wUo51VO6s4mattcUErgXgxm52+Q3n/zw3h3t/5k9SXlHxnVVpJQ4wqSyX6fZIt5XIEods5XEcSszx9ih3mSW75JzM13hvZIlw3/WTNos9SFzV74sx/zGOAMX4pZmD5W6PHwB/0I1glHoWCKiNVjYaP7xTOwqJnk8Lpte057Y++dNewfqHBHE3dFgJuLPUs1nenLR84lJ81s+cUviTz88tVWG1jkR3+5AKzWtcKFTzdoxVIKr9vixQYq2TEnyIyKzccvvL6D9GQwJzUtarQquLe5tkdk8i7hsf3YJBIOyuJ26d5rMWV+3I8uhMht5D3CuIEZFoWz1lIXxguZIhWSXECft+rzZdoKqmotwashIuyW2rRVvxUA5u7E3kuaI2bf/9ZHJ9Kx/jJhZ9C1BNy8+tD3Fx9tKsG73PB4MoHUZfXpmCl7CPfzOU72v3UAMDRjFYWAH5FGk175h0ZbzOhWbi8X14MO2o1KwNuSYpdkQ7f5HKNjA2XC5IDsmr/QiEap/Eahtt9apiO36mfRv0Yti82k3C0j+jPmTRZxul+P85XuHlmz1jtKE8jNS3OVaghEfhCG7jU2ogEqKc+iVJGTCiv7NySqZA7IgEHM2A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199021)(46966006)(40470700004)(36840700001)(40480700001)(54906003)(110136005)(186003)(81166007)(356005)(478600001)(40460700003)(70206006)(8936002)(8676002)(316002)(4326008)(70586007)(2616005)(41300700001)(36860700001)(426003)(6666004)(83380400001)(1076003)(26005)(336012)(82740400003)(47076005)(44832011)(86362001)(5660300002)(82310400005)(2906002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:33.9966 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97e66252-284d-4126-e4cd-08db676b93c4 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6891 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 Reviewed-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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 060a975f9885..e17c8afce2f4 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6054,7 +6054,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, if (recalculate_timing) drm_mode_set_crtcinfo(&saved_mode, 0); - else if (!dm_state) + else drm_mode_set_crtcinfo(&mode, 0); /* From patchwork Wed Jun 7 15:26:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270908 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 E8709C7EE2F for ; Wed, 7 Jun 2023 15:27:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 209EB10E519; Wed, 7 Jun 2023 15:26:46 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A87210E513; Wed, 7 Jun 2023 15:26:37 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PB8BE4mYFyoAq4uODRoNMhmCtUuoff+sq0J9+oUm6QJNjTjoKLer0mkmRa7oaT/3KoZ4brd7ZYoSNXbQGV9eiszrODY2qN5fZnW7G91Al7SbEl5vlq5Cg6/IsXBhjkyd3/gltRkrbLT67D/W/xfeLsXo2uwwjQcIcE3zm4rxPCoEmvei0Is2ULSOJvCgARciz0qF6bIHdSa1gctVfyTyO1GQKCjuvlNtxhW8/PyIzBHrvlfnMVQqWe9J80vhAYGV21ddzkwTAAJ/79P4C3YoZbxaPoopN2FVH0xGf6qM532/ielz7JFUx5ETb4zCXOpRe0X2Cz1bFlcI9uZNXYTahA== 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=Rn5reteYR2HdgDftsI/4TpxA4HC9GyZGJ/5HzxeHUY0=; b=bO4U228NKRYIWfOWirrolkkvVKcnCv3yv3rvMy35llI5akxqKI7UmmDPlgQBp7h8je9BObFYOwWLC9/rGgEIGvN4kwDTdhDyYpaJNwH36HDX9cl3Wr7mgIkPT8NZirlGzOhByMS4JTduO0K9sBAqf//P3hia4Zy0wtiv+C1m8/2UAKMZQLCBjphJkACeLJcmzdroMOkGAz8Ad/4mSco7oxOqmAj8jA/ano5yb1HbzRHhrwFl2Up2udSZfrI84lFHCZx+YI0TJln5exQCdRrPULjAfAYeyza3/wamwd7PdtQdAkErwQHuZeKwGwXBQH0yJQByCV7BMz900DZERBHdmQ== 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=Rn5reteYR2HdgDftsI/4TpxA4HC9GyZGJ/5HzxeHUY0=; b=qRKMOt8MxmcQh+VeGv5Tto2DCGyfTanKMV5obT96wAIMcdUKNeKlfGPTTfNCIQlVOnUTRh+VizBDKx0gfcVhLN225fsmyGEKMPxWrnjvKvji0UCRtiLEorCtjh43EHbByazcu13/pp7vKdO7JFgaAOhqVP2AYfspsfBsGs8JZrk= Received: from MW4PR03CA0091.namprd03.prod.outlook.com (2603:10b6:303:b7::6) by SJ1PR12MB6097.namprd12.prod.outlook.com (2603:10b6:a03:488::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 15:26:35 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::8f) by MW4PR03CA0091.outlook.office365.com (2603:10b6:303:b7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33 via Frontend Transport; Wed, 7 Jun 2023 15:26:34 +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 CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 15:26:34 +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; Wed, 7 Jun 2023 10:26:33 -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; Wed, 7 Jun 2023 10:26:32 -0500 From: Harry Wentland To: , Subject: [PATCH v6 12/13] drm/amd/display: Add debugfs for testing output colorspace Date: Wed, 7 Jun 2023 11:26:16 -0400 Message-ID: <20230607152617.997573-13-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|SJ1PR12MB6097:EE_ X-MS-Office365-Filtering-Correlation-Id: c432fc3c-119f-48ce-a13d-08db676b9445 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xMlSSb/S4Q9cOtofxiCkwyAZFwpGeYFeyCIIAWpjjAbVDOUV216ojHPc0hvqnsCEjhMROC9T1EZ8LmHhymXwgX/TAiHKySvkURdWpGNygeGgi0+sAqnYRd5wcv5Vbt+xsDpuhhch/t/geaxT8eG/IOd3HpHcmwn+SZ7+aRSktG8P2KovtxS1BnxPjXPZgdRgFze2hI4wXVUpBJlYLP3t2cfh2FFAd9VJaOgBTvGauOLVtxbWvZCJlQqVPEfYk2MOUkPubupdDXvvYXP5NO0CJt5hNWcaqtocLnNCtvK4rxnaZhK9YGQBe/hb9tdQ0ChUuHdFqwWNAfXeBi+uv2zBG5qiZ829+rcwEtKjEO5LrZTMRR7pMNhzAj2WnAnTuQBeyd9nWBVe+JOBlt0cUIv8HBzPjd+KEbo45BGZ2eK28y5p/TCsOUL9c0JrAJAKrKQ/9E4KqFVWHv6tYPc7dxxOoKniEukBqz3KPXPaaUQsOboLZAKn8FOXlKGbDd9B0lCbvWFmwLKz6dj/Mr4+SStXZJFWLvwNbuz1UW8ZJKSeKPoh+j7kkdi/XdW9w0jj4TFodOY4JEei12Vu46krHkMbOdcipO1Hu3w4CwjC1pRflC2CiWaaiIHCSYJH+Z2Ln1iLWgvItSpZO1Ybyx05ABZQyfl2+lSgFaBRWmTvRer04qEc+5Gd9zfaSq/v3rnbRX2DTJbQ/mTEToRZBM2WoxvJjMylAKd0qWWULDPwz6NLxwGQog0kBLaTI00Fa72vRx0Z8z4a7gQCczaEJ8k7882wgQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(396003)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(40460700003)(426003)(2906002)(47076005)(336012)(83380400001)(2616005)(82310400005)(36756003)(86362001)(356005)(81166007)(82740400003)(36860700001)(40480700001)(41300700001)(6666004)(5660300002)(316002)(8676002)(8936002)(54906003)(478600001)(70206006)(70586007)(4326008)(1076003)(110136005)(26005)(186003)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:34.8403 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c432fc3c-119f-48ce-a13d-08db676b9445 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6097 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 Reviewed-by: Joshua Ashton Cc: Pekka Paalanen Cc: Sebastian Wick Cc: Vitaly.Prosyak@amd.com Cc: Joshua Ashton Cc: Simon Ser Cc: Melissa Wen Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org --- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 82234397dd44..caf13b2e8cb6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -906,6 +906,61 @@ static int amdgpu_current_bpc_show(struct seq_file *m, void *data) } DEFINE_SHOW_ATTRIBUTE(amdgpu_current_bpc); +/* + * Returns the current colorspace for the crtc. + * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/amdgpu_current_colorspace + */ +static int amdgpu_current_colorspace_show(struct seq_file *m, void *data) +{ + struct drm_crtc *crtc = m->private; + struct drm_device *dev = crtc->dev; + struct dm_crtc_state *dm_crtc_state = NULL; + int res = -ENODEV; + + mutex_lock(&dev->mode_config.mutex); + drm_modeset_lock(&crtc->mutex, NULL); + if (crtc->state == NULL) + goto unlock; + + dm_crtc_state = to_dm_crtc_state(crtc->state); + if (dm_crtc_state->stream == NULL) + goto unlock; + + switch (dm_crtc_state->stream->output_color_space) { + case COLOR_SPACE_SRGB: + seq_printf(m, "sRGB"); + break; + case COLOR_SPACE_YCBCR601: + case COLOR_SPACE_YCBCR601_LIMITED: + seq_printf(m, "BT601_YCC"); + break; + case COLOR_SPACE_YCBCR709: + case COLOR_SPACE_YCBCR709_LIMITED: + seq_printf(m, "BT709_YCC"); + break; + case COLOR_SPACE_ADOBERGB: + seq_printf(m, "opRGB"); + break; + case COLOR_SPACE_2020_RGB_FULLRANGE: + seq_printf(m, "BT2020_RGB"); + break; + case COLOR_SPACE_2020_YCBCR: + seq_printf(m, "BT2020_YCC"); + break; + default: + goto unlock; + } + res = 0; + +unlock: + drm_modeset_unlock(&crtc->mutex); + mutex_unlock(&dev->mode_config.mutex); + + return res; +} +DEFINE_SHOW_ATTRIBUTE(amdgpu_current_colorspace); + + /* * Example usage: * Disable dsc passthrough, i.e.,: have dsc decoding at converver, not external RX @@ -3139,6 +3194,8 @@ void crtc_debugfs_init(struct drm_crtc *crtc) #endif debugfs_create_file("amdgpu_current_bpc", 0644, crtc->debugfs_entry, crtc, &amdgpu_current_bpc_fops); + debugfs_create_file("amdgpu_current_colorspace", 0644, crtc->debugfs_entry, + crtc, &amdgpu_current_colorspace_fops); } /* From patchwork Wed Jun 7 15:26:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 13270906 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 686D3C77B7A for ; Wed, 7 Jun 2023 15:27:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC18410E521; Wed, 7 Jun 2023 15:26:43 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2073.outbound.protection.outlook.com [40.107.237.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4400710E525; Wed, 7 Jun 2023 15:26:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n3oQfsoiUzSWrID2N4+bRy2wjNDavr6EsDq28dPjwo/e2B5PhCBh0dc4omad75/y+/Yqr2FSXB24Cge0ELa8wKWgeRL+daaxddjZTeFhtVhYUwaNank16jD7lI6SzkIfKsON8Gpb3sXfHjZS44dNwXMmyOtr8EZ8TV3uD84xv0IT834LL4HlSfxh5To1gFk9Rlauxcbvk49D0OOj5psa32mRsrh2thJzkaO7RtcRriPk7Sfa3b8vVxr6gyVomNb2JKkCHlDA6koYCuyEKWSY4avewpRH17YcIxiKJvWWSRHQMK2zuuu00jVEcnYTpdEQgvIRWTXIBGSpXW/XmtzhFA== 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=EZQZzHcjaiaCdVd0vLNQybb6vZiPNNxQpS6xkYcJjU4=; b=T6YrtX9LWtZZX9AdGg6m/NpQI2LpioY6rjciswQ7432jYpYAfjViP0UOzK1PvVt9ISiPO3Ow9JkF1waJlkUbCybI8JrorHpGGT7QrVoVm9Hzf64O7ao/XjgKDiOUJxQbyBls53aJjxP9NP64BnbVKNR84jet/8auUVLiRQGbvKtOwl7m6BKE4/5XNnW+LN8CypSUjUusQ9vGTACz1A2/aNa9oWuLLutCqkjkUFLwXb3FKzP1cIiEKXbOjqE/7Hlh5P7Qzoc5rfXPIYqfxGAcbC2RLO41MVTEnkifF3e9uZlyV6L3gDbYwhTJXegoKV15eAduwgn+8oNpUQOfY2Kmyg== 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=EZQZzHcjaiaCdVd0vLNQybb6vZiPNNxQpS6xkYcJjU4=; b=zTGU3Y8Cjg7qS1cuwhMYp5qxytRO8BNbw6rlWQMKJQZUKWK/5kRvfItJt9KOQAwmz0RftReyUon+iRjwpwRy2DEPazhU3X/klJq2t65/us1OefVibJFPuROh7RNj9NTlRJagq2i4sTN+6Ki6xkAcPgo1t5UB1Eo41Cn1KW9p/LQ= Received: from MW4PR03CA0120.namprd03.prod.outlook.com (2603:10b6:303:b7::35) by SJ1PR12MB6146.namprd12.prod.outlook.com (2603:10b6:a03:45b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19; Wed, 7 Jun 2023 15:26:35 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::61) by MW4PR03CA0120.outlook.office365.com (2603:10b6:303:b7::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Wed, 7 Jun 2023 15:26: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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.36 via Frontend Transport; Wed, 7 Jun 2023 15:26:35 +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; Wed, 7 Jun 2023 10:26:34 -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; Wed, 7 Jun 2023 10:26:33 -0500 From: Harry Wentland To: , Subject: [PATCH v6 13/13] drm/amd/display: Refactor avi_info_frame colorimetry determination Date: Wed, 7 Jun 2023 11:26:17 -0400 Message-ID: <20230607152617.997573-14-harry.wentland@amd.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230607152617.997573-1-harry.wentland@amd.com> References: <20230607152617.997573-1-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|SJ1PR12MB6146:EE_ X-MS-Office365-Filtering-Correlation-Id: 41005a09-705c-456a-86a0-08db676b94ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iEHXERAZci8z0XhNKYdmKir+QZklPIUMAAXN1Sge06KNkZ6C13ZVL1x6nBr6YGNG83jssJK4FTP0ejNiqIo3kM/AwOyyAzfxB+1a+ayPI+3WWm1p1hDMFxcvAUXajB5utUg+2BAq1C1tDyK2d4wUy4h0mQzUDudxPsNKAHqO2pyof05kQ4kVCliwp/71N1u5H9AJAtc8UIsgmm/BBswmgaf1JUEoXV9MHRi2Ks/dZSEX0YMz8ioXAcg5e5rqJbdHrfdr5ghTyKtsLgzonOR4bstcahUI+sdxnOT24FJCZNjsb57K/tgoRdnFI7IFWQtNlbCgqaC77YJHJ57/GvtqiT5LTG1HSXVxTzakK0CDc16qbQN+Vc3FGtqtkj2mqRYBPUoZ+S3UAasqJ7SfymzQjceToqWWQqfrnj5BMfbwianE5HtOlkV/07xv5ZyF+hQqcaqakyyAoaLUiMgiGz2MU3h9GRHveX4c6G5itcOI1b38eGv4zMDG7YEJ/9Dk/gmuYaPb1p/u0TjbXlkK7eSoCcdS1OcWgYg89ikX/TLWMg9+uqoBaFpN85EFsbanzfV6tZ48yopIp1SNeW1R3xnHoo4cTbfJ+vG7CyUIeCNmmq6rI33QR3CvHjB2Xsvl0Bw9BP8llACFcb+HLBNkgnZGUXl8WV+jwpd8tKRm15gfycqSsK1kI5def3e27MvsqhlgYD57jpqFYaYzCuTji1GS7dxmElGVfs0NyyLgtgC/B/bCTtO9pbqbwHb+xoNXQcbhRYWOMJUQ+6A9tncTEPSpPw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199021)(36840700001)(46966006)(40470700004)(36756003)(478600001)(5660300002)(110136005)(40460700003)(54906003)(6666004)(8936002)(8676002)(316002)(4326008)(70206006)(70586007)(41300700001)(44832011)(2906002)(81166007)(40480700001)(356005)(82740400003)(1076003)(26005)(86362001)(186003)(47076005)(2616005)(36860700001)(83380400001)(336012)(426003)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 15:26:35.5278 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41005a09-705c-456a-86a0-08db676b94ae 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6146 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 Reviewed-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/dc/core/dc_resource.c | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index c72540d37aef..2f3d9a698486 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -3035,23 +3035,29 @@ static void set_avi_info_frame( hdmi_info.bits.S0_S1 = scan_type; /* C0, C1 : Colorimetry */ - if (color_space == COLOR_SPACE_YCBCR709 || - color_space == COLOR_SPACE_YCBCR709_LIMITED) + switch (color_space) { + case COLOR_SPACE_YCBCR709: + case COLOR_SPACE_YCBCR709_LIMITED: hdmi_info.bits.C0_C1 = COLORIMETRY_ITU709; - else if (color_space == COLOR_SPACE_YCBCR601 || - color_space == COLOR_SPACE_YCBCR601_LIMITED) + break; + case COLOR_SPACE_YCBCR601: + case COLOR_SPACE_YCBCR601_LIMITED: hdmi_info.bits.C0_C1 = COLORIMETRY_ITU601; - else { - hdmi_info.bits.C0_C1 = COLORIMETRY_NO_DATA; - } - if (color_space == COLOR_SPACE_2020_RGB_FULLRANGE || - color_space == COLOR_SPACE_2020_RGB_LIMITEDRANGE || - color_space == COLOR_SPACE_2020_YCBCR) { + break; + case COLOR_SPACE_2020_RGB_FULLRANGE: + case COLOR_SPACE_2020_RGB_LIMITEDRANGE: + case COLOR_SPACE_2020_YCBCR: hdmi_info.bits.EC0_EC2 = COLORIMETRYEX_BT2020RGBYCBCR; hdmi_info.bits.C0_C1 = COLORIMETRY_EXTENDED; - } else if (color_space == COLOR_SPACE_ADOBERGB) { + break; + case COLOR_SPACE_ADOBERGB: hdmi_info.bits.EC0_EC2 = COLORIMETRYEX_ADOBERGB; hdmi_info.bits.C0_C1 = COLORIMETRY_EXTENDED; + break; + case COLOR_SPACE_SRGB: + default: + hdmi_info.bits.C0_C1 = COLORIMETRY_NO_DATA; + break; } if (pixel_encoding && color_space == COLOR_SPACE_2020_YCBCR &&