anv/query: consider codec when querying the encoding status.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27810>
This commit is contained in:
Hyunjun Ko 2024-03-05 15:59:57 +09:00 committed by Marge Bot
parent 22abbb84b7
commit 3bd46afac1
2 changed files with 23 additions and 3 deletions

View file

@ -6044,6 +6044,9 @@ struct anv_query_pool {
struct intel_perf_counter_pass *counter_pass;
uint32_t n_passes;
struct intel_perf_query_info **pass_query;
/* Video encoding queries */
VkVideoCodecOperationFlagsKHR codec;
};
static inline uint32_t khr_perf_query_preamble_offset(const struct anv_query_pool *pool,

View file

@ -226,6 +226,11 @@ VkResult genX(CreateQueryPool)(
perf_query_info->pCounterIndices,
perf_query_info->counterIndexCount,
pool->pass_query);
} else if (pool->vk.query_type == VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR) {
const VkVideoProfileInfoKHR* pVideoProfile = vk_find_struct_const(pCreateInfo->pNext, VIDEO_PROFILE_INFO_KHR);
assert (pVideoProfile);
pool->codec = pVideoProfile->videoCodecOperation;
}
uint64_t size = pool->vk.query_count * (uint64_t)pool->stride;
@ -1465,15 +1470,27 @@ void genX(CmdEndQueryIndexedEXT)(
#if GFX_VER < 11
#define MFC_BITSTREAM_BYTECOUNT_FRAME_REG 0x128A0
#define HCP_BITSTREAM_BYTECOUNT_FRAME_REG 0x1E9A0
#elif GFX_VER >= 11
#define MFC_BITSTREAM_BYTECOUNT_FRAME_REG 0x1C08A0
#define HCP_BITSTREAM_BYTECOUNT_FRAME_REG 0x1C28A0
#endif
case VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR:
mi_store(&b, mi_mem64(anv_address_add(query_addr, 8)), mi_reg32(MFC_BITSTREAM_BYTECOUNT_FRAME_REG));
case VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR: {
uint32_t reg_addr;
if (pool->codec & VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR) {
reg_addr = MFC_BITSTREAM_BYTECOUNT_FRAME_REG;
} else if (pool->codec & VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR) {
reg_addr = HCP_BITSTREAM_BYTECOUNT_FRAME_REG;
} else {
unreachable("Invalid codec operation");
}
mi_store(&b, mi_mem64(anv_address_add(query_addr, 8)), mi_reg32(reg_addr));
emit_query_mi_availability(&b, query_addr, true);
break;
}
default:
unreachable("");
}