From patchwork Sat Jun 17 17:48:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9795015 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 BF48E600C5 for ; Mon, 19 Jun 2017 01:11:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B00E626E46 for ; Mon, 19 Jun 2017 01:11:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4B5527F98; Mon, 19 Jun 2017 01:11:38 +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 3F4BA26E46 for ; Mon, 19 Jun 2017 01:11:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C0706E124; Mon, 19 Jun 2017 01:10:19 +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 413566E0B6 for ; Sat, 17 Jun 2017 18:03:30 +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=a8jpRmLfymH6TBXFcYLFZ1L1RYCkHSMuk7e0GPv4VuM=; b=cygAMvEn0lW2nGYEkdtdVTvrAUb5dYYW4GYVKx1rEMbETwAbY+MyJeUlOR0QCNr6WelKO9glNfAGNVNcRp6JUmdf7MmrStWINYNULhRqudpXJP/2RlRrtV1F57FeX9viunu5ocrS2j5ty7+FLIgFexsJpRi88G7GpkqHzvVCNOM= 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:38 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 3/3] drm: atmel-hlcdc: add clut support for legacy fbdev Date: Sat, 17 Jun 2017 19:48:04 +0200 Message-Id: <1497721684-3002-4-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: cd4b075c-8ca2-4959-e746-08d4b5a8f2ac X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:DB6PR0202MB2552; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2552; 3:Q7FSFary7VfiYfSlV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QQXjYKGkN9MUBeUpqQlc= 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:PMs9OMMxJa+ba7XOj0m/Bx4Od2t+MSjzvrtHkxvO?= =?us-ascii?Q?HC+qdQnI4Qs4/GvD3c6mRq20jIiReISXoQYbFX17GjmAOaQB+b/7cG0ApVhp?= =?us-ascii?Q?sTYME5n/1qKVryYTipM0/ry/4R5Cagqb4Mk2RF/Tge4/gN2KXMFsOB4bfN4f?= =?us-ascii?Q?3oBg3jm4i4A6b1LF3A083ezpHv3C5gpjtXqQ9Mj6ySUDKDhFy238tiLgJSpa?= =?us-ascii?Q?3WaILMCKFntM59xsKhZZclmdnZRo1rGh660/afv9doVCksZ2HqKsvu2Q/I3S?= =?us-ascii?Q?ElXjsZcIkKvTmdVPxUlGaiRmTDj67MzMIxPB86DVc5ctKGurC49VXo2dhDe5?= =?us-ascii?Q?OiJGmvWf856c9s307j4DXIPA9JbHvUEGQrwAN9KoyxVUtA5pGEpW0Qv2YV0Z?= =?us-ascii?Q?EClnFTLhvAgy4On5OPEAgm6CTnVyKlkqGQdP7HIYw96BpTISaFUQgyuWxEin?= =?us-ascii?Q?UlaG8I921NKEONazO9JPCfXdSFwumToGAEB04chLWtFKXelnFd34mGVWYGqC?= =?us-ascii?Q?mkcWF5NihLA2LX2OQvcZydsQGwmYpeGNou61h2Beg27aKO6ztXsl4iiNTwTs?= =?us-ascii?Q?LQ7nF9BHV4pjjjUfv8ZdrVjoMR+XVVFJcY5tmDsLBh/RwAmMiC1OWS5xHrYO?= =?us-ascii?Q?ZVppPUW29lrCK/DLadWuFm2jrp9bdtBUkWLnzEP0XqGoMWCtqT9l1K67bQq0?= =?us-ascii?Q?vXd78dxAWz6G7ZOcfLj96xbPO+eRQWxCoxnnY9j3pcfyM9rajzmRNB6D0AP+?= =?us-ascii?Q?ayqSiTiwHA82sk7CLDmrlU0xnmf1tcmEIDGEsfefNBLM6g4qp2DdkX726g+Z?= =?us-ascii?Q?tuNenx2q4XySrZe8za+Ql0DI0HpgXSEP4C310YXr2XlSVMhDWdSSCsQbWo5c?= =?us-ascii?Q?kKaJ38QSOcQjuSJ2WGZP+UqZBkRNnQoeZa2aIBo46ovU8vrI9/bia9mXBso9?= =?us-ascii?Q?ipp7J57QIA1wXZBnTwj85/vKCA41KJKzunka0WtzuV9rwz4rMFrEzPTPaaZs?= =?us-ascii?Q?DGEGhfppwTgxUka3Stkcncol+/buB5LQkHigbpydzyVtLnQ8ycKyHWt1fMu1?= =?us-ascii?Q?+CtpLGbMp611s8FztQwAEGIs0dwIpJPraWpEr1cYy6tsKOec++NkUO2Fanhi?= =?us-ascii?Q?+tPJWsgRsvhLC19UcB81XQrvV1wZMLWX0fmGV6I6JqoWO9TY6mY3EqFbJ1Cy?= =?us-ascii?Q?BtvHvYYlYk11vKNvy1EQJxAKrwqSaBzj8bkO?= 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:L1oJ8iAYIYvjU0T9+rSnR+ch5OX1HTVKaB/TWU3?= =?us-ascii?Q?EIxfvIo+OVwipda6Mq0e1wFsN2f7Ugfw7mu1cz11TOmkf2q3npGXRwyO4wco?= =?us-ascii?Q?0r2PUQhQpHqep1Ak25KEnIKjxEEyvv6N97ftAdXOA/jDi/EyKquF/Eq6hpfN?= =?us-ascii?Q?UG15TI0vNzI4Eb2Cupt0nbpTuMbQSKaDc7nkkbLSwtjqIr/KnALdCS0X6qFx?= =?us-ascii?Q?Z8X0uyIUGDp4fhk6aun8rue3UktkV0I2b2RPzWibVJmuK5uRX/BMy90zTxyp?= =?us-ascii?Q?jyE7YszWfQIXSWVAiAF742FcA52jEbfPKn9p6pdtrvxZtOJVvnp2KXTqN283?= =?us-ascii?Q?9ofDCtoZjOp6BX1gNFj4mKxVX+Pf5TdJ9XZ/wR0asKDXkZLUsgRPot2YTtz/?= =?us-ascii?Q?YoNiJJu9CSAF3o5uCHcrqKj7LPKZSrsDuTjs48CcIUOHpHuvYE2v0g9w0x7T?= =?us-ascii?Q?os2Uiqi3NdN4HlO1JzEclY4pIgHoDAV7hBHZirpyGAq5WNXTO7262xv7WAuy?= =?us-ascii?Q?yzuTCBg/Kj7DMpi06KkAKv9tLoW3S0MmMhNKtou01EQ92lD1+8DYsnJItdLR?= =?us-ascii?Q?65r0ava0zT7eaHkeUi9DAcsiwjbCb/b4s2QocntyUG18bMjTImpEL00mL0U3?= =?us-ascii?Q?7vxShVeYzyLf72zSHHwMwerODoJO51eJE6EohwN8dqWi4zr5/CfSHsf8blm9?= =?us-ascii?Q?8NDwLwiuLSO1DGrls4XgLIek5bd2DCYcLCAGTyPCVbH1ohZzVb+Ml6b3lauI?= =?us-ascii?Q?8KaQoix1JkVmj5o0AaZ8HfOww4akorjkctyjIqblQJoILQTEO0hUm6TEoPuN?= =?us-ascii?Q?uDKHwrMm1FJ4iStnJdbzpynzXJJEw2LbSEBOuw5AKkwK+l+RNUy3TmCCUGTC?= =?us-ascii?Q?uGClfFmbdoQeB1t6pRhlwsjuKl+nDPg/WwR+pdk3J6/r5GYXldCpe7lK1SZc?= =?us-ascii?Q?H/Vs7JYTtf1gSYOXnU1DW/b0UTLG3Eu/cqup6sz8uw/B237KppLTsu3Ibpoi?= =?us-ascii?Q?pq6+KeWapW/bYASiSqusTRhQmqJvV0MxF7bAAm9M+RB9MZDmuUcNBVnn9SjM?= =?us-ascii?Q?ylRyK+uwBq+cCBTIumbA9tB+J16VV3Zu7Xkaa9DxE3dNS71Q1eBbY4hypD34?= =?us-ascii?Q?hKkmvkKkDRJan4DbLC8nZEY2VnUy7Pk/z?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2552; 6:K/8n8mgxJT08DqVV+RzhrHDcf1d4G/Ve68Go9uk+?= =?us-ascii?Q?07xmQRXy+51Ofp7oVbR/r0tzZtWIoCz9zu213+oMRHF+5blH9mfiGu14PuAt?= =?us-ascii?Q?XpKRcmTrlIj+UZ0vvFCJLs7XrI1H/nxSqZhqR+XlV8lpLNznClUoptWZzKZ7?= =?us-ascii?Q?PNROwMO1SlOpBosvAQsLTmqPNpOEhwokxES6mB2htoowPq3vsqkuFgP175Cl?= =?us-ascii?Q?2zU8N3HNeEQeOiPM5kzD5TCOWPsp1J6iKebHCXf3JixUny/zn/sSqlXfNQN1?= =?us-ascii?Q?wvAysfpJ+g/pxPAZ5FJia7MkT2gLNZK0lrXjvPTW5ebat1PKcweI4lkHnGht?= =?us-ascii?Q?TV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mxdE3d03numb4WGGyZFQ7Cfrb+rndkrQuj3AZ5z6iCEUrlf1yQWUybpYFV1MYGbktcxB1ZrcF4qbYigVZiM936xsFTaC9exb6G8X40ZMAKQXAV2jSxvjJmStmn5/tvxH7Z1SgvkchnsLfxgxsUOG1Jo4B1mXkMNKMTOkpqbHDKnyiBTxn7KzGrUG3tWqYIp7EynWABY3v3n5g= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2017 17:47:38.4445 (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 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 709f7b9..1b13224 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);