From patchwork Fri Nov 10 04:30:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 10052367 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 E8954603FA for ; Fri, 10 Nov 2017 04:32:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8CD428AF8 for ; Fri, 10 Nov 2017 04:32:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBCD02B15B; Fri, 10 Nov 2017 04:32:25 +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 3DE5928AF8 for ; Fri, 10 Nov 2017 04:32:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EC7288005; Fri, 10 Nov 2017 04:32:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0054.outbound.protection.outlook.com [104.47.33.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9B906E9E7; Fri, 10 Nov 2017 04:32:21 +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=p5IuSK+6D/bEKEOLg+yqcvdW9yQLFt9szosQB/rtG4Q=; b=G8DQQnNwJnAMe/hUwolek5Aj9PG5AHmYVr3VY9iRaxtjqWYCR0f6tGxayufN2y7oRKQU6rxXUbiIjQ7BQc1Kb3+LH7zM4Q1GY7FAG4B3XgmW3c7mZNmGbh0Ji425B8lfCbRz2hbTJn3U25fxfQCoZYlM/E4I92+LPrEuYvS56vs= Received: from DM5PR12CA0006.namprd12.prod.outlook.com (10.172.32.144) by DM5PR12MB1273.namprd12.prod.outlook.com (10.168.237.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Fri, 10 Nov 2017 04:32:19 +0000 Received: from DM3NAM03FT053.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by DM5PR12CA0006.outlook.office365.com (2603:10b6:4:1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.218.12 via Frontend Transport; Fri, 10 Nov 2017 04:32:19 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT053.mail.protection.outlook.com (10.152.83.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.218.12 via Frontend Transport; Fri, 10 Nov 2017 04:32:19 +0000 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 9 Nov 2017 22:32:18 -0600 Received: from ubuntu-1604-test.amd.com (172.27.224.252) by SCYBEXDAG03.amd.com (10.34.11.13) with Microsoft SMTP Server id 14.3.361.1; Fri, 10 Nov 2017 12:31:22 +0800 From: Andrey Grodzovsky To: , Subject: [PATCH libdrm 3/4] amdgpu: Move memory alloc tests in bo suite. Date: Thu, 9 Nov 2017 23:30:02 -0500 Message-ID: <1510288203-21716-4-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510288203-21716-1-git-send-email-andrey.grodzovsky@amd.com> References: <1510288203-21716-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)(6009001)(346002)(39860400002)(376002)(2980300002)(428002)(189002)(199003)(54906003)(8936002)(8676002)(33646002)(81166006)(189998001)(106466001)(53416004)(101416001)(68736007)(50986999)(76176999)(478600001)(50226002)(105586002)(4326008)(72206003)(5003940100001)(36756003)(77096006)(81156014)(50466002)(450100002)(6666003)(2950100002)(2906002)(47776003)(48376002)(53936002)(86362001)(316002)(305945005)(16586007)(97736004)(5660300001)(110136005)(356003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1273; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT053; 1:qb88acBx9xZnsCgJYI6sg7ssvJ4ODMj2cGxcQ7rXh9iEwqWlenyqIPUObQkhmJhK5omHRW+V0qBwp5v0Gxp3bt4K6f8BdX51mIme8Oc2Umo6M+enjOl6YHG9gPAH8lTd X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7c5ac2c-3040-4476-436d-08d527f407a5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:DM5PR12MB1273; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1273; 3:rYqYVincFwzaRWp4u5daWH/4WBwDZrAe0gp8P3iyG7ZMDOSamYMR7lwQ4RWXNAJ4dRqsxsXXLNyb112FynQNVGkRZavQzf5bRABvoHr4/xF6SmfxawXhlxSoytWHSqGTu59m1/TR7CnV6EWnG3j48l8wDAI0QXS3Jng9KSaNOuir562h1JZ8nego/L+rrANk92cMyTCVGTauY9uwO4YdRsB/RLKL2N++j7rhbRI/XT00dpjXXAEtfLtfVmP1ndOthswEA2y//F5s61z52HxHroUpeXOFX+un200YBRXmBZcz0XQHBjq/kgD8C4vFBYgh/5B42qpwpbgsWVXMh2MuklXoGHXUpstJQkIJFAckKNY=; 25:IBSY11aXnOK92KeF9wVFIsjDC+Eu7aMqR0nHRRWTvP9blhqiMHU3W9AS2XTwMBd03czTtOx/LfoJ+JIMrz2vOrriGKJscUbRJhkb+clTSLy5UiQEVyTaiAvNMq8PY+U5sUcg+CuZ1dNC0wX0H0xlOSOCSZS23kjqEG1UDEglXfvPzt0M0AKm3KQCwHeQ6D4Vxko76xy5+hMUfxNYptM9hpuJmB+C4qRmNm3Wtu6mwJlWCaHXCXNcS7e2yDhJMG5X3mpx9P9HPaZBSOm0ZfBT7UUoXD3gjyvkbv9OONbkC5xKiga408cP1VjBxyq5VuGTOLUaopCnAQCBSJR7CQjL5w== X-MS-TrafficTypeDiagnostic: DM5PR12MB1273: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1273; 31:PBaYqbimLxlMIRnVzToI/cKx6pZagMWxBaLwsGv3atqTf4M7UAb7JVv1EvsqUE9s8sSpmBU3rtvs/5Yis9RnjUawYG8KeNstf4kEV7Uifs6zabkM85CwwCgdtW64X5nZ7cqMaeWwyWg03vIW5tCB0U8b9vDmn/qg49dVoy5c9442mkf6TgUgHSc7E5577lksnBEkCe1j4Ou7dy23d7uTo03c+pbcZ+1b+vjTcSXsJFU=; 20:DLhveqisMsSLSozfXowIulGZB+yJO+1iNamyvSdIbPvonYKyTrfDUyApDR+/ivLNlCIPUoUtAxtKEFtR6NIG/PDO0ZOiCvFbvFsQRixHWr1wX9PGDWCyp1bj+xcoWUAhn2D4vOlaTWFUh1huitCdK9pwcrPZWf/AvetHI6HjWRT2MpukQKW5qbSxj1T/NNtFYBdGwiUnVuoT3EF3cWTN6U/h8bXDoiPCW+V1plzWN9Ek+fO8mzS+JT239k+1m3xg+TJEDkuMr8YnRsdDr9p553sDzQpJ6pfvN6wLuVW8d763/KUu2U3BglWrPR9oCZpBJCgMHj25WE1GIrJMm2UKe3Pi/qEEKhJWklMTZmsoXMLUtbHZr6yiFFoD3p4Yv2Z+IZY1O8jL0+kHcrYf9qE/Yc7j3LHvKwc4O0LD8vl2X0CQgvldHxlQVzUrTM5DFUcH1Uc6vzP4A63eb5YqBjtFYgQVNzmoxYAwXVUcm7nbjWrx36VS7pDg7DbChanc+8ip X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93003095)(10201501046)(3002001)(3231021)(6055026)(6041248)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR12MB1273; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR12MB1273; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1273; 4:xMFS634LhqQSyUmM3R/Bnh4IT5JrMRQKQHcajwTvCjQ3wXHpQuoS91EXvbCNzF0ljRA1SHcciblP0NHaB6D3SOw9dgVvLdyRJjAdklR4U2QQfeuYGEpAnNUOLn1wmI4+eWKjQ1Dhrp7vSY25KiZfdT33uztErXUElPnLx3/LoCP6YJKH5pOONYoP4jUauXhWP91xbAwEUKapHhuDu0y9ij59W8lLiTvPqv1pcChQkCnOaacmwtmF3es/r8eiWuUmovLejshZZ0oB6cG3JAXN4Znbh+CBaKENF9q5TA+wioa2QzX4sPLXBJmnEru/Gwsy X-Forefront-PRVS: 0487C0DB7E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1273; 23:ZUXzTY1PH9dEC4PcLh6zq8ATcrclf11ejupTBUoEK?= =?us-ascii?Q?3H+oDufLuRP+RkDHLXi3RYzZO1YMCNiA7PSqtOe/Zq0r3LIqPm5ro+EZDtaq?= =?us-ascii?Q?qNNFospY8O153Z0cfSKS25DGPSHnw+2n2eq68BvRhU/LwSyyloDYp/TvGTxD?= =?us-ascii?Q?TBDOEAdXL5fPTmm5fu/cYMhc8pZuyJgzGZf3I3+XOXqB4obMmATG2MaEnlz3?= =?us-ascii?Q?42k2f+xumFnwptpRBChBHp6KWT+5v8Crfj+E+frBp3F4fkN1I5YIB3eL2cKm?= =?us-ascii?Q?eJRiDqW73UobZ5b3CqKkZWXvx3Kj6+SBpQrFbT63iKLLZHzqPs5KmdDOKT4u?= =?us-ascii?Q?mDOXfHmUCAVriqE34pfuNXtwtbXPvmehWSjou0Gpz0KvDJLPgok3I2q50YZi?= =?us-ascii?Q?yiB4y741PPZOvZmecbdQc5yU3EQ+pd/N5eGjygAcNpqlIb8oiwAJlzSH5azx?= =?us-ascii?Q?er4KM6ttTtTMS6qF6DmRttUD0wcNTlLf5RlqBztXjUxeZoag+OxWQ9x6BSWf?= =?us-ascii?Q?XbQaSelH2WtiNo+gP/eLqUiUwYw1N2wIE9mvvWt5eXdiBFaOQUlaRbeUo6KC?= =?us-ascii?Q?KSvkIm+XQqpBGo+U8SIL9uod+7OlTSWS9Q9wUueG+KVpIFZ7+7Wt+M35+7CY?= =?us-ascii?Q?XbOmafti7ZZIX/36dIU9Xspd/6wiNK1CCG4ZPhV9WrEENxdBh8jKr0jsfb2/?= =?us-ascii?Q?RKofDR8uRimz/rNweWWv8cja/lvUvvg0tnIw+8rJQFeXrc1KgIadVLGlexBV?= =?us-ascii?Q?T3B3d7DEGjJiYwaT2F1zJChJPk0QIUBgb2PZrN/mCLpb36nDyJcmobnVahXb?= =?us-ascii?Q?L0oQmQ/L280md4y1oT3K1vuqecNDM1RW+JgnqWl17m2rKbD3ok+1UOwujF2/?= =?us-ascii?Q?ePRh9vZPRsdyYbfXe6UDhIxyq4KrR/8W7BzNGO8nu/48FEnYqEAxoz0bgLst?= =?us-ascii?Q?2LtT3CBV5cuFUxyIFQ50/MXhwrGLjz3tpdyM8C/m23R2wU3u6foLQRlCvRd3?= =?us-ascii?Q?ACv8bYlzfP77LxR2iR2+xGc8iTRFrN7sd64zqAxPa84g/2cKSf0VQtr3sxil?= =?us-ascii?Q?XA4VpGXzeR4wdeGOhsDg7crbsHJ?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1273; 6:bN4is3ytTHmvRl8nropkSRHb8+ldYr33xv5NjmGj2vxNPeyDj64VqViGYgxShXYnhiZ05Vi8GdxtCBmBRY9nelFztbePT0PEA0OQGCwmq2wiRVDgZatL+ucNbPQFyuOdRDra+cN/tCo70rKmJT1mrmplubZhVoWlJEmuuVurnxMGkKg4F0mgOwYvxFP6OhOa9ijUeeggNFpVPI2/ORLqKQ7FioWIL4XuSnAzmcze293bM1HW2F2exLaJN98fPrK9a0F7O57tbaLSjzZNGwH2xgJxZbhnleQdPud3yi/fhz35B8LVsCcT2GT2/BQcXsteLJNcTueIpPGu5d1fd+Rs8FQ8PNAP2g8FHjNb3yxJejE=; 5:rDO8ZG0ps7LsFv3Uqt16bHCNsWb0qJHFTGT3D4lyNIXeH7llfZhT8q++YGyGbtZ7m0m7kQH/S0bV7OmF/SEcfbbHzCVfXUb1bMeDKs9uRVthDP7gUF7Co3m6Ejoq6ZKE0ieXp6ua/I0kcFnJC7ojp5zMLSZo8VPiT1nM9ZCAFug=; 24:jlVv/6uQMKZBjqaoi1gBB5iWXeSoOvwDcHiqbBnK6rzV5XIuzs2lotKLqpnPqB18Bm3szTnq+nx0dm/SijR2cs99F3jTCAksmUIcCIMdtPY=; 7:OIRF5BNTjZIUshG0d3AE1A1LPaIqC0F1+gLE8Zyy7lapjWI4vpzdeS2nrxeXww2fNAS3knEukpE8WcAr32k6RcRW2gf3X6xx1n5hO5uvgcD0yqb3V6oIQBQ3iSmOrC1VdAlz0kCkxfsTOg8+8wGMRvT+ZL62bHDF8r0CVQ74f6XYg05W0SkhdnIXW+BzIkbLtnwPgsCtGvPxD/0tFqoKlwiaSVOlrP7ihqb7xZ7hMFMd62VFku4Rwon0I2qdyibb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1273; 20:GEaMAZn5TlvTsDOLouYfyKcP0cSapshfUTxzMi5QI+tHHBHtLEp4qCXT9MbtPqMKYtAM5x/194bo2zxHFJ5JaVaHqGV+NMC0f/IYeMe3+zUutJn0SCKDQVG87dwsAMYj09OzIHhGm3Fl9EjjnyTGZJIT/tDt24QxIIzBB0grFOaPUb0jyq/bQ6smjXTg7Xlu2eLx8hMnYk7XoSVps5vd/ZvyXSvKz3m19XF+5GwhGF5XuGwtU2/LiogFWr/vvTJx X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2017 04:32:19.5161 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7c5ac2c-3040-4476-436d-08d527f407a5 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1273 Cc: Christian.Koenig@amd.com 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: Andrey Grodzovsky --- tests/amdgpu/basic_tests.c | 49 ---------------------------------------------- tests/amdgpu/bo_tests.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c index 18bcf91..e7f48e3 100644 --- a/tests/amdgpu/basic_tests.c +++ b/tests/amdgpu/basic_tests.c @@ -44,7 +44,6 @@ static uint32_t minor_version; static uint32_t family_id; static void amdgpu_query_info_test(void); -static void amdgpu_memory_alloc(void); static void amdgpu_command_submission_gfx(void); static void amdgpu_command_submission_compute(void); static void amdgpu_command_submission_multi_fence(void); @@ -58,7 +57,6 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type); CU_TestInfo basic_tests[] = { { "Query Info Test", amdgpu_query_info_test }, - { "Memory alloc Test", amdgpu_memory_alloc }, { "Userptr Test", amdgpu_userptr_test }, { "Command submission Test (GFX)", amdgpu_command_submission_gfx }, { "Command submission Test (Compute)", amdgpu_command_submission_compute }, @@ -277,53 +275,6 @@ static void amdgpu_query_info_test(void) CU_ASSERT_EQUAL(r, 0); } -static void amdgpu_memory_alloc(void) -{ - amdgpu_bo_handle bo; - amdgpu_va_handle va_handle; - uint64_t bo_mc; - int r; - - /* Test visible VRAM */ - bo = gpu_mem_alloc(device_handle, - 4096, 4096, - AMDGPU_GEM_DOMAIN_VRAM, - AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, - &bo_mc, &va_handle); - - r = gpu_mem_free(bo, va_handle, bo_mc, 4096); - CU_ASSERT_EQUAL(r, 0); - - /* Test invisible VRAM */ - bo = gpu_mem_alloc(device_handle, - 4096, 4096, - AMDGPU_GEM_DOMAIN_VRAM, - AMDGPU_GEM_CREATE_NO_CPU_ACCESS, - &bo_mc, &va_handle); - - r = gpu_mem_free(bo, va_handle, bo_mc, 4096); - CU_ASSERT_EQUAL(r, 0); - - /* Test GART Cacheable */ - bo = gpu_mem_alloc(device_handle, - 4096, 4096, - AMDGPU_GEM_DOMAIN_GTT, - 0, &bo_mc, &va_handle); - - r = gpu_mem_free(bo, va_handle, bo_mc, 4096); - CU_ASSERT_EQUAL(r, 0); - - /* Test GART USWC */ - bo = gpu_mem_alloc(device_handle, - 4096, 4096, - AMDGPU_GEM_DOMAIN_GTT, - AMDGPU_GEM_CREATE_CPU_GTT_USWC, - &bo_mc, &va_handle); - - r = gpu_mem_free(bo, va_handle, bo_mc, 4096); - CU_ASSERT_EQUAL(r, 0); -} - static void amdgpu_command_submission_gfx_separate_ibs(void) { amdgpu_context_handle context_handle; diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c index 74b5e77..4545196 100644 --- a/tests/amdgpu/bo_tests.c +++ b/tests/amdgpu/bo_tests.c @@ -46,6 +46,7 @@ static amdgpu_va_handle va_handle; static void amdgpu_bo_export_import(void); static void amdgpu_bo_metadata(void); static void amdgpu_bo_map_unmap(void); +static void amdgpu_memory_alloc(void); CU_TestInfo bo_tests[] = { { "Export/Import", amdgpu_bo_export_import }, @@ -53,6 +54,7 @@ CU_TestInfo bo_tests[] = { { "Metadata", amdgpu_bo_metadata }, #endif { "CPU map/unmap", amdgpu_bo_map_unmap }, + { "Memory alloc Test", amdgpu_memory_alloc }, CU_TEST_INFO_NULL, }; @@ -195,3 +197,50 @@ static void amdgpu_bo_map_unmap(void) r = amdgpu_bo_cpu_unmap(buffer_handle); CU_ASSERT_EQUAL(r, 0); } + +static void amdgpu_memory_alloc(void) +{ + amdgpu_bo_handle bo; + amdgpu_va_handle va_handle; + uint64_t bo_mc; + int r; + + /* Test visible VRAM */ + bo = gpu_mem_alloc(device_handle, + 4096, 4096, + AMDGPU_GEM_DOMAIN_VRAM, + AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, + &bo_mc, &va_handle); + + r = gpu_mem_free(bo, va_handle, bo_mc, 4096); + CU_ASSERT_EQUAL(r, 0); + + /* Test invisible VRAM */ + bo = gpu_mem_alloc(device_handle, + 4096, 4096, + AMDGPU_GEM_DOMAIN_VRAM, + AMDGPU_GEM_CREATE_NO_CPU_ACCESS, + &bo_mc, &va_handle); + + r = gpu_mem_free(bo, va_handle, bo_mc, 4096); + CU_ASSERT_EQUAL(r, 0); + + /* Test GART Cacheable */ + bo = gpu_mem_alloc(device_handle, + 4096, 4096, + AMDGPU_GEM_DOMAIN_GTT, + 0, &bo_mc, &va_handle); + + r = gpu_mem_free(bo, va_handle, bo_mc, 4096); + CU_ASSERT_EQUAL(r, 0); + + /* Test GART USWC */ + bo = gpu_mem_alloc(device_handle, + 4096, 4096, + AMDGPU_GEM_DOMAIN_GTT, + AMDGPU_GEM_CREATE_CPU_GTT_USWC, + &bo_mc, &va_handle); + + r = gpu_mem_free(bo, va_handle, bo_mc, 4096); + CU_ASSERT_EQUAL(r, 0); +}