From patchwork Sat Jun 17 17:48:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9795017 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 BB783600C5 for ; Mon, 19 Jun 2017 01:11:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC9C126E46 for ; Mon, 19 Jun 2017 01:11:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A147027F98; Mon, 19 Jun 2017 01:11:49 +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 EDABC26E46 for ; Mon, 19 Jun 2017 01:11:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F4266E132; Mon, 19 Jun 2017 01:10:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0094.outbound.protection.outlook.com [104.47.2.94]) by gabe.freedesktop.org (Postfix) with ESMTPS id 44B146E0B2 for ; Sat, 17 Jun 2017 18:03:11 +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=oaP821ge+nPbK0HDFcGXHxGdYG4Chcv9K00nUbvuFic=; b=sY+r+0VNPpHS1pbKQPyVxo1GJ6mR3awb8+g0luUM/4pxbUQ+iJam+wJVSHFEGe4hyY7fUhzb8NxWE0Q1i7XkbzLxPKK7d8NJ3jAt6itwX8d6xLSMKoCp9PmmPPSysRGcoeiGa9bNCLZsC5qW9WrPLub345RxNjjBIBJCHjzGJuk= 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 localhost.localdomain (81.224.171.159) by DB6PR0202MB2552.eurprd02.prod.outlook.com (2603:10a6:4:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14; Sat, 17 Jun 2017 17:47:31 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 1/3] drm: atmel-hlcdc: add support for 8-bit color lookup table mode Date: Sat, 17 Jun 2017 19:48:02 +0200 Message-Id: <1497721684-3002-2-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1497721684-3002-1-git-send-email-peda@axentia.se> References: <1497721684-3002-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: HE1P192CA0016.EURP192.PROD.OUTLOOK.COM (2603:10a6:3:fe::26) To DB6PR0202MB2552.eurprd02.prod.outlook.com (2603:10a6:4:1b::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20f1e435-d2a0-4c7b-4ff8-08d4b5a8eea9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:DB6PR0202MB2552; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2552; 3:tXD9U5e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RjmUBbWOgGIYf51dPU/MQGcn6xIXIzsq0H7z2AAJU= 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)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(2016111802025)(20161123558100)(20161123564025)(20161123562025)(6043046)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0202MB2552; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0202MB2552; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2552; 4:zIT8vHUQQ7cczBkF2cvy4uDQ2kOJ8nETydQ3LmEQ?= =?us-ascii?Q?DX1D9CH1bq0xn3+L5L+XXdzjt4czjm8q6+5cYLV2n1SHJMkQrvpwoDzoe36Q?= =?us-ascii?Q?ew7S2XpipnBm5v3Ay5kUidQfX3x+gjcdqGjhciXJO4n74vxhF4L7+mRd8xLR?= =?us-ascii?Q?ZA1YE2Ukl1JzXTXvcBFgyC+Irm5aqdgndRUyFLdF0hqrJQsAWzG7viY4dPjx?= =?us-ascii?Q?osSHpBsP+mK3cTacSJFp6ZK2333nA/s4niGM4s7T5WmH5pmYb+rDne6Sreu3?= =?us-ascii?Q?B8zem3xa9kIIbLdzcxow6UkHwZbOjO+wzRZtJtg1MrV9ryAYP5qoA4wQV5fi?= =?us-ascii?Q?fbNyOoE3USsNcrewUwblbYDB7Nk4k53NOyUsIv3WSLTBZUze/Te/mZOUW4Bg?= =?us-ascii?Q?877MDOmOstxyyq4bNvl78SZCf6C/5ntnrftvncpXM27u30gx1wvfUna4T2mt?= =?us-ascii?Q?LIPCV0OvHUFxsw7huptE9sZBm6DFe4JDSFVf/guFXeuUXPhCN2e9u8y6EtP7?= =?us-ascii?Q?it+2zJBsvSmUawy0DG6o0ylFwj4RofvT47VTgSZsF6Q1aJw92Exc+ke5CWSo?= =?us-ascii?Q?drXm1U62618s51Jzw5Z0aZsrwSPmaEN+OpoKqOJQqWfFDxWpkfQJIUjQUOId?= =?us-ascii?Q?9KhbA/AXVxE1VbAaHBiPaPp3PmLxEx/RcSyy73W/nJSMVsQXjGltnFZixwID?= =?us-ascii?Q?dUwBjXEAIbfpcNhzqhlb2DqYLkzLLfnihb1LFfnMWL7QvTH1MKhZ84dND5vK?= =?us-ascii?Q?bIx6IA3beg0Rni6UcWJNHqPxouNHeu7VtWUrnaPoiPQauvaAIMndWXzQf3ys?= =?us-ascii?Q?omYXu+iqcbynOX0a7wBZ5iUFuchlCY6etidP1ha73T5EXHR21kx9tniBl44o?= =?us-ascii?Q?CGEC/7FCU14AyJNV2Ti0nabKQcei0nQ9MGe/wKgD3pLsSt+69ROfCzneS1Yc?= =?us-ascii?Q?H/30cBG5IIVLqmK7psl/ZIeCisaFG/ZgyDfVwcOQX6RTcNHmHEbGjdSyweLO?= =?us-ascii?Q?W4PtnsUP+DflJOahUsqLom1FWiTH4KrQNuoBRExlyY+aeKTVLJktyi/vPxPg?= =?us-ascii?Q?y6YZVVcEao1HuaapolSaW/MqgNioembdn4fdYd7gZXZfwrJBB2Gpl6I/2XYP?= =?us-ascii?Q?GjNXzA3U4IXNspH90ivUT8H2CjQBaFjXpLySkrc5qTXQl/VoB/9GRo1hoUUX?= =?us-ascii?Q?y/Snv34SQDpFQ/7xPDIxgY28KnjMJNtygpCd?= X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(39450400003)(39400400002)(39410400002)(39830400002)(76176999)(42186005)(50986999)(189998001)(33646002)(5003940100001)(2351001)(2361001)(86362001)(25786009)(50466002)(2906002)(48376002)(74482002)(66066001)(4326008)(47776003)(110136004)(38730400002)(3846002)(305945005)(81166006)(5660300001)(6116002)(50226002)(7736002)(478600001)(2950100002)(6666003)(6916009)(8676002)(6506006)(6486002)(53936002)(36756003)(54906002)(6512007)(217873001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0202MB2552; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2552; 23:xN2rDf4sclKeKL8lBOf2WqLsEVYGONDo+dVJbEb?= =?us-ascii?Q?ozVdu2AqFx8OTB4/xOsE9pxE92/J2NoelkkPVK60FX05+bW3cZcrXnv8Qpl8?= =?us-ascii?Q?0fIK346NEgZ/rlkJuEDpvL5X1aU+mgx0tAbKgcGILYolftcvIyGVH5usKXgw?= =?us-ascii?Q?gIWcqd/glaEfQl1Qk9Od8t/ANK2/XJAqrzJmN1mx3v2uUymcxAXZRCi54DWU?= =?us-ascii?Q?s/kNMs9GNfB3G8zHCKroCcqC/qYTwUIZLvkkRTj3ckUp2t6YO8Afj2VSLYfr?= =?us-ascii?Q?fCKyX55VDScjilbqyqqu0C+h5EPysRxY3ITEOg+yK+CsFDMRDTF3IL81kOIv?= =?us-ascii?Q?nBApo768uOLUvQHfBZ83sn6QlqJOaWE/sVDxQPHVyiLmm3fNLJz783Q+N1PJ?= =?us-ascii?Q?9Y1CAGBVRkyye6STGhtt1/TKO32upqTFE674T98iPhQ/FB0RmSll3f7oAnIH?= =?us-ascii?Q?80ykU9CcEBJK7jz9QEUEb+T6U4RGaViZl/8VEPAxTyRH6S1V553cF/cXOocZ?= =?us-ascii?Q?+SyWVd6D4eBw/clBBO7g47ROpFS7R5Yk34ZeEuAEzXAXXqmY4uDKBNL52iiQ?= =?us-ascii?Q?6B75YPJ8ToNDLNove3Ivt6UmyiBAfA5HcE5QowPMMtqFqreGa6djf6m5PUEM?= =?us-ascii?Q?0WWPcNBIlPox0azVL0OL/ajx9PLNzS7Zm9unbWq95+8P0bPz+wRhtn5ski5k?= =?us-ascii?Q?jtopzUvbZgdH1gBCGSi19hU4Ekpuy88jxl41i+M8pqgnSLyRTZH+mEnzvWwX?= =?us-ascii?Q?6Itci/ywvbC9kP/qkq2t31aemj39OWTKZ7zwihmdYnt06maKzRjPYciNhJ5j?= =?us-ascii?Q?IXW4GGzKjubithbTaurvk8PYN7lIv89cDFrtuPmFGj//2bSb7lLPvXEqeTxp?= =?us-ascii?Q?pjtppeosfyACwnsgGFiEEB1qpRHJcdCTmQl2pl+6VUg6aXmrmcEjEvsowqbO?= =?us-ascii?Q?8k2oi7HyMfNDBx5JpHxaXH7NUzRIVDtS1hu4WYHD7ksOXBf0nV4hlkAdkCdN?= =?us-ascii?Q?/36y09u/Bb3yqAt2WM+4q5CGru4w/stbSRasKkhu/HNA+MgTJaeFYWPbe6gK?= =?us-ascii?Q?NGyVUBR036dKWuTVLtDkteC2AEF3XPrZSudDkYF2YEgp1KFW0D/m7gZPCs+F?= =?us-ascii?Q?4IRpmkq3nJnm8Oxtj/KaLst0YvXBzdrXZ?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2552; 6:QNubFubW1GPLvxEqst2cbxChs8huOJOUwzo9hHAx?= =?us-ascii?Q?W4agOXBMDCMvacr9xaFlYGVJPwCo9pv9P+Pxm2zYuIhfqj90eA27Qj9bAzSt?= =?us-ascii?Q?H2WEbfF4k0tgUnUldg5a6hZ4g/QfqjtQeIlU2HT5shSXHT3EiCBSSZtDKZg8?= =?us-ascii?Q?VY+HfT0v6TfUUNj2ulZwKkXrIcVtFHJ3HGgTCrjbd3WHvaOpgY2Q6q1G7ixD?= =?us-ascii?Q?hflQzAIDH/2Qcsp/ERViXM40ZoSl1GcdJKjxsXUFG1z8onZhnNgAo21jfesp?= =?us-ascii?Q?QhREH6wkOJ98bpUot0sjrjbm6RDl8/kvDQdKe5FVWjVafkUAm7ppNFAyyQmo?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s/ieSedzQ3yiwiZC4yG0wUSc7d9Z3kY9EYcZXhcAT+tJRsuzJ9UzkIyxAEBag/s0rD5zeS788CJ3Kza0/8Z0NUG9paNs+UFd5a66h0o0OJAT+3tHEnP++et3sqd8xhLkLGQEzLCASnj1djlFFX46/E5iKO9pH5RMc28rzVpLhJyYhJjYyD3nLppcwV2bvDx51igJnVTaAK0FjRRkbzVDzwLq2KoGbemCGqsdGcySVEpE= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2017 17:47:31.7570 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0202MB2552 X-Mailman-Approved-At: Mon, 19 Jun 2017 01:09:41 +0000 Cc: dri-devel@lists.freedesktop.org, 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. Signed-off-by: Peter Rosin Acked-by: Daniel Vetter --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 5 +++++ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 13 +++++++++++ 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 5348985..694adcc 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -429,6 +429,8 @@ static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = { .atomic_destroy_state = atmel_hlcdc_crtc_destroy_state, .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) @@ -484,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..4f6ef07 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", @@ -336,6 +348,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..709f7b9 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) +{ + atmel_hlcdc_layer_write_reg(layer, + 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);