mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-24 06:00:22 +01:00
anv: support VK_IMAGE_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR
Signed-off-by: Hyunjun Ko <zzoon@igalia.com> Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31436>
This commit is contained in:
parent
0981d20850
commit
ac2fd8ae66
1 changed files with 26 additions and 15 deletions
|
|
@ -895,23 +895,30 @@ add_aux_surface_if_supported(struct anv_device *device,
|
|||
static VkResult
|
||||
add_video_buffers(struct anv_device *device,
|
||||
struct anv_image *image,
|
||||
const struct VkVideoProfileListInfoKHR *profile_list)
|
||||
const struct VkVideoProfileListInfoKHR *profile_list,
|
||||
bool independent_profile)
|
||||
{
|
||||
ASSERTED bool ok;
|
||||
unsigned size = 0;
|
||||
|
||||
for (unsigned i = 0; i < profile_list->profileCount; i++) {
|
||||
if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR ||
|
||||
profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR) {
|
||||
unsigned w_mb = DIV_ROUND_UP(image->vk.extent.width, ANV_MB_WIDTH);
|
||||
unsigned h_mb = DIV_ROUND_UP(image->vk.extent.height, ANV_MB_HEIGHT);
|
||||
size = w_mb * h_mb * 128;
|
||||
}
|
||||
else if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR ||
|
||||
profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR) {
|
||||
unsigned w_mb = DIV_ROUND_UP(image->vk.extent.width, 32);
|
||||
unsigned h_mb = DIV_ROUND_UP(image->vk.extent.height, 32);
|
||||
size = ALIGN(w_mb * h_mb, 2) << 6;
|
||||
if (independent_profile) {
|
||||
/* Takes the worst case */
|
||||
unsigned w_mb = DIV_ROUND_UP(image->vk.extent.width, ANV_MB_WIDTH);
|
||||
unsigned h_mb = DIV_ROUND_UP(image->vk.extent.height, ANV_MB_HEIGHT);
|
||||
size = w_mb * h_mb * 128;
|
||||
} else {
|
||||
for (unsigned i = 0; i < profile_list->profileCount; i++) {
|
||||
if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR ||
|
||||
profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR) {
|
||||
unsigned w_mb = DIV_ROUND_UP(image->vk.extent.width, ANV_MB_WIDTH);
|
||||
unsigned h_mb = DIV_ROUND_UP(image->vk.extent.height, ANV_MB_HEIGHT);
|
||||
size = w_mb * h_mb * 128;
|
||||
} else if (profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR ||
|
||||
profile_list->pProfiles[i].videoCodecOperation == VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR) {
|
||||
unsigned w_mb = DIV_ROUND_UP(image->vk.extent.width, 32);
|
||||
unsigned h_mb = DIV_ROUND_UP(image->vk.extent.height, 32);
|
||||
size = ALIGN(w_mb * h_mb, 2) << 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1781,8 +1788,12 @@ anv_image_init(struct anv_device *device, struct anv_image *image,
|
|||
const VkVideoProfileListInfoKHR *video_profile =
|
||||
vk_find_struct_const(pCreateInfo->pNext,
|
||||
VIDEO_PROFILE_LIST_INFO_KHR);
|
||||
if (video_profile) {
|
||||
r = add_video_buffers(device, image, video_profile);
|
||||
|
||||
bool independent_video_profile =
|
||||
pCreateInfo->flags & VK_IMAGE_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR;
|
||||
|
||||
if (video_profile || independent_video_profile) {
|
||||
r = add_video_buffers(device, image, video_profile, independent_video_profile);
|
||||
if (r != VK_SUCCESS)
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue