mirror of
https://github.com/elwrcl/intel-hard-graphics.git
synced 2026-10-31 19:08:03 +03:00
hasvk: Add host_image_copy, H.264 encode and a batch of gen7 fixes.
Squashed work that had been sitting in the working tree. Grouped by area: Extensions VK_EXT_host_image_copy, with a MEMCPY_BIT path that reads and writes the image's own tiled layout, VkSubresourceHostMemcpySizeEXT filled in, and VkHostImageCopyDevicePerformanceQueryEXT answered. Depth/stencil and non-power-of-two bpb stay NotSupported. VK_EXT_pipeline_robustness, VK_KHR_shader_float_controls2, VK_KHR_shader_subgroup_rotate, VK_EXT_vertex_input_dynamic_state, VK_EXT_conditional_rendering (an MI_PREDICATE path for gen7, which has no GPRs), custom_border_color, border_color_swizzle, map_memory2, load_store_op_none, depth_clamp_zero_one, dynamic_rendering_unused_attachments, index_type_uint8, line_rasterization, vertex_attribute_divisor, mutable_descriptor_type. H.264 encode MFC command emission and a bitstream writer, driving intra-only encode through the video queue. Video profile reporting was also corrected from 270 combinations down to the 11 that actually exist. Correctness gfx7 routes typed surface writes through the render cache, so VK_ACCESS_SHADER_WRITE barriers have to flush it -- without that, nothing a fragment shader stored was visible. nir_opt_algebraic's fadd->flrp fusion rules dropped signed zero; '~' only excludes nir_fp_exact, not preserve_signed_zero, so reflect() with a -0 input came out wrong. Guarded with (nsz). Stop advertising STORAGE_READ_WITHOUT_FORMAT: shaderStorageImageReadWithout- Format is false here, and since Vulkan 1.3 the per-format bit is what grants permission, so reporting it while rejecting the pipeline is a contradiction. gfx7's typed data port ignores SURFTYPE_NULL -- the null surface still has one addressable texel, which read and wrote graphics address zero. Bounds check typed image access against the image param when nullDescriptor is enabled, the same trick lower_image_atomic_instr already used on IVB. Formats that require a sampler Y'CbCr conversion no longer report BLIT_SRC/BLIT_DST/STORAGE_IMAGE. Video decode does not need them. Check the surface state allocations in emit_binding_table() and in the push descriptor path instead of writing through a NULL map in release builds. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
28 files changed
+2666
-327
No files matched your search
@@ -28,6 +28,7 @@
|
||||
#include "vk_common_entrypoints.h"
|
||||
#include "vk_video/vulkan_video_codecs_common.h"
|
||||
#include "vk_video/vulkan_video_codec_h264std.h"
|
||||
#include "vk_video/vulkan_video_codec_h264std_encode.h"
|
||||
|
||||
VkResult
|
||||
anv_CreateVideoSessionKHR(VkDevice _device,
|
||||
@@ -114,25 +115,59 @@ anv_GetPhysicalDeviceVideoCapabilitiesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkVideoCapabilitiesKHR
|
||||
*pCapabilities)
|
||||
{
|
||||
if (pVideoProfile->videoCodecOperation != VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR) {
|
||||
const bool is_encode =
|
||||
pVideoProfile->videoCodecOperation == VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR;
|
||||
|
||||
if (pVideoProfile->videoCodecOperation != VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR &&
|
||||
!is_encode) {
|
||||
return VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR;
|
||||
}
|
||||
|
||||
const VkVideoDecodeH264ProfileInfoKHR *h264_profile =
|
||||
vk_find_struct_const(pVideoProfile->pNext, VIDEO_DECODE_H264_PROFILE_INFO_KHR);
|
||||
if (h264_profile) {
|
||||
switch (h264_profile->stdProfileIdc) {
|
||||
case STD_VIDEO_H264_PROFILE_IDC_BASELINE:
|
||||
case STD_VIDEO_H264_PROFILE_IDC_MAIN:
|
||||
case STD_VIDEO_H264_PROFILE_IDC_HIGH:
|
||||
break;
|
||||
default:
|
||||
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
|
||||
if (pVideoProfile->chromaSubsampling != VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR ||
|
||||
pVideoProfile->lumaBitDepth != VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR ||
|
||||
pVideoProfile->chromaBitDepth != VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR)
|
||||
return VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR;
|
||||
|
||||
if (!is_encode) {
|
||||
const VkVideoDecodeH264ProfileInfoKHR *h264_profile =
|
||||
vk_find_struct_const(pVideoProfile->pNext, VIDEO_DECODE_H264_PROFILE_INFO_KHR);
|
||||
if (h264_profile) {
|
||||
switch (h264_profile->stdProfileIdc) {
|
||||
case STD_VIDEO_H264_PROFILE_IDC_BASELINE:
|
||||
case STD_VIDEO_H264_PROFILE_IDC_MAIN:
|
||||
case STD_VIDEO_H264_PROFILE_IDC_HIGH:
|
||||
break;
|
||||
default:
|
||||
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Baseline and Main are supported. Main is accepted so that CABAC
|
||||
* (entropy_coding_mode_flag == 1, forbidden in Baseline) can be selected;
|
||||
* the PAK performs the entropy coding. Main's inter-prediction features
|
||||
* (B slices) are still not emitted — only I frames are produced. High is
|
||||
* rejected (8x8 transform / scaling lists not emitted). */
|
||||
const VkVideoEncodeH264ProfileInfoKHR *h264_profile =
|
||||
vk_find_struct_const(pVideoProfile->pNext, VIDEO_ENCODE_H264_PROFILE_INFO_KHR);
|
||||
if (h264_profile) {
|
||||
switch (h264_profile->stdProfileIdc) {
|
||||
case STD_VIDEO_H264_PROFILE_IDC_BASELINE:
|
||||
case STD_VIDEO_H264_PROFILE_IDC_MAIN:
|
||||
break;
|
||||
default:
|
||||
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pCapabilities->minBitstreamBufferOffsetAlignment = 32;
|
||||
pCapabilities->minBitstreamBufferSizeAlignment = 32;
|
||||
if (is_encode) {
|
||||
pCapabilities->minBitstreamBufferOffsetAlignment = 4096;
|
||||
pCapabilities->minBitstreamBufferSizeAlignment = 4096;
|
||||
} else {
|
||||
pCapabilities->minBitstreamBufferOffsetAlignment = 32;
|
||||
pCapabilities->minBitstreamBufferSizeAlignment = 32;
|
||||
}
|
||||
|
||||
pCapabilities->pictureAccessGranularity.width = ANV_MB_WIDTH;
|
||||
pCapabilities->pictureAccessGranularity.height = ANV_MB_HEIGHT;
|
||||
pCapabilities->minCodedExtent.width = ANV_MB_WIDTH;
|
||||
@@ -142,29 +177,87 @@ anv_GetPhysicalDeviceVideoCapabilitiesKHR(VkPhysicalDevice physicalDevice,
|
||||
pCapabilities->flags =
|
||||
VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR;
|
||||
|
||||
struct VkVideoDecodeCapabilitiesKHR *dec_caps =
|
||||
(struct VkVideoDecodeCapabilitiesKHR *)
|
||||
vk_find_struct(pCapabilities->pNext, VIDEO_DECODE_CAPABILITIES_KHR);
|
||||
if (dec_caps)
|
||||
dec_caps->flags =
|
||||
VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR;
|
||||
if (!is_encode) {
|
||||
struct VkVideoDecodeCapabilitiesKHR *dec_caps =
|
||||
(struct VkVideoDecodeCapabilitiesKHR *)
|
||||
vk_find_struct(pCapabilities->pNext, VIDEO_DECODE_CAPABILITIES_KHR);
|
||||
if (dec_caps)
|
||||
dec_caps->flags =
|
||||
VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR;
|
||||
|
||||
struct VkVideoDecodeH264CapabilitiesKHR *ext =
|
||||
(struct VkVideoDecodeH264CapabilitiesKHR *)
|
||||
vk_find_struct(pCapabilities->pNext,
|
||||
VIDEO_DECODE_H264_CAPABILITIES_KHR);
|
||||
pCapabilities->maxDpbSlots = 16;
|
||||
pCapabilities->maxActiveReferencePictures = 16;
|
||||
struct VkVideoDecodeH264CapabilitiesKHR *ext =
|
||||
(struct VkVideoDecodeH264CapabilitiesKHR *)
|
||||
vk_find_struct(pCapabilities->pNext,
|
||||
VIDEO_DECODE_H264_CAPABILITIES_KHR);
|
||||
pCapabilities->maxDpbSlots = 16;
|
||||
pCapabilities->maxActiveReferencePictures = 16;
|
||||
|
||||
if (ext) {
|
||||
ext->fieldOffsetGranularity.x = 0;
|
||||
ext->fieldOffsetGranularity.y = 0;
|
||||
ext->maxLevelIdc = 51;
|
||||
if (ext) {
|
||||
ext->fieldOffsetGranularity.x = 0;
|
||||
ext->fieldOffsetGranularity.y = 0;
|
||||
ext->maxLevelIdc = 51;
|
||||
}
|
||||
strcpy(pCapabilities->stdHeaderVersion.extensionName,
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME);
|
||||
pCapabilities->stdHeaderVersion.specVersion =
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION;
|
||||
} else {
|
||||
/* Limits reflecting what the encoder emits: I and P frames, CQP, single
|
||||
* reference. P frames use one reference (the previous reconstructed
|
||||
* frame) plus the current setup slot, so two DPB slots and one active
|
||||
* reference. B frames and multi-reference are not implemented. */
|
||||
pCapabilities->maxDpbSlots = 2;
|
||||
pCapabilities->maxActiveReferencePictures = 1;
|
||||
|
||||
struct VkVideoEncodeCapabilitiesKHR *enc_caps =
|
||||
(struct VkVideoEncodeCapabilitiesKHR *)
|
||||
vk_find_struct(pCapabilities->pNext, VIDEO_ENCODE_CAPABILITIES_KHR);
|
||||
if (enc_caps) {
|
||||
enc_caps->flags = 0;
|
||||
/* Constant QP only; no CBR/VBR rate control. */
|
||||
enc_caps->rateControlModes =
|
||||
VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR;
|
||||
enc_caps->maxRateControlLayers = 1;
|
||||
enc_caps->maxBitrate = 0;
|
||||
enc_caps->maxQualityLevels = 1;
|
||||
enc_caps->encodeInputPictureGranularity.width = ANV_MB_WIDTH;
|
||||
enc_caps->encodeInputPictureGranularity.height = ANV_MB_HEIGHT;
|
||||
/* Both flags are required by the ffmpeg h264_vulkan encoder. Note
|
||||
* that bytes-written currently reports the full dstBufferRange rather
|
||||
* than the real encoded size; reading back the MFC bit counter is not
|
||||
* yet implemented. */
|
||||
enc_caps->supportedEncodeFeedbackFlags =
|
||||
VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR |
|
||||
VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR;
|
||||
}
|
||||
|
||||
struct VkVideoEncodeH264CapabilitiesKHR *h264_enc_ext =
|
||||
(struct VkVideoEncodeH264CapabilitiesKHR *)
|
||||
vk_find_struct(pCapabilities->pNext, VIDEO_ENCODE_H264_CAPABILITIES_KHR);
|
||||
if (h264_enc_ext) {
|
||||
h264_enc_ext->flags =
|
||||
VK_VIDEO_ENCODE_H264_CAPABILITY_PER_SLICE_CONSTANT_QP_BIT_KHR;
|
||||
h264_enc_ext->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_4_1;
|
||||
/* One slice per MB row at most (matches the encoder's row-granular
|
||||
* slice splitting). */
|
||||
h264_enc_ext->maxSliceCount = 68; /* 1088/16, covers up to 1080p */
|
||||
h264_enc_ext->maxPPictureL0ReferenceCount = 1;
|
||||
h264_enc_ext->maxBPictureL0ReferenceCount = 0;
|
||||
h264_enc_ext->maxL1ReferenceCount = 0;
|
||||
h264_enc_ext->maxTemporalLayerCount = 1;
|
||||
h264_enc_ext->expectDyadicTemporalLayerPattern = VK_FALSE;
|
||||
h264_enc_ext->minQp = 0;
|
||||
h264_enc_ext->maxQp = 51;
|
||||
h264_enc_ext->prefersGopRemainingFrames = VK_FALSE;
|
||||
h264_enc_ext->requiresGopRemainingFrames = VK_FALSE;
|
||||
h264_enc_ext->stdSyntaxFlags = 0;
|
||||
}
|
||||
|
||||
strcpy(pCapabilities->stdHeaderVersion.extensionName,
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME);
|
||||
pCapabilities->stdHeaderVersion.specVersion =
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION;
|
||||
}
|
||||
strcpy(pCapabilities->stdHeaderVersion.extensionName,
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME);
|
||||
pCapabilities->stdHeaderVersion.specVersion =
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -224,6 +317,8 @@ get_h264_video_mem_size(struct anv_video_session *vid, uint32_t mem_idx)
|
||||
{
|
||||
uint32_t width_in_mb =
|
||||
align(vid->vk.max_coded.width, ANV_MB_WIDTH) / ANV_MB_WIDTH;
|
||||
uint32_t height_in_mb =
|
||||
align(vid->vk.max_coded.height, ANV_MB_HEIGHT) / ANV_MB_HEIGHT;
|
||||
|
||||
switch (mem_idx) {
|
||||
case ANV_VID_MEM_H264_INTRA_ROW_STORE:
|
||||
@@ -238,6 +333,15 @@ get_h264_video_mem_size(struct anv_video_session *vid, uint32_t mem_idx)
|
||||
case ANV_VID_MEM_H264_MPR_ROW_SCRATCH:
|
||||
/* mpr row scratch is width in macroblocks * 64 * 2 */
|
||||
return width_in_mb * 64 * 2;
|
||||
/* Encode scratch buffer sizes, matching gen6_mfc_init (VA-API). */
|
||||
case ANV_VID_MEM_H264_ENC_MB_STATUS:
|
||||
return width_in_mb * height_in_mb * 16;
|
||||
case ANV_VID_MEM_H264_ENC_DIRECT_MV_TOP:
|
||||
case ANV_VID_MEM_H264_ENC_DIRECT_MV_BOTTOM:
|
||||
return 68ull * width_in_mb * height_in_mb;
|
||||
case ANV_VID_MEM_H264_ENC_INPUT_MV:
|
||||
/* 16 4x4 motion-vector pairs (32MV) per MB, 4 bytes each = 64 bytes. */
|
||||
return 64ull * width_in_mb * height_in_mb;
|
||||
default:
|
||||
UNREACHABLE("unknown memory");
|
||||
}
|
||||
@@ -247,21 +351,32 @@ static void
|
||||
get_h264_video_session_mem_reqs(struct anv_video_session *vid,
|
||||
VkVideoSessionMemoryRequirementsKHR *mem_reqs,
|
||||
uint32_t *pVideoSessionMemoryRequirementsCount,
|
||||
uint32_t memory_types)
|
||||
uint32_t memory_types,
|
||||
uint32_t first_mem_idx,
|
||||
uint32_t count)
|
||||
{
|
||||
VK_OUTARRAY_MAKE_TYPED(VkVideoSessionMemoryRequirementsKHR,
|
||||
out,
|
||||
mem_reqs,
|
||||
pVideoSessionMemoryRequirementsCount);
|
||||
|
||||
for (unsigned i = 0; i < ANV_VID_MEM_H264_MAX; i++) {
|
||||
uint32_t bind_index = ANV_VID_MEM_H264_INTRA_ROW_STORE + i;
|
||||
uint64_t size = get_h264_video_mem_size(vid, i);
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
uint32_t bind_index = first_mem_idx + i;
|
||||
uint64_t size = get_h264_video_mem_size(vid, bind_index);
|
||||
|
||||
/* The row-store and direct-MV scratch buffers reach the hardware through
|
||||
* MFX_PIPE_BUF_ADDR_STATE / MFX_BSP_BUF_BASE_ADDR_STATE, whose address
|
||||
* fields are bits 31:6, so 64 bytes is enough. The encode input-MV buffer
|
||||
* instead feeds MFX_IND_OBJ_BASE_ADDR_STATE, which stores addresses in
|
||||
* bits 31:12; a base that is not 4KiB aligned would be truncated and the
|
||||
* MFC would fetch its per-MB motion vectors from the wrong address. */
|
||||
uint64_t alignment = bind_index == ANV_VID_MEM_H264_ENC_INPUT_MV ?
|
||||
4096 : 64;
|
||||
|
||||
vk_outarray_append_typed(VkVideoSessionMemoryRequirementsKHR, &out, p) {
|
||||
p->memoryBindIndex = bind_index;
|
||||
p->memoryRequirements.size = size;
|
||||
p->memoryRequirements.alignment = 64;
|
||||
p->memoryRequirements.alignment = alignment;
|
||||
p->memoryRequirements.memoryTypeBits = memory_types;
|
||||
}
|
||||
}
|
||||
@@ -283,7 +398,24 @@ anv_GetVideoSessionMemoryRequirementsKHR(VkDevice _device,
|
||||
case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR:
|
||||
get_h264_video_session_mem_reqs(vid, mem_reqs,
|
||||
pVideoSessionMemoryRequirementsCount,
|
||||
memory_types);
|
||||
memory_types,
|
||||
ANV_VID_MEM_H264_INTRA_ROW_STORE,
|
||||
ANV_VID_MEM_H264_MPR_ROW_SCRATCH -
|
||||
ANV_VID_MEM_H264_INTRA_ROW_STORE + 1);
|
||||
break;
|
||||
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR:
|
||||
/* A single call over the whole contiguous enum range.
|
||||
* VK_OUTARRAY_MAKE_TYPED resets *count to 0 and writes from index 0 on
|
||||
* every call, so two separate calls would make the second clobber the
|
||||
* first, leaving some scratch buffers unbound. MPR_ROW_SCRATCH falls in
|
||||
* the range and is included even though encode does not use it (a small
|
||||
* unused allocation). */
|
||||
get_h264_video_session_mem_reqs(vid, mem_reqs,
|
||||
pVideoSessionMemoryRequirementsCount,
|
||||
memory_types,
|
||||
ANV_VID_MEM_H264_INTRA_ROW_STORE,
|
||||
ANV_VID_MEM_H264_ENC_INPUT_MV -
|
||||
ANV_VID_MEM_H264_INTRA_ROW_STORE + 1);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("unknown codec");
|
||||
@@ -303,6 +435,87 @@ anv_UpdateVideoSessionParametersKHR(VkDevice _device,
|
||||
return vk_video_session_parameters_update(¶ms->vk, pUpdateInfo);
|
||||
}
|
||||
|
||||
/* Required entry point for VK_KHR_video_encode_queue. Emits the SPS/PPS RBSP
|
||||
* (start code and NAL header included) using the common
|
||||
* vk_video_encode_h264_sps/pps() helpers; the H.264-only reduction of the
|
||||
* mainline anv implementation. */
|
||||
VkResult
|
||||
anv_GetEncodedVideoSessionParametersKHR(VkDevice _device,
|
||||
const VkVideoEncodeSessionParametersGetInfoKHR *pVideoSessionParametersInfo,
|
||||
VkVideoEncodeSessionParametersFeedbackInfoKHR *pFeedbackInfo,
|
||||
size_t *pDataSize,
|
||||
void *pData)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_video_session_params, params,
|
||||
pVideoSessionParametersInfo->videoSessionParameters);
|
||||
size_t total_size = 0;
|
||||
size_t size_limit = pData ? *pDataSize : 0;
|
||||
|
||||
if (params->vk.op == VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR) {
|
||||
const struct VkVideoEncodeH264SessionParametersGetInfoKHR *h264_get_info =
|
||||
vk_find_struct_const(pVideoSessionParametersInfo->pNext,
|
||||
VIDEO_ENCODE_H264_SESSION_PARAMETERS_GET_INFO_KHR);
|
||||
size_t sps_size = 0, pps_size = 0;
|
||||
if (h264_get_info->writeStdSPS) {
|
||||
for (unsigned i = 0; i < params->vk.h264_enc.h264_sps_count; i++)
|
||||
if (params->vk.h264_enc.h264_sps[i].base.seq_parameter_set_id == h264_get_info->stdSPSId)
|
||||
vk_video_encode_h264_sps(¶ms->vk.h264_enc.h264_sps[i].base,
|
||||
size_limit, &sps_size, pData);
|
||||
}
|
||||
if (h264_get_info->writeStdPPS) {
|
||||
char *data_ptr = pData ? (char *)pData + sps_size : NULL;
|
||||
for (unsigned i = 0; i < params->vk.h264_enc.h264_pps_count; i++)
|
||||
if (params->vk.h264_enc.h264_pps[i].base.pic_parameter_set_id == h264_get_info->stdPPSId)
|
||||
vk_video_encode_h264_pps(¶ms->vk.h264_enc.h264_pps[i].base,
|
||||
params->vk.h264_enc.profile_idc == STD_VIDEO_H264_PROFILE_IDC_HIGH,
|
||||
size_limit, &pps_size, data_ptr);
|
||||
}
|
||||
total_size = sps_size + pps_size;
|
||||
}
|
||||
|
||||
/* The size check is done here against *pDataSize (mainline anv pattern). */
|
||||
if (pData && *pDataSize < total_size) {
|
||||
*pDataSize = 0;
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
*pDataSize = total_size;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* Required entry point for VK_KHR_video_encode_queue; the H.264-only reduction
|
||||
* of the mainline anv implementation. The reported values are preferred
|
||||
* defaults and do not constrain what the application may request. */
|
||||
VkResult
|
||||
anv_GetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR *pQualityLevelInfo,
|
||||
VkVideoEncodeQualityLevelPropertiesKHR *pQualityLevelProperties)
|
||||
{
|
||||
const VkVideoProfileInfoKHR *profile = pQualityLevelInfo->pVideoProfile;
|
||||
|
||||
pQualityLevelProperties->preferredRateControlMode = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR;
|
||||
|
||||
switch (profile->videoCodecOperation) {
|
||||
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR: {
|
||||
VkVideoEncodeH264QualityLevelPropertiesKHR *ext =
|
||||
vk_find_struct(pQualityLevelProperties->pNext, VIDEO_ENCODE_H264_QUALITY_LEVEL_PROPERTIES_KHR);
|
||||
if (ext) {
|
||||
ext->preferredIdrPeriod = 60;
|
||||
ext->preferredGopFrameCount = 60;
|
||||
ext->preferredConstantQp = (VkVideoEncodeH264QpKHR) { 26, 26, 26 };
|
||||
ext->preferredMaxL0ReferenceCount = 0; /* no references */
|
||||
ext->preferredMaxL1ReferenceCount = 0;
|
||||
ext->preferredStdEntropyCodingModeFlag = false; /* Baseline: CAVLC */
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
copy_bind(struct anv_vid_mem *dst, const VkBindVideoSessionMemoryInfoKHR *src)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user