From patchwork Mon Jun 19 07:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9800511 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 91C7F60329 for ; Wed, 21 Jun 2017 01:00:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8480C24603 for ; Wed, 21 Jun 2017 01:00:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 765272624A; Wed, 21 Jun 2017 01:00:04 +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 C95F624603 for ; Wed, 21 Jun 2017 01:00:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 939EB6E416; Wed, 21 Jun 2017 00:59:04 +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-db5eur01on0118.outbound.protection.outlook.com [104.47.2.118]) by gabe.freedesktop.org (Postfix) with ESMTPS id 388786E257 for ; Tue, 20 Jun 2017 01:13: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=RnGDOtuXvDyfBJ7t7mW4w68hHn+UoT2377R0f7Q6wW8=; b=ZpH1JIGSNbox5u1t9/bEtg8RnGU9QzsuZhY7Qn/mEqDlje9/b+9Swy9uCgSokBIm3lklNHltZw/IxNpqt7QSVoyC233yUVbvklCET8s5bn0RGstz9gd+JdS1KMew+tKbrCldKVCZlPPzjxE32vhqxGfq6kU7fvtuKloERN899Gs= 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:51 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] drm/fb-cma-helper: expose more of fb cma guts Date: Mon, 19 Jun 2017 09:44:25 +0200 Message-Id: <1497858266-17844-3-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: e19458d0-693f-4bd9-5aa0-08d4b6e6ee59 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:DB6PR0202MB2549; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2549; 3:WJ+15mF4Ce4VpLMirczkIqh4AKt5LCJogeMNLc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qtk0ARLgfawH2yzmwNiQ= 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:L52b9nW9w8Gps2JM5gtTvKvvg37TG4X6XWBrMbGm?= =?us-ascii?Q?xpqzMeyn8vcULH98mXEkt+JjxIm2T771UCgW6wvkfKRb+6tCA+xt2r7gIGcc?= =?us-ascii?Q?X/NYtqPQwL6FUJZmGPMLaQZyXAinFTVHciEgte5HaLV1K8RKUX9naC5tmERX?= =?us-ascii?Q?oJyh6MYL6lJlREEPFYfv3i6kXDByn8NVoy2txw3NTx/i7Q9FGHv2GQeNxcwV?= =?us-ascii?Q?Wq9clEia1Exi0OH83lKbOPAoZEg0aE/u9+MijBgvjUoXAUBoHy5xv3Exbg45?= =?us-ascii?Q?lWSfi1+696kLckJ2pDvUD+iWWQTJHV7x1lsVTby6ybGDpUqNyUkM0g7fa3cO?= =?us-ascii?Q?/is4++jtYmQPtHM0MCsK597w01sDJ+5joP3DyK/czsD+rh7MY/dG8Ed6Afp4?= =?us-ascii?Q?S+ng921TmwTD6ME6tavJ/4rXpKrJfbzFlFWcDHSJFjlWFV1tPDL5/gEOnrqz?= =?us-ascii?Q?OGBQccKGWH/OsT59iyAzmOawWFNhzZuWZMnjXVG1/AUQh9NpDjQAiKeo4N9v?= =?us-ascii?Q?9mc1LO0wg96R7PZyE6yPQA1GUn4L/iqXkt5CZ9mEazItzxtY3kvdqumRLCFA?= =?us-ascii?Q?bl7zK+Orur/PtKKAPzySUEdnK4gkhhPFAAGoiClqHNgkDTBU49dkrBRTfk9V?= =?us-ascii?Q?FTehF9G7JbqIZvQpX6YpsOdBwbLA7eXSenfokWDfyobeUWcjotRmIOvmEmI6?= =?us-ascii?Q?9wvu3llUL6C1opjlWWz0Y76QNOhIhMWlgWN/ttXUGVUHkoeRSO3uoXhVczr4?= =?us-ascii?Q?J2A8qlszo96YF1ZQaNTQp19btih2wvbzVMCNr9y7S2u0cgKiXwWoBOEFa7pQ?= =?us-ascii?Q?hUTzzFF26cDMJnzYCHnObI9sikc8UWoxlis+cJVXVUBSK+yzBSwxXRqk5DCo?= =?us-ascii?Q?ZkSzYy2AF8YmU6Sp9xFno60PsCDsnJh2d/eGYCYVIqFUMDO6zpEz6SG8q58D?= =?us-ascii?Q?dug77EaBo+y1QZm14nvuyOV2nRZRMAnxnFnxiO7IMmyqT3eBL3zd+XQwPc95?= =?us-ascii?Q?qb8ohwHVqcgs99I1Mw/AD2fLyOOQ0MEdTCmChEXKWNC+rbKUc/e2Op/oYRcB?= =?us-ascii?Q?PTeYsuY7enB3lO1MPeWaqMLstSAN6y2k4SWCH596IFGa63ScsulQedVzZvya?= =?us-ascii?Q?yr8jbWIhkh3NyksBUi8nZaXV9UDF68AgKEUFngfWyq1SCXa+V/5sd+QF6Wks?= =?us-ascii?Q?VM2KkV8TyEjJVHe6WaiC7xlLlo6jaanr11wO?= X-Forefront-PRVS: 0343AC1D30 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39410400002)(39830400002)(39400400002)(39450400003)(478600001)(38730400002)(50226002)(189998001)(230783001)(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:c6SYB1rBDeQEVIWeS3dZiXIyYf8JKuqwXesuZ1G?= =?us-ascii?Q?5lCvrg6fP1hqDQEMO9HWB6vFXNPDj4VRvKPExr06Jgyvi6vF4PJSfjIUyx0o?= =?us-ascii?Q?5rDWWCg5SXP4cCtdmzy+1UlogV/5Cdk/8YA8kE9xUj+c1Lj+jNCDD1yj5NAb?= =?us-ascii?Q?8GiBnqZVQHfowSPRe7svKcfFtLAkSrA7dbPcLqm7aTFzF8O8RN8Z4D3ndUPD?= =?us-ascii?Q?+QDBHbFpXc3igKi8CTsq/LBxZX6vdocN08tSRYZRF/q11szjavDFfCdxEGo7?= =?us-ascii?Q?M6aJY/0CcIObfG++NTIXOwIEV8G1oXvnKQiSpVH0c23IdLikzTmxzM4zfTl/?= =?us-ascii?Q?HWzSFWKS8FLn943FA85XTFQgtxp45OHixV76qThDmkoAu4EL09wJ3pFlo0VS?= =?us-ascii?Q?andXJB9pksrFkLv5lxLbRHYhSWtHxq9x6vTNml8/HhgTznS3aszTKq52BJvH?= =?us-ascii?Q?nZu+4ylCG/2jH+QmjYZSJXSQxs2CRy1MVSFKp8L2jXMuSY910OM8c5jy45cf?= =?us-ascii?Q?5kmnFLSQk59UyGKI0Srt7Fp1W2X1yx9iTwn372A1i4hodyU9LUZPH2aDUic7?= =?us-ascii?Q?+5sRJR8OXXG6ilPnb2Bgf4cbuDmssPNjlRL/Plsbdiosax5pKb6zefVtaKBm?= =?us-ascii?Q?47amr0fWDpeJ9YC0ol+7A9CS5SOn7dBaOVr7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IWtxrfSiFzG4Wfl0prrIjdkh5u/FGIjOosizIf2DfvmUsqUXInPtostSHKN22a6uC50Zi1r7T3+kTG48xL30euEXlFf2Y+UjE84pkCAxl5I4stvsGyoA82NJPIzZiHoQ1mwVIhZwEJ3LOGdiwMX08XE=; 23:qC1sB3Whyq6RqAIb5Pa/CS40Ii1DQdbxOBhmWlggqfb4aVwBrAvhBfPaLXxlUuvouaNnsGrZRTyoHHHU2kwW2FLNJK3kNesDgk/XS/iy88n0t6AA8CapTSIC4iLkZfKd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 07:43:51.5252 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0202MB2549 X-OriginatorOrg: axentia.se X-Mailman-Approved-At: Wed, 21 Jun 2017 00:58:52 +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);