Module: Mesa Branch: main Commit: 4ff1b0f7516587c555abcade330150c3466bbb47 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ff1b0f7516587c555abcade330150c3466bbb47
Author: Lionel Landwerlin <[email protected]> Date: Tue Dec 5 13:29:48 2023 +0200 anv/video: only report matching memory types for protected sessions Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 794b0496e9 ("anv: enable protected memory") Reviewed-by: José Roberto de Souza <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26519> --- src/intel/vulkan/anv_video.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_video.c b/src/intel/vulkan/anv_video.c index faf55e3f857..401aeb28115 100644 --- a/src/intel/vulkan/anv_video.c +++ b/src/intel/vulkan/anv_video.c @@ -371,7 +371,19 @@ anv_GetVideoSessionMemoryRequirementsKHR(VkDevice _device, ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_video_session, vid, videoSession); - uint32_t memory_types = (1ull << device->physical->memory.type_count) - 1; + uint32_t memory_types = 0; + for (uint32_t i = 0; i < device->physical->memory.type_count; i++) { + /* Have the protected buffer bit match only the memory types with the + * equivalent bit. + */ + if (!!(vid->vk.flags & VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR) != + !!(device->physical->memory.types[i].propertyFlags & + VK_MEMORY_PROPERTY_PROTECTED_BIT)) + continue; + + memory_types |= 1ull << i; + } + switch (vid->vk.op) { case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR: get_h264_video_session_mem_reqs(vid,
