hasvk/image: allocate some memory for mv storage after video images.

these images need motion vector storage allocated with them
This commit is contained in:
Dave Airlie authored and elwrcl committed 2026-07-21 15:18:38 +03:00
1 parent f75fb64c41
commit 4d12fc3ec6
2 files changed
+38

No files matched your search

+33
View File
@@ -685,6 +685,30 @@ add_shadow_surface(struct anv_device *device,
ANV_OFFSET_IMPLICIT); ANV_OFFSET_IMPLICIT);
} }
static VkResult
add_video_buffers(struct anv_device *device,
struct anv_image *image,
const struct VkVideoProfileListInfoKHR *profile_list)
{
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) {
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;
}
}
if (size == 0)
return VK_SUCCESS;
ok = image_binding_grow(device, image, ANV_IMAGE_MEMORY_BINDING_PRIVATE,
ANV_OFFSET_IMPLICIT, size, 65536, &image->vid_dmv_top_surface);
return ok;
}
/** /**
* Initialize the anv_image::*_surface selected by \a aspect. Then update the * Initialize the anv_image::*_surface selected by \a aspect. Then update the
* image's memory requirements (that is, the image's size and alignment). * image's memory requirements (that is, the image's size and alignment).
@@ -1251,6 +1275,15 @@ anv_image_init(struct anv_device *device, struct anv_image *image,
if (r != VK_SUCCESS) if (r != VK_SUCCESS)
goto fail; goto fail;
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);
if (r != VK_SUCCESS)
goto fail;
}
r = alloc_private_binding(device, image, pCreateInfo); r = alloc_private_binding(device, image, pCreateInfo);
if (r != VK_SUCCESS) if (r != VK_SUCCESS)
goto fail; goto fail;
+5
View File
@@ -3274,6 +3274,8 @@ struct anv_image {
*/ */
bool can_non_zero_fast_clear; bool can_non_zero_fast_clear;
} planes[3]; } planes[3];
struct anv_image_memory_range vid_dmv_top_surface;
}; };
static inline bool static inline bool
@@ -3698,6 +3700,9 @@ static inline uint32_t khr_perf_query_preamble_offset(const struct anv_query_poo
return pool->pass_size * pass + 8; return pool->pass_size * pass + 8;
} }
#define ANV_MB_WIDTH 16
#define ANV_MB_HEIGHT 16
void void
anv_dump_pipe_bits(enum anv_pipe_bits bits); anv_dump_pipe_bits(enum anv_pipe_bits bits);