From patchwork Wed Jul 19 02:22:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 9850343 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 E74E7602A7 for ; Wed, 19 Jul 2017 02:22:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEE8527F2B for ; Wed, 19 Jul 2017 02:22:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0C4B28628; Wed, 19 Jul 2017 02:22:06 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, 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 213B427F2B for ; Wed, 19 Jul 2017 02:22:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CEFB6E3E9; Wed, 19 Jul 2017 02:22:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 78096 seconds by postgrey-1.35 at gabe; Wed, 19 Jul 2017 02:22:02 UTC Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0043.outbound.protection.outlook.com [104.47.37.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id D9E286E3E5; Wed, 19 Jul 2017 02:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DxmfChSgKAQnpa0HzY7dH/FerfjQ5hRyF94Dz4DWyWE=; b=OYgKWEzArDjLLXHMO+5GS4rXXhbZ1MLETPv9rakKx44GGjkhC0CxiqoF9vsI1QqZUtBS7LNsOiVm5nw4Xn/AjF+LG1F6+uvpq4MsmX5M4hzQnga67cWOWCcQcBNk4yyxJbMLEgPb9mh7P3Ulbufgg4t2gBJHW2+cxoccUJIl5W4= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from Harpoon.amd.com (165.204.55.251) by DM5PR1201MB0235.namprd12.prod.outlook.com (10.174.107.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.13; Wed, 19 Jul 2017 02:22:01 +0000 From: Felix Kuehling To: amd-gfx@lists.freedesktop.org Subject: [PATCH 1/6] drm: Add helper to cast DMA-buf to GEM object v2 Date: Tue, 18 Jul 2017 22:22:08 -0400 Message-Id: <1500430934-27098-2-git-send-email-Felix.Kuehling@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500430934-27098-1-git-send-email-Felix.Kuehling@amd.com> References: <1500430934-27098-1-git-send-email-Felix.Kuehling@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: CY4PR03CA0008.namprd03.prod.outlook.com (10.168.162.18) To DM5PR1201MB0235.namprd12.prod.outlook.com (10.174.107.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc825741-b669-421a-830c-08d4ce4cf084 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR1201MB0235; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 3:p4hH590nVRX5OIB7VrG6WpeKvqepksd+y3LKXbHULf0SnlMVy3x53+C47e3+ykHLoL5nSmyy9U10qCPjAKjotyLX/e1BXPkiRc5NE50Xks9Y5OMyNiilroSPFRgdEArFOBW+RUEhz4Gt+JUyUKIlXIC18vJXAHOw24MNOAl9ZtCD8+f8YVZ+a9M50uNozjaY8xpsKZ/J4Y3HAtm/A4xpJyokjas9FtpsXlH9Wry2s3w7PUyShgfnMbpGaqFLWinBZ+MJAt/xVFQ1wsca0OrYHYBIoQV9vS+LfPCRVRgaAx4eAS+0uKFK5BCwlzdG4miBjLayTp3hshCf5YSgduWU1461kElIdSynu5lj/3Kr/NVEKNATn3Czi7KEidZ5rER7q7n5GBtoQXtyyTkwHoagCXFPjt3C0czFLvC2qPs7IDEJsus/3hDWdup58ADM8Z8Y4DgeyB4mvYk7thikBTQ2jvB5ez5Lg3FFJuBlblSaSJZzg1vFwcAruR6DW3+6Vw6iWqZfRF0BdnWmHRJfsAwauwBxT1sEdbu7M02P5Xh5e78w2dx3WklO6cMGQLt1iZKn5zDZ5AGfl/q4H8v7pTUCDrj9agJKk/VWueTLRxTMWBdFfvEMJbO6oG6Q7I/xPjrC3obdSRAKDSSv1w6HRpq1i82VqykxDCFzC1YvbEppPTLpS7kamPMcTSaG1rkAUERC1jZWmwTm9a/Ceifzfy6UWr4g3j7UehUUHsF8vx7xcqRTmumEnwHEbD9Sn757tJpML6bM0S7eK292edP5OKOFiw== X-MS-TrafficTypeDiagnostic: DM5PR1201MB0235: X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 25:U8L/Y3FwOFuaC8RSe1JBS40u4/CpTkrlqIgV0b3cOOHz5A2q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exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110)(148574349560750); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(2017060910075)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123555025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR1201MB0235; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR1201MB0235; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyMDFNQjAyMzU7NDoxQ1ZBVHpReS8rbWIyZWl5aHFsY1V4dXNK?= =?utf-8?B?YnJsWkwzR2xkd1lMQU9CTGQwU1lWZkFMaHRZSks5UEtzMk0xTU90NXpWSUFW?= =?utf-8?B?SkY2dUpLaWhqNFJwQTRCYmlWZXpHQ212WDJnWEdMZVFOdnBLUWg5TURRYzJN?= =?utf-8?B?Z3RLM2UzZEJzdXJ3M2hxQ2tDVHlidTMwdUptN3dzRXpVZUw1T1FSUzZmNlRY?= =?utf-8?B?c0tWQ0RPaDlNeEpVZ0lobzh1VFpMdXVSTjN4Skk2cGM5SWxDYTRlT2Y4bzc1?= =?utf-8?B?L08xZ0tETWQ3b0FVYm5tYTFzcFRNa1RDS2FyTExucGUrTUVFV0Z3OFFuZVRp?= =?utf-8?B?dXFSS3RLaHNnYzlVQ01oakFGREhQb2ZmRVpqemhKQ2Q4eFlFelhFUmF5YXFO?= =?utf-8?B?TGc0WVlMalAwNExTUlFZTFNtU2w5Ylk4Q3MvMUxlNUlNcnJBNjBXTDYwVmlU?= =?utf-8?B?bEcrOWI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yanZrL2gxbXZxaDJ0?= =?utf-8?B?UjVFSmZocFlBY1ZpZmhzVWxQZGRUU3FhQjh0VWxrVHNVay9oeVZDbTM4eG9n?= =?utf-8?B?Ylo1VUtyLzRCaDc4ZkM5QnNrRnhLREVPck1xU2pMY3ZvZWNEQjRkV3YxVVRF?= =?utf-8?B?WUI1NkppeTRYL0pjRm02TWRKd0xIVnVOQnhkRmMwdnlmdDVaSUlmcEw1QXZR?= =?utf-8?B?ZVY1UVpQWDdqTWlib3krY2ZIbWhpTlZjNTNLWDBvZ2lYWVM5d2tGY0p0WXRP?= =?utf-8?B?SW8zOXUzOUdSSjFTQUMwVFNJUFBqWHhjbTNFNHo3RTZ1VkUxdEhVL2F5cHpQ?= =?utf-8?B?cEFMMmY5ZWExb21mT2IvRmRwZGw0azU4ejg5dTE0Q1VWaVp3emNuaHdyUmw5?= =?utf-8?Q?jGMFw3+HLHilrTeFBeexFhUFmfk7ULCJHsSvLw=3D?= X-Forefront-PRVS: 0373D94D15 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39410400002)(39860400002)(39840400002)(39400400002)(39850400002)(39450400003)(25786009)(50226002)(47776003)(66066001)(2361001)(42186005)(8676002)(2870700001)(81166006)(23676002)(2906002)(4326008)(53936002)(50466002)(7350300001)(5660300001)(76176999)(50986999)(450100002)(53416004)(36756003)(2351001)(86362001)(38730400002)(305945005)(189998001)(72206003)(478600001)(6916009)(6486002)(6116002)(3846002)(2950100002)(7736002)(110136004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0235; H:Harpoon.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyMDFNQjAyMzU7MjM6L2RIRDREZWhpcUJveWxsUDFKcllmUkw2?= =?utf-8?B?M1dpemVwaFhlVFVEcytXV1ltSWdhcmJwWlIwQWx6eUcrNko5UElLOTM2cHVP?= =?utf-8?B?Zmx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FQTRwNEJSeVFrZXk2MTY3?= =?utf-8?B?eFJEVEpsOE5HY1lqYXo5c2IzZkFYNkd2dmpwejdGS3c1alQ3ZFpCVERXNXB6?= =?utf-8?B?d0RBRkMyM2c5WFB4T2hkeFRaaUowZVlhWnBnWGVXZHNLS2pBYnB1ZWJBTGFK?= =?utf-8?Q?2Kxjf5EG2?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 5:OYfGLiwzLj0IrtkYEPFrEheX5Af+gbh0cg0IM264l6Ns/kwM42F8dUbzz85J0YWdipob+GVmgL8T01cj6USIIGh3W4gHjxhJX74HziAASX8npzZihwCZTLldnPA21SUKb4VYj1gSGF/uCTETPdRPK0KdFIxnQDx2X1DrzWnzRZpmwHGhZ8fwt9Q0DZzdkllxW1tfXkp3fVYWwVkdS2eYvilyW8K1JIRzvw+5swa/GDAjozwSsC0RW4WmIZ5McTtm3I6bTEMGAXfLHq80QKcUs4sMxIzmkfejok7we1bzXyw1Jrgi827Bd+7I+Avw+CLBmjl3O0hh63PcobeUr3h3jAtInZ4AqgeRvpN5jyLcnIpOa1S5dgFGOj7wtW76NUjUHXMTOiRM+h6+6WBO9kHg7f/spPqNJRmkW6PnuMAuRjpNwB4PxAjNEUBE0ZSl3pzR09AtSqkmrDgzWiAH7sZM+vgvHJPnk09f0oq8lv2N4VJQbCPxiO6r7tATSH7EgbmO; 24:p94sdvU2AfGZSYNogoocjMi86uec3t7db+acwaIAlczI4G0MPElVR4DmxgkiMo1TMgsNtqRVAjWNxNhtpyviO78dhp5Lvf3f10cQhIWZ6z4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 7:bb99Uje72Rah+1M+UHr68KdwYQE2n79wKHETceoWBmYS0+OlgRIXGZkyvI7xcphnhQ4KCOVXechlwuJFYDEJj7TKmmjzkFZJb1rw+Psgrp51O1dd9UEe4Z5TRN+SotevEO43f9Tslo1qvj5PpiK36dbthip5+XUeLCKGd26KFsDU5zPVs6GZvV2rMC4MAw39wbEbT1lM6vuG076QvKVQewnc3TTCQSmqrZ7sIazXMLcQanZ2RCO6Ay+QohecWyByb/g0uUU8YTbF7k2NbcH8DATcrg+yJ+XIr6tuHqWm+qxLAhjMzjQ4t4HSIWpsIb3nXEB9bPE/223xZD1JsoQLi6aK0h1U2DYKspfdAhGIbpfXLyF6C75mtKwzkyOzq0ZmTsi+OkztrT17x5jQ0OGH5QU5+vTVJaORURz/HyNKpnWu10FaZ7Cfbub/ujkOBOpGPvf8ZGLTqM+KncYMWIHuccZGxlHoKS/4uuoBpiVSVa76BVjGXlqAJyrU85Ma1c+AQrpyXgx86WPyn5J2jHApIlB8GOfNNDA3jteADU9oN08G4A8Zxahw5EeRf2DYwSMntB/UUuIdQQn3U7MBu6lUSwDJsmbmGOClQXZbbXS4pwRHr237CgJF30LewO1H9M+Q0mbpvKcjU7t2twIqc7u66OHP50t7IkDsnvcgKYhBF085a6jBYDcKjy41R4n/MamnXT2jZ3x1D8V6JEm0C8s5W2LD2OV+bPfMdi2Q4Traup+It6ze2epcG7JYbFzUS6PAHyk98j9WzJL+XOndJH2THw85bIXljsPHqkrnI7DFbWE= X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0235; 20:4wGLm8SWgpgAMTGMRkEIODkVKLU9h28YxTYKCbgbB1S07xJ2SOja9vpJQGpFHTIbx7kMNhPFQE2/wpsi2ppixBA8X0yyIIEQm6eZnmt6RBGRvRSItDF0n0xyG5jokrRgOJ304/IE8R6BBA+ZZOUACksFsk8Qv2PfHmBKukM2550T1eRDreeuPoWms4zrPieoE6QX70PFD+OfhfGbd65960G7vZQxn42i+3XDDKYVgzjL9wAPD+vgHgLQFhi2GkGh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2017 02:22:01.0385 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0235 Cc: Felix Kuehling , dri-devel@lists.freedesktop.org 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 v2: Use the new helper in drm_gem_prime_import Signed-off-by: Felix Kuehling Reviewed-by: Christian König Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_prime.c | 43 +++++++++++++++++++++++++++++++++---------- include/drm/drmP.h | 2 ++ 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 25aa455..1ccf354 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -594,6 +594,31 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); /** + * drm_gem_prime_dmabuf_to_object - try to cast dmabuf to GEM object + * @dma_buf: dma-buf object to cast + * @driver: driver that is the expected exporter of the dma-buf + * + * If @dma_buf represents a GEM object, this function return a pointer + * to it. Optionally, if @driver is not NULL, it also checks that the + * object was exported by @driver. Otherwise it returns NULL. + */ +struct drm_gem_object *drm_gem_prime_dmabuf_to_object(struct dma_buf *dma_buf, + struct drm_driver *driver) +{ + struct drm_gem_object *obj; + + if (dma_buf->ops != &drm_gem_prime_dmabuf_ops) + return NULL; + + obj = dma_buf->priv; + if (driver && obj->dev->driver != driver) + return NULL; + + return obj; +} +EXPORT_SYMBOL(drm_gem_prime_dmabuf_to_object); + +/** * drm_gem_prime_import - helper library implementation of the import callback * @dev: drm_device to import into * @dma_buf: dma-buf object to import @@ -609,16 +634,14 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, struct drm_gem_object *obj; int ret; - if (dma_buf->ops == &drm_gem_prime_dmabuf_ops) { - obj = dma_buf->priv; - if (obj->dev == dev) { - /* - * Importing dmabuf exported from out own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ - drm_gem_object_reference(obj); - return obj; - } + obj = drm_gem_prime_dmabuf_to_object(dma_buf, NULL); + if (obj && obj->dev == dev) { + /* + * Importing dmabuf exported from out own gem increases + * refcount on gem itself instead of f_count of dmabuf. + */ + drm_gem_object_reference(obj); + return obj; } if (!dev->driver->gem_prime_import_sg_table) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 6105c05..79c2b23 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -767,6 +767,8 @@ extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev, extern int drm_gem_prime_handle_to_fd(struct drm_device *dev, struct drm_file *file_priv, uint32_t handle, uint32_t flags, int *prime_fd); +extern struct drm_gem_object *drm_gem_prime_dmabuf_to_object( + struct dma_buf *dma_buf, struct drm_driver *driver); extern struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, struct dma_buf *dma_buf); extern int drm_gem_prime_fd_to_handle(struct drm_device *dev,