From patchwork Wed Jul 12 05:29:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 9836003 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 60BEF602A0 for ; Wed, 12 Jul 2017 07:02:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 507AF2074F for ; Wed, 12 Jul 2017 07:02:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4492128550; Wed, 12 Jul 2017 07:02:26 +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=BAD_ENC_HEADER,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 BE0782074F for ; Wed, 12 Jul 2017 07:02:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 371BE6E360; Wed, 12 Jul 2017 07:02:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0057.outbound.protection.outlook.com [104.47.40.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62DEB6E360 for ; Wed, 12 Jul 2017 07:02:23 +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=8N4f7lmM6SOb50JYq6BozOom648h3iz5hVCtoimxl2Y=; b=pSokDn3XBXPSGejBERps7THWk/6N5yD2nACPr2Ca5fBqOaJbLZry/Ex///Fe7EBHgE3CiUySqutM3V9yk2lVrRTtYMQQCx7QxJP9QJg2ApaKzqc2UWZNK3GCboxfFlYVD6SS+W63mp00iyb5SQtwtBVD8eeeak95hH6dWQCNTag= 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 BN6PR1201MB0225.namprd12.prod.outlook.com (10.174.115.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.13; Wed, 12 Jul 2017 05:30:03 +0000 From: Felix Kuehling To: amd-gfx@lists.freedesktop.org Subject: [PATCH 1/6] drm: Add helper to cast DMA-buf to GEM object Date: Wed, 12 Jul 2017 01:29:22 -0400 Message-Id: <1499837367-8368-2-git-send-email-Felix.Kuehling@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499837367-8368-1-git-send-email-Felix.Kuehling@amd.com> References: <1499837367-8368-1-git-send-email-Felix.Kuehling@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: BN6PR19CA0083.namprd19.prod.outlook.com (10.175.197.21) To BN6PR1201MB0225.namprd12.prod.outlook.com (10.174.115.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f8b1e41-ec16-4f87-d0f1-08d4c8e70c4a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR1201MB0225; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0225; 3:JlOkQA50SKG8jzCuiJ1tYGj0XwWu+hLuOAPlU3+uSobk+RVpYlJM/GCrvxCtQqj6fMWkoWx3lMf2/TlogQkzdVWFn0QNXaYHb2MNsDr4kTZ56J5ivsh/+FTQrA0GNt68YwktUk9RYeL/nFBMaYfAWMTkj498kCgK3XsqwRnWHNAa1dr9MsRsYEvMJmuKb4Qem7QTOZlruaU62hP9UlOGvrU6Wr93tEbeHEappSxsa9XFk92wfu4l74AyxDrYnTZrktc+3JHlTppeW+UcmaU4kMYMaT6JL9TCBOch84RU3uPqf5Pl2dpnKJsPoi8j+pS4EbgZNJgaEvYVnRm2DEd3E11+vyBZd/VmIFzYiKwDM1NPfP7VHIKH5onVZIwqDrP+kOaXZFKP5c6GPN0UHxbt2eMERSkvoK58fBb4VALTk5JYrw5fF2WRyOUpd4B4pa2dj8x+w6rwAYy76U1OK0GH33/1swBeT25Jb5mireoZjR8D9glyHU/zHHL/eLgRFkX5S7ZGhBBKfWx5/OnGkJ1kra+TfxpXW8fCSbShWJgZ3FoWeevoT9+VWg19tQRmRHReooccKgHushllF5DktX32elkryU1VscF6Lm3mqkMFRgbv74jNSlrWzgo6KxBkPsm1XsrDLikHpq+WAopon9MjehHqMii63VldoQ6u4bbaR9lTgm7fP752nXqyhr5/9vWX7PnkG4To19y3CkWExefZcZNIjamtFYSuNCZcB+fxyCoIc6MrK3iTiMX5rr8DjKUpOacp1aLip7s4Zv4VSUvcjA== X-MS-TrafficTypeDiagnostic: BN6PR1201MB0225: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0225; 25:bYu7/kTpHuuGqCm45ZSMgS7SM5oUAt4krKLQAo5jTaVndLWAtB6uFh05zV3mFfjEAV6t2W0QZ0f5K+go/7QJDY1DL9nhwplXnnRanDECjuZfN++rPWcQouh+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bC7H143u1GTVOHsU1s0OXmwCskRIXOPPvnUxeMBkVlP7g+2kNOFpIVmPAW1NO61CjqBI2UBO0QutpiBAiMQvb9hcpcKMw1naCckUo1eKYjfqICBuNTAHEaOOgdqnHTjAhZbDmFvsqCNIDzJ2Th4mUP+2wpTI76MIp/xJKYgFCJ2Mebj886JFT28XhjF3c98ZCNYdurynj87/tbhSP493WJ3WPR+/+MLysGNm6QQ+GQIpL+Iqcfna/qNP9E0I8OnXt8gf35tUPQzv0uXsqTR8kZfvmW6oBZ94/aa+2n6/NUbtF/3rTu7WEyi4dNp7xRpUBS93lE4T0TP7UohhyRw9sxWtAvOIKjYzwoWSfXCWCJeGhrl0+xX+uGUBv8m+mJufHgzslixKesawDIj4TrGhfEdmEiF7rauy3bB6dlSAIoGbnvvaeT4V/Xxne+4xoNd3TUQ9vIE= X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0225; 20://hXLPqP6x4+XKCnmQlYXeByFqrnUs1XZTlPkxfKezd1eHIIvh4R3ZI5mKe/d5TFKfsp7R6SmBQBsyAtVkr/i2FXsyHRPt55PUFvqjijfckO4JP2kkHAElb01n9/aKMyWJDwjUI6P2DMEkRdpwXc0764WUlKlTe3wxO80E5yHqdo2n++8GcHonfHbb8bNc0702+4iODpg6mpijCqPCZOITozBk3s4Y2XHnNoEiOMSuIAb3B8cqRq3feF74jg4PTLX1RLl2DYnIenbJN6/l4LcnyS+46oNMjZWyijssKRukBKLZ9otaXjceolHGNbrFdYduOyy00vp+1o/oq++eapA+QSfLxtb9tDXDcijX1I1lo+X0iqmSJfJdVGcocxss2iRvqTpM4QhgCuYeMlCChhElQtAQJVDclrctDq6ifseP8V0pbJ5vUj4FnT6m1UEbLO9aSzuWBhoY12BgZSwc/HH1ptW3BVptamljCjrvuklJlAiiX6KvoIsWDw0WlSCZbZ X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(2017060910075)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(20161123558100)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR1201MB0225; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR1201MB0225; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR1201MB0225; 4:ZwB424MgntwVcP6EcTeKs0VoPdpebNCU1dUHSlPp?= =?us-ascii?Q?pfiBbvj7F2H5yBmXu5SWORLn11WmJHWs8j+E8MDFktwP56ZvnpnIU61gYH0f?= =?us-ascii?Q?L0iT/0Ae8SYLPaV8t1+LIomR0bZyTAYw+UnbPBD4L4LoO3COCN/luut83gSA?= =?us-ascii?Q?BIy0ssIrBbOmTDCM35IcfyoY7aVswmFXbGRnefhaWS6xGFcp0m2adZoSalGb?= =?us-ascii?Q?GhuwYpiNTlthUneYwh0G/d8Ozduu7xrZthyt4MxFNomGsCTh8c1ETX4m+iF6?= =?us-ascii?Q?KDVNElV1WE4DKrEYHIp0uUzRbZ2KG2DSQ0htB1SKoosQdQ6yo38WjlgHqdCt?= =?us-ascii?Q?QLHbO/yYhOkMV5bEwCtJUw+0mpk5yI6qI0dfcemmR+VKPI4TfYFi49oEL7zg?= =?us-ascii?Q?tnkInKfTXkYzckLfwkfLEKO0NvtuRQAS+DPrIvUZvuhA+AmdhqVEdKTY+YEA?= =?us-ascii?Q?3zKSI0mE/b6L6g9DOm41BTYZW7CIJbZJhJ8svCa79K5muBfaEouKx5MyF7Ed?= =?us-ascii?Q?nfm7gYO9UgJ/x6pwJHkVXUHX/t1WD3dZKc74Z/YZF/g14hO3MTHYtsgU/twJ?= =?us-ascii?Q?DKjqWHLu4hh1R43/dDlzIikK/mITtRMPO+FRGHnTL6q50ALCoC5yZjYYefBb?= =?us-ascii?Q?svnDNN9jmjwqOKTdXi5mavGqvG0WUhhGyuaFT7PstUjTwug16QayK4BKRCLT?= =?us-ascii?Q?we0DBdv7Bwcb+R+g1GHRQg2W/ulJ0OwM9J4gGLGb7QB0FTqaj6/vuhm2I8NM?= =?us-ascii?Q?kHMeoc+8oK7U2XGsDTmUvXc/MbgzLDig676KERzyQXQmdjITy+Lxx554Ln89?= =?us-ascii?Q?E5P7AP439NE/XAIyO36NjIcSQXHLMoQ7t+IB0R6DCYXdcYhIMZc2+ad5+qeG?= =?us-ascii?Q?KtRzcROrqFGf7ErQXORz/uqwhVPce+1BKKlFwCg3JfZLmwgNXumz89Egytie?= =?us-ascii?Q?lwSuBOmtZAN1pdn4F6vzi1w+/TarhatdtJdac7RF5efmBbLS64du955lnkwF?= =?us-ascii?Q?VKh6FZkbtizoFzxHejFmRkWKFpuTXxzUb8JqU213cYGx4V9cprOQPi2lhA+i?= =?us-ascii?Q?hmEdgTBB3mK3lssSmaonJEIhOoDzQuOLvD9BvYDNJANBJY+aADJmOaGqr4aQ?= =?us-ascii?Q?/Zwc5iCDe6FEVwpziAn/2fZDWlmFXD8Ze4SSvpJ3iLQOpOC0buGId1jXhTcs?= =?us-ascii?Q?VubnSQU4vV+WpHkM1PGiUp0iSp57d2mLE+roVgTwy+gByYZb0pdAnQLpAL2M?= =?us-ascii?Q?9DybUdeq0gizVSiSGVRMAgXlO5t67n/IAaoXPvZ0?= X-Forefront-PRVS: 036614DD9C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39400400002)(39860400002)(39850400002)(39410400002)(39840400002)(39450400003)(5003940100001)(50986999)(50466002)(50226002)(6486002)(8676002)(2906002)(110136004)(38730400002)(81166006)(76176999)(2351001)(66066001)(2361001)(47776003)(7350300001)(189998001)(53416004)(42186005)(36756003)(6116002)(3846002)(305945005)(450100002)(4326008)(86362001)(7736002)(25786009)(53936002)(5660300001)(2950100002)(72206003)(6916009)(6666003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0225; H:Harpoon.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR1201MB0225; 23:CDtDrZQp8LacsqhFOT3LYhDd77tImjxwAbsQZef?= =?us-ascii?Q?oYFxYt+WCaN+Q7BIv2dnGTSUOhKb1X10hra8+3zQ46W9zaYCaMFGJWGlYV/3?= =?us-ascii?Q?u93h5a529vg30PvadJ7jpJNIB0ThmTk9EQlQVLL9WuHw+x3xecHsJNTvxjt2?= =?us-ascii?Q?70zmmGRZjRZHxYOrujE3i6/DM/hrr6Gxnc/48a5M6xpsjsKqKM4viJMDKMs6?= =?us-ascii?Q?9LsVxh1STUhd5tMADvvhQIX4gNxWD9ZrBPrDpZNnnyY6KFWzo/MWxFzkY8a2?= =?us-ascii?Q?lSFSH16FWEEZfpQP84F7+qs7c8RmcisMDrSrP6RyR0wR6alMnuKBrCn2icyt?= =?us-ascii?Q?ebujf9tGfJcHVA/Cz6bJdTCAVcd5oth9agDw+udIKirw+BfvT/ryZqwXNQE3?= =?us-ascii?Q?YoZA6AZ9W6iMxFJmgjy8nnObGux8+BQYgn5y6a62hyIO2S+4B3qbRxHg05yJ?= =?us-ascii?Q?Cs/AThJ+kVQRvHXI/C11wya18AYIQ5Vh9SjIw+fSFyup2rR9uIVc7EfBKSVw?= =?us-ascii?Q?MWgQ8CBYdkhkESsiLpJi7spNc8K20h9OPswdAK77nXLIimUjxH1D/yUF/bog?= =?us-ascii?Q?yVtgdzHvkCUXxS6dNQxBYioDUt9Me4ujLZ3DIStcInNlrI8nWbyLREkqBJQa?= =?us-ascii?Q?qCfucMrtVQxfXBZ3pffX7ZInkz3ML2Vk9Tz8fSsB5AJA52uAIhChBfvYaw9G?= =?us-ascii?Q?pjIyKORKUNigignhwY3xoQ1plcEBO4oL8dCe8fdjW3Z7yr5blO6xjSLS2Wc5?= =?us-ascii?Q?h76D3G2kGlA7euQ0lLaEFHs6MtBNzjpaBhqRySjX3TJMURSYLHBbRYthplPR?= =?us-ascii?Q?VXpqoFNVRFQEVdisgGvFkqxJeSo0U8y4ZCzmMqfnjmHqnuSaZvZQTbLWKoQJ?= =?us-ascii?Q?XI45e/Cc8VymjT9OGEo06U72iCMoQ9FSGv0BVTGjAZZ3wNqQynF1rkzHoVfD?= =?us-ascii?Q?ijKAOGpWZYsXhvFznzfbdXjQeB21TNwiFwgLXjpN0fngxI41SWqfhqKnqeJ9?= =?us-ascii?Q?EdcRyX5PhSugsWr3J0x88j0rrav4zMzCAfuQ3lhmDgIAxEY+8gtS+4T5+d0C?= =?us-ascii?Q?/BM7euHA3tkMrWLbfbBT6K6c+VKvAAIf8x/W8ES2RHHgZ39P0N8RIu8aBP8j?= =?us-ascii?Q?N1xTaK4WLQRjAXFKUVGPKy9e+4R+zzpLn?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR1201MB0225; 6:uweDk1w75fNEVQIf7i2N+Ai6KsfBrAgZ90Swhpec?= =?us-ascii?Q?eas6IqJiszsG0koV557WoeDN8jqJnmi3OdB8ioASE6w8GVvAGrOzWvHtdgIs?= =?us-ascii?Q?v/zRXuEvpV6shhBQ4bE0cUKAYJbAoGluMYHspVjkOHMN61D1CXAXahTKX5Qk?= =?us-ascii?Q?X3eL3WMZTdLKDZPyk2UWNZiHMBT6VioxpxnvuO2r6P0eGF11HD4wHwe8bnTU?= =?us-ascii?Q?gowmbgJuw0zdCNouz971CKjW6I4GDFF3FOhBCYK4hI00xgN0q1wIhr9VB20c?= =?us-ascii?Q?TcWy1C5Y6x/9odUEEej1mxSDQqvA5feF/R+SAf49DxXsBSqKy/XMSD8DCxMv?= =?us-ascii?Q?TRo5uKxQaCGfKdTfc+7njFBuG1TT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/VozqlJ1Oh/MbYhbeT79Tchb2y1LMZz06Vrh877ObqU187Mk02ZKP3YAkWmWB+cj7IZWZ1tw6dczVEKI6uJn8AaE0Ue+SRmTYR2YpksvoQQW9VwdkQFMf2CmLa/TYPctdcaB8+zpsqfMbXHt1j6BHOCMRx4WSc7taOG1GtAZfWPpRdJy6v5J48gaw2hukB0dCs8/k+HANGaUm6pK/ltY= X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0225; 20:X2vOnMrUY9HkxGLyj1arCe/zERP72uFGc2cXaFaIKIIPz+TlAIB4xzdkeeUk9K/PB2mcTJz60bOYAziXPGoEGsmqvuFwRMCd7O3n03RhQWNjD1LLTeD7ovLiJxGbkvGlynkw0eiulNAXqdxtGOjRwcgAwDNosZduPACxZ4EcAKBEl2NOV67ATDU1xGO6TSjPabxmE54qSHXu1EveH+oYNdgJO4homodBmgMJI7brULWMqmBIth6URw54BNFaPUnD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2017 05:30:03.3750 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0225 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 Signed-off-by: Felix Kuehling Reviewed-by: Christian König Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_prime.c | 25 +++++++++++++++++++++++++ include/drm/drmP.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 25aa455..b1f8445 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 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,