From fb953b4366d5e555f7a82e6da10bbbab1fc6b896 Mon Sep 17 00:00:00 2001 From: Aryan Salmanpour Date: Tue, 16 Jan 2024 14:49:54 -0500 Subject: [PATCH] Add support to correctly detect the gfx name for gfx940/gfx941/gfx942 (#178) --- src/rocdecode/vaapi/vaapi_videodecoder.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rocdecode/vaapi/vaapi_videodecoder.cpp b/src/rocdecode/vaapi/vaapi_videodecoder.cpp index 1a43e082d0..bbcd88b682 100644 --- a/src/rocdecode/vaapi/vaapi_videodecoder.cpp +++ b/src/rocdecode/vaapi/vaapi_videodecoder.cpp @@ -68,10 +68,14 @@ rocDecStatus VaapiVideoDecoder::InitializeDecoder(std::string gcn_arch_name) { ERR("ERROR: the codec config combination is not supported!"); return ROCDEC_NOT_SUPPORTED; } + + std::size_t pos = gcn_arch_name.find_first_of(":"); + std::string gcn_arch_name_base = (pos != std::string::npos) ? gcn_arch_name.substr(0, pos) : gcn_arch_name; + // There are 8 renderDXXX per physical device on gfx940/gfx941/gfx942 - int num_render_cards_per_device = ((gcn_arch_name.compare("gfx940") == 0) || - (gcn_arch_name.compare("gfx941") == 0) || - (gcn_arch_name.compare("gfx942") == 0)) ? 8 : 1; + int num_render_cards_per_device = ((gcn_arch_name_base.compare("gfx940") == 0) || + (gcn_arch_name_base.compare("gfx941") == 0) || + (gcn_arch_name_base.compare("gfx942") == 0)) ? 8 : 1; std::string drm_node = "/dev/dri/renderD" + std::to_string(128 + decoder_create_info_.deviceid * num_render_cards_per_device); rocdec_status = InitVAAPI(drm_node); if (rocdec_status != ROCDEC_SUCCESS) {