Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753343AbdFPJMM (ORCPT ); Fri, 16 Jun 2017 05:12:12 -0400 Received: from mail-ve1eur01on0111.outbound.protection.outlook.com ([104.47.1.111]:42730 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753289AbdFPJMI (ORCPT ); Fri, 16 Jun 2017 05:12:08 -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 2/3] drm/fb-cma-helper: expose more of fb cma guts Date: Fri, 16 Jun 2017 11:12:26 +0200 Message-Id: <1497604347-17960-3-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: 9bd05e2d-408a-4f5b-b52e-08d4b497c1ff X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075);SRVR:HE1PR0202MB2554; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;3:pmZWKAd0TSkBvbUNhri+kGj0FdyNygicPMUXB5ZFHbfQEYLFUtcyqsIGxTudB02+MmWawgHjr31ZB7+lTcxq8IdhZ/oj8akCBG6zItTlty/yeg1nABktFZy6DL4Ekyzs6CRcTd2SfxIiGlxDMHxG0M8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2ypP2c1DBmvTenGmuWjvy1bxNR+62U6G7iiDCZSG110fh8NUQJQ0hgOxs/5XguHKuIIT3dKiKUCC961AlFFnU= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;31:/PXh2ZGAmcEsd1ccu96l1PCI6q/BllSwlW+ILjhc/Yp3JZtYp8h4BM73XWGuK6iOl29/q+cCjxxIiFQDdT8IvTAlJcKazqHNASQ6e3yRk6F7dFBYNp52yrSSIObAoj7mJrAoFs5Vig7Wyjw5up/7FdDH5bbykfglPrUsjS9+NfgnmmF4XEIcajGbJF4QVjOwkGY/q+ZGpQemuhZd7fvDTKxFxolJ6IIz94+H8HS44P/8JoY++jba9P0czgvW7jEncTsheXwWzDvOKIdPthB8HfQ1czNJkLvR5ZPVskpb9fxKpxKR0uOm0N3FMhs7SpMki38tosIgW8iwZK2KDu5e2DBHaRGb2GX1NlTMXrxnHlFRRTc5lqN7GfKiABtY3wNaOPlBU/3OWyPkyVjJ3Sodt0YhzkJgeoWXJcn1a7EUAN6Wl4gWesKUx483weJHk6o3pkSSq5K/u9OyyhpAHvpMZDQWM9q8/PbwvQ25VFwwR2iBO7FKNxnWZblYt7gCPQrm2yAgn2tF36IaIbYJ2cEGxKZZBkqrvncgbyl7HWzVpctPUy/P8Y9OIewLZnSvtvnu9dJkdxIqH+pwWuTuM57X+P1OXi72Hk0OmNZbT6tSuK8= 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:j6YY/L0ZmdUPqrOBkupLhqGuDtlRv3BpbgfVjkdg?= =?us-ascii?Q?Ci3RXDjDhd2GCE6omzkAmQMBMYW9JvQuZTgm0StXrSvdCex6UZP6eBGICtgc?= =?us-ascii?Q?eOsTz4fEN8f67D7r2Xo6+C7cIlQ3Vb2iemJV9x40vzOuJmh0JPVTiT5Y7IOM?= =?us-ascii?Q?TcSqG/RuP+uSSxi4BH3TyRVwnQS8w3x/nXYGz1XcJVelwBvZ9zrJQ7USRE+m?= =?us-ascii?Q?jMS+1KD1PQiFOJBjfdvTGPu2vC22IzNHi2n9z2xPFLoVHE9MPcTZUG4PlhXI?= =?us-ascii?Q?5uKiB8StD6P1CnLJw2/fLaxUV3xhcUyvMbSPH/h++ohwdp8sfGPkBaZhHErg?= =?us-ascii?Q?G/uOT1X5wDpzC0NQdM0IDjBPF/v5IJUU15F25abwI6vsDt64joFTw04z0blR?= =?us-ascii?Q?oHnSK5aMaCYG6FGipPeD35HM5M9StNTNVZz1zHAOoltd3LihxY0gtWkwRwzb?= =?us-ascii?Q?a6XUAktzqgZRI3skRbuJ4COOoYSFK2gRrmAKbQMqNto2FrJx++Wg4BzXcPwE?= =?us-ascii?Q?xsjGjDi6YrOfkkHZPzAeUPRBhCib6zOoO0iRhuSBTpQpkjMLCkJqJd83qxfG?= =?us-ascii?Q?lCbOTbKIDkmFCsybwdBikAHQIynse5xmwN2Y/dS61HbQxkp+rhvJ3xAp25R/?= =?us-ascii?Q?/YIrsJjf38f0lxfb4S2tsZvoIW2o0hDQO5WaXAactxz4uRT2Jbjj0torrNSH?= =?us-ascii?Q?51lhxQPN0YKswPRAFZNjZdiejbElUoiIXcTWTISU3WbuZrTLKau0Xj3KqJwm?= =?us-ascii?Q?GlhPso1f6Rv4kYOj4HhmUG+sy9D6tsfQTErHOQ1/2mr+g4KSKZXeSNeKUllk?= =?us-ascii?Q?LC9MaINoigObLo+vX1uL6ajBMK3kCjpbEkhJJDARJzysy6+10RSyQotgX67b?= =?us-ascii?Q?VL2uTZlNLkwBHGrSxhYIGZynhRKdxFokte8jEis4hrRcg0CneIf+AhuXW+G8?= =?us-ascii?Q?9G+5SXRXAkfVgCysEjitCK93GbnIQ7FLZYaPtWz3W7atZRj/9FyRYGPp7BxN?= =?us-ascii?Q?0PfDjD5LKHcaCUrA5BwZrUeg/QZHcywmd53raNDxKh9ZKjzMi6v11IznCshY?= =?us-ascii?Q?sWNpave5mLY/Uv9SxSmCkxXW/edGQonuyGccmoIlzl40kdv/tCjQ3fTKCDcN?= =?us-ascii?Q?Zxq8Dielzvo1RIBcCwremdVzeOo/RmAnzCZVQ0ybttcKKfy7EgRmRmBC2Hks?= =?us-ascii?Q?JmllbrDRLramUMx5F1nli6QHIiA+EGw/fFRB?= X-Forefront-PRVS: 0340850FCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6069001)(39830400002)(39400400002)(39410400002)(189998001)(2950100002)(230783001)(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:XDJWpgkCNlh94wZhlATlS+4LYYkzzWA8zzBlMsk?= =?us-ascii?Q?1FVLTen4DSzNDwxnAIxklvmHGYxGG5gm18tFZF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WC9insAGP7i/a0ZH58LIjEDK7H3Fgvs/6jGdrKu41dAd9KWjVcTJZT5pM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;7:9jARQ/WqoRTJIdhFAk4jsoApANbry+ZBdt7uhXI929Pwdnexly43iP+2jOGnOOj2heVhZMkUxtg/8I/pVLZgIQobC5+gNoZyQC/luSR3bOLLWOz4Ii9EuvzC0Wmd4teTfa1pTRyu2F2O+Qq/TFGz6+dyNojbMJ0LLI2r0quKmRQIllCdyQsb77DihbExFrLeatxl4QReWb9eMancFkbz/vRsnvzJkvurTFv3zBiqHtryO7D2XYqC9993km1ocwH6QfyjEbNF4lxmaA1xkRKR5L/KaVyK3u4zkegYaN7zqwruLL/wJ/PuxJOxypJVAl7CLf4cc+JnF6KhC0HG7BbIDZkZL3mjshwUOJcl2pIMcbQp499CCaMbQkjgi2xmxXclucEVM9YC11nqgjorNB42XBJt5rITTN6cJyTdWohTf1sQK94nn6GMh06BXAjdCtzIsToGKULMIjuCuClvt4cNMh3mUFth8gwbmmU1t1ds7/GnvH6quY/Tlcc7lrTfkEF2sVfGESrB34deCwiQ3CPFsEFUjgavY9Y9wEMu4wuN5VwYuE6kL4Ijgox9bl3NRdNIb5KfW0ry5LGkJ+dPYBSOSBMRzg+VYjSL1TRrF8yToR8KqsxXhwbxfQfpSLGmCFMd4d8qb5JPk0p2obYwWHR389bDGxzGHh0obQK2b53y2T3jK/n3S8G6UwVmhMW0HENJ1Vvh/zUz4OOVFjc8zbT3bYhGZ6itP+dzTHjPiEAeUC91Uswqpdz2UCix6s5uvs/qtr/I6GK2dypHEDLk7J4WwBS2Aec3P5bpz2CT9z9lqX0= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 09:12:04.0283 (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: 6033 Lines: 157 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); -- 2.1.4