From patchwork Mon Feb 26 15:59:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10242723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 102C6602A0 for ; Mon, 26 Feb 2018 16:00:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA9B92A1C8 for ; Mon, 26 Feb 2018 16:00:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2F002A181; Mon, 26 Feb 2018 16:00:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A4632A171 for ; Mon, 26 Feb 2018 16:00:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 805876E4EE; Mon, 26 Feb 2018 16:00:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0084.outbound.protection.outlook.com [104.47.0.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C1936E4EE for ; Mon, 26 Feb 2018 16:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=knOWQOQIvhfhRSRfbaWjSn9nhj92aQjN+qh33CxgcYg=; b=o4gxmSHrCAfGIBx2jsz7EMPFHNUFfyeof6UjYJRsFDOr82huw09iHAPOd4uyO8opjD8S8EEXk+3rQ5yE+iXFp1sJPk5Yg1W9T2PedLPjSJWAW2RsOTOZ344hsol/vQTDn5JSgFrzf82B3rtpba/BP4ReeYnEqY1aCeGvJhlVusg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alexandru-Cosmin.Gheorghe@arm.com; Received: from e114479-lin.cambridge.arm.com (217.140.96.140) by VI1PR0801MB1264.eurprd08.prod.outlook.com (2603:10a6:800:3a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Mon, 26 Feb 2018 16:00:02 +0000 From: Alexandru Gheorghe To: liviu.dudau@arm.com, brian.starkey@arm.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, mihail.atanassov@arm.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, seanpaul@chromium.org Subject: [PATCH 1/1] [RFC] drm: Add per-plane color management Date: Mon, 26 Feb 2018 15:59:22 +0000 Message-Id: <1519660762-16981-2-git-send-email-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519660762-16981-1-git-send-email-alexandru-cosmin.gheorghe@arm.com> References: <1519660762-16981-1-git-send-email-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: CWLP265CA0057.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:12::21) To VI1PR0801MB1264.eurprd08.prod.outlook.com (2603:10a6:800:3a::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 19769da9-0e85-434c-8f5e-08d57d31ff04 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1264; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1264; 3:i9F3Bw5L8vSSrlqywtEyo4yrhWtgvYRcwuf3hR9ucfCgLmZNyoNqI8NWbO6SXRaKacqIb3cuvuje/hXk7L2ViMB+coOWZkLH9ofFKaAZOAhjSL01q7/3EP+H5n1XCBY1wcrHPH27GyJVNj7lwZNLlXTNHjK2A6LyTeh1AaOx6U2o0vxqufX/byD6NVP7XWjsz1hbmCJ/kWHHMEuP6aIqch1a3Kc7waOHuG0I+GdBta9YAuCufdkGtYcmJJIDsr/6; 25:/bgb9aTDwTIFaLLNfl4wv8Wry6bZYK7kItRpQ+BW0G30nNJ+9gXVP6YZQQRthMQq+1vW1prv66mfPL5dYr7jE7dqSHyXh+yzuC1VAQzp2bJqvWVyo+QP1V9/OLnEwwAkONUUsBQMVTPN0PNpTB5DD8nvj45ECpE8yolVIvCAex4q483SfBjeJ+qsOXJe7R8Ilug7lZp7GfRTvDSTWh6rhNqCk8zKsDnL3cv+nzpcp6MGS2kqrodN+344JLu4cYEqWwC4zqV4HYsNtMq4dt51FYB7eiBWBofMCPqGNAyTk4nv9uN0NUWb6tYdKLLoQDYwQ3UhudzNjE/JrzwlQmzvvA==; 31:x4ahRbOWlCAk8KCwnRVtSxA0wd0aEA1Ykw215oE+ZgUrL3nJw/AsUVGh7gIChaexw0YBXNY8Dswum/Pi5Qu5iWCVfWaschsrthogqR6HDUCo4sRd9WCZtj1KzTRIQVatFJBuiFv12Hod5EW7S/Jhghx6n0IyrYHhT8IfWfAkk02Eonao3VugqJ84Snra1ZjIoo0qhZ3MiSqiVYO3T9jRtxXQ39SSws0yODcm0ligm0o= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1264: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1264; 20:mZzGriDi5HFigr9nLug6rIrXO+zmj9s27gCee3TGXwnBUon4rZpOmauFoObrEk2qotn9qcIz8iyzbOY8Aw43jBqwhQM1o1m9+O27NN8JkoPxkoTuLyCYPFgquKltFyYtHaLnM/IhZA/cb/2Senm/5gH3opARN2m5vQlzdQbuZj0=; 4:Uh1ERGdIJ2gaZgUcyFj6bIiGKXzHB8/hM6O1jRN4grYEiEJPkiFZjT+k10N3R/TMtodbq1YuV4XvyVU5AIRhOeTkGDYuoaH48ZZpTfsiEre29LlCZ5DLMvSIZ9hNyNiDlRrBUKWnkGYkV2sJKQLoueS6sAKGCS94AkFmiSxXBS4Ppl3I5aNK8bdFPYy/4Qtb8FBDrucC8+QR5BVsHhiFyPsr4sCj8drL0TfyvR1FzD5f75SwaQB2fKSOhYTYvWRtBYDorhDnoYBIlbagy7xtOd7F+x2fXh6QCkpCXY9cb5MeNPtAKxUMVyPx4gUzHsxX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(10201501046)(3231220)(944501161)(52105095)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR0801MB1264; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1264; X-Forefront-PRVS: 05954A7C45 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(396003)(366004)(39860400002)(376002)(199004)(189003)(7736002)(478600001)(305945005)(8676002)(5890100001)(68736007)(81156014)(25786009)(50226002)(106356001)(105586002)(2950100002)(50466002)(6666003)(97736004)(36756003)(48376002)(86362001)(26005)(16586007)(72206003)(4326008)(2906002)(316002)(5660300001)(16526019)(66066001)(47776003)(81166006)(386003)(51416003)(7696005)(8936002)(6486002)(6116002)(3846002)(52116002)(53936002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB1264; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1264; 23:wNGRkA1NNpJJhkX4/mHVCGtY/1Ah+Udv/FvoMHB?= =?us-ascii?Q?9TeZr9GiO7aAOjUGYcbj8x9d8VnGJANh81bFd8ArNcaXaHVm7APu62aIVjGn?= =?us-ascii?Q?j4B7KJU5u+Eb6DqQlRH4Py8UglzwfgsKpbHQBoX5Q8Z990eLsK1qoZA8npJJ?= =?us-ascii?Q?z/xbYmszQkY9Cia+huhAMg0YNFddS6BsuAyJmR3sxLtohLaqQHzQUfQdFZfI?= =?us-ascii?Q?2IKE3+QT4KK6uPFCl4L+/fUL5ZgtpXj/yomNzEIK8PdPjp+3LrvqYDy/3fNW?= =?us-ascii?Q?QgSZtHVEewDrzfqfE6G78X9jDm+5XdG2ULngVgBK2GNHeEeUdWiDClhD1R37?= =?us-ascii?Q?MAcOANvqWO195lormPzEsofl7G0YHiJWsVj8+RMCOmmxnE2xQJPSPyu4TPPo?= =?us-ascii?Q?N0UcHN38XRvQytSzwL6bpROKHeTN2r+fL1Nf7mbykMfxQ+pKH9VabHUewcYM?= =?us-ascii?Q?BW0ve841ht89cRUCddROuSGz43AvHvz5CwkIB+dfCjixwWjG9Yyh8m8Gwj/g?= =?us-ascii?Q?zVM5ZPN6wXCujWYATAFQChs6stiCpK7VQiUYvc6/7oKzlpIZNvx04qmBlGqj?= =?us-ascii?Q?zZI1g8KPEUGtvzADHrVCkCG6b5jYTINSXuNmwumWaEFV0Fx81xNNnmzC3aKZ?= =?us-ascii?Q?jvxLPYkzduriWmjl39c9iHoclzb7Jz+nNcBtWI1YdnWMJ7ZOF7ACVKIX2I+7?= =?us-ascii?Q?Gvmgkm88YZU2hiXEWGHigHrOI8HjH3dNe0TIm+I2sgLCnVV3ktrYSAX0g8ap?= =?us-ascii?Q?pY8vtj/d5sme8WyF14V0XZC5bdLRn+XXmsb+yLzKO5Iacw8wY3zBs+xwWKdi?= =?us-ascii?Q?QINrX6mD1XXGKhw+YkgGO9eYU7KEZiRRm+74MR60Z8XceeIYB4sQ4nbV5XsV?= =?us-ascii?Q?VU+Klyrq4GdjpBvyHVMvKOXMdSyq3qaqxXHRoHe7wSGt0d675m8rF8GLkIvo?= =?us-ascii?Q?qwx4lTLea/TACoApk6b5u6CQj2SZoZSLyu+LSzxk8XDSpv9tZti6BV96Jr+O?= =?us-ascii?Q?l2t32btXOsD3V/MHBuLiIv+8OmEJ/4GDeubaUmddygsZJ+T8qjfPaVREDYXM?= =?us-ascii?Q?UMU+qIGmq11/t4VrILCs9w1fi/TDARNfCNkf2D9iD/VNUyhb3Bg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1264; 6:C2Quxgs9hjpkErY9XXvua3x3Vum73Ao4ThZdG0lHSW0rZmTnYJEBkHpz+26lvylLJsPhumaeCUlRk+QYHhzr9YJKf0zgqfCroceXoP9wEfU7vYzsIXGl0BWHFdPArxps1Mw7kH3Eo/amwBDGkL8NKRLKD/Ku0K0Fdt5U2TWC36dD8Dh8ecFr7LVHtDLTzR4QHPbL1KBbbuOcV/3/yszPZi+oNJuVsYeAZ0FU75CloJlu+n196zHYfLUAwB2rrAzLLBAp/VRuM1Hy7+TLiNIg0DoM006n7WgLwk63xE8pU08c4MrP7XsdALRF8gcJpQC0/UhPIFQF4WrzY6/TOdqyAgov/vly6FsW/soSh2pjdmo=; 5:2kpTlPna8c9qa8iwfc6Pi8zW0g0qODbwBqnyf/xatvYs979/nylxpCjznrS3I+26vEtY1MMNXQfQ04tj+kMJefZqRt+y6KEgqk0zIYmQg8Lk1m5xEVTswKupYIWDR9/S/JZyKN4Xmm90O0zOi7aWUyeWkp5im/Ka5DkTuLiTZGo=; 24:jmp20LXVDnk96myrI0b0N0hW55QMkKCCsJ1Aoia6ZV9OJugyDjjmjbIadOJQQ6l0BjdHHEEiA6Pqvar39ovTwAnKHL/6GBktW2zgjA/28rA=; 7:SqsabCLcPUpSAdQJUig4ioK9kOv9m6x4jQ5sDkQ8c26iuLcQfkq+CpJsyNnHj8WfxF5mPDKQkDBkdezfi67Zq0mTOd0Eq/f/6Fct9BTWP4vo63YNN6iOWxAuhuMHiR4n6XP7lpNo4ny1GtZMTuM1wMbXVyX6WTpPIyQx8GUN6hxme0xF8MODqivysVKPqEdfqooUgV6ABYLSUqgUOBiR3TVdpUDqgfKS1CQJED2uVwGDV4hl0/PJwAJ8DwcDH3dm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2018 16:00:02.2682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19769da9-0e85-434c-8f5e-08d57d31ff04 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1264 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Mihail Atanassov Export drm_plane_enable_color_mgmt, which attaches the existing degamma, ctm, and gamma properties to a plane. Add a color_mgmt_changed flag to drm_plane_state, mimicking the drm_crtc_state flag of the same name. Signed-off-by: Mihail Atanassov Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/drm_atomic.c | 33 ++++++++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 9 +++++ drivers/gpu/drm/drm_color_mgmt.c | 76 +++++++++++++++++++++++++++---------- include/drm/drm_color_mgmt.h | 5 +++ include/drm/drm_mode_config.h | 20 +++++----- include/drm/drm_plane.h | 8 ++++ 6 files changed, 122 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 46733d5..39af45f 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -717,6 +717,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, { struct drm_device *dev = plane->dev; struct drm_mode_config *config = &dev->mode_config; + bool replaced = false; + int ret; if (property == config->prop_fb_id) { struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val); @@ -762,6 +764,31 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); + } + if (property == config->degamma_lut_property) { + ret = drm_atomic_replace_property_blob_from_id(dev, + &state->degamma_lut, + val, + -1, + &replaced); + state->color_mgmt_changed |= replaced; + return ret; + } else if (property == config->ctm_property) { + ret = drm_atomic_replace_property_blob_from_id(dev, + &state->ctm, + val, + sizeof(struct drm_color_ctm), + &replaced); + state->color_mgmt_changed |= replaced; + return ret; + } else if (property == config->gamma_lut_property) { + ret = drm_atomic_replace_property_blob_from_id(dev, + &state->gamma_lut, + val, + -1, + &replaced); + state->color_mgmt_changed |= replaced; + return ret; } else { return -EINVAL; } @@ -814,6 +841,12 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->src_w; } else if (property == config->prop_src_h) { *val = state->src_h; + } else if (property == config->degamma_lut_property) { + *val = (state->degamma_lut) ? state->degamma_lut->base.id : 0; + } else if (property == config->ctm_property) { + *val = (state->ctm) ? state->ctm->base.id : 0; + } else if (property == config->gamma_lut_property) { + *val = (state->gamma_lut) ? state->gamma_lut->base.id : 0; } else if (property == plane->rotation_property) { *val = state->rotation; } else if (property == plane->zpos_property) { diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index ae3cbfe..1995b49 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3501,6 +3501,12 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, if (state->fb) drm_framebuffer_get(state->fb); + if (state->degamma_lut) + drm_property_reference_blob(state->degamma_lut); + if (state->ctm) + drm_property_reference_blob(state->ctm); + if (state->gamma_lut) + drm_property_reference_blob(state->gamma_lut); state->fence = NULL; state->commit = NULL; @@ -3548,6 +3554,9 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) if (state->commit) drm_crtc_commit_put(state->commit); + drm_property_unreference_blob(state->degamma_lut); + drm_property_unreference_blob(state->ctm); + drm_property_unreference_blob(state->gamma_lut); } EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 0d002b0..e0871ce 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -90,6 +90,61 @@ * "GAMMA_LUT" property above. */ +static void drm_object_enable_color_mgmt(struct drm_mode_object *drm_object, + struct drm_mode_config *config, + uint degamma_lut_size, + bool has_ctm, + uint gamma_lut_size) +{ + if (degamma_lut_size) { + drm_object_attach_property(drm_object, + config->degamma_lut_property, 0); + drm_object_attach_property(drm_object, + config->degamma_lut_size_property, + degamma_lut_size); + } + + if (has_ctm) + drm_object_attach_property(drm_object, + config->ctm_property, 0); + + if (gamma_lut_size) { + drm_object_attach_property(drm_object, + config->gamma_lut_property, 0); + drm_object_attach_property(drm_object, + config->gamma_lut_size_property, + gamma_lut_size); + } +} + +/** + * drm_plane_enable_color_mgmt - enable color management properties for a plane + * @plane: DRM plane + * @degamma_lut_size: the size of the degamma lut (before CSC) + * @has_ctm: whether to attach ctm_property for CSC matrix + * @gamma_lut_size: the size of the gamma lut (after CSC) + * + * This function lets the driver enable the color correction + * properties on a plane. This includes 3 degamma, csc and gamma + * properties that userspace can set and 2 size properties to inform + * the userspace of the lut sizes. Each of the properties is + * optional. The gamma and degamma properties are only attached if + * their size is not 0 and ctm_property is only attached if has_ctm is + * true. + */ +void drm_plane_enable_color_mgmt(struct drm_plane *plane, + uint degamma_lut_size, + bool has_ctm, + uint gamma_lut_size) +{ + struct drm_device *dev = plane->dev; + struct drm_mode_config *config = &dev->mode_config; + + drm_object_enable_color_mgmt(&plane->base, config, + degamma_lut_size, has_ctm, gamma_lut_size); +} +EXPORT_SYMBOL(drm_plane_enable_color_mgmt); + /** * drm_color_lut_extract - clamp and round LUT entries * @user_input: input value @@ -140,25 +195,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, struct drm_device *dev = crtc->dev; struct drm_mode_config *config = &dev->mode_config; - if (degamma_lut_size) { - drm_object_attach_property(&crtc->base, - config->degamma_lut_property, 0); - drm_object_attach_property(&crtc->base, - config->degamma_lut_size_property, - degamma_lut_size); - } - - if (has_ctm) - drm_object_attach_property(&crtc->base, - config->ctm_property, 0); - - if (gamma_lut_size) { - drm_object_attach_property(&crtc->base, - config->gamma_lut_property, 0); - drm_object_attach_property(&crtc->base, - config->gamma_lut_size_property, - gamma_lut_size); - } + drm_object_enable_color_mgmt(&crtc->base, config, + degamma_lut_size, has_ctm, gamma_lut_size); } EXPORT_SYMBOL(drm_crtc_enable_color_mgmt); diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index 03a59cb..831b09f 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -29,6 +29,11 @@ struct drm_crtc; uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision); +void drm_plane_enable_color_mgmt(struct drm_plane *plane, + uint degamma_lut_size, + bool has_ctm, + uint gamma_lut_size); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm, diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 7569f22..a19e59e 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -727,30 +727,30 @@ struct drm_mode_config { */ struct drm_property *aspect_ratio_property; /** - * @degamma_lut_property: Optional CRTC property to set the LUT used to - * convert the framebuffer's colors to linear gamma. + * @degamma_lut_property: Optional CRTC or plane property to set the + * LUT used to convert the framebuffer's colors to linear gamma. */ struct drm_property *degamma_lut_property; /** - * @degamma_lut_size_property: Optional CRTC property for the size of - * the degamma LUT as supported by the driver (read-only). + * @degamma_lut_size_property: Optional CRTC or plane property for the + * size of the degamma LUT as supported by the driver (read-only). */ struct drm_property *degamma_lut_size_property; /** - * @ctm_property: Optional CRTC property to set the + * @ctm_property: Optional CRTC or plane property to set the * matrix used to convert colors after the lookup in the * degamma LUT. */ struct drm_property *ctm_property; /** - * @gamma_lut_property: Optional CRTC property to set the LUT used to - * convert the colors, after the CTM matrix, to the gamma space of the - * connected screen. + * @gamma_lut_property: Optional CRTC or plane property to set the LUT + * used to convert the colors, after the CTM matrix, to the gamma space + * of the connected screen. */ struct drm_property *gamma_lut_property; /** - * @gamma_lut_size_property: Optional CRTC property for the size of the - * gamma LUT as supported by the driver (read-only). + * @gamma_lut_size_property: Optional CRTC or plane property for the + * size of the gamma LUT as supported by the driver (read-only). */ struct drm_property *gamma_lut_size_property; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 8185e34..dd52fab 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -105,6 +105,11 @@ struct drm_plane_state { uint32_t src_x, src_y; uint32_t src_h, src_w; + /* Color transform blob properties exposed to userspace */ + struct drm_property_blob *degamma_lut; + struct drm_property_blob *ctm; + struct drm_property_blob *gamma_lut; + /* Plane rotation */ unsigned int rotation; @@ -131,6 +136,9 @@ struct drm_plane_state { */ struct drm_crtc_commit *commit; + /* computed state bits used by drivers */ + bool color_mgmt_changed : 1; + struct drm_atomic_state *state; };