From patchwork Sat Jun 17 17:48:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9795009 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 EFD60600C5 for ; Mon, 19 Jun 2017 01:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFAC3205FC for ; Mon, 19 Jun 2017 01:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2CD127F91; Mon, 19 Jun 2017 01:10:52 +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 3DFFA205FC for ; Mon, 19 Jun 2017 01:10:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CE9F6E136; Mon, 19 Jun 2017 01:10:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 156086 seconds by postgrey-1.35 at gabe; Sat, 17 Jun 2017 18:01:46 UTC Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0102.outbound.protection.outlook.com [104.47.2.102]) by gabe.freedesktop.org (Postfix) with ESMTPS id 491736E0B6 for ; Sat, 17 Jun 2017 18:01:46 +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=RnGDOtuXvDyfBJ7t7mW4w68hHn+UoT2377R0f7Q6wW8=; b=R/8UhrL3usYnrq+EV5M7NLLnL+xe4nAXhvH++b5TQn/VzS8K3pYA+u99oMoD9zSpg8hUvc7v6swZQ7tmaZAUH/VQecgAn64Np+2KLord0CYZLNWcvOqhvvb5YzmLsu/rzxD/tZ+WLc3gAc8hoHL/Kl0m6njux/7fUTcYBDp38e0= 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:35 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 2/3] drm/fb-cma-helper: expose more of fb cma guts Date: Sat, 17 Jun 2017 19:48:03 +0200 Message-Id: <1497721684-3002-3-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: 328f3752-639c-45a9-5f9e-08d4b5a8f0bf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:DB6PR0202MB2552; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2552; 3:CAUod7E/3DZxO/IOkmfbBvYjLaBytJopEfBtPzeOrle34KT+owF/I438VZ9f1z50f0rBj7ut6BueuPsNd388weNepOIAd6dnujlt4dLXKB58w2xl4kXa+hdlJ7T4Lo/sHkAE893f91RCKRuKgC+Oi/qG7unE8p2ShKQ+Zjazk/VKex1A5+AQ7WA7Vu7Ysd26NVTOMnGe7SyrgBZ8DpvFF0L9JZH0oizln7A/NSnPCHjaRqdtr9eVwcvHXVDHLolgke/kYhFWQ9TAXgAwECDBzGphyTVS2fcPq/ZZyDNX31mll1Gt8ckzF1Y6H6Bm6+iy; 25:vCGSxxCwza0AZCP1uLb5IqcxtNNtcp13NQA8CtRiZJUg+2z9w/h5c1XXsaoKZDtmsA0HwE2tXiy5MsyuwwvG7yIq9M0sbaRsSbTsK1LUubQsva8ts9214JVfwjilEeV2c9oQ9X1GgID5omgGDM/4GcqVpx1xLlRup/CCpP66E51zgq162tB+D8qzAZXtmSMTtiuoaTIwR9DHPXClPLYPNO/xBo788XW/IZH+b1Me9+VV9BL8v3maNn6NRsD9EvLDszJ0zRVEY7AGlzd6OYk+dIDHofS9WzT/sciJk8EkF4nANApHrnFb9gR5SDpXIMkP9xawkLPLHox8Sa5QIYNc5vZrvzcBv4spbfUbOOFiU8E7Hf9d+GtpORLiT6axFy+ZGENWJ2BvrK9ElhhLPH9SetLoopclxOtR6HBX8WFWE6x15G+1Ij08pZJbd0ou3AktwGOOxGTHkhb2JlrR11zXKWnZwE1aDiRfyghoMdjazpo= X-MS-TrafficTypeDiagnostic: DB6PR0202MB2552: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2552; 31:AP01snYKEX92gChLaafQ4ZQFcfu1XvqifTqFXseT9m1Euna9LwwtdOlt/RcPesCTgkH1WM45ui5cutgopG8wTyFiPjxYQcwsNGKz6kj4YLycrjyLdxl1VtOlEPbk+0MT6WkrI7TITo2P19o3EbmfBRt5gvPAlFrCs1Wm6PZzOZgiv8YlKug4sz0L4cH3GYB/XSBqMPFpjln0STAs0PntdXdtU73bpi2PHxIrmtIhBrs= 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:FqibdyGqCzDc5BRtZRKclurCYfXcbBgzxT7DdMCq?= =?us-ascii?Q?SLNG7abBzN8OnHUu4h5Oe0302V+1sNPW1plSkfZ/lFvtiQ1PcK0I7lL3Dqyp?= =?us-ascii?Q?4oGkbv3UQmaUq/XH2kvfx9w8JScJAck9Gce0RJj8OfN9DdaN/16Rpx3pGyeR?= =?us-ascii?Q?KiuskWPQOTHUR6uPXkaIchaegzL7+7s6j/QrBwHV/GwHXnuw3KSt4nrcFbiJ?= =?us-ascii?Q?rvdYRmvPCANNMKA/Kd4okJ91xrrqP2XE48w8JL5TrPFverBncBM/Z0cIKp/a?= =?us-ascii?Q?DZbUxcisInGN9qPK08DGkHotwDu7G8/UX/BKDS5yKYFzITOR8jD+zZUvxvWS?= =?us-ascii?Q?nZPLUNIovWS9u0c/OWYjcTTkeDU7lkhQkErDtrkuFQbtyn3nzwRUrDXJvQRa?= =?us-ascii?Q?CSS/r+BEFmfz2wr5BfmXN8HiPUGdpTAYbtJWqmXJPY78fZvB9WsQsEZ3dooo?= =?us-ascii?Q?mXYHZ1lCBALyHeLabxO0b/+Yk4gQ2z1N+Uow1l2AvXm20odmECljQ73+kcgI?= =?us-ascii?Q?ZLt+35YcehZk8yFy+kIoVvDxyg9ljomBWQ+yRu0Q+ZMtKMyzJ05jD8kfUExh?= =?us-ascii?Q?GjO0ufwFSGMpKt4vHz9rBrBfF229HDFqmsbSTqbzO+BqqArVm+wBbG8DY02c?= =?us-ascii?Q?evF3JvzXcks9bmJT8m8TsrW3SfZBBwiuKHwo5iaf5YfIrZIXMsh2XXohoZsO?= =?us-ascii?Q?Ls1H0itzZS9qMqho0/i2jA0ZMIwPTzWDDZBruzI50bnah1y0/nUbOPTnrFyC?= =?us-ascii?Q?4BRBgoG/EGwGIAbiQybFN6FrWza5TMwhMQBEXiYrqXWvmnhsG6vtxgjOjsjj?= =?us-ascii?Q?mRZFiqn82cf/53QKp7cF0jIY3/XkqJT6V0/IHntgFDDAXmwqR/z4cjx2dlYA?= =?us-ascii?Q?6c0IOFFPZOc9f4HzSPcQzdHFLNqz19G6FSr+D5cabeBz9hTSQ0c0Pd8gVLa3?= =?us-ascii?Q?XRxCTLg5MNs3u3u+ssPJ+Ux9/9AG0hboeriAGWAAZF7waN3xoOhOFKsT9GBY?= =?us-ascii?Q?UNtbcuFGVTkMhaxYdi3R+/bsThadMz8Qw4p5IlJo65XWEMgD1jUW8BV9odSh?= =?us-ascii?Q?FouvLfglc7eotKoDI2n/T0LHRi/TqzK42yjeYCm944qjRVq+QwYMRBVYDo0o?= =?us-ascii?Q?/KDlwX2rD+2ZTCf0cBEg/nJgd32A4FCHjKYxCxl/6A7yUXaW44a8y56CHdHq?= =?us-ascii?Q?ptGQWdIYiwX9LmX+HUDUe80/43oc6pgbnVL1?= 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)(230783001)(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:82hunaOWv7QHlwQ/X5IRZBlRE4VhuinFdPcwBPs?= =?us-ascii?Q?QWIOWyacvHTqfKrYGKIhw4kF2cdIGYBYLyD+I6i/qUgxkqkPQ17dUBegvQ+e?= =?us-ascii?Q?8XI2BkW3Fyfu+EAYwcSQ7Aq4aAbywaSnHNQmeG665BE66EJSjzV6vO//t2Z/?= =?us-ascii?Q?9iRscCSQOGoqGNwvrDz8tVGCuMnwWAN6REiO6KlTi9fJIVVO0S2jTy7f7V6A?= =?us-ascii?Q?f4cHnZgj61wuAzHx5eN/VXOkG1wGv6Og3JVReXtzf2AJconqWf3LjDFWbPeq?= =?us-ascii?Q?nqPMURxv/EHuX8zxpDom/fz+8HtxGsht0ggotRdpuTfWrDgxEiVr03CffPgA?= =?us-ascii?Q?5RuOjD3O8WFs+Om1bxll5ZFjDDroNvUt3YC1vVjFPD03CCPYnp/0lqFrQA53?= =?us-ascii?Q?aTFJTqlC/A6iCj3eLTb1ndTVUOPYpSJUGbmdSucOwN5xwjPfsWd9R8PH9qb6?= =?us-ascii?Q?NY9nxNync9Nk2iWpFy+3x4M/ZbZxCxm0i3TykNBpeObrBXL/P43oNcDuVXZW?= =?us-ascii?Q?eR6eZXYepUwEhQbdBJo4Pjvt/njdd6qNk7JfjSDO3JSMTmaiH6+s8jv7A6RW?= =?us-ascii?Q?AjaHR81ZjXLkoM/yLH9DYAJKkF/tWX1gBVktn46nqr/Ed/l+PRf+1Ude4zcq?= =?us-ascii?Q?WLjqTulJIPZJTOn22yqGsT+CXbYZISlrfoPiMGJ8ZSUv3RSKFVqCJemYLZsz?= =?us-ascii?Q?/soH1kR2GoCMzOrljjRc1WqDm3LH40fF3qSmQD5akUM1LkaKIjk1zzCLQz/A?= =?us-ascii?Q?Uj7MRKJNAMGqYCBm8gCEcxEU4+TczKbFz/JrQNQaWQZo3OIdH7P9PRcJ9ygo?= =?us-ascii?Q?AHdj8PYyR0oky9CBvuC92xxz9+TMIrtJgBnR8g8BGgtqFoPrjt5tvMtiORSc?= =?us-ascii?Q?MWy4WEQ92odmEsPqhz+GKjpv5c/xRnA1idt43TC4RVGCvOxySc35dEzgjpQP?= =?us-ascii?Q?aMiw5hhus5VZILwWBk0r56iztQ9+I7zt8xDkf4x/2NV063nWsR3y9riS8Low?= =?us-ascii?Q?Vi+9bbov3YmTXl7iLywMC/qoSIEkMjSQtNx7pDRTwJppLCRX9LbsXOn1K07s?= =?us-ascii?Q?LscjPzcXsDEpTHbWzrJR7n+imgcL7yBOHr2XCXz6Tk1sFyFnMaFBhtN8L9ww?= =?us-ascii?Q?bDf+rz9TQSpjIfYV2FOH02jahLfv2Z2I5qSSJ9JEMU6KaCLjWA4oifw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2552; 6:JKw2VZBiYzJYgMy+GfepDXDO0UsM9JnoSJaDY9sf?= =?us-ascii?Q?pLaTbdfaGoaPS6WkxrRd69qKRjIW75UZah6BIjL3yYSb1qyLo8SGZrOqplCk?= =?us-ascii?Q?YLfRovbOvYh97b8j6i61IdFR9YhExiB2OCLRd4f5y3AASQJyFStrzbj7lBwk?= =?us-ascii?Q?HkemJMXIR+NJrjt9wAf7IeSW5TqUD1hMbAto4CIF/v/jVHYYsqNiGqxO8IUt?= =?us-ascii?Q?4melMvqiXUqjRBMND2mkI5u2ShE0hdk7MSGXALFzdG7uk6SH8INQk3113cQ2?= =?us-ascii?Q?IVSzLJj45x/rWz/qqXqAjEte5gbsvkcyUIa4VwHOrE/UCXK1do8XgaJZE4kB?= =?us-ascii?Q?zykaDjmeE1KkmJPzV/bNa09JvPySgNiagatyTof3EcLkZzpgVSfyyQOKSj1t?= =?us-ascii?Q?GYz1AWVuBl3PP6vjY1DxukVIkOGNF2gWqOHC2htumNtNK6fD1v4WqFWyDNUr?= =?us-ascii?Q?HjqDyEI1ackiKMBOmvSDjlpT0fH0T3s9vkAc5jZDk3JgAVH0NzwLOo5zI9qd?= =?us-ascii?Q?FQsCVIX44OcxyOl7rZJj9T78dR5EwYfLLKIQBAUfATC6c25ct88QjjSgAlxZ?= =?us-ascii?Q?/QKVzdtvGf2BNLK7O+YvXXNc3tJMNgwBgVDBIKPrEAWZXPcXF8CAAQdYd2iv?= =?us-ascii?Q?rCfGnKC571DjFfE7hdCfiI06yzx5uAj1VOAswBKaYVkZPQr/U2oxcAHyDdI9?= =?us-ascii?Q?SGwQNdirFMv0vvfRLUvflxRgwgabHWModfigMY7Gc0jYkCPd7jcu6cRs7mmY?= =?us-ascii?Q?mPjwG3Za8/htjyWORTtDp73Z0OtQP0eCO+GsqEPgHCYqMg0cceHm8aI3IfRe?= =?us-ascii?Q?DrvtcSXSyz9+HVAC1p7pr4U8SkO6z7LXdK3G46BqF6QhYohsL9b/kWeOqoGB?= =?us-ascii?Q?GUD2WnB18fckeup62K7BvdxpAOAKbid8pgTM+ZGdEGc0Uir7NQ01/SvHPydu?= =?us-ascii?Q?hxSYBWUZ+1VjOtjPBi19QqMudC6P7E76A35rdoADBTkig7yIkbXtTKrs4dPc?= =?us-ascii?Q?bIg=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2552; 5:VnjY7A+mu7+ymap72gQKVbBv7bNXES0DMkxw51xjn7eZ9uAR9vpoE81EaTtkjNY8a/hSxV2ahzntiZqIccoXxsMFJyEC7gmT73bbTmoq8vgwNwCyJqvj9rnQHQJV0aKh6pB/TgkUB06epHr2fo8eMmHSXWbo+UdAQ+Te0irdjrUVXRdHEEZQjkzGSKb2prNYSRRmtoYRjtvbCtF5sOEIrrVgXF0X+TO3Dj4q+pMlRYQGP0t0bmi8BsF1ZQ/1zmpNoLqm+pdhCbGr3sv8YcdK8ZoAjkccAUDMZiE+bXU2Ny9mQL5MXnDttlngWvuY3BqIuWhYUDxj3fOfZLwhNLuP87sffovXwOwGPrCu5atRG6F41WEpQ0PsfUNxXMKxQdbChUU4UikBcDp7tQcVwtYNiKrmPsbFqRkSV3ZFQPlzgT+TtKoYiIFcyrWRoYVxcJMukwu/LOGh5x9iqP+65RLhMskPgHkBMApwFJSQJ0kiBvNEqAbBX8B3kzds81twz5v/; 24:LYQkutgLXqJX21jw2DaYQdrYevXr2NZKTDeJO0/plbFjpDCLz50zb855YzrFgquV6KiFecVX2ghNehXWDKRLW2EnRwA6oLR6Yrju5eWu4vc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2552; 7:Je6WSses6Ezz7F0ykRe1F0fI1j2iNRja04+C8JKbR8clvi95ak6cn6tfFWUs9+Rlqvb2W+FhIZOGz0nXI39LI9qrGUsT5Hx4vkJeZeXO8efIRTckY5VFbYtVVY0vfmtqZNwWVsdO+hzdKWYslkbwHeiuhDauxxGmDQp+FT19DkaU2QAGRWEl2/6BXIPpibyXHwtLmQLMPFQnUjmIPCcSCWk1J3/rE5IZg8zbHauKidTvAIt6K1ZZfAHaPA5REKQy8uxSptH7CHrm6XlX69lwz7otFDTX6yjcLTQj4QCNQKp9lG3CX7N7lZipCvjUkPs+JksBrF0awJ1Y7l6IZJM3qvuO9rzCLhV3M5Y+2Cb/A0X9WUBZZ6N76TEH7Am7cFLUsct/IQT6zw8MYKrhO5Ov+kJfY19TH3Vfvmu5fxjkDfvAXUe1BvCREq8vs9EfZb2g4eG3eyBvWjpVa8K+vk599nu5Qa4evy7xfaB7h/GIihpRHOcIw6sV9cyHyhn3n7x0GjkL+sHo7WDZWYpf6v7Z7b9O0UNQx3crTP8MEdVLUDLY1D1GDa9olqEjlZuLIikkoeTIV/h4q8GDkVXs1fRFovZs4BUJ0RTFwz0/5IiIZoH3QglUf7sElNXIT41+fBaSMlbk0JdJZpDHYoUKH4rpKZQv79yA+7InClGRgYJoK00Hkfo463z3+IItUQpXRVg9aoB6Ka2VLDRfeloY1PbWhGj56TufI8AtNfCMsQXlY3eZb5Bv39oPX4gzGXrMFhu7OZluLppVgESe2KTKh+o6uj7Nw6hccEdTxtLliyeIfok= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2017 17:47:35.3195 (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 DRM drivers supporting clut may want a convenient way to only use non-default .gamma_set and .gamma_get ops in the drm_fb_helper_funcs in order to avoid the following /* * The driver really shouldn't advertise pseudo/directcolor * visuals if it can't deal with the palette. */ if (WARN_ON(!fb_helper->funcs->gamma_set || !fb_helper->funcs->gamma_get)) return -EINVAL; warning in drm_fb_helper.c:setcolreg(). Signed-off-by: Peter Rosin --- drivers/gpu/drm/drm_fb_cma_helper.c | 55 ++++++++++++++++++++++++++++++------- include/drm/drm_fb_cma_helper.h | 8 +++++- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 53f9bdf..ef96227 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -426,7 +426,12 @@ static void drm_fbdev_cma_defio_fini(struct fb_info *fbi) kfree(fbi->fbops); } -static int +/** + * drm_fbdev_cma_create() - Default fb_probe() function for fb_cma_helper_funcs + * @helper: The fb_helper to create a cma for + * @sizes: The fbdev sizes + */ +int drm_fbdev_cma_create(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { @@ -507,23 +512,28 @@ drm_fbdev_cma_create(struct drm_fb_helper *helper, drm_gem_object_put_unlocked(&obj->base); return ret; } +EXPORT_SYMBOL_GPL(drm_fbdev_cma_create); static const struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = { .fb_probe = drm_fbdev_cma_create, }; /** - * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct + * drm_fbdev_cma_init_with_funcs2() - Allocate and initializes a drm_fbdev_cma struct * @dev: DRM device * @preferred_bpp: Preferred bits per pixel for the device * @max_conn_count: Maximum number of connectors - * @funcs: fb helper functions, in particular a custom dirty() callback + * @framebuffer_funcs: framebuffer functions, in particular a custom dirty() callback + * @fb_helper_funcs: fb helper functions, in particular custom gamma_set() and gamma_get() callbacks + * + * If framebuffer_funcs or fb_helper_funcs are NULL, default functions are used. * * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. */ -struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev, +struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs2(struct drm_device *dev, unsigned int preferred_bpp, unsigned int max_conn_count, - const struct drm_framebuffer_funcs *funcs) + const struct drm_framebuffer_funcs *framebuffer_funcs, + const struct drm_fb_helper_funcs *fb_helper_funcs) { struct drm_fbdev_cma *fbdev_cma; struct drm_fb_helper *helper; @@ -534,11 +544,17 @@ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev, dev_err(dev->dev, "Failed to allocate drm fbdev.\n"); return ERR_PTR(-ENOMEM); } - fbdev_cma->fb_funcs = funcs; + + if (!framebuffer_funcs) + framebuffer_funcs = &drm_fb_cma_funcs; + if (!fb_helper_funcs) + fb_helper_funcs = &drm_fb_cma_helper_funcs; + + fbdev_cma->fb_funcs = framebuffer_funcs; helper = &fbdev_cma->fb_helper; - drm_fb_helper_prepare(dev, helper, &drm_fb_cma_helper_funcs); + drm_fb_helper_prepare(dev, helper, fb_helper_funcs); ret = drm_fb_helper_init(dev, helper, max_conn_count); if (ret < 0) { @@ -568,6 +584,25 @@ struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev, return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs2); + +/** + * drm_fbdev_cma_init_with_funcs() - Allocate and initializes a drm_fbdev_cma struct + * @dev: DRM device + * @preferred_bpp: Preferred bits per pixel for the device + * @max_conn_count: Maximum number of connectors + * @framebuffer_funcs: framebuffer functions, in particular a custom dirty() callback + * + * Returns a newly allocated drm_fbdev_cma struct or a ERR_PTR. + */ +struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev, + unsigned int preferred_bpp, unsigned int max_conn_count, + const struct drm_framebuffer_funcs *framebuffer_funcs) +{ + return drm_fbdev_cma_init_with_funcs2(dev, preferred_bpp, + max_conn_count, + framebuffer_funcs, NULL); +} EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs); /** @@ -581,9 +616,9 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init_with_funcs); struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev, unsigned int preferred_bpp, unsigned int max_conn_count) { - return drm_fbdev_cma_init_with_funcs(dev, preferred_bpp, - max_conn_count, - &drm_fb_cma_funcs); + return drm_fbdev_cma_init_with_funcs2(dev, preferred_bpp, + max_conn_count, + NULL, NULL); } EXPORT_SYMBOL_GPL(drm_fbdev_cma_init); diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index 199a63f..280ec2b 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h @@ -15,13 +15,19 @@ struct drm_mode_fb_cmd2; struct drm_plane; struct drm_plane_state; +struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs2(struct drm_device *dev, + unsigned int preferred_bpp, unsigned int max_conn_count, + const struct drm_framebuffer_funcs *framebuffer_funcs, + const struct drm_fb_helper_funcs *fb_helper_funcs); struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev, unsigned int preferred_bpp, unsigned int max_conn_count, - const struct drm_framebuffer_funcs *funcs); + const struct drm_framebuffer_funcs *framebuffer_funcs); struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev, unsigned int preferred_bpp, unsigned int max_conn_count); void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma); +int drm_fbdev_cma_create(struct drm_fb_helper *helper, + struct drm_fb_helper_surface_size *sizes); void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma); void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma); void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);