From patchwork Thu Jun 22 05:03:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9805491 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 23E2560329 for ; Fri, 23 Jun 2017 01:06:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F2A226222 for ; Fri, 23 Jun 2017 01:06:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 139A028405; Fri, 23 Jun 2017 01:06:31 +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 DC1D226222 for ; Fri, 23 Jun 2017 01:06:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 91B826E707; Fri, 23 Jun 2017 01:04:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 116290 seconds by postgrey-1.35 at gabe; Thu, 22 Jun 2017 05:16:59 UTC Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0108.outbound.protection.outlook.com [104.47.1.108]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DBA06E0A8 for ; Thu, 22 Jun 2017 05:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5Hk5PWn2lAJTxKmFYkxp+MtPnpBmK9JsTxVCa2nP7io=; b=No1a0735knJDXlGak9ahNjGEViRB75uazmuRGG239IxEhMVNRLlOx7SUa/bm9dye879+6iL05GtP2FJGGV3DFove/+sMCWbc/TqNQ9g0SAHwYU1EoP1G86VCg94CQHmSywEQDyOjpyx3Znbx/LCjJqiS7HZaM5DqjOuAC+UaLkE= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=axentia.se; Received: from orc.lan (81.224.171.159) by AM5PR0202MB2547.eurprd02.prod.outlook.com (2603:10a6:203:6d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14; Thu, 22 Jun 2017 05:02:27 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [PATCH v5 2/2] drm: atmel-hlcdc: add support for 8-bit color lookup table mode Date: Thu, 22 Jun 2017 07:03:11 +0200 Message-Id: <1498107791-17450-3-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1498107791-17450-1-git-send-email-peda@axentia.se> References: <1498107791-17450-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: AM3PR07CA0130.eurprd07.prod.outlook.com (2603:10a6:207:8::16) To AM5PR0202MB2547.eurprd02.prod.outlook.com (2603:10a6:203:6d::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 395a9725-a4e0-4c78-751e-08d4b92be1b5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:AM5PR0202MB2547; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0202MB2547; 3:7X28fuikrM9i7Yc46IHwBsiTVq/zVg3JCDK2qnqRJpt/S9qFp4wi7C5Bwbg8MllB1Rvt/sgx5qggEdihJ/63smBESJrTSdZGQRLsTs71ztBmLhvc8d669VlL2BeY4U2uY5h5G1792gJbrQEVSvRiUA/8/V61PfgCS4hqicLekOZsXSw95z0Y3aHH0Q6wxUbEkeBf1R59eQGZhWmctE+uioApr8KayTjsb4iqdugcpsuBCkRqw1kZ6cy5F+MeUGgSSbiAR3gphncAKdc2nMNmEtcxBLuZ+0Zw++ML/V2oGq6xk3OmwzU3s48B8vv2axeQ; 25:FRBOtMjr1Sz5YGRn3ROcwG0agt57Xr9VdscWlo0cZf848R9XMzTDX+lf7avHkcXQWmEeN9PcXsxVv40lIMFogeI9dJw6d36mNORCLsWJWBIGQQ0Iz7Wgmr33iydSayc4AKWKcGfqVWYwk8mgT6YP7XpUm8vwoS5XalGraR5qc2tnsNINnY/zLbN5iR56dJhza74xq1gcQ4eNORs/Iu8IibXbAahxSDPOFAyrXO9aXOaQCJriBmMQ7WUQPM2vOKX2H2u9XOXLnqsnCfdrP9b085A5NMXEELoXZeShptjqfHXQlGrzsll+an+b280b6J1cJbY9grLaY99qNRiO6mScDVn1vGtqGwK5tUJg69gFxBRd15pohzuGFfiJKQjBulMdS2d6uydIARuqQZ1POYpWh7rS50Ab7TF+UuxitpP6vBva/Rc9cDuglxQvX5SaYW7Ri1gWAoCIBWli1PWimqowvZCVxp29qTNc4NKxAoSrEGc= X-MS-TrafficTypeDiagnostic: AM5PR0202MB2547: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0202MB2547; 31:UT/+oRyW4P2UEfO+g8YSoabkrL80z27jQIlgE4GStW5RuFnlM1mppqY5iqXRuFJPQHuBAj8FLIW6n1Jd1X3YCOFcYGo1HfaqaMGnq913ZRG5SeXxxF1F3ckPw3zoDLyjKzv+NylgUTnaHI1j/EyiWktklaLPobB81QcysfcTXIB/3YgwRAqsGF+awQBAE85FZsfTh02TsPxyn2Psql5BpCfsrJFnKHkQBEsa41GIkLc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(20161123560025)(2016111802025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(6072148)(6043046)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM5PR0202MB2547; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM5PR0202MB2547; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0202MB2547; 4:6J2cNRQn2P+IWg1vPlvXaMGtmfsMTx/BoHXYpQ9d?= =?us-ascii?Q?yUZeCki5JUyTmcL15ash3sddLWeAChZiuQHweyLe2BIWe3ikKiVwk/lZ9H0l?= =?us-ascii?Q?7b89eQCj1lUERKOJ0IFZn/EoU0HKGr7TOOlkmaBuxiS0pTb9ksCLKyNBICYd?= =?us-ascii?Q?ZnhPBgOwgjfUSqL+sAXQIwrS3W5Rr1LRFTr+vDBZLBH0b2zLOqTOFI7HivQL?= =?us-ascii?Q?0T64IsH2NwuwRJbOBWWaI6XGotO3ls15WloHrh6eb6D6OPbsAQyZQaitxTga?= =?us-ascii?Q?BosalBzBrc/L7WoaLc/ZtCeirby7+Hu/cMb71skHthv75JNMJvLVC36q9K96?= =?us-ascii?Q?YfpwXk2SdGC2GKljT5WBcHz5uyFgZn0P9yS/MEK9a/XZKpqR7gpAkkHTOV9J?= =?us-ascii?Q?qU+oEQiOp60nHznRRXEf6PN13A1EGGvOzi5gp8C1DIGavMMx3ySQ4L5FY3Ed?= =?us-ascii?Q?vV0JKDTH1JEoSGEo2tNGXY4r6g+DWCDnfnLa485R4MvM/pwTKptsnEV2R4aD?= =?us-ascii?Q?yTBGtwhlwe2gZH7Epy8eYRLhZBq1nQTEnc8ZdV2+IYOdVdeMC3efWgIEZBmd?= =?us-ascii?Q?jpPlz1fyu9SgbQD/PN2CagLt3+yGspjiVwhWjgCXrz8ELcowSJ5BcZB/uWBi?= =?us-ascii?Q?SkSGPjSz4HVKcKEv6Iuw0ATIFMp/ip2tOPncl6ZwRoE/1tEE/wLVa9xy+y8+?= =?us-ascii?Q?hoz1tMopZnbnCX9mI2h1ut0aPAnyjf1K6gkXAVarbIlZoH/NQwIp8w67KoPF?= =?us-ascii?Q?zdweCSsSozbFisyktCEky/vpLrMYCIyl/aCzjWODcjjBCcwIqZnMtFrIqcNn?= =?us-ascii?Q?jRkcHLoUEnJ3qyY+0+jAGAmbZ+zSzFIRJ63lK/4apWg7V7U4vNhoLC7Qr11t?= =?us-ascii?Q?AKRfJhIIVjp5DDphhxg7GhwJwf46g+MJEBzNWNfig91hdJs89lVH6Wlr5PDu?= =?us-ascii?Q?hYfehHT94U0E32hNcuE3xrVihNkmxGjZu2JAmyt28XYF+9Kp6jw3vrotaOb/?= =?us-ascii?Q?OCzDTimRY77bTzEYvrZ8SOcndGu8gJEIsK599/D6/oaWILAagRWq39EaOOak?= =?us-ascii?Q?pyIMw5L/Kp+DZjxdZNv55RBkuoTWA3czBREvKtB3Sr+VpACElNBDm60XusFm?= =?us-ascii?Q?dtBPH0tqq5v16rSJk1F42EwcrY9cqdETe3hHC4K09wj6zkaMLMxU9vSAlU1q?= =?us-ascii?Q?cMBOq/ZAr03vO4ydHZ3Jqld5OZfGKyjLSmXs?= X-Forefront-PRVS: 03468CBA43 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39410400002)(39830400002)(39450400003)(39400400002)(7736002)(50986999)(8676002)(478600001)(36756003)(42186005)(305945005)(5660300001)(86362001)(74482002)(6666003)(2950100002)(6916009)(53936002)(6512007)(81166006)(54906002)(48376002)(47776003)(38730400002)(110136004)(50466002)(66066001)(2361001)(2906002)(3846002)(5003940100001)(2351001)(6116002)(50226002)(25786009)(76176999)(6486002)(6506006)(4326008)(189998001)(33646002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0202MB2547; H:orc.lan; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0202MB2547; 23:OPSRFtmraQ+7aTOt0Xbl2qErFwt1zhW9371zAnY?= =?us-ascii?Q?32rArQ8Rqq+D1z0GGKlW4RohLWDcc42u79n38N4qYeEwgjKb5vvwgTu84Obm?= =?us-ascii?Q?/7CfHUHVly17AY17APb4W1bBx00wtsD0oUGPFmBzPNfeHDFmQzjooIlChel2?= =?us-ascii?Q?fUVxc8/A4osLfAhXOMetPHeVonnYO0sUV83Ou8qTZZ/nE3Eld7yE+W/7+625?= =?us-ascii?Q?Y3ipL1YiVH25h+khO/cyJNVhTMLyUygnREm4UMv2G11/MBfPYfaTXYJtEsQ9?= =?us-ascii?Q?9A9wM20BEBTthU5XPj0Dg4q+S0YrwlKeM+Dx2/v/bfaxVQFnGM9Nezm0ZBIn?= =?us-ascii?Q?i2I31+F+tJ1N1wN33q4M7GagMXN1uIcelacZTcJFadv79pU9VjIkOk3uz5+L?= =?us-ascii?Q?wK/IZAlae8Gd+e5aqir+35yaEzb2QsvYmVXqAl7qAkYTUrEc0aZHY3BKmlkr?= =?us-ascii?Q?IZxnm4shUVdQifa5SUr8vhUCgrMFd09wAa/vstBu+Hyo5nVXsoWV01a0bI+5?= =?us-ascii?Q?5X9469ki0u8PqsKErETUnSchj/09fPlUloKJ6Q6zXnOyMpPeB8Cc/hd+9TIl?= =?us-ascii?Q?uj0IWpzePiN+Mr9WPXTNs0Do0ORvl9SuMgpfqjGfHwitRhPJh8JySC3UU4k8?= =?us-ascii?Q?rQJZt/Xrgx35kzIODp6pLDgIc5059K+9z4q8Ac/L6TXy8VesDdNS/yCocztm?= =?us-ascii?Q?0360gW8EAmi0+l+u7PSlBne76cKcw8YqT9FCuLsTQcggOJLS6Rly69zfHFyM?= =?us-ascii?Q?TpOQZh9Cf6aCYyxe9sRrLwxi4Wk2wxvwz6TsDtH/gaBZTRZkaJwSXDngyGT3?= =?us-ascii?Q?XBuLCTJQ8JGDcduqxRTKrSwzS/pvM/66thfeV+kUqBmHhlUf895UEtwWh073?= =?us-ascii?Q?5j4Il6uTsh7xGmTGATvUp6sTT1B0JQ2s4aSIBZjyZFL8we5CRR/DKkbtIhKX?= =?us-ascii?Q?xW/c2QlTQg3MF8PjHn6QIa+vsNzlQnTd7sNPw3hvfwoHlu2vMYTra4wGsWMb?= =?us-ascii?Q?C3+7CLBPHMvDS7ugj0Fr4IPPYb14ByHLWMMdSCiwt8Knk1nP38zqj8sYfpkk?= =?us-ascii?Q?Swx3K7AMr6zTYzEXM535Uqj9hwOozEuHPyA4XdBvBJYAKzstw4g=3D=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0202MB2547; 6:4smMljzWABvUSe4JhI3iFfNAPg3F8ta4BVj20Pc4?= =?us-ascii?Q?3AipDNEd5G3bKAkjtFr8NBNPDIs3zC/xQtXoedV7BzlgQfhe0IT4vEE/VlTO?= =?us-ascii?Q?xeRu1rwR57f+ghY6Zem9YQDigCVf2zPAlT2IAhgPChX6hqXBgnutgGY64cbd?= =?us-ascii?Q?vv0MzuBm8rEmLs0LLAoBf9hfmMOU87TfAS2Fj89pbs98z4a0s0OvEUxiq62C?= =?us-ascii?Q?RevFfqV6Su5S4Ys7BBGaeB/wkUKfltfOPHlXGwHQJHjxGUw+5gRYotM5QlFG?= =?us-ascii?Q?/OLcIYruzjHSmqrVa3v1jlLstQOUzveMMqyBil9P6JM6neEM3S2hUz4JZP3u?= =?us-ascii?Q?8mYXredskQ2moGjIVb3pqQxDUXBKxP0ubNvHWVl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SMgwtS8TjqC6K7DZcovs3DLTM1/+BdDjGpMBPkkgV59B4PlyfspVXj4VwPf25tH3sZtg1RvNbweojn2+0nYVzE0eg6zvfdol7eR1IGced0A7SPZoBw97zEcyhlk+rCMdgFZRYVKghEftvvcK4jsyDz+gUR2QPKp0i8b+2r/ryKb+6sdYAmCbzbDn4YHJ/RP9n4UqbbPX4Xhhyumd//ws4jKF0OLs0= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2017 05:02:27.9583 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0202MB2547 X-Mailman-Approved-At: Fri, 23 Jun 2017 01:03:45 +0000 Cc: Boris Brezillon , Nicolas Ferre , dri-devel@lists.freedesktop.org, Alexandre Belloni , Daniel Vetter , Peter Rosin X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP All layers of all supported chips support this, the only variable is the base address of the lookup table in the register map. Acked-by: Daniel Vetter Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++++ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 14 ++++++++++++ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h | 16 ++++++++++++++ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 29 +++++++++++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index cc00ce3..694adcc 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -430,6 +430,7 @@ static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = { .enable_vblank = atmel_hlcdc_crtc_enable_vblank, .disable_vblank = atmel_hlcdc_crtc_disable_vblank, .set_property = drm_atomic_helper_crtc_set_property, + .gamma_set = drm_atomic_helper_legacy_gamma_set, }; int atmel_hlcdc_crtc_create(struct drm_device *dev) @@ -485,6 +486,9 @@ int atmel_hlcdc_crtc_create(struct drm_device *dev) drm_crtc_helper_add(&crtc->base, &lcdc_crtc_helper_funcs); drm_crtc_vblank_reset(&crtc->base); + drm_mode_crtc_set_gamma_size(&crtc->base, ATMEL_HLCDC_CLUT_SIZE); + drm_crtc_enable_color_mgmt(&crtc->base, 0, false, ATMEL_HLCDC_CLUT_SIZE); + dc->crtc = &crtc->base; return 0; diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 30dbffd..6ff771c 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -42,6 +42,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_at91sam9n12_layers[] = { .default_color = 3, .general_config = 4, }, + .clut_offset = 0x400, }, }; @@ -73,6 +74,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_at91sam9x5_layers[] = { .disc_pos = 5, .disc_size = 6, }, + .clut_offset = 0x400, }, { .name = "overlay1", @@ -91,6 +93,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_at91sam9x5_layers[] = { .chroma_key_mask = 8, .general_config = 9, }, + .clut_offset = 0x800, }, { .name = "high-end-overlay", @@ -112,6 +115,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_at91sam9x5_layers[] = { .scaler_config = 13, .csc = 14, }, + .clut_offset = 0x1000, }, { .name = "cursor", @@ -131,6 +135,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_at91sam9x5_layers[] = { .chroma_key_mask = 8, .general_config = 9, }, + .clut_offset = 0x1400, }, }; @@ -162,6 +167,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d3_layers[] = { .disc_pos = 5, .disc_size = 6, }, + .clut_offset = 0x600, }, { .name = "overlay1", @@ -180,6 +186,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d3_layers[] = { .chroma_key_mask = 8, .general_config = 9, }, + .clut_offset = 0xa00, }, { .name = "overlay2", @@ -198,6 +205,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d3_layers[] = { .chroma_key_mask = 8, .general_config = 9, }, + .clut_offset = 0xe00, }, { .name = "high-end-overlay", @@ -223,6 +231,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d3_layers[] = { }, .csc = 14, }, + .clut_offset = 0x1200, }, { .name = "cursor", @@ -244,6 +253,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d3_layers[] = { .general_config = 9, .scaler_config = 13, }, + .clut_offset = 0x1600, }, }; @@ -275,6 +285,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d4_layers[] = { .disc_pos = 5, .disc_size = 6, }, + .clut_offset = 0x600, }, { .name = "overlay1", @@ -293,6 +304,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d4_layers[] = { .chroma_key_mask = 8, .general_config = 9, }, + .clut_offset = 0xa00, }, { .name = "overlay2", @@ -311,6 +323,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d4_layers[] = { .chroma_key_mask = 8, .general_config = 9, }, + .clut_offset = 0xe00, }, { .name = "high-end-overlay", @@ -336,6 +349,7 @@ static const struct atmel_hlcdc_layer_desc atmel_hlcdc_sama5d4_layers[] = { }, .csc = 14, }, + .clut_offset = 0x1200, }, }; diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h index b0596a8..4237b04 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h @@ -88,6 +88,11 @@ #define ATMEL_HLCDC_YUV422SWP BIT(17) #define ATMEL_HLCDC_DSCALEOPT BIT(20) +#define ATMEL_HLCDC_C1_MODE ATMEL_HLCDC_CLUT_MODE(0) +#define ATMEL_HLCDC_C2_MODE ATMEL_HLCDC_CLUT_MODE(1) +#define ATMEL_HLCDC_C4_MODE ATMEL_HLCDC_CLUT_MODE(2) +#define ATMEL_HLCDC_C8_MODE ATMEL_HLCDC_CLUT_MODE(3) + #define ATMEL_HLCDC_XRGB4444_MODE ATMEL_HLCDC_RGB_MODE(0) #define ATMEL_HLCDC_ARGB4444_MODE ATMEL_HLCDC_RGB_MODE(1) #define ATMEL_HLCDC_RGBA4444_MODE ATMEL_HLCDC_RGB_MODE(2) @@ -142,6 +147,8 @@ #define ATMEL_HLCDC_DMA_CHANNEL_DSCR_DONE BIT(2) #define ATMEL_HLCDC_DMA_CHANNEL_DSCR_OVERRUN BIT(3) +#define ATMEL_HLCDC_CLUT_SIZE 256 + #define ATMEL_HLCDC_MAX_LAYERS 6 /** @@ -259,6 +266,7 @@ struct atmel_hlcdc_layer_desc { int id; int regs_offset; int cfgs_offset; + int clut_offset; struct atmel_hlcdc_formats *formats; struct atmel_hlcdc_layer_cfg_layout layout; int max_width; @@ -414,6 +422,14 @@ static inline u32 atmel_hlcdc_layer_read_cfg(struct atmel_hlcdc_layer *layer, (cfgid * sizeof(u32))); } +static inline void atmel_hlcdc_layer_write_clut(struct atmel_hlcdc_layer *layer, + unsigned int c, u32 val) +{ + regmap_write(layer->regmap, + layer->desc->clut_offset + c * sizeof(u32), + val); +} + static inline void atmel_hlcdc_layer_init(struct atmel_hlcdc_layer *layer, const struct atmel_hlcdc_layer_desc *desc, struct regmap *regmap) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 1124200..b5bd9b0 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -83,6 +83,7 @@ drm_plane_state_to_atmel_hlcdc_plane_state(struct drm_plane_state *s) #define SUBPIXEL_MASK 0xffff static uint32_t rgb_formats[] = { + DRM_FORMAT_C8, DRM_FORMAT_XRGB4444, DRM_FORMAT_ARGB4444, DRM_FORMAT_RGBA4444, @@ -100,6 +101,7 @@ struct atmel_hlcdc_formats atmel_hlcdc_plane_rgb_formats = { }; static uint32_t rgb_and_yuv_formats[] = { + DRM_FORMAT_C8, DRM_FORMAT_XRGB4444, DRM_FORMAT_ARGB4444, DRM_FORMAT_RGBA4444, @@ -128,6 +130,9 @@ struct atmel_hlcdc_formats atmel_hlcdc_plane_rgb_and_yuv_formats = { static int atmel_hlcdc_format_to_plane_mode(u32 format, u32 *mode) { switch (format) { + case DRM_FORMAT_C8: + *mode = ATMEL_HLCDC_C8_MODE; + break; case DRM_FORMAT_XRGB4444: *mode = ATMEL_HLCDC_XRGB4444_MODE; break; @@ -424,6 +429,29 @@ static void atmel_hlcdc_plane_update_format(struct atmel_hlcdc_plane *plane, ATMEL_HLCDC_LAYER_FORMAT_CFG, cfg); } +static void atmel_hlcdc_plane_update_clut(struct atmel_hlcdc_plane *plane) +{ + struct drm_crtc *crtc = plane->base.crtc; + struct drm_color_lut *lut; + int idx; + + if (!crtc || !crtc->state) + return; + + if (!crtc->state->color_mgmt_changed || !crtc->state->gamma_lut) + return; + + lut = (struct drm_color_lut *)crtc->state->gamma_lut->data; + + for (idx = 0; idx < ATMEL_HLCDC_CLUT_SIZE; idx++, lut++) { + u32 val = ((lut->red << 8) & 0xff0000) | + (lut->green & 0xff00) | + (lut->blue >> 8); + + atmel_hlcdc_layer_write_clut(&plane->layer, idx, val); + } +} + static void atmel_hlcdc_plane_update_buffers(struct atmel_hlcdc_plane *plane, struct atmel_hlcdc_plane_state *state) { @@ -768,6 +796,7 @@ static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p, atmel_hlcdc_plane_update_pos_and_size(plane, state); atmel_hlcdc_plane_update_general_settings(plane, state); atmel_hlcdc_plane_update_format(plane, state); + atmel_hlcdc_plane_update_clut(plane); atmel_hlcdc_plane_update_buffers(plane, state); atmel_hlcdc_plane_update_disc_area(plane, state);