Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video encode: support more DPB image formats and usage limitations #489

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions external/vulkancts/modules/vulkan/video/vktVideoEncodeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ class VideoEncodeTestInstance : public VideoBaseTestInstance

VkFormat checkImageFormat(VkImageUsageFlags flags, const VkVideoProfileListInfoKHR *videoProfileList,
const VkFormat requiredFormat);
VkFormat getFirstSupportedImageFormat(VkImageUsageFlags flags, const VkVideoProfileListInfoKHR *videoProfileList);

bool checkQueryResultSupport(void);

Expand Down Expand Up @@ -1388,6 +1389,19 @@ VkFormat VideoEncodeTestInstance::checkImageFormat(VkImageUsageFlags flags,
TCU_THROW(NotSupportedError, "Failed to find required picture format");
}

VkFormat VideoEncodeTestInstance::getFirstSupportedImageFormat(VkImageUsageFlags flags,
const VkVideoProfileListInfoKHR *videoProfileList)
{
const InstanceInterface &vki = m_context.getInstanceInterface();
const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
MovePtr<vector<VkFormat>> supportedFormats = getSupportedFormats(vki, physicalDevice, flags, videoProfileList);

if (!supportedFormats || supportedFormats->empty())
TCU_THROW(NotSupportedError, "No supported picture formats");

return supportedFormats->front();
}

bool VideoEncodeTestInstance::checkQueryResultSupport(void)
{
uint32_t count = 0;
Expand Down Expand Up @@ -1500,8 +1514,8 @@ tcu::TestStatus VideoEncodeTestInstance::iterate(void)

const VkFormat imageFormat = checkImageFormat(VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR, videoEncodeProfileList.get(),
VK_FORMAT_G8_B8R8_2PLANE_420_UNORM);
const VkFormat dpbImageFormat = checkImageFormat(VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR,
videoEncodeProfileList.get(), VK_FORMAT_G8_B8R8_2PLANE_420_UNORM);
const VkFormat dpbImageFormat =
getFirstSupportedImageFormat(VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR, videoEncodeProfileList.get());

const VideoDevice::VideoDeviceFlags videoDeviceFlags = m_testDefinition->requiredDeviceFlags();

Expand Down Expand Up @@ -1691,12 +1705,12 @@ tcu::TestStatus VideoEncodeTestInstance::iterate(void)
videoDeviceDriver, videoDevice, videoEncodeSessionParametersCreateInfos.back().get()));
}

const VkImageUsageFlags dpbImageUsage = VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
const VkImageUsageFlags dpbImageUsage = VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR;
// If the implementation does not support individual images for DPB and so must use arrays
const bool separateReferenceImages =
videoCapabilities.get()->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR;
const VkImageCreateInfo dpbImageCreateInfo =
makeImageCreateInfo(imageFormat, codedExtent, 0, &encodeQueueFamilyIndex, dpbImageUsage,
makeImageCreateInfo(dpbImageFormat, codedExtent, 0, &encodeQueueFamilyIndex, dpbImageUsage,
videoEncodeProfileList.get(), separateReferenceImages ? 1 : dpbSlots);
const VkImageViewType dpbImageViewType =
separateReferenceImages ? VK_IMAGE_VIEW_TYPE_2D : VK_IMAGE_VIEW_TYPE_2D_ARRAY;
Expand Down Expand Up @@ -1753,7 +1767,7 @@ tcu::TestStatus VideoEncodeTestInstance::iterate(void)

std::unique_ptr<Move<VkImageView>> dpbImageView(new Move<VkImageView>(
makeImageView(videoDeviceDriver, videoDevice, dpbImages[separateReferenceImages ? j : 0]->get(),
dpbImageViewType, imageFormat, dpbImageSubresourceRange)));
dpbImageViewType, dpbImageFormat, dpbImageSubresourceRange)));
std::unique_ptr<VkVideoPictureResourceInfoKHR> dpbPictureResource(
new VkVideoPictureResourceInfoKHR(makeVideoPictureResource(codedExtent, 0, dpbImageView->get())));

Expand Down