Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753369AbdFPJMX (ORCPT ); Fri, 16 Jun 2017 05:12:23 -0400 Received: from mail-ve1eur01on0132.outbound.protection.outlook.com ([104.47.1.132]:17256 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753196AbdFPJMU (ORCPT ); Fri, 16 Jun 2017 05:12:20 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=axentia.se; From: Peter Rosin To: linux-kernel@vger.kernel.org Cc: Peter Rosin , Boris Brezillon , David Airlie , Daniel Vetter , Jani Nikula , Sean Paul , dri-devel@lists.freedesktop.org Subject: [RFC PATCH 3/3] atmel-hlcdc: add clut support for legacy fbdev Date: Fri, 16 Jun 2017 11:12:27 +0200 Message-Id: <1497604347-17960-4-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1497604347-17960-1-git-send-email-peda@axentia.se> References: <1497604347-17960-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: DB6PR1001CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:b7::29) To HE1PR0202MB2554.eurprd02.prod.outlook.com (2603:10a6:3:90::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 815b28ef-a99f-4c95-2d97-08d4b497c619 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075);SRVR:HE1PR0202MB2554; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;3:KMqTRAVRC3MX9A3fPSBVbzb9F2wO0/E/scEb6XSUWam9MHG3GFbOTvjjqxTLayNvifmDKwx1/Y7XYHOI8b68YIHu/+czKmMTcNLrMT05TJvyw4rShAaX8umouk+OmDcmcue2uyR8wIBgq50zY+/pdCsey8DgltK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zp/1LIwNu7xqe7QHZ0oyMahUNXJl3EvZpojXxPqIzEGrkZ5LqBan+ay+tUXIktfNeQovIm2LdTR1ajuhrYhD7uDEqedGdy2NFJc= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;31:G4EUrgOhyWFItggRsuzeP88AnT23ijZAosjRJMPtfti+q+vh3jc9onxeGoGRYP2+NdWflcLuVAgbw1aOhrnFmeqgf+M5XgKEkZuQzwxECXoYxEamFiAt1XLmtpCfiJEWzlLu08RcqxQfyFdUqakc3lJWVeUBpRtptptm09slsR0Du8aP5ThZhNONOBAV2lrED7Y2jYP6rDn0rtfZZ0mPoOTExEETOiE5I6OlCQD3THXUz75w6fyYIef1kt8QWFu0/Lc/JtqNOoDJdTe/L4B0bv/FEtnF8089pzId0cOgPYGjmga9GD2Icn4fqye+bvI4FbUrZcrWjoCD6Yxn+HxDf8+jLMcFNcuZPZHXfBmYDfTZj21hP6fDZ4nQO6xkFO2wvKNSic7UPVPWnltRw2LO+IAeB9blCG6NiXRXbR75pbzv30UK673CbkEvWDfOK3hJkp/qBur2OU1eoQX0E1GSmlEgVU+it7Aek7WEfRVmaK24xtYWTvf5zR1lVnBWTeZA7T3wwrzFQDNwFUTu8rdUtymfjW7EowttxMsAdyr4wTLES73cLQiAyXroXH/X8aI305yomBz4WCLoOYL7quy95k53acNzhkKW6mUQBZoyT7s= 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)(93006095)(93001095)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(2016111802025)(20161123564025)(20161123555025)(20161123562025)(20161123558100)(20161123560025)(6072148)(6043046)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR0202MB2554;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR0202MB2554; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0202MB2554;4:mAz5RYWO/K0707lPhaBtsWE/QU30vG3TUvPl9TcC?= =?us-ascii?Q?hUydNYpL9qTOK+HBTyJZSk/YUEqDuLXMOChkUy2GduVrBZCYKjO8gIFYAIKK?= =?us-ascii?Q?sepiH4I4btMA5SjLaBl+jAYFNwigrsepkePjti5gZnTJPj8qcEpez95qdXXD?= =?us-ascii?Q?Y5gEgAYkk9rftIdpq1QdyLlSW4h6VWNIUeLtFyAfm5E7my0oAFbB+Hr8LHM8?= =?us-ascii?Q?UwPcJsTWqAOTEcYAri8NyzIKXKGzzf5dOZ0B7usHsuAaW75J6AQL3IQWvNFY?= =?us-ascii?Q?XNzIfl2D6dCCJCVDSTPOTSePKfbrMAs7mGYwuT5gOq9bTLOUAvIn8iq4ri97?= =?us-ascii?Q?VJ3xdvCpNC0ErjD3fGoE7ZQZ+Czg2201ThtaJJdUahwNAAz0GajIRaN68rEb?= =?us-ascii?Q?v1hgG+fZU2sbaP4avk2UQllpgNYUylkrxbdV1JraVsey+iLVDs0vPdlhr5Un?= =?us-ascii?Q?R9okPuqG48udMLV8F1agUyc6WmjZ2F1FBfIJ60H5r7f+tNdCvZ0KYpCupnNS?= =?us-ascii?Q?tTuHP3OY2GKYlAwP69l+V7D605gtY5oRVGeof6x3ijGJ982ac6smhpONbGzL?= =?us-ascii?Q?eYKrWeMDR8kva83sfiVPq9TTFLyJa1wqC3u8f3jshwtVv+P3MCWGBX4wT1Yr?= =?us-ascii?Q?VIGiGIRVb67sp2RRlvbq6bgACAbtwkSAAxFItvv+/ak+E3huARzWx/dkGJdg?= =?us-ascii?Q?4bQaffdnwO/LC/ddCUwOn559GRkZGEFR7yIPsHUGSWcjOmZqHiK1EVOhdBTn?= =?us-ascii?Q?hTU4v+fHUKNHaSheC6OVPiDnoOUcYiJk7DToQ4/gAIDEqypN2Ru5Nxnzt6Mt?= =?us-ascii?Q?Nkmf1w2TPS1MYM2u60BJlA3D4ZRSyh1BNnf5/IoEfAAlTxiB+Rez+ROH1smb?= =?us-ascii?Q?RGKIHxXLkLsRu/aClpqGQEQNN45rIQN189fTSowPu1mKAzMHjmMsERzVrpYM?= =?us-ascii?Q?SFRkspi7NkW0nkMAf0mrIdoTyM3+TYPRRW6mRh/phRsiaDQcQ6m3JiC9Z+b6?= =?us-ascii?Q?EHSaKHIHW5ZgFsnVyXfV5mEWq/kWwABggkCxkX6PxydWuJ7rEEzv+THYL83r?= =?us-ascii?Q?xTuJoJKI4hjwIAYW9fyD6svwUcLxnFICQco2F3f/EZ/PBJTN9pF33GE0ksC4?= =?us-ascii?Q?NLsVZ3fK7s9lA4/ErXgcK1DMDcU7rHn1+MJLluZL9LNxZGxHOJlVC/kKf3vf?= =?us-ascii?Q?5WnNIxPne1zP1fKmSTQcRQjt18F9wnhncxQu?= X-Forefront-PRVS: 0340850FCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6069001)(39830400002)(39400400002)(39410400002)(189998001)(2950100002)(8676002)(6506006)(2361001)(54906002)(42186005)(6916009)(2351001)(81166006)(5003940100001)(66066001)(7736002)(86362001)(50226002)(2906002)(36756003)(47776003)(5660300001)(478600001)(4326008)(53936002)(305945005)(33646002)(110136004)(6512007)(74482002)(76176999)(50986999)(48376002)(38730400002)(25786009)(6666003)(6116002)(3846002)(50466002)(6486002)(217873001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0202MB2554;H:localhost.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0202MB2554;23:vG2jtcqTUR753anhq05VhVqbu8Wkw3fmD1Dg/RZ?= =?us-ascii?Q?EWHfXq9SSXtxoBmM43Qb6MRc8RAZWXePt2t7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CdEji+kCFYBdVx5/SJ9GiytFSi5rqmScqMHxy61xQfYCSU?= =?us-ascii?Q?1O5Kf49Ic1acFnb/Co6McUl0z6b6TndjhD5rmD8AP7gwkqT+9KVGZiFfZVBZ?= =?us-ascii?Q?FQjNihIO8Igxdkc8VKXoM91SzawNT14JntUjAwZ8R2bb+QLfn/rbH+c3OT3a?= =?us-ascii?Q?08Xhgju2yf6s=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0202MB2554;6:QE83ziIodPkq1/UiTW8V7NO+m8OvC+q7eSqoWktr?= =?us-ascii?Q?cUbdTymR7kTgKdcub5xR1lRyFTiVmcWNCeR6qkJAjzHVS6PKmU2avcUPVC0y?= =?us-ascii?Q?rtULEaTOL2eh0aymgdLUjNIs4KfAfStNxu16F0lV4aoySqt7RjV9CViQHDDP?= =?us-ascii?Q?fm85fWbHgRDgktDN4M4/yuadFtyDKwRBCQo65hxCUQb9B2gMwdA0NgGSU2bT?= =?us-ascii?Q?jgJnEymb/9MHUuPQPvo83WqYhx5pnrTQGe4YgljyPLeE1v6vfo5w2vqEhMbg?= =?us-ascii?Q?N9Iy3LXmhTdqGXBEk3ihHIfAmR8LYIpsVRTdObfApMr6c3mH88dmULLJ54vW?= =?us-ascii?Q?Yz84VeAyNz4+ucJtLILDhrdBUFz+XOEloGkAj9eunCVjHEuB8Y95Ess+EGYU?= =?us-ascii?Q?u1aCwR+lNtWYZjwUx2KwUIrng8ZmCyKbvFDafpfV8+ma1aV9jLN6JqPpPsmE?= =?us-ascii?Q?46C6PmsOOwft+BV2fNgjLOX6kDXUZoqsCYBV1yh2poTXn6IOOFiNBK66Z97S?= =?us-ascii?Q?I/t1gmxjZYYM8iyVZ42tOaxdHPDgt0S6pwL+RocLaac5ZJ7DPXRP4QTQxPVv?= =?us-ascii?Q?1MGG7sHT3O3S1ZA9w8EC+9OwDESkAc4xyNudStK/d118WzNAoi3ULNn/2xx7?= =?us-ascii?Q?fgFg7zwj7wjyCIu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+a0JNKgE1W8IIC0I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;7:HatWHPYPIQFBuuMNU7EzWNBFp8VyQ1jYIYXdrVYyknfZaJHQurBdhBj7GcTvgp0BPC1Gz3Efe8/y+PHxVBo35YFRKaNoa6hHUPLrUD4kFohtiJViSlFWQa11TFKyJydmkwSv6mWkiCmySUZiAQWoeABCWdM1oaWtWwpbgk+3SPEYf0Ex01zOPZ7ymF88FMqAL+2O75H7GPOn2ke+T6BV+5e3zBt9ZuNKa2KMDt6rlRAPVCIqVk0eeyvblG5NKBEmHmSpZTojO32YQ8NaWKMZ97innOnt8xlc68gxnv5vXxGPfP2rPTuwFSOuC15+yeBs5/q8G7Ml3oEMJC61Qd2Ee2iRfwYrhQx9r6lF4/u4vxIujBqwwh1RHNmkaqK+7phpHHzUL/ArUhdLnAIIID56IAdonW7vd6uTj9OSCirO4dAwqPduHxpP1oxyjJOGrXVncmHv2Cm0YBYKruxNYR8eFZTYdoBevFn5R9Z8IiljXCpZgb9bWvw2ocJKozINrdcXDmGPMJ5RHeqSf3D0V823cDDCMGIt9kD79yLYTpPRTcMlR/G7dLJFrSI/oKj+odfyGB5xdV2vOlTc5gm+Cj2SptxA/UJqZAcespTnvSgaKVmGiI6l4yCoPU220dkhcTmCks9sqqK1N+wb936t8NLjdBj5JlToTL6BlGqaLKiJQPs3cJste0EUdMWcgyTBwytheJ3y5QISaGkWMcgxxV4/4nMrcuuhlom+H/9FGqCmcvnSZc1lZoJ2qb1OqqR+o3nO5/3NXl6o/uw/vr9TIogaxvYQOjZVuA2OgmFeAlIDZ3c= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 09:12:10.7650 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0202MB2554 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4286 Lines: 130 The clut is also synchronized with the drm gamma_lut state. Signed-off-by: Peter Rosin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 49 ++++++++++++++++++++++++++ drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 12 +++++-- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h | 4 +++ 3 files changed, 63 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 75871b5..54ecf56 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -158,6 +158,54 @@ atmel_hlcdc_crtc_load_lut(struct drm_crtc *c) } } +void atmel_hlcdc_gamma_set(struct drm_crtc *c, + u16 r, u16 g, u16 b, int idx) +{ + struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); + struct drm_crtc_state *state = c->state; + struct drm_color_lut *lut; + + if (idx < 0 || idx > 255) + return; + + if (state->gamma_lut) { + lut = (struct drm_color_lut *)state->gamma_lut->data; + + lut[idx].red = r; + lut[idx].green = g; + lut[idx].blue = b; + } + + crtc->clut[idx] = ((r << 8) & 0xff0000) | (g & 0xff00) | (b >> 8); +} + +void atmel_hlcdc_gamma_get(struct drm_crtc *c, + u16 *r, u16 *g, u16 *b, int idx) +{ + struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); + struct drm_crtc_state *state = c->state; + struct drm_color_lut *lut; + + if (idx < 0 || idx > 255) + return; + + if (state->gamma_lut) { + lut = (struct drm_color_lut *)state->gamma_lut->data; + + *r = lut[idx].red; + *g = lut[idx].green; + *b = lut[idx].blue; + return; + } + + *r = (crtc->clut[idx] >> 8) & 0xff00; + *g = crtc->clut[idx] & 0xff00; + *b = (crtc->clut[idx] << 8) & 0xff00; + *r |= *r >> 8; + *g |= *g >> 8; + *b |= *b >> 8; +} + static void atmel_hlcdc_crtc_flush_lut(struct drm_crtc *c) { @@ -363,6 +411,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); -- 2.1.4