From patchwork Mon Jun 19 07:44:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9798275 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 CD1BF60328 for ; Tue, 20 Jun 2017 00:22:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF2A8223A6 for ; Tue, 20 Jun 2017 00:22:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3DEB24560; Tue, 20 Jun 2017 00:22:14 +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 82E65223A6 for ; Tue, 20 Jun 2017 00:22:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 966616E251; Tue, 20 Jun 2017 00:22:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 15639 seconds by postgrey-1.35 at gabe; Mon, 19 Jun 2017 12:19:22 UTC Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0111.outbound.protection.outlook.com [104.47.1.111]) by gabe.freedesktop.org (Postfix) with ESMTPS id 621FA6E198 for ; Mon, 19 Jun 2017 12:19:22 +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=EVYE/dJTsli/3i4R8aBOrmgRmbQO82i128MuCl6T+mE=; b=B4uKXnTQq26vEMrE93PORHRpK55QJRuNthVzTknrpjzusX+l+wKdSOGxaBKefOV9isTQwvAXYzbucskMOtsk8xaBOUsW75py3wUIWgpjqf/j7VlJnJwsJ3WCCYQ12BFVo+1v5ZNKDaUs+vftTY1qeekyDuj+hqLoYAxv2DIjX/8= 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 DB6PR0202MB2549.eurprd02.prod.outlook.com (2603:10a6:4:1b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14; Mon, 19 Jun 2017 07:43:49 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] drm: atmel-hlcdc: add support for 8-bit color lookup table mode Date: Mon, 19 Jun 2017 09:44:24 +0200 Message-Id: <1497858266-17844-2-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1497858266-17844-1-git-send-email-peda@axentia.se> References: <1497858266-17844-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: DB6PR07CA0129.eurprd07.prod.outlook.com (2603:10a6:6:16::22) To DB6PR0202MB2549.eurprd02.prod.outlook.com (2603:10a6:4:1b::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1d7ff44-467b-4e34-1cdd-08d4b6e6ed2d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:DB6PR0202MB2549; X-Microsoft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QUNyGkn3wq4zyjYRoxt1jan3J+YkpneBJxGeaQGTUSlHaX74Qrct+hOV1z+ffgvRen/rma3tGc/jUc= 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)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123562025)(20161123555025)(20161123564025)(2016111802025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(6043046)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0202MB2549; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0202MB2549; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2549; 4:CuQCTjK6BXK5IKFy5W9lWKWACRYrnFbMV5QQ1a1Y?= =?us-ascii?Q?dEyTM/+v/eTOQsZw91GriYiS2aqgP4LMJDoc32InT6udcmFb8skhqH+BH2VC?= =?us-ascii?Q?P7pG5N/9bjWHlO0odoCJyjuvVHUbzsxAaT7n0lF0sCRGoNMI3RS/MTec3Bp0?= =?us-ascii?Q?rpPY9utfIkv0/j2E0OroPLUCmXWs/DkD0qPvAeiJeSGTWWKIcnZjTH2olq8R?= =?us-ascii?Q?7EZ1+MQ83YLdStwDDAYYc1X4RIRTJIQLM253+AjqPVNadhN4dIBn0xJOAiHT?= =?us-ascii?Q?alEPXwEa6rRJ5TpTIXPT7d67X/3qZ72R3DFZQ+TRDiHhVMuhFXqay14G4IQh?= =?us-ascii?Q?RmW04E65PPpplShKRhwjIfAu0sYdp6qJ9mW2CHjQMOxrvch/TGhl9jGojMWR?= =?us-ascii?Q?nRKewHnjXHmtx5BFgjdkTeOn9dXJbOj31hA+AiKX75i1lQAQbKovCZZNdXQR?= =?us-ascii?Q?/mknwY4NwXRA6l0vA6wVaGwyPsWyQAkS/xCLRoo6+2MaW+IZPAkOtMp2h2nj?= =?us-ascii?Q?CCsCYkatv0b92cQK2MEtwxr5BsqUpp2AlG1Tlal17GvRMwGXmHHozNsLVOIV?= =?us-ascii?Q?EP8NohnpKU2liFSEzi31lH5OLJBRGqzCnV6szkl0Cs/dFDRHY0fnUPCMGTbA?= =?us-ascii?Q?U8rxZhAwU8FBrbirPc3Ng+BJTXxBPMo7d19X4U1X3nKNKUhK7VWDfzPgBukZ?= =?us-ascii?Q?1OqPll5Bk23sES9+RwmCa26UF2Cm0e57vlFzZviVAyX5wZLXci/yDFarkxD2?= =?us-ascii?Q?Oci8DPURnSfdyxpVm1LvqoWzzd2WdYB0L4v+a4n2h7QXGoLC1FvYXkpWPoak?= =?us-ascii?Q?79nLP6xBwyQtkWh7szzy2arQ+6yp7ZWmQ7I+oAMFZeRbUx4PkpruEQKR/eiS?= =?us-ascii?Q?wdQ5V5ylDgxIJ+8E/c0y+gpcyU/oZelPKWA5HKjuOLdPgtxc5stWA2U+QhJq?= =?us-ascii?Q?5l5Q7XJ5Pu6wbdt8LJXcFxzql1NQxmNnBIKEJEMz2gBHvQlN2poKIv2+QoDQ?= =?us-ascii?Q?Zqmn4CY+IWoJ0K8tkU712X2wlYftqnFcLX5p7CS+YJBMP2Ikpz1aHgPTTYHb?= =?us-ascii?Q?pWhmZf1lt2AsisDKqvMbr/kidEx3rpDcfBkHJQiWi5JphPmtp9vdaY94I4+Q?= =?us-ascii?Q?uArscKiLvRGc3kqDva9Jx2CV6+fN9OkPbyS4sDGAB946VALXhgdXOD/5Csr/?= =?us-ascii?Q?unJjYUM+U3nqqhOLUwnwUDsv1giMoFauh8LM?= X-Forefront-PRVS: 0343AC1D30 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39410400002)(39830400002)(39400400002)(39450400003)(478600001)(38730400002)(50226002)(189998001)(6486002)(7736002)(8676002)(50986999)(76176999)(33646002)(36756003)(5003940100001)(81166006)(4326008)(53936002)(2906002)(42186005)(110136004)(3846002)(66066001)(86362001)(48376002)(74482002)(5660300001)(2351001)(305945005)(2361001)(6666003)(6916009)(2950100002)(54906002)(25786009)(6506006)(6116002)(6512007)(47776003)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0202MB2549; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2549; 23:IapczJNt27yMvGRRAtHhnMPYjI75QMQ7T9NVe6S?= =?us-ascii?Q?IdcCidZ2lH814WKFdjqsNW8NJvWIxfCJevIV9sqiqlIylZVRSLkJKNscYeCi?= =?us-ascii?Q?8V+dWCqpO0rMmjkikbsi9cSTYglGwdMK3DGPSFnFSmbeSpk/hAdw8jQpKEXD?= =?us-ascii?Q?eYdGE0sin3fbB0qAoloND4e1AL4nwMRHZoNwT6gCOF/SBR8KdXq3XBvTtDBF?= =?us-ascii?Q?kb72lBevcS2Gz6IBbh1DWHFuT7QdIolmdcGEBoNmN/vdGD8eQmSZisF9r+3D?= =?us-ascii?Q?Kt+2fGfrh3nVYcVDsSaa8w8KJX2QqtMPzfwUkhDxFseutMIuJzlfeEPPDyDp?= =?us-ascii?Q?gbcqoqC/dweCwK4rSzvSPFVky035Zbb645Ct2E0vax1iptCU23YORq9idCwa?= =?us-ascii?Q?JEXdkiSDEHNYCgUXmslVukqeGBnbJxIAW2Vh/cvTzj+nYfUbfE3jP7vSDwfd?= =?us-ascii?Q?hPJstQULLILoKvG2p+n1LUnnAmycMHlJ6fRCDGQtz+MKdnehDKkFir7voezZ?= =?us-ascii?Q?V44cbNrmjQ4oa7s/4b3d28d3n1q3sL9fzxZiCELyHAf/AtitQJrD+4rvy0py?= =?us-ascii?Q?bP38z0EJK2PCiVvx7f3PsbXSolnva1PLq4OwACvsXj/Pdg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3tNs3DnfOokqO/YJ5zWgfjBGEHY5gxOkbIor6kCQhvuQpMaWWpNPYg5ztoAgiph2W5x+W6vP9/07fsPPtk/YlBVTjjlC5JNTrXTPkbHzuGN7KCXlJOdvZimPJDmUDuSlsy837NBMm89ohSIihT+bmnPBURpNrW0rjg9iw+KJnbuAfZzMSZxRvD3O39A9usSZDk6P/K2dJKk7hewkNW0257YfAbv+FiGct92PszKmSIYv7Y5h5g1I/zhMXnkK97S+1bfnOAXhUIu3IaEj2YyiLn7; 24:nQyfS1lxTYcwn9xUcGJbJ0x9Z7ggbVz2kvUZfFso6T12L4F01yxKLc0CAf3s6tvbczPePE64W/pKH2yy1HI0mB+1zRM6T24quwrcsqgi58A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2549; 7:pVHqkoRHkWgrv0zG2xaITVNrhqrnWXRlaY/PhvAqYG7XxP0tvyCQREiUF+y/JC7Q81Il9Yn5dozDlPf12qr5XBqMVnArIRuIdQuFhsnuFZQhopgWPCCafbl70SMaN4ui5L8J8FTl9jmVszBrg9mfumsxtGvcsQlTpRNB51iNoPxGk/V2GR1RmCPMdO8JEte7Dmdc0u7CFLybDUG+UstEcITZ4pm+nwft0Is8+we9BlfoiSh8E0MlHj619xlK/aqDmE9F2yqOvvzMCQgc+BML5DoIgNEuyWVixPRop9DT7NnIbSUenNknlDBNFR42m+zbeHCzW5oygSY9OiHVf3YXRC2JJUbr5coyleWr0Yo6PoVhIDZnJb10ZRo+zGeSP6hpghUSN3vAjycs3IrkO2NN1hI5NQT87JAlKx2bA+vKYH90UnR50serON/huBIDiKJeXgw7+7dnrVyAl4qZA84TUZzVcSTTJqjC2RhKMEQNUbrbEWZLk4fFPMlD4ZmGc8w+a/dvp/5hJvAa91YhYnOh7+e/2XcONJTDkOHudcxlLQoO8LMJ936QeJFhdcV9msbXpZuINclJ7jxmv5tw7OZ9AEhazzeRQWlSilTZCJt5fVgwRmBHNb3BPhzE500poWVi5W/XEICaDzA/7jgKkpF2+Qke8O0CYffQ3siyxu6ar9UOL6nZvHNFiLwqQajnHJbeehwMxWMJog4iUaoDP1i99kHzRvIlLCvcqABfFwYL16Sxu86FN6r0WB0favPRakNoOjoHqcP5cSV8Xl9UJX9Jz81hqImM5wKCJfSoQiqGQBA= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 07:43:49.5365 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0202MB2549 X-Mailman-Approved-At: Tue, 20 Jun 2017 00:21:59 +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 --- 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..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);