From patchwork Thu Oct 5 15:24:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Zhu X-Patchwork-Id: 9987485 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 04FE8602B8 for ; Thu, 5 Oct 2017 15:58:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB30B28CDB for ; Thu, 5 Oct 2017 15:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF94B28CE0; Thu, 5 Oct 2017 15:58:43 +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 6C6D728CDB for ; Thu, 5 Oct 2017 15:58:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 820BE6E828; Thu, 5 Oct 2017 15:58:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0061.outbound.protection.outlook.com [104.47.34.61]) by gabe.freedesktop.org (Postfix) with ESMTPS id 213E66E827 for ; Thu, 5 Oct 2017 15:58:40 +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=26o2ZLUHpurvgusNXcx4ohkjjWS8HFL5B7/nwBjXFcI=; b=eW2z0ZEzhmcpNyuhAZk5yLWqPwPr6JWxmNY93eCA3Mbb8aljvc94tzZBRGZNW6YGYp8XBRQayXXlhr1RGIdcsE2A9FloJrBJwn9dfKCOjWOlRxpNqdRdbG9/nCWljckDoDyZh0hY6/TQP8uIIYjojuv2zb9eUsqOvujkyB4z1Cc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=James.Zhu@amd.com; Received: from JamesZhu.amd.com (165.204.55.251) by BN6PR12MB1410.namprd12.prod.outlook.com (10.168.228.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 5 Oct 2017 15:25:33 +0000 From: James Zhu To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH libdrm v2 1/2] tests/amdgpu: add new uvd enc support check Date: Thu, 5 Oct 2017 11:24:49 -0400 Message-Id: <1507217090-10669-1-git-send-email-James.Zhu@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: BN6PR02CA0048.namprd02.prod.outlook.com (10.173.146.162) To BN6PR12MB1410.namprd12.prod.outlook.com (10.168.228.144) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae8ee4a4-2716-480f-4278-08d50c05526d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR12MB1410; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1410; 3:jDPBKzGlCDETVi8S59JL/K9pe1ZwG+4Hy5g3aJB9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ucg7taAfK+6FUHatawUmhdidCUYNoSzzscmjsrW45sAM517x9ksCtyUhqkuzwXqhKzY7cLeGjte3igHTafnhkv2M+rjWN5XAaFE3ePi8nHdoZr06CDIY3DEP9IAx2wzGbAIHuPown/mZMKnRUXHfRbkoFkk7CDxgIdxaDBr2L21hasBnkAARsokV0BV/iS5arIoMDy72fO50GwaL4YtD0Vud+5qoKTzZkIu2toNL+aOxUProXV5xFiG5c4LI7+9hNcBVjOB1Bc+49uLk4U22LmRhdOl1hHoGo+PIHrAyq+J7wKJacxppYIHlHOndhlDHUTbxP; 4:EA/29IyJN9yj0VMnT+O5sU358woZjIpc3O0c06opWL7c5kpQwVlaExc/UqON7OJMlbChN0BScDCvHCcJ9gvu4Xzdf5OiVca1HWjr50Nx0fM6r2i5KmhiU3SgYwgmLyMtfcjyUBFlGd8+9XELxPNSuIRd2iWkHCKAWPNUTeDR0MRa68CAqBMkkbifyPA6+BIv2PIr7k8PINlMrPFvlSe3LXndxmtlF24WZ6tCHAPjJNwmM5S5o3UJ8u8koKR1qyvbAGz4FER+Er4e7J7qQb3yH37ojmaYiY+5kE2fLCMXLPU= 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)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR12MB1410; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR12MB1410; X-Forefront-PRVS: 04519BA941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(199003)(189002)(72206003)(53936002)(86362001)(6666003)(305945005)(81166006)(8676002)(50466002)(8936002)(16526018)(16586007)(450100002)(7736002)(316002)(48376002)(50226002)(478600001)(53416004)(106356001)(105586002)(2906002)(189998001)(50986999)(81156014)(47776003)(6486002)(101416001)(5003940100001)(6116002)(5660300001)(36756003)(25786009)(3846002)(97736004)(68736007)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1410; H:JamesZhu.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1410; 23:eVa/qodfVCkXeLz5Fkmb/NRsdeMccvMttaJH5maBI?= =?us-ascii?Q?k+dho+bSs12Y+T46+VbLbaeXsBRXoCusMntqtuRjJaRoBCvXUbkR+BeLyonG?= =?us-ascii?Q?zQ6evnxkiUFNEWUFuYtcvy9jYYDeR1Dfipc80c2kkayWWegZyNwEtfsV1wGp?= =?us-ascii?Q?Vo+YUI8ZAwBmSe9mzKThTY+mWhdXQ78PhGNzufaP6RebjnoAMPVEU55oxD/D?= =?us-ascii?Q?E7F05wiHKG81NxSWHlnm58dJga9awrtY9K1JjLN/qKFOsPw0eOs732v09O9i?= =?us-ascii?Q?RM7Qh9uzg8Kc9E85qW6yl0rap3a9n0xXlUJeb6JoCp8+YUwjYnjRBkJ1rDhe?= =?us-ascii?Q?0etw4GYCy06hRbTZw8u088fFm8uUB08A3nCpVnu4iLcqVhU0TwZJUVW13MCh?= =?us-ascii?Q?G7i1VfL5vCDTnm8fF4Ljx9nbodqV2dVGhg8PDUWRJarTZjZYkmCJNZPXq25Y?= =?us-ascii?Q?87nAdfMhywM/T0WPSiPPf8R5GfG/U4X71wjtrfndLs7+mXp5/5HvqaBggcRZ?= =?us-ascii?Q?hPLm9lygTuFwKlaz+d3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sZCz7Je2IO+kCoHT8AG2JimaywJo0yjONCeRWmn5sUv+tU+W+rueeoB93xPUXWoZIFc+HTOg==; 24:10wqwL7RRR1pkjI6OSo/idaIxXIO3MJiZpge4qDuOTC9Jlb83rcfKC6rZK3r9DeyxNZvFa9DgV0kAbkLjLEOzugtkVKCPlRCC69afzpFXXA=; 7:psJhzLTS5cBeRlv5+dr3Gj75VNJM1GGafTrafB6tj6qBU+Q6BzEs0RaPN8082f/RgapPfJRhnjMQS+vNjQILd3LDh5LU7KSKPbhOzjlxYCDqLgd7DfErc/DQQLne8o4agqyf/lis7cGhD9rxsNVd+48H8FFj2degjYx05pZ0Q/8CzCVGXUr+i5FSbogg4krDDppC30Jec046opHfPs2Gu8KFPt8fg2Fou1I7Um4+Ioc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1410; 20:hAhgVGotUf4lf4m2S6WuGfsGrCojBAKz63uX5BNn3n/K3jNMY+AqalZL9pvFsHqrnZWV4oqWI+0K1HyyM3Dqy5dNCflaUoWgJ35ks1bNnQ5BujOmEsR+79XbU9QGYWOLNwdtGPLHU5mUbpjJxDJE+gqbiyyQV2Y/WpJgwLCid4oAN3W8FtMDlhaiJN3SVDB9tLnFewcvQJ9OWneWzRL5UEO4ZxPQ2/2xFAUPI7PTf4lVxq26Unw+Mxax5ptXoLxV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2017 15:25:33.8180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1410 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 Query hardware IP information to find out if there are uvd encode rings ready for use in kernel driver. Signed-off-by: James Zhu --- tests/amdgpu/uvd_enc_tests.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c index 6c19f7b..7518103 100644 --- a/tests/amdgpu/uvd_enc_tests.c +++ b/tests/amdgpu/uvd_enc_tests.c @@ -79,6 +79,8 @@ static void amdgpu_cs_uvd_enc_session_init(void); static void amdgpu_cs_uvd_enc_encode(void); static void amdgpu_cs_uvd_enc_destroy(void); +static bool uvd_enc_support(void); + CU_TestInfo uvd_enc_tests[] = { { "UVD ENC create", amdgpu_cs_uvd_enc_create }, { "UVD ENC session init", amdgpu_cs_uvd_enc_session_init }, @@ -98,7 +100,7 @@ int suite_uvd_enc_tests_init(void) family_id = device_handle->info.family_id; - if (family_id < AMDGPU_FAMILY_AI || family_id >= AMDGPU_FAMILY_RV) { + if (!uvd_enc_support()) { printf("\n\nThe ASIC NOT support UVD ENC, all sub-tests will pass\n"); return CUE_SUCCESS; } @@ -121,7 +123,7 @@ int suite_uvd_enc_tests_clean(void) { int r; - if (family_id < AMDGPU_FAMILY_AI || family_id >= AMDGPU_FAMILY_RV) { + if (!uvd_enc_support()) { r = amdgpu_device_deinitialize(device_handle); if (r) @@ -238,11 +240,24 @@ static void free_resource(struct amdgpu_uvd_enc_bo *uvd_enc_bo) memset(uvd_enc_bo, 0, sizeof(*uvd_enc_bo)); } +static bool uvd_enc_support(void) +{ + int r; + struct drm_amdgpu_info_hw_ip info; + + r = amdgpu_query_hw_ip_info(device_handle, AMDGPU_HW_IP_UVD_ENC, 0, &info); + + if (r) + return false; + else + return (info.available_rings?true:false); +} + static void amdgpu_cs_uvd_enc_create(void) { int len, r; - if (family_id < AMDGPU_FAMILY_AI || family_id >= AMDGPU_FAMILY_RV) + if (!uvd_enc_support()) return; enc.width = 160; @@ -281,7 +296,7 @@ static void amdgpu_cs_uvd_enc_session_init(void) { int len, r; - if (family_id < AMDGPU_FAMILY_AI || family_id >= AMDGPU_FAMILY_RV) + if (!uvd_enc_support()) return; len = 0; @@ -339,7 +354,7 @@ static void amdgpu_cs_uvd_enc_encode(void) vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5; cpb_size = vbuf_size * 10; - if (family_id < AMDGPU_FAMILY_AI || family_id >= AMDGPU_FAMILY_RV) + if (!uvd_enc_support()) return; num_resources = 0; @@ -472,7 +487,7 @@ static void amdgpu_cs_uvd_enc_destroy(void) struct amdgpu_uvd_enc_bo sw_ctx; int len, r; - if (family_id < AMDGPU_FAMILY_AI || family_id >= AMDGPU_FAMILY_RV) + if (!uvd_enc_support()) return; num_resources = 0;