From patchwork Mon Jun 19 07:44:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9798279 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 2967860328 for ; Tue, 20 Jun 2017 00:22:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C59C223A6 for ; Tue, 20 Jun 2017 00:22:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10F7924560; Tue, 20 Jun 2017 00:22:47 +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 77223223A6 for ; Tue, 20 Jun 2017 00:22:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A51996E25A; Tue, 20 Jun 2017 00:22:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 7103 seconds by postgrey-1.35 at gabe; Mon, 19 Jun 2017 12:16:17 UTC Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0095.outbound.protection.outlook.com [104.47.1.95]) by gabe.freedesktop.org (Postfix) with ESMTPS id DCD6B6E195 for ; Mon, 19 Jun 2017 12:16:17 +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=AXrghbXqrAWzDf6etBJao6VBVbd4u4DBM/RMuL6AwNA=; b=RWkQa9hq0mLZS9gleiMeXvReB05xN9Fw13929OH+Z6ObQMRIuhXvkyajFueTC0FrRMjnGg3e2SMW1w/ZPFU2+NPXlUykVIP5WEgCwLw+hy6GBGoPkT+v2QTHNvBn5c6mU1RXTi1L2sQ24wk9nbgSS9GJpataSK7vrG/kV+zHgOE= 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:53 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] drm: atmel-hlcdc: add clut support for legacy fbdev Date: Mon, 19 Jun 2017 09:44:26 +0200 Message-Id: <1497858266-17844-4-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: 94131c67-8fe2-43fb-b439-08d4b6e6ef8b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:DB6PR0202MB2549; X-Microsoft-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355D88QdgqQ8QzA8pBFpDkYLn6AfmRabENEtw07kfKJZEmEphgjfhEexJFo4r/o3zatepnKd5qk= 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:VkFv4DQzZ4pa9/xr1NUiklihei6J+lE4Z+vlqfry?= =?us-ascii?Q?4+Wm9HVWJmBl1FZpul6E17W/BQ+1aKtjWn0ktYDeC3cYAzcK+oFGSMJ92NmE?= =?us-ascii?Q?RF9ycXJ6FCPtpItv5FJVlkOIWLDGl8X5P7FzK+AB/0tp8qAi3tkfkWP10+Mp?= =?us-ascii?Q?+D6zNEl7lDqX0WbhrMx+A4pAG0+VUlFpKIqWloMqhFGuSTtxf0OJ3RT7he2g?= =?us-ascii?Q?fYxQ9WHg+lryXZl2KguJsNVNz/5O42hOBazgI8UCP5GcEpSTRu8VQBsJ6x4H?= =?us-ascii?Q?MWZKOVAcx4gA4XP+h5BXjUzMwWTRWyxK/fIMqkPV+KrTqOxw1dcmqdzofsKu?= =?us-ascii?Q?HMlmo/eXPZkJnk54FIAnUX+iDBv0ls0vlYuvuIrnl1fr/vh6kqtGSbJ1doNT?= =?us-ascii?Q?WAVlXPOVTQptwWy6Pz+nJA2wjBkqRSYuSCbTRg+E6noRQ1TMIxxEVsWzuiXX?= =?us-ascii?Q?oOYmlDpmjsH3F6I7NnSC7ubrxmOSCD3Xs7VKGRpQNZm390CjZOWiUXYDE+w6?= =?us-ascii?Q?P03GbB33a0MjdE5wc/wByQqu+kxEN7yN0RBL5nM1Yxuf61NNTLdjn1rlQoCh?= =?us-ascii?Q?qSNCX72OFd/wsLqtPdUF/uUyZTLzUVlXed8oLsh83oZ9eGs36jSnAzXourHr?= =?us-ascii?Q?KQq5atYCgY1pqxb4If9ILl5C4DvqxjOadUYwmYk3Q8R6avLJ0kJgqhlyVzSR?= =?us-ascii?Q?hqXUxSFjXIyLGQjpazeqS2hhqIPstOY4nIpQnjtdaU2gnieoQX90e6UWqGrG?= =?us-ascii?Q?SMZom25BGturS2SX1663YEayfGrXj8zGi95x72cveoZtVxLEwCcGCoA658ij?= =?us-ascii?Q?sK7GMk7tS46SLF3uOKJ8eJosV78d8aRKxqolYUUQgX/lnxtBMTdMV3/xYG1z?= =?us-ascii?Q?+xu4bLO++huVYwRub2pl89/RwYBJhzs6wbWxqAjJZel1CFssmI8Z8s+30J2K?= =?us-ascii?Q?NuQilvcobGxEWKvGRKdwOs+8thoqIq06r9SWY8zUn0ahpGLlRn2M5r85Cfrr?= =?us-ascii?Q?m1uQ42ofwpgKrIotJcq05Jo1ywGm49i2zeSphqOtcwvEAwRaAYUsyFn9EZDy?= =?us-ascii?Q?SLgL/z+wSVONahkMO1HdD9zEqootZdYF0CVlpdndfNZEh8IYDV/gFZkOHeR6?= =?us-ascii?Q?A8Txcg7dj7m9aKceie8Aj46t+aSFX9ixxq5CaDG8Jg53x2Sshb3DrwFN5pOR?= =?us-ascii?Q?U+yElG3ZAwM7TbLq0TQW42YVAGJuipXBUpQ2?= 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:k78epyUBi/EAmKGMU9AwvRIwT3ZM5yzklCgnit+?= =?us-ascii?Q?b7Ddf/8Ba3ETt5Iv7rGgVQbmov/Mx35Glp+u5U3pTKLkCR52lAwq1D8qYADp?= =?us-ascii?Q?cOpwZnaB9ixsItOvlMPcKfMa7rUa9fDigvBbHn/upN7BPae5c5TgTdtqBik2?= =?us-ascii?Q?/F3Rxz5FrYLWWPVU/Ik79ROLGccpX82eUFiYeuFp4bPDPMyv1EtoEvbKNLeg?= =?us-ascii?Q?xPcD1IwxU3RhnO4J4ipcjkAcsHPUowsaU2ZYE4F0bPO7fAoTpz6UAiud1HYO?= =?us-ascii?Q?8l/VqXpq/zlSJE0gxg0djDGWl76EcjIE45hrUZjaAvOAvM4rBIySrCFcHrCs?= =?us-ascii?Q?wjAFg5Rkq4G4hHASoy57Db2dq/OIHr1+pWju/FzAifRFPqQvl2fZ53XCAUbR?= =?us-ascii?Q?vN8QwiyB4BU9dV+ch368OFuyud4AOKvX81OR+qwhhLULWSE2ZzfKiKXdEBBW?= =?us-ascii?Q?lOkqLGdN6kABHvKIrF1HihliFc3B+iXjjJ19kA7judzN0Yb8kKBZ81uoaSnK?= =?us-ascii?Q?3V//pgLt0K5kflOgjTGx4bnzQLmiSXGvVgAYLO6uZOcpABw/zDPhk9bq9ymP?= =?us-ascii?Q?mkQErrdputlYnGAb0jERNhJXzijynVvkCH8cI4kaJVRrMjZdSyQocIG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AZXlarxGQkETf/CGQRKSNPB2HFF8F9NKSaTLHC6++ncEeRMH8viKPuClOKoVIFRrIfskIIOvRbCkWusAFenIGPKMc3NO5GYkNkPNDzKNK77MF4ERHnDvwit9pd6bS2mBYs1l/tOpyFwdLZwX2rfAkSKSJL/LrdHqwawyZvFpTw6gqUac/UfKIsHPDVc= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 07:43:53.5439 (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 The clut is not synchronized with the drm gamma_lut state. Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 53 ++++++++++++++++++++++++++ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 12 +++++- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h | 4 ++ 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index 694adcc..4bee26e 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -140,6 +140,58 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) cfg); } +static void +atmel_hlcdc_crtc_load_lut(struct drm_crtc *c) +{ + struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); + struct atmel_hlcdc_dc *dc = crtc->dc; + uint16_t *red = c->gamma_store; + uint16_t *green = red + c->gamma_size; + uint16_t *blue = green + c->gamma_size; + int layer; + int idx; + + for (layer = 0; layer < ATMEL_HLCDC_MAX_LAYERS; layer++) { + if (!dc->layers[layer]) + continue; + + for (idx = 0; idx < ATMEL_HLCDC_CLUT_SIZE; idx++) { + u32 val = ((red[idx] << 8) & 0xff0000) | + (green[idx] & 0xff00) | + (blue[idx] >> 8); + + atmel_hlcdc_layer_write_clut(dc->layers[layer], + idx, val); + } + } +} + +void atmel_hlcdc_gamma_set(struct drm_crtc *c, + u16 r, u16 g, u16 b, int idx) +{ + if (idx < 0 || idx >= c->gamma_size) + return; + + c->gamma_store[idx] = r; + idx += c->gamma_size; + c->gamma_store[idx] = g; + idx += c->gamma_size; + c->gamma_store[idx] = b; +} + +void atmel_hlcdc_gamma_get(struct drm_crtc *c, + u16 *r, u16 *g, u16 *b, int idx) +{ + if (idx < 0 || idx >= c->gamma_size) + return; + + *r = c->gamma_store[idx]; + idx += c->gamma_size; + *g = c->gamma_store[idx]; + idx += c->gamma_size; + *b = c->gamma_store[idx]; +} + static enum drm_mode_status atmel_hlcdc_crtc_mode_valid(struct drm_crtc *c, const struct drm_display_mode *mode) @@ -319,6 +371,7 @@ static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = { .mode_set = drm_helper_crtc_mode_set, .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb, .mode_set_base = drm_helper_crtc_mode_set_base, + .load_lut = atmel_hlcdc_crtc_load_lut, .disable = atmel_hlcdc_crtc_disable, .enable = atmel_hlcdc_crtc_enable, .atomic_check = atmel_hlcdc_crtc_atomic_check, diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 4f6ef07..9a09c73 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -601,6 +601,12 @@ static int atmel_hlcdc_dc_modeset_init(struct drm_device *dev) return 0; } +static const struct drm_fb_helper_funcs atmel_hlcdc_fb_cma_helper_funcs = { + .gamma_set = atmel_hlcdc_gamma_set, + .gamma_get = atmel_hlcdc_gamma_get, + .fb_probe = drm_fbdev_cma_create, +}; + static int atmel_hlcdc_dc_load(struct drm_device *dev) { struct platform_device *pdev = to_platform_device(dev->dev); @@ -664,8 +670,10 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) platform_set_drvdata(pdev, dev); - dc->fbdev = drm_fbdev_cma_init(dev, 24, - dev->mode_config.num_connector); + dc->fbdev = drm_fbdev_cma_init_with_funcs2(dev, 24, + dev->mode_config.num_connector, + NULL, + &atmel_hlcdc_fb_cma_helper_funcs); if (IS_ERR(dc->fbdev)) dc->fbdev = NULL; diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h index 4237b04..fb57c6e 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -448,6 +449,9 @@ void atmel_hlcdc_plane_irq(struct atmel_hlcdc_plane *plane); int atmel_hlcdc_plane_prepare_disc_area(struct drm_crtc_state *c_state); int atmel_hlcdc_plane_prepare_ahb_routing(struct drm_crtc_state *c_state); +void atmel_hlcdc_gamma_set(struct drm_crtc *c, u16 r, u16 g, u16 b, int idx); +void atmel_hlcdc_gamma_get(struct drm_crtc *c, u16 *r, u16 *g, u16 *b, int idx); + void atmel_hlcdc_crtc_irq(struct drm_crtc *c); int atmel_hlcdc_crtc_create(struct drm_device *dev);