From 4ff1b0f7516587c555abcade330150c3466bbb47 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 5 Dec 2023 13:29:48 +0200 Subject: [PATCH] anv/video: only report matching memory types for protected sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Fixes: 794b0496e9 ("anv: enable protected memory") Reviewed-by: José Roberto de Souza Part-of: --- 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,