From patchwork Thu Sep 27 19:05:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 10618475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6785D112B for ; Thu, 27 Sep 2018 19:06:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 540582BA62 for ; Thu, 27 Sep 2018 19:06:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 488252BA78; Thu, 27 Sep 2018 19:06:00 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 E4C052BA62 for ; Thu, 27 Sep 2018 19:05:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6DEC6E1E5; Thu, 27 Sep 2018 19:05:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0066.outbound.protection.outlook.com [104.47.37.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 103166E1E5; Thu, 27 Sep 2018 19:05:57 +0000 (UTC) Received: from SN1PR12CA0063.namprd12.prod.outlook.com (2603:10b6:802:20::34) by BY1PR12MB0421.namprd12.prod.outlook.com (2a01:111:e400:51b0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Thu, 27 Sep 2018 19:05:40 +0000 Received: from CO1NAM03FT040.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by SN1PR12CA0063.outlook.office365.com (2603:10b6:802:20::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1164.22 via Frontend Transport; Thu, 27 Sep 2018 19:05:40 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT040.mail.protection.outlook.com (10.152.81.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.1185.13 via Frontend Transport; Thu, 27 Sep 2018 19:05:39 +0000 Received: from ubuntu-1604-test.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Thu, 27 Sep 2018 14:05:38 -0500 From: Andrey Grodzovsky To: Subject: [PATCH libdrm 2/3] amdgpu/test: Allow flags to be passed to amdgpu_bo_va_op Date: Thu, 27 Sep 2018 15:05:08 -0400 Message-ID: <1538075109-3759-2-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538075109-3759-1-git-send-email-andrey.grodzovsky@amd.com> References: <1538075109-3759-1-git-send-email-andrey.grodzovsky@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(136003)(346002)(39860400002)(396003)(2980300002)(428003)(189003)(199004)(48376002)(36756003)(50226002)(47776003)(34290500001)(6916009)(4326008)(6666003)(8936002)(86362001)(81156014)(7696005)(450100002)(81166006)(8676002)(51416003)(53936002)(76176011)(14444005)(2906002)(54906003)(16586007)(104016004)(316002)(97736004)(77096007)(50466002)(356003)(426003)(446003)(305945005)(68736007)(44832011)(186003)(336012)(53416004)(106466001)(5660300001)(486006)(11346002)(105586002)(26005)(72206003)(478600001)(476003)(126002)(2616005)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR12MB0421; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT040; 1:YDL98p7jGp9tqrLKZ5vY+c0KKFrAZikhiM6BZixLVCqtdimBgYunLUyRPUtRkXbQHXx9YL9Z0XHmsqRgV5I4WcQlV9Mo5Z36z58kYXkw/YP4sEDeNSJaQ66jwR7OIv9R X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e67cde1f-5d49-499e-7a4b-08d624ac3751 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060); SRVR:BY1PR12MB0421; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0421; 3:kLHm1k+8ji4io1AVxcY9j3/BFy8A6gm5JZUrGsWIrZSFoFBqBep2yu+dlDOWH5GeXf/5SybIJfb3rbf8qz9qP/8GO507DAWPgU4Dy2gkgJ0/DvX57fpzx5eBsAXxNqj+SSGa+i9LbMwWJlaQLtoCo+KersZWe6dLei4kgD78oABTSj+clnyEfnYzpuab8UZhZ7eLBfQpwSEkp0SHW+IJa6JKsQoCf2FYkdZu+iJ94AetbkhTk6iJAFbHdTUnaYG2A9YN4AFbDcSjEipP/7W64vF42DjTsU5PLJZ5fJquGEB8+fmf8xBKXCf1oXIn8U7Y4fFVEWRoesZoOMjymUaozq/mLIRVW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QFdqAJSi+amq1wvzwyKcA5qDOT1Ahaooigr5eQeIRvSt89GNtUb0PnqAYTl444cVMxKtgPqSSvkyq7rOOOx2PJ0iLZI5hxxN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93003095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:BY1PR12MB0421; BCL:0; PCL:0; RULEID:; SRVR:BY1PR12MB0421; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0421; 4:+zTYNMUOwL7PfuFC5cH2WmnPP0JCqjv+T1YL5HLxaS/b78c1d5sljksYNcTHhHlrWsdcpuc+kFx649DWGTX4T72Zruv0mYsIiUs+LbuyBV90Mp6oWuvVlxuNEQQpTrhxKtPP48v0jhYdDRePykpnS3qY+9rTgwDMgh7i+8Eu/lsDjwwAlCRE6YirLxst1g1osPsgWfpJM2Q9cbUd/jGUzYvK2P97rV9qwPahJtxi3ELJ1JyPwPs8DOTAOlnnrKCxkY2P/L0mvKzvsWNZ5p5jYxwfu0Mx/R2PpYdE0XMSQyFgPGEPL00znwq1jrOgLm5e X-Forefront-PRVS: 0808323E97 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR12MB0421; 23:kZluZMwv/A9zk09Ly4h2ybdfHTVrNpMlxceT7a3WV?= E/Bb4ek5k8wqMs0Eid+Gns59n0du0OyaYH7LwFHfi2zRsOXHcN6cEnxcfEotdyAlKxHJAouK8AvfTu9wCUjReLslJ2hT9Jd1A5osuTwGlKUzlmrdU6zmvkGRZVVLa37iJNfyngxG9Cwnk5nd/NkSdUlBzp1vosIOMPdFXI+laDWdq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bPSucKjKxmYICFsvyhaJcOvrooA7HqI4kR+jc4sIdKstROftFrguV0jRxHn3QlzvKTwGTGL8X6jG1L8WiK6kFbJfKtRXre967znhNZ3JpyZzy+ZZsV6b67ubAcjhEYyCGg1IkaSk+qDK3A1LWZcu9BNrB6oevLUlPwdd1w/6jS9l4F1Y/iReY6HPDCFcxSfAixRowDTfXx14DsDsQW4EaieBAa1AgoAtKettOhcs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0421; 20:YTNfOz4Lm/JrYmWggFK5f5RG68a4YlSc2VIOwwJ5Dr/mgNK8K0M6VsJ+jyFyH9cPEtHFmumd53CMa1zuXsfAxbn8dOh12J4rsPjnWXw3z+wi2xjumJRUUEYKgwgk4n6MRkfjxCgpCuoJmQdopu0Whl6YDYMrHOlPKo7kY8b1uxPlbO0ob4Sk4ELP4C08Ts60O7ZbV0F3tsN/mwedIl23ATKL7n2j73rdXzVIyNFLaNGyFJKpaRhYf3U6YxKwcWYx X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2018 19:05:39.8690 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e67cde1f-5d49-499e-7a4b-08d624ac3751 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB0421 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek.Olsak@amd.com, amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Andrey Grodzovsky --- tests/amdgpu/amdgpu_test.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/amdgpu/amdgpu_test.h b/tests/amdgpu/amdgpu_test.h index 0609a74..8024507 100644 --- a/tests/amdgpu/amdgpu_test.h +++ b/tests/amdgpu/amdgpu_test.h @@ -280,7 +280,7 @@ static inline int gpu_mem_free(amdgpu_bo_handle bo, static inline int amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size, - unsigned alignment, unsigned heap, uint64_t flags, + unsigned alignment, unsigned heap, uint64_t alloc_flags, amdgpu_bo_handle *bo) { struct amdgpu_bo_alloc_request request = {}; @@ -290,7 +290,7 @@ amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size, request.alloc_size = size; request.phys_alignment = alignment; request.preferred_heap = heap; - request.flags = flags; + request.flags = alloc_flags; r = amdgpu_bo_alloc(dev, &request, &buf_handle); if (r) @@ -302,9 +302,9 @@ amdgpu_bo_alloc_wrap(amdgpu_device_handle dev, unsigned size, } static inline int -amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, - unsigned alignment, unsigned heap, uint64_t flags, - amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address, +amdgpu_bo_alloc_and_map_raw(amdgpu_device_handle dev, unsigned size, + unsigned alignment, unsigned heap, uint64_t alloc_flags, + uint64_t mapping_flags, amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address, amdgpu_va_handle *va_handle) { struct amdgpu_bo_alloc_request request = {}; @@ -316,7 +316,7 @@ amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, request.alloc_size = size; request.phys_alignment = alignment; request.preferred_heap = heap; - request.flags = flags; + request.flags = alloc_flags; r = amdgpu_bo_alloc(dev, &request, &buf_handle); if (r) @@ -329,7 +329,7 @@ amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, if (r) goto error_va_alloc; - r = amdgpu_bo_va_op(buf_handle, 0, size, vmc_addr, 0, AMDGPU_VA_OP_MAP); + r = amdgpu_bo_va_op(buf_handle, 0, size, vmc_addr, mapping_flags, AMDGPU_VA_OP_MAP); if (r) goto error_va_map; @@ -355,6 +355,16 @@ error_va_alloc: } static inline int +amdgpu_bo_alloc_and_map(amdgpu_device_handle dev, unsigned size, + unsigned alignment, unsigned heap, uint64_t alloc_flags, + amdgpu_bo_handle *bo, void **cpu, uint64_t *mc_address, + amdgpu_va_handle *va_handle) +{ + return amdgpu_bo_alloc_and_map_raw(dev, size, alignment, heap, + alloc_flags, 0, bo, cpu, mc_address, va_handle); +} + +static inline int amdgpu_bo_unmap_and_free(amdgpu_bo_handle bo, amdgpu_va_handle va_handle, uint64_t mc_addr, uint64_t size) {