From patchwork Thu Oct 5 15:21:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Zhu X-Patchwork-Id: 9987599 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 189D26029B for ; Thu, 5 Oct 2017 16:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B7CB28CF8 for ; Thu, 5 Oct 2017 16:54:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 002D628CFD; Thu, 5 Oct 2017 16:54:02 +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 F2BFA28CF8 for ; Thu, 5 Oct 2017 16:54:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D6296E842; Thu, 5 Oct 2017 16:54:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 4375 seconds by postgrey-1.35 at gabe; Thu, 05 Oct 2017 16:54:00 UTC Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0086.outbound.protection.outlook.com [104.47.40.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 08FCF6E842 for ; Thu, 5 Oct 2017 16:54:00 +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=Lg1vQuHeCADTnKDHsfKeXUW1kB7NAm1GIDh/FjxbY+eqB6wnUp+6zJSi+g5Ew+SZbIffcim1O5BqSRDdxZboRjQd89JyKZCXvL9fsBweCsg6QZMhMAXjUH7+SnBAEEtDIM2tLY0vWLgerFY2tontHpAR1FXHzvtAbmdDsmvwNog= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=James.Zhu@amd.com; Received: from JamesZhu.amd.com (165.204.55.251) by CY4PR12MB1415.namprd12.prod.outlook.com (10.168.170.22) 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:21:30 +0000 From: James Zhu To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/2] add new uvd enc support check Date: Thu, 5 Oct 2017 11:21:18 -0400 Message-Id: <1507216879-9815-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: CY4PR01CA0016.prod.exchangelabs.com (10.169.249.26) To CY4PR12MB1415.namprd12.prod.outlook.com (10.168.170.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e132a17a-f957-4b73-d7da-08d50c04c15f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY4PR12MB1415; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1415; 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//A8Sru71uHUPYWhGxugCOJ/N4qXqrT14f7jOutH0PCtXL4ve4YkZSEZDvCZfvoaKrrprEZTStLVL0MkywB6jlBe+Z12kNP20s1dYN6P2WcvHma7M05qQ+JZLYhoi34QOBKQ1jFu6Qx2Hm1GnbIJ/oiOJxN8QvFsZHGkiLTCIEkb1ty5J5eGzcPOfvEOcjbReHt9wL9rSGng/SEhUCJncXv1r686haeMjXcu0lvHGe8btr4yWikhVfflpSVAGweoYRxRF1ZbD0mvtxmRAD7jCkEswPrEnVb31ZEPHTMYmI/3BOrzhKzFSS1O0LiWLfjI4aH2SL9AWQd0IWal5gqOivgsGKEI5eSXl+g; 4:ms7hE46CwlaczbHxdD3KniEjzGN8c/D60tWLMCiu4qaVCwXinM0e5opCLtOLEkwqa3/L0fcctzcCLLpPPVhPCl8mZ/mmMu2hgAFAc1kjvLY2IcMX8X07t/Jekc/quFvqjRTfcFY6ZxN5ACnd0Y92MsFISccX95vIMAAjPuco/52gD10P4RGeaxqCSjQLf63S2dMgvt7MyzZFLZncd54oELRJj34ufgUhwstlFc5T8e/Aae0q4qYWLyVq0d4630I9/WW3VQXxIQab1Yf1oXAaLs6S0/tO/1gYXv3bfbb6Gb0= 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)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR12MB1415; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR12MB1415; X-Forefront-PRVS: 04519BA941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(376002)(346002)(189002)(199003)(36756003)(81166006)(47776003)(66066001)(97736004)(8676002)(189998001)(3846002)(7736002)(8936002)(81156014)(316002)(16586007)(478600001)(72206003)(16526018)(305945005)(68736007)(50226002)(6666003)(5660300001)(6116002)(53936002)(50466002)(53416004)(86362001)(50986999)(5003940100001)(2906002)(101416001)(450100002)(6486002)(105586002)(106356001)(25786009)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1415; H:JamesZhu.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR12MB1415; 23:lXAFnJxf/0I7RLOgmW6kfUwoPfzSid9IUOMQcCNBD?= =?us-ascii?Q?XGX9T+ahVYGgifqQQysyO25WlYw7ODzSsUJSsqrEnJdj4GDa4UsxAVbZoZIc?= =?us-ascii?Q?OEMB6MjpvWyHOfVd3vtPgqRdORpgF+BSRb1sSHacQGhLRgpzuV18+hBP7ega?= =?us-ascii?Q?Cs57mCkYl8dsN+K2dlJHW5OK09wKHNIDK63+wOGNWC/e9xrvh/mHe1Eany2l?= =?us-ascii?Q?eDDIFm6ta4UHgY3gBOWCGl9sa0N6TJu+TuU3QKJUgT6PJjSSkafBvw/7ha9d?= =?us-ascii?Q?nbzC3MTPkSGWqm6sk/YP0xdp+tqIFw66TmB2F8teo1W0bT/PTHWKXW26ghRd?= =?us-ascii?Q?tQZDmxXiU2oQppFTY8bqLhLp23FibjWYiNkVHtTYdP6GeeTR/62BrHAp0LtE?= =?us-ascii?Q?wma3utkg0ayiaxC5C53ahbdmbhaclurwh97o4Nst7c2tENy1Ispr03M3PBvb?= =?us-ascii?Q?gDfiQ9y+PpzbNKlPVwzq/NmvdRccTutcV94LzATudsi6dr8a+KQytJV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7+Mx094sXY7nOwIvc13UPrCdBpzHmdNCuMjkNGgB5aTD2DGAHP/k47LZykcu9pFs/bdSXLvkt8cglNIFYw==; 24:x54Vb0nDErl6dfUQWkqT0ym0QpfSvOkwCXPdBgXg5ARijtH09OWLoywsL8gW7uAhRX2yccyjfYZJjzyGjKNtx/pQj/M+ZJvZDAAAAcGGI+w=; 7:/LScaEv5GZN8rmkxRdhpHI7BoWqO3SJNa5E0VUrOa2Uzm8QSqBpufQjb3xlo1VDsUiQ602nVb034oDS87hH2lpsRhFFL3U6Za1dYL6F1sjWlFYUNpDkHqtppn50Us9V5EEGm6A7V6vRI6Csr2zIMa7mI+EL5PburX3wDewSx+5CT5M3uZOGlMtO8XUkTqHBsLNkufwP/FnnQqVNi3mxPbQMbjeKe9eyYsMrAfRAwDRI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1415; 20:/FuxfC63a9vu9mRliQzWXZ32zutZy3NDBcHgSP01YyxcLHZh3BKqfEriGb27NpN24nqdQhYSbMUmlX6egTeGLTXlsMIRbb4GKngZGNg2lafUeFBIuWdV1/7cZebtrgVakgtUnfT7+8bVEUsxfsTGsKKcroj8uw+JJhKSoTFJBoZzxbh0u/0OnIVFhKmJG6qMvQhbj89cRZ8HGfXYl/WyOdNidLm3c6cUY57P1stsqpCmq4Z5ojMVdxkJQocoWeUp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2017 15:21:30.3979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1415 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;