GPUOpen-LibrariesAndSDKs / AMF

The Advanced Media Framework (AMF) SDK provides developers with optimal access to AMD devices for multimedia processing
Other
599 stars 149 forks source link

[Bug]: None of the encoders is working on the RX 7900 XTX #369

Closed cromefire closed 1 year ago

cromefire commented 1 year ago

Describe the bug None of the available encoders on the 7900 XTX is reconized as being available.

Confirmed fixed:

To Reproduce Steps to reproduce the behavior:

  1. Build latest ffmpeg (upstream) with AMF.
  2. Try to use the encoder (h264/hevc/av1)

Setup (please complete the following information):

Debug Log (please upload or paste):

H264:

[h264_amf @ 0xd38040] AMF initialisation succeeded via Vulkan.
[h264_amf @ 0xd38040] AMFVideoCore: 0123-01-05 16:44:38 9639F800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[h264_amf @ 0xd38040] EncodeQueueVulkan: 0123-01-05 16:44:38 9639F800 [EncodeQueueVulkan]    Info: EncodeQueueServiceVulkanImpl::Initialize() new encode queue extension is not supported
[h264_amf @ 0xd38040] EncodeQueueService: 0123-01-05 16:44:38 9639F800 [EncodeQueueService] Warning: Failed to create encode queue serivce.
[h264_amf @ 0xd38040] AMFEncoderCoreBaseImpl: 0123-01-05 16:44:38 9639F800 [AMFEncoderCoreBaseImpl] Warning: Failed to initialize EncodeQueueFactory.
[h264_amf @ 0xd38040] AMFEncoderCoreBaseImpl: 0123-01-05 16:44:38 9639F800 [AMFEncoderCoreBaseImpl] Warning: Failed to create encode queue serivce.
[h264_amf @ 0xd38040] AMFEncoderCoreH264: 0123-01-05 16:44:38 9639F800 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path
[h264_amf @ 0xd38040] AMFEncoderCoreH264: 0123-01-05 16:44:38 9639F800 [AMFEncoderCoreH264] Warning: CreateServices failed.
[h264_amf @ 0xd38040] AMFEncoderCoreH264: 0123-01-05 16:44:38 9639F800 [AMFEncoderCoreH264]    Info: *****Fallback to UVE path!
[h264_amf @ 0xd38040] AMFEncoderCoreH264: 0123-01-05 16:44:38 9639F800 [AMFEncoderCoreH264]   Debug: AMFEncoderCoreH264Impl::Terminate()
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(453):InitializeCap() res: AMD Decode extension is not loaded
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ConstraintSetFlags changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param EnableVBAQ changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param EncoderMaxInstances changed to 1!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param EncoderOutputCallback changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ExtraData changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param FrameSize changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param InstanceID changed to -1!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param IntraRefreshMode changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxDecFrameBuffering changed to -1!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxMBPerSec changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxNumRefFrames changed to 4!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxOfLTRFrames changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MultiInstanceMode changed to 0!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty CABACEnable:0
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param Profile changed to 77!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ProfileLevel changed to 42!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param QualityPreset changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param QueryTimeout changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param RateControlPreanalysisEnable changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ScanType changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param UniqueInstance changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param WaitForTask changed to 0!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty Usage:0
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ConstraintSetFlags changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param EnableVBAQ changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param EncoderMaxInstances changed to 1!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param EncoderOutputCallback changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ExtraData changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param FrameSize changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param InstanceID changed to -1!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param IntraRefreshMode changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxDecFrameBuffering changed to -1!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxMBPerSec changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxNumRefFrames changed to 4!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxOfLTRFrames changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MultiInstanceMode changed to 0!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty CABACEnable:0
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param Profile changed to 77!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ProfileLevel changed to 42!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param QualityPreset changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param QueryTimeout changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param RateControlPreanalysisEnable changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ScanType changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param UniqueInstance changed to 0!
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param WaitForTask changed to 0!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty FrameSize:1920,1080
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan] Warning: SetProperty FrameSize failed in AMFPropertyStorageExImpl with return code:0x5, and will not set driver either, but return ok for now!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty FrameRate:19001,317
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty Profile:77
[h264_amf @ 0xd38040] PropertyStorageExImpl: 0123-01-05 16:44:38 9639F800 [PropertyStorageExImpl]   Error: ../../../../../public/common/PropertyStorageExImpl.h(277):AMF_ERROR 4 : AMF_INVALID_ARG: Property=Profile
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan] Warning: SetProperty Profile failed in AMFPropertyStorageExImpl with return code:0x4, and will not set driver either, but return ok for now!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty AspectRatio:1,1
[h264_amf @ 0xce5440] Rate control turned to CBR
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty RateControlPreanalysisEnable:0
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty QualityPreset:1
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param QualityPreset changed to 1!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty RateControlMethod:1
[h264_amf @ 0xd38040] PropertyStorageExImpl: 0123-01-05 16:44:38 9639F800 [PropertyStorageExImpl]   Error: ../../../../../public/common/PropertyStorageExImpl.h(277):AMF_ERROR 4 : AMF_INVALID_ARG: Property=RateControlMethod
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan] Warning: SetProperty RateControlMethod failed in AMFPropertyStorageExImpl with return code:0x4, and will not set driver either, but return ok for now!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty MaxAUSize:0
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty TargetBitrate:2000000
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan] Warning: SetProperty TargetBitrate failed in AMFPropertyStorageExImpl with return code:0x5, and will not set driver either, but return ok for now!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]    Info: SetProperty PeakBitrate:2000000
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan] Warning: SetProperty PeakBitrate failed in AMFPropertyStorageExImpl with return code:0x5, and will not set driver either, but return ok for now!
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Debug: AMFEncoderVulkanH264Impl::_Init(YUV420P, 1920, 1080)
[h264_amf @ 0xd38040] EncodeVulkanImpl: 0123-01-05 16:44:38 9639F800 [EncodeVulkanImpl]   Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanImpl.cpp(89):Assertion failed:invalid pointer : m_pVulkanDevice->GetVulkan()->vkGetPhysicalDeviceVideoEncodeCodecsAMD
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(667):AMF_ERROR 7 : AMF_INVALID_POINTER: InitVulkan() Codec is not supported by HW
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(402):AMF_ERROR 7 : AMF_INVALID_POINTER: _Init() - Failed to init H264 service
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Debug: AMFEncoderVulkanH264Impl::Terminate
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(177):AMF_ERROR 7 : AMF_INVALID_POINTER: _Init() - Failed
[h264_amf @ 0xce5440] encoder->Init() failed with error 7
[h264_amf @ 0xd38040] AMFEncoderVulkan: 0123-01-05 16:44:38 9639F800 [AMFEncoderVulkan]   Debug: AMFEncoderVulkanH264Impl::Terminate
    Last message repeated 1 times
[h264_amf @ 0xd38040] EncoderVulkanH264PropertySet: 0123-01-05 16:44:38 9639F800 [EncoderVulkanH264PropertySet]   Debug: ~EncoderVulkanH264PropertySet(): destroyed
[vost#0:0/h264_amf @ 0xd0ef00] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

HEVC:

[hevc_amf @ 0x6b57c0] AMF initialisation succeeded via Vulkan.
[hevc_amf @ 0x6b57c0] AMFVideoCore: 0123-01-05 16:47:08 634EF800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[hevc_amf @ 0x6b57c0] EncodeQueueVulkan: 0123-01-05 16:47:08 634EF800 [EncodeQueueVulkan]    Info: EncodeQueueServiceVulkanImpl::Initialize() new encode queue extension is not supported
[hevc_amf @ 0x6b57c0] EncodeQueueService: 0123-01-05 16:47:08 634EF800 [EncodeQueueService] Warning: Failed to create encode queue serivce.
[hevc_amf @ 0x6b57c0] AMFEncoderCoreBaseImpl: 0123-01-05 16:47:08 634EF800 [AMFEncoderCoreBaseImpl] Warning: Failed to initialize EncodeQueueFactory.
[hevc_amf @ 0x6b57c0] AMFEncoderCoreBaseImpl: 0123-01-05 16:47:08 634EF800 [AMFEncoderCoreBaseImpl] Warning: Failed to create encode queue serivce.
[hevc_amf @ 0x6b57c0] AMFEncoderCoreHevc: 0123-01-05 16:47:08 634EF800 [AMFEncoderCoreHevc] Warning: Encode Core dll not found, fall back to UVE path
[hevc_amf @ 0x6b57c0] AMFEncoderCoreHevc: 0123-01-05 16:47:08 634EF800 [AMFEncoderCoreHevc] Warning: CreateServices failed.
[hevc_amf @ 0x6b57c0] AMFEncoderCoreHevc: 0123-01-05 16:47:08 634EF800 [AMFEncoderCoreHevc]    Info: *****Fallback to UVE path!
[hevc_amf @ 0x6b57c0] AMFEncoderCoreHevc: 0123-01-05 16:47:08 634EF800 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::Terminate()
[hevc_amf @ 0x6720c0] CreateComponent(AMFVideoEncoderHW_HEVC) failed with error 11
[vost#0:0/hevc_amf @ 0x6aaf40] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

AV1:

[av1_amf @ 0x8bd7c0] AMF initialisation succeeded via Vulkan.
[av1_amf @ 0x8bd7c0] AMFVideoCore: 0123-01-05 16:47:53 84D89800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[av1_amf @ 0x8bd7c0] EncodeQueueVulkan: 0123-01-05 16:47:53 84D89800 [EncodeQueueVulkan]    Info: EncodeQueueServiceVulkanImpl::Initialize() new encode queue extension is not supported
[av1_amf @ 0x8bd7c0] EncodeQueueService: 0123-01-05 16:47:53 84D89800 [EncodeQueueService] Warning: Failed to create encode queue serivce.
[av1_amf @ 0x8bd7c0] AMFEncoderCoreBaseImpl: 0123-01-05 16:47:53 84D89800 [AMFEncoderCoreBaseImpl] Warning: Failed to initialize EncodeQueueFactory.
[av1_amf @ 0x8bd7c0] AMFEncoderCoreBaseImpl: 0123-01-05 16:47:53 84D89800 [AMFEncoderCoreBaseImpl] Warning: Failed to create encode queue serivce.
[av1_amf @ 0x8bd7c0] AMFEncoderCoreAv1: 0123-01-05 16:47:53 84D89800 [AMFEncoderCoreAv1] Warning: Encode Core dll not found
[av1_amf @ 0x8bd7c0] AMFEncoderCoreAv1: 0123-01-05 16:47:53 84D89800 [AMFEncoderCoreAv1] Warning: CreateServices failed.
[av1_amf @ 0x8bd7c0] AMFEncoderCoreAv1: 0123-01-05 16:47:53 84D89800 [AMFEncoderCoreAv1] Warning: *****Failed to create AV1 encoder component.
[av1_amf @ 0x8bd7c0] AMFEncoderCoreAv1: 0123-01-05 16:47:53 84D89800 [AMFEncoderCoreAv1]   Debug: AMFEncoderCoreAv1Impl::Terminate()
[av1_amf @ 0x87a0c0] CreateComponent(AMFVideoEncoderHW_AV1) failed with error 11
[vost#0:0/av1_amf @ 0x8b2f40] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Expected behavior As the 7900 XTX has all of the encoders supported by AMF, all 3 should be recognized and working.

Additional context libamdenc64 and libamfrt64 are both there and libamdenc64 is sucessfully loaded right before the error (in the case of AV1):

[pid 141638] openat(AT_FDCWD, "/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdenc64.so", O_RDONLY|O_CLOEXEC) = 9
[pid 141638] newfstatat(9, "", {st_mode=S_IFREG|0644, st_size=1411248, ...}, AT_EMPTY_PATH) = 0
cromefire commented 1 year ago

Searching up something on the arch forums led me to forcing the pro drive icd's (VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json) and rolling back the pro driver to 4.5.1/22.40 (pro driver doesn't seem to be there yet with 4.5.2) which still fails the same, but the errors seems a bit clearer this way:

[av1_amf @ 0xf997c0] AMF initialisation succeeded via Vulkan.
[av1_amf @ 0xf997c0] AMFVideoCore: 0123-01-05 17:11:43 DC07E800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[av1_amf @ 0xf997c0] EncodeCore: 0123-01-05 17:11:43 DC07E800 [EncodeCore]   Error: ./sources/drivers/enc_core/cmn/av1config.cpp(285):Av1Config::IsEncodeSupported(): Unknown Hardware!
[av1_amf @ 0xf997c0] AMFEncoderCoreAv1: 0123-01-05 17:11:43 DC07E800 [AMFEncoderCoreAv1] Warning:  AMFEncoderCoreAv1Impl::CreateEncodeService() not supported VCN instance 0! 
[av1_amf @ 0xf997c0] AMFEncoderCoreAv1: 0123-01-05 17:11:43 DC07E800 [AMFEncoderCoreAv1]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreAv1Impl.cpp(315):AMF_ERROR 1 : AMF_FAIL: Failed to create encode service!
[av1_amf @ 0xf997c0] AMFEncoderCoreAv1: 0123-01-05 17:11:43 DC07E800 [AMFEncoderCoreAv1] Warning: CreateServices failed.
[av1_amf @ 0xf997c0] AMFEncoderCoreAv1: 0123-01-05 17:11:43 DC07E800 [AMFEncoderCoreAv1] Warning: *****Failed to create AV1 encoder component.
[av1_amf @ 0xf997c0] AMFEncoderCoreAv1: 0123-01-05 17:11:43 DC07E800 [AMFEncoderCoreAv1]   Debug: AMFEncoderCoreAv1Impl::Terminate()
[av1_amf @ 0xf560c0] CreateComponent(AMFVideoEncoderHW_AV1) failed with error 1
[vost#0:0/av1_amf @ 0xf8ef40] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Seems like AMF doesn't know the 7000 series yet.

MikhailAMD commented 1 year ago

Did you install the driver and AMF following the standard procedure? I am asking because the problem is in the first line: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002. This is a mismatch between libamdenc64 and libamfrt64. Note, that after you roolled back to the older driver the versions in the log are still the same. I suggest to fully uninstall AMD driver and reinstall the latest.

https://amdgpu-install.readthedocs.io/en/latest/install-installing.html#uninstalling-the-amdgpu-stack

https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-22-40

amdgpu-install -y --usecase=workstation,amf or amdgpu-install -y --usecase=graphics,amf Reboot

cromefire commented 1 year ago

Did a full reinstall with uninstall and then install again as suggested and the line is still showing up. May there's something in the driver repo mismatched?

Also double checked the versions of both libraries and according to apt with have the same subversion 1518373:

Package: amf-amdgpu-pro
Version: 1.4.29-1518373.22.04
Priority: optional
Section: libs
Maintainer: Advanced Micro Devices (AMD) <gpudriverdevsupport@amd.com>
Installed-Size: 8.195 kB
Depends: libc6 (>= 2.34), libdrm2-amdgpu, libstdc++6 (>= 11), vulkan-amdgpu-pro, libamdenc-amdgpu-pro
Recommends: rocm-opencl-runtime
Download-Size: 1.654 kB
APT-Manual-Installed: yes
APT-Sources: https://repo.radeon.com/amdgpu/5.4.1/ubuntu jammy/proprietary amd64 Packages
Description: AMDGPU Pro Advanced Multimedia Framework

Package: libamdenc-amdgpu-pro
Version: 1.0-1518373.22.04
Priority: optional
Section: libs
Maintainer: Advanced Micro Devices (AMD) <gpudriverdevsupport@amd.com>
Installed-Size: 1.439 kB
Depends: libc6 (>= 2.14), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 4.1.1), amdgpu-pro-core
Download-Size: 248 kB
APT-Manual-Installed: no
APT-Sources: https://repo.radeon.com/amdgpu/5.4.1/ubuntu jammy/proprietary amd64 Packages
Description: AMD Encode Core Library
MikhailAMD commented 1 year ago

I am opening an internal ticket based on your finding with top priority.

MikhailAMD commented 1 year ago

22.40.3 Linux driver has been published. It should have the fix.

cromefire commented 1 year ago

Just did a full reinstall (and rebooted of course) and it's still the same error.

For reference I used this command line:

VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json ffmpeg -v debug -i "file.webm" -c:v h264_amf -c:a copy -y h264-amf.mkv

To be sure, without specifying the ICD still fails the same way and falls back to UVE, which also doesn't work:

Logs ``` [h264_amf @ 0x185b040] AMF initialisation succeeded via Vulkan. [h264_amf @ 0x185b040] AMFVideoCore: 0123-01-24 21:53:20 8906C800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002 [h264_amf @ 0x185b040] EncodeQueueVulkan: 0123-01-24 21:53:20 8906C800 [EncodeQueueVulkan] Info: EncodeQueueServiceVulkanImpl::Initialize() new encode queue extension is not supported [h264_amf @ 0x185b040] EncodeQueueService: 0123-01-24 21:53:20 8906C800 [EncodeQueueService] Warning: Failed to create encode queue serivce. [h264_amf @ 0x185b040] AMFEncoderCoreBaseImpl: 0123-01-24 21:53:20 8906C800 [AMFEncoderCoreBaseImpl] Warning: Failed to initialize EncodeQueueFactory. [h264_amf @ 0x185b040] AMFEncoderCoreBaseImpl: 0123-01-24 21:53:20 8906C800 [AMFEncoderCoreBaseImpl] Warning: Failed to create encode queue serivce. [h264_amf @ 0x185b040] AMFEncoderCoreH264: 0123-01-24 21:53:20 8906C800 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path [h264_amf @ 0x185b040] AMFEncoderCoreH264: 0123-01-24 21:53:20 8906C800 [AMFEncoderCoreH264] Warning: CreateServices failed. [h264_amf @ 0x185b040] AMFEncoderCoreH264: 0123-01-24 21:53:20 8906C800 [AMFEncoderCoreH264] Info: *****Fallback to UVE path! [h264_amf @ 0x185b040] AMFEncoderCoreH264: 0123-01-24 21:53:20 8906C800 [AMFEncoderCoreH264] Debug: AMFEncoderCoreH264Impl::Terminate() [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(453):InitializeCap() res: AMD Decode extension is not loaded [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ConstraintSetFlags changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param EnableVBAQ changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param EncoderMaxInstances changed to 1! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param EncoderOutputCallback changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ExtraData changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param FrameSize changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param InstanceID changed to -1! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param IntraRefreshMode changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxDecFrameBuffering changed to -1! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxMBPerSec changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxNumRefFrames changed to 4! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MaxOfLTRFrames changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param MultiInstanceMode changed to 0! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty CABACEnable:0 [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param Profile changed to 77! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ProfileLevel changed to 42! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param QualityPreset changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param QueryTimeout changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param RateControlPreanalysisEnable changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param ScanType changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param UniqueInstance changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(0): UpdateConfig:Init Param WaitForTask changed to 0! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty Usage:0 [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ConstraintSetFlags changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param EnableVBAQ changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param EncoderMaxInstances changed to 1! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param EncoderOutputCallback changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ExtraData changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param FrameSize changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param InstanceID changed to -1! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param IntraRefreshMode changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxDecFrameBuffering changed to -1! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxMBPerSec changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxNumRefFrames changed to 4! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MaxOfLTRFrames changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param MultiInstanceMode changed to 0! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty CABACEnable:0 [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param Profile changed to 77! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ProfileLevel changed to 42! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param QualityPreset changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param QueryTimeout changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param RateControlPreanalysisEnable changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param ScanType changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param UniqueInstance changed to 0! [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param WaitForTask changed to 0! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty FrameSize:1920,1080 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Warning: SetProperty FrameSize failed in AMFPropertyStorageExImpl with return code:0x5, and will not set driver either, but return ok for now! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty FrameRate:19001,317 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty Profile:77 [h264_amf @ 0x185b040] PropertyStorageExImpl: 0123-01-24 21:53:20 8906C800 [PropertyStorageExImpl] Error: ../../../../../public/common/PropertyStorageExImpl.h(277):AMF_ERROR 4 : AMF_INVALID_ARG: Property=Profile [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Warning: SetProperty Profile failed in AMFPropertyStorageExImpl with return code:0x4, and will not set driver either, but return ok for now! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty AspectRatio:1,1 [h264_amf @ 0x1808440] Rate control turned to CBR [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty RateControlPreanalysisEnable:0 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty QualityPreset:1 [h264_amf @ 0x185b040] EncoderVulkanH264PropertySet: 0123-01-24 21:53:20 8906C800 [EncoderVulkanH264PropertySet] Debug: EncoderVulkanH264PropertySet(-1): UpdateConfig:Init Param QualityPreset changed to 1! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty RateControlMethod:1 [h264_amf @ 0x185b040] PropertyStorageExImpl: 0123-01-24 21:53:20 8906C800 [PropertyStorageExImpl] Error: ../../../../../public/common/PropertyStorageExImpl.h(277):AMF_ERROR 4 : AMF_INVALID_ARG: Property=RateControlMethod [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Warning: SetProperty RateControlMethod failed in AMFPropertyStorageExImpl with return code:0x4, and will not set driver either, but return ok for now! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty MaxAUSize:0 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty TargetBitrate:2000000 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Warning: SetProperty TargetBitrate failed in AMFPropertyStorageExImpl with return code:0x5, and will not set driver either, but return ok for now! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Info: SetProperty PeakBitrate:2000000 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Warning: SetProperty PeakBitrate failed in AMFPropertyStorageExImpl with return code:0x5, and will not set driver either, but return ok for now! [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Debug: AMFEncoderVulkanH264Impl::_Init(YUV420P, 1920, 1080) [h264_amf @ 0x185b040] EncodeVulkanImpl: 0123-01-24 21:53:20 8906C800 [EncodeVulkanImpl] Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanImpl.cpp(89):Assertion failed:invalid pointer : m_pVulkanDevice->GetVulkan()->vkGetPhysicalDeviceVideoEncodeCodecsAMD [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(667):AMF_ERROR 7 : AMF_INVALID_POINTER: InitVulkan() Codec is not supported by HW [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(402):AMF_ERROR 7 : AMF_INVALID_POINTER: _Init() - Failed to init H264 service [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Debug: AMFEncoderVulkanH264Impl::Terminate [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Error: ../../../../../runtime/src/components/EncoderVulkan/EncoderVulkanH264Impl.cpp(177):AMF_ERROR 7 : AMF_INVALID_POINTER: _Init() - Failed [h264_amf @ 0x1808440] encoder->Init() failed with error 7 [h264_amf @ 0x185b040] AMFEncoderVulkan: 0123-01-24 21:53:20 8906C800 [AMFEncoderVulkan] Debug: AMFEncoderVulkanH264Impl::Terminate ```

The new library versions are:

Package: amf-amdgpu-pro
Version: 1.4.29-1538781.22.04
Priority: optional
Section: libs
Maintainer: Advanced Micro Devices (AMD) <gpudriverdevsupport@amd.com>
Installed-Size: 8.195 kB
Depends: libc6 (>= 2.34), libdrm2-amdgpu, libstdc++6 (>= 11), vulkan-amdgpu-pro, libamdenc-amdgpu-pro
Recommends: rocm-opencl-runtime
Download-Size: 1.656 kB
APT-Manual-Installed: yes
APT-Sources: https://repo.radeon.com/amdgpu/5.4.3/ubuntu jammy/proprietary amd64 Packages
Description: AMDGPU Pro Advanced Multimedia Framework

Package: libamdenc-amdgpu-pro
Version: 1.0-1538781.22.04
Priority: optional
Section: libs
Maintainer: Advanced Micro Devices (AMD) <gpudriverdevsupport@amd.com>
Installed-Size: 1.439 kB
Depends: libc6 (>= 2.14), libgcc-s1 (>= 3.3.1), libstdc++6 (>= 4.1.1), amdgpu-pro-core
Download-Size: 246 kB
APT-Manual-Installed: no
APT-Sources: https://repo.radeon.com/amdgpu/5.4.3/ubuntu jammy/proprietary amd64 Packages
Description: AMD Encode Core Library

Installed using:

sudo amdgpu-install --usecase="dkms,graphics,opencl,hip,rocm,mllib,amf" --opencl=rocr --vulkan=amdvlk,pro -y

DKMS also looks fine:

amdgpu/5.18.13-1538762.22.04, 5.19.0-32-generic, x86_64: installed
Package: amdgpu-dkms
Version: 1:5.18.13.50403-1538762.22.04
Priority: optional
Section: misc
Maintainer: Advanced Micro Devices (AMD) <gpudriverdevsupport@amd.com>
Installed-Size: 428 MB
Provides: rock-dkms
Depends: dkms (>= 1.95), libc-dev | libc6-dev, autoconf, automake, initramfs-tools, shim-signed, amdgpu-dkms-firmware (= 1:5.18.13.50403-1538762.22.04)
Conflicts: rock-dkms (<< 1:5.18.13.50403-1538762.22.04)
Breaks: rock-dkms (<< 1:5.18.13.50403-1538762.22.04)
Replaces: rock-dkms (<< 1:5.18.13.50403-1538762.22.04)
Download-Size: 9.846 kB
APT-Manual-Installed: yes
APT-Sources: https://repo.radeon.com/amdgpu/5.4.3/ubuntu jammy/main amd64 Packages
Description: amdgpu driver in DKMS format.
MikhailAMD commented 1 year ago

At this point we cannot repro with the latest public driver. Could you please provide log from: dpkg -l | grep amdgpu

cromefire commented 1 year ago
ii  amdgpu-core                                                 1:5.4.50403-1538762.22.04                          all          Core meta package for unified amdgpu driver.
ii  amdgpu-dkms                                                 1:5.18.13.50403-1538762.22.04                      all          amdgpu driver in DKMS format.
ii  amdgpu-dkms-firmware                                        1:5.18.13.50403-1538762.22.04                      all          firmware blobs used by amdgpu driver in DKMS format
ii  amdgpu-install                                              5.4.50403-1538762.22.04                            all          AMDGPU driver repository and installer
ii  amdgpu-lib                                                  1:5.4.50403-1538762.22.04                          amd64        Meta package to install amdgpu userspace components.
ii  amdgpu-lib32                                                1:5.4.50403-1538762.22.04                          amd64        Meta package to support i386 runtime on amd64 architecture
ii  amdgpu-pro-core                                             22.40-1538781.22.04                                all          Core meta package for Pro components of the unified amdgpu driver.
ii  amf-amdgpu-pro:amd64                                        1.4.29-1538781.22.04                               amd64        AMDGPU Pro Advanced Multimedia Framework
ii  gst-omx-amdgpu                                              1:1.0.0.1.50403-1538762.22.04                      amd64        GStreamer OpenMAX plugins
ii  libamdenc-amdgpu-pro:amd64                                  1.0-1538781.22.04                                  amd64        AMD Encode Core Library
ii  libdrm-amdgpu-amdgpu1:amd64                                 1:2.4.113.50403-1538762.22.04                      amd64        Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-amdgpu-amdgpu1:i386                                  1:2.4.113.50403-1538762.22.04                      i386         Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-amdgpu-common                                        1.0.0.50403-1538762.22.04                          all          List of AMD/ATI cards' device IDs, revision IDs and marketing names
ii  libdrm-amdgpu-radeon1:amd64                                 1:2.4.113.50403-1538762.22.04                      amd64        Userspace interface to radeon-specific kernel DRM services -- runtime
ii  libdrm-amdgpu-radeon1:i386                                  1:2.4.113.50403-1538762.22.04                      i386         Userspace interface to radeon-specific kernel DRM services -- runtime
ii  libdrm-amdgpu1:amd64                                        2.4.113-2~ubuntu0.22.04.1                          amd64        Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-amdgpu1:i386                                         2.4.113-2~ubuntu0.22.04.1                          i386         Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm2-amdgpu:amd64                                        1:2.4.113.50403-1538762.22.04                      amd64        Userspace interface to kernel DRM services -- runtime
ii  libdrm2-amdgpu:i386                                         1:2.4.113.50403-1538762.22.04                      i386         Userspace interface to kernel DRM services -- runtime
ii  libegl1-amdgpu-mesa:amd64                                   1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the EGL API -- runtime
ii  libegl1-amdgpu-mesa:i386                                    1:22.3.0.50403-1538762.22.04                       i386         free implementation of the EGL API -- runtime
ii  libegl1-amdgpu-mesa-drivers:amd64                           1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the EGL API -- hardware drivers
ii  libegl1-amdgpu-mesa-drivers:i386                            1:22.3.0.50403-1538762.22.04                       i386         free implementation of the EGL API -- hardware drivers
ii  libgbm1-amdgpu:amd64                                        1:22.3.0.50403-1538762.22.04                       amd64        generic buffer management API -- runtime
ii  libgbm1-amdgpu:i386                                         1:22.3.0.50403-1538762.22.04                       i386         generic buffer management API -- runtime
ii  libgl1-amdgpu-mesa-dri:amd64                                1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the OpenGL API -- DRI modules
ii  libgl1-amdgpu-mesa-dri:i386                                 1:22.3.0.50403-1538762.22.04                       i386         free implementation of the OpenGL API -- DRI modules
ii  libgl1-amdgpu-mesa-glx:amd64                                1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the OpenGL API -- GLX runtime
ii  libgl1-amdgpu-mesa-glx:i386                                 1:22.3.0.50403-1538762.22.04                       i386         free implementation of the OpenGL API -- GLX runtime
ii  libglapi-amdgpu-mesa:amd64                                  1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the GL API -- shared library
ii  libglapi-amdgpu-mesa:i386                                   1:22.3.0.50403-1538762.22.04                       i386         free implementation of the GL API -- shared library
ii  libllvm15.0.50403-amdgpu:amd64                              1:15.0.50403-1538762.22.04                         amd64        Modular compiler and toolchain technologies, runtime library
ii  libllvm15.0.50403-amdgpu:i386                               1:15.0.50403-1538762.22.04                         i386         Modular compiler and toolchain technologies, runtime library
ii  libxatracker2-amdgpu:amd64                                  1:22.3.0.50403-1538762.22.04                       amd64        X acceleration library -- runtime
ii  libxatracker2-amdgpu:i386                                   1:22.3.0.50403-1538762.22.04                       i386         X acceleration library -- runtime
ii  mesa-amdgpu-omx-drivers:amd64                               1:22.3.0.50403-1538762.22.04                       amd64        Mesa OpenMAX video drivers
ii  mesa-amdgpu-va-drivers:amd64                                1:22.3.0.50403-1538762.22.04                       amd64        Mesa VA-API video acceleration drivers
ii  mesa-amdgpu-va-drivers:i386                                 1:22.3.0.50403-1538762.22.04                       i386         Mesa VA-API video acceleration drivers
ii  mesa-amdgpu-vdpau-drivers:amd64                             1:22.3.0.50403-1538762.22.04                       amd64        Mesa VDPAU video acceleration drivers
ii  mesa-amdgpu-vdpau-drivers:i386                              1:22.3.0.50403-1538762.22.04                       i386         Mesa VDPAU video acceleration drivers
ii  vulkan-amdgpu:amd64                                         22.40-1538781.22.04                                amd64        AMDGPU Vulkan driver
ii  vulkan-amdgpu-pro:amd64                                     22.40-1538781.22.04                                amd64        AMDGPU Pro Vulkan driver
ii  vulkan-amdgpu-pro:i386                                      22.40-1538781.22.04                                i386         AMDGPU Pro Vulkan driver
ii  xserver-xorg-amdgpu-video-amdgpu                            1:22.0.0.50403-1538762.22.04                       amd64        X.Org X server -- AMD/ATI Radeon display driver
ii  xserver-xorg-video-amdgpu                                   22.0.0-1ubuntu0.1                                  amd64        X.Org X server -- AMDGPU display driver
MikhailAMD commented 1 year ago

One thought: it seems you have two AMD Vulkan drivers installed open-Source and Pro: vulkan-amdgpu:amd64 22.40-1538781.22.04 amd64 AMDGPU Vulkan driver vulkan-amdgpu-pro:amd64 22.40-1538781.22.04 amd64 AMDGPU Pro Vulkan driver vulkan-amdgpu-pro:i386 22.40-1538781.22.04 i386 AMDGPU Pro Vulkan driver Could be from --vulkan=amdvlk,pro BTW: AMF has dependency and will install Vulkan Pro driver automatically Is it possible that AMF loading open-source driver? What is in amd_icd64.json? Can you try to uninstall all AMD and use simple install: amdgpu-install -y --usecase=workstation,amf or amdgpu-install -y --usecase=graphics,amf reboot

cromefire commented 1 year ago
sudo amdgpu-install -y --usecase=graphics,amf

Same error:

Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
~$ dpkg -l | grep amdgpu
ii  amdgpu-core                                                 1:5.4.50403-1538762.22.04                          all          Core meta package for unified amdgpu driver.
ii  amdgpu-dkms                                                 1:5.18.13.50403-1538762.22.04                      all          amdgpu driver in DKMS format.
ii  amdgpu-dkms-firmware                                        1:5.18.13.50403-1538762.22.04                      all          firmware blobs used by amdgpu driver in DKMS format
ii  amdgpu-install                                              5.4.50403-1538762.22.04                            all          AMDGPU driver repository and installer
ii  amdgpu-lib                                                  1:5.4.50403-1538762.22.04                          amd64        Meta package to install amdgpu userspace components.
ii  amdgpu-lib32                                                1:5.4.50403-1538762.22.04                          amd64        Meta package to support i386 runtime on amd64 architecture
ii  amdgpu-pro-core                                             22.40-1538781.22.04                                all          Core meta package for Pro components of the unified amdgpu driver.
ii  amf-amdgpu-pro:amd64                                        1.4.29-1538781.22.04                               amd64        AMDGPU Pro Advanced Multimedia Framework
ii  gst-omx-amdgpu                                              1:1.0.0.1.50403-1538762.22.04                      amd64        GStreamer OpenMAX plugins
ii  libamdenc-amdgpu-pro:amd64                                  1.0-1538781.22.04                                  amd64        AMD Encode Core Library
ii  libdrm-amdgpu-amdgpu1:amd64                                 1:2.4.113.50403-1538762.22.04                      amd64        Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-amdgpu-amdgpu1:i386                                  1:2.4.113.50403-1538762.22.04                      i386         Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-amdgpu-common                                        1.0.0.50403-1538762.22.04                          all          List of AMD/ATI cards' device IDs, revision IDs and marketing names
ii  libdrm-amdgpu-radeon1:amd64                                 1:2.4.113.50403-1538762.22.04                      amd64        Userspace interface to radeon-specific kernel DRM services -- runtime
ii  libdrm-amdgpu-radeon1:i386                                  1:2.4.113.50403-1538762.22.04                      i386         Userspace interface to radeon-specific kernel DRM services -- runtime
ii  libdrm-amdgpu1:amd64                                        2.4.113-2~ubuntu0.22.04.1                          amd64        Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-amdgpu1:i386                                         2.4.113-2~ubuntu0.22.04.1                          i386         Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm2-amdgpu:amd64                                        1:2.4.113.50403-1538762.22.04                      amd64        Userspace interface to kernel DRM services -- runtime
ii  libdrm2-amdgpu:i386                                         1:2.4.113.50403-1538762.22.04                      i386         Userspace interface to kernel DRM services -- runtime
ii  libegl1-amdgpu-mesa:amd64                                   1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the EGL API -- runtime
ii  libegl1-amdgpu-mesa:i386                                    1:22.3.0.50403-1538762.22.04                       i386         free implementation of the EGL API -- runtime
ii  libegl1-amdgpu-mesa-drivers:amd64                           1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the EGL API -- hardware drivers
ii  libegl1-amdgpu-mesa-drivers:i386                            1:22.3.0.50403-1538762.22.04                       i386         free implementation of the EGL API -- hardware drivers
ii  libgbm1-amdgpu:amd64                                        1:22.3.0.50403-1538762.22.04                       amd64        generic buffer management API -- runtime
ii  libgbm1-amdgpu:i386                                         1:22.3.0.50403-1538762.22.04                       i386         generic buffer management API -- runtime
ii  libgl1-amdgpu-mesa-dri:amd64                                1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the OpenGL API -- DRI modules
ii  libgl1-amdgpu-mesa-dri:i386                                 1:22.3.0.50403-1538762.22.04                       i386         free implementation of the OpenGL API -- DRI modules
ii  libgl1-amdgpu-mesa-glx:amd64                                1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the OpenGL API -- GLX runtime
ii  libgl1-amdgpu-mesa-glx:i386                                 1:22.3.0.50403-1538762.22.04                       i386         free implementation of the OpenGL API -- GLX runtime
ii  libglapi-amdgpu-mesa:amd64                                  1:22.3.0.50403-1538762.22.04                       amd64        free implementation of the GL API -- shared library
ii  libglapi-amdgpu-mesa:i386                                   1:22.3.0.50403-1538762.22.04                       i386         free implementation of the GL API -- shared library
ii  libllvm15.0.50403-amdgpu:amd64                              1:15.0.50403-1538762.22.04                         amd64        Modular compiler and toolchain technologies, runtime library
ii  libllvm15.0.50403-amdgpu:i386                               1:15.0.50403-1538762.22.04                         i386         Modular compiler and toolchain technologies, runtime library
ii  libxatracker2-amdgpu:amd64                                  1:22.3.0.50403-1538762.22.04                       amd64        X acceleration library -- runtime
ii  libxatracker2-amdgpu:i386                                   1:22.3.0.50403-1538762.22.04                       i386         X acceleration library -- runtime
ii  mesa-amdgpu-omx-drivers:amd64                               1:22.3.0.50403-1538762.22.04                       amd64        Mesa OpenMAX video drivers
ii  mesa-amdgpu-va-drivers:amd64                                1:22.3.0.50403-1538762.22.04                       amd64        Mesa VA-API video acceleration drivers
ii  mesa-amdgpu-va-drivers:i386                                 1:22.3.0.50403-1538762.22.04                       i386         Mesa VA-API video acceleration drivers
ii  mesa-amdgpu-vdpau-drivers:amd64                             1:22.3.0.50403-1538762.22.04                       amd64        Mesa VDPAU video acceleration drivers
ii  mesa-amdgpu-vdpau-drivers:i386                              1:22.3.0.50403-1538762.22.04                       i386         Mesa VDPAU video acceleration drivers
ii  vulkan-amdgpu-pro:amd64                                     22.40-1538781.22.04                                amd64        AMDGPU Pro Vulkan driver
ii  xserver-xorg-amdgpu-video-amdgpu                            1:22.0.0.50403-1538762.22.04                       amd64        X.Org X server -- AMD/ATI Radeon display driver
ii  xserver-xorg-video-amdgpu                                   22.0.0-1ubuntu0.1                                  amd64        X.Org X server -- AMDGPU display driver
MikhailAMD commented 1 year ago

Warning message is not a problem, will be removed later. The absence of queue is. Could you please try VAAPI via FFmpeg? I want to check if VCN is visible. Also please provide output of vulkaninfo –summary And: do to you by chance use VM rather then baremetal setup?

cromefire commented 1 year ago

Warning message is not a problem, will be removed later. The absence of queue is.

Yeah, just wanted to indicate it's the same error, but yes, it's still failing the same way.

Default is (seems to prefer what I think is RADV?):

vulkaninfo --summary ``` ERROR: [Loader Message] Code 0 : libLLVM-15.so.1: cannot open shared object file: No such file or directory ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so. Ignoring this JSON ERROR: [Loader Message] Code 0 : libLLVM-15.so.1: cannot open shared object file: No such file or directory ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /usr/lib/x86_64-linux-gnu/libvulkan_radeon.so. Ignoring this JSON WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 1. Skipping ICD. WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 2. Skipping ICD. ========== VULKANINFO ========== Vulkan Instance Version: 1.3.239 Instance Extensions: count = 20 ------------------------------- VK_EXT_acquire_drm_display : extension revision 1 VK_EXT_acquire_xlib_display : extension revision 1 VK_EXT_debug_report : extension revision 10 VK_EXT_debug_utils : extension revision 2 VK_EXT_direct_mode_display : extension revision 1 VK_EXT_display_surface_counter : extension revision 1 VK_KHR_device_group_creation : extension revision 1 VK_KHR_display : extension revision 23 VK_KHR_external_fence_capabilities : extension revision 1 VK_KHR_external_memory_capabilities : extension revision 1 VK_KHR_external_semaphore_capabilities : extension revision 1 VK_KHR_get_display_properties2 : extension revision 1 VK_KHR_get_physical_device_properties2 : extension revision 2 VK_KHR_get_surface_capabilities2 : extension revision 1 VK_KHR_portability_enumeration : extension revision 1 VK_KHR_surface : extension revision 25 VK_KHR_surface_protected_capabilities : extension revision 1 VK_KHR_wayland_surface : extension revision 6 VK_KHR_xcb_surface : extension revision 6 VK_KHR_xlib_surface : extension revision 6 Instance Layers: count = 16 --------------------------- VK_LAYER_AMD_switchable_graphics_64 AMD switchable graphics layer 1.3.240 version 1 VK_LAYER_INTEL_nullhw INTEL NULL HW 1.1.73 version 1 VK_LAYER_KHRONOS_profiles Khronos Profiles layer 1.3.239 version 1 VK_LAYER_KHRONOS_synchronization2 Khronos Synchronization2 layer 1.3.239 version 1 VK_LAYER_KHRONOS_validation Khronos Validation Layer 1.3.239 version 1 VK_LAYER_LUNARG_api_dump LunarG API dump layer 1.3.239 version 2 VK_LAYER_LUNARG_gfxreconstruct GFXReconstruct Capture Layer Version 0.9.16-unknown 1.3.239 version 36880 VK_LAYER_LUNARG_monitor Execution Monitoring Layer 1.3.239 version 1 VK_LAYER_LUNARG_screenshot LunarG image capture layer 1.3.239 version 1 VK_LAYER_MANGOHUD_overlay Vulkan Hud Overlay 1.2.135 version 1 VK_LAYER_MESA_device_select Linux device selection layer 1.3.211 version 1 VK_LAYER_MESA_overlay Mesa Overlay layer 1.3.211 version 1 VK_LAYER_VALVE_steam_fossilize_32 Steam Pipeline Caching Layer 1.3.207 version 1 VK_LAYER_VALVE_steam_fossilize_64 Steam Pipeline Caching Layer 1.3.207 version 1 VK_LAYER_VALVE_steam_overlay_32 Steam Overlay Layer 1.3.207 version 1 VK_LAYER_VALVE_steam_overlay_64 Steam Overlay Layer 1.3.207 version 1 Devices: ======== GPU0: apiVersion = 1.3.240 driverVersion = 2.0.255 vendorID = 0x1002 deviceID = 0x744c deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU deviceName = Radeon RX 7900 XTX driverID = DRIVER_ID_AMD_OPEN_SOURCE driverName = AMD open-source driver driverInfo = 2023.Q1.2 (LLPC) conformanceVersion = 1.3.0.0 deviceUUID = 00000000-0b00-0000-0000-000000000000 driverUUID = 414d442d-4c49-4e55-582d-445256000000 ```

Forced to use the pro driver:

VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json vulkaninfo --summary ``` ========== VULKANINFO ========== Vulkan Instance Version: 1.3.239 Instance Extensions: count = 18 ------------------------------- VK_EXT_acquire_xlib_display : extension revision 1 VK_EXT_debug_report : extension revision 10 VK_EXT_debug_utils : extension revision 2 VK_EXT_direct_mode_display : extension revision 1 VK_EXT_display_surface_counter : extension revision 1 VK_KHR_device_group_creation : extension revision 1 VK_KHR_display : extension revision 23 VK_KHR_external_fence_capabilities : extension revision 1 VK_KHR_external_memory_capabilities : extension revision 1 VK_KHR_external_semaphore_capabilities : extension revision 1 VK_KHR_get_display_properties2 : extension revision 1 VK_KHR_get_physical_device_properties2 : extension revision 2 VK_KHR_get_surface_capabilities2 : extension revision 1 VK_KHR_portability_enumeration : extension revision 1 VK_KHR_surface : extension revision 25 VK_KHR_wayland_surface : extension revision 6 VK_KHR_xcb_surface : extension revision 6 VK_KHR_xlib_surface : extension revision 6 Instance Layers: count = 16 --------------------------- VK_LAYER_AMD_switchable_graphics_64 AMD switchable graphics layer 1.3.240 version 1 VK_LAYER_INTEL_nullhw INTEL NULL HW 1.1.73 version 1 VK_LAYER_KHRONOS_profiles Khronos Profiles layer 1.3.239 version 1 VK_LAYER_KHRONOS_synchronization2 Khronos Synchronization2 layer 1.3.239 version 1 VK_LAYER_KHRONOS_validation Khronos Validation Layer 1.3.239 version 1 VK_LAYER_LUNARG_api_dump LunarG API dump layer 1.3.239 version 2 VK_LAYER_LUNARG_gfxreconstruct GFXReconstruct Capture Layer Version 0.9.16-unknown 1.3.239 version 36880 VK_LAYER_LUNARG_monitor Execution Monitoring Layer 1.3.239 version 1 VK_LAYER_LUNARG_screenshot LunarG image capture layer 1.3.239 version 1 VK_LAYER_MANGOHUD_overlay Vulkan Hud Overlay 1.2.135 version 1 VK_LAYER_MESA_device_select Linux device selection layer 1.3.211 version 1 VK_LAYER_MESA_overlay Mesa Overlay layer 1.3.211 version 1 VK_LAYER_VALVE_steam_fossilize_32 Steam Pipeline Caching Layer 1.3.207 version 1 VK_LAYER_VALVE_steam_fossilize_64 Steam Pipeline Caching Layer 1.3.207 version 1 VK_LAYER_VALVE_steam_overlay_32 Steam Overlay Layer 1.3.207 version 1 VK_LAYER_VALVE_steam_overlay_64 Steam Overlay Layer 1.3.207 version 1 Devices: ======== GPU0: apiVersion = 1.3.232 driverVersion = 2.0.247 vendorID = 0x1002 deviceID = 0x744c deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU deviceName = Radeon RX 7900 XTX driverID = DRIVER_ID_AMD_PROPRIETARY driverName = AMD proprietary driver driverInfo = (LLPC) conformanceVersion = 1.3.0.0 deviceUUID = 00000000-0b00-0000-0000-000000000000 driverUUID = 414d442d-4c49-4e55-582d-445256000000 ```

VAAPI at least finds the capabilities for H264 and HEVC (AV1 is notably missing):

vainfo ``` libva info: VA-API version 1.14.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_1_14 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.14 (libva 2.12.0) vainfo: Driver version: Mesa Gallium driver 22.3.0-devel for Radeon RX 7900 XTX (gfx1100, LLVM 15.0.3, DRM 3.48, 5.19.0-32-generic) vainfo: Supported profile and entrypoints VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointEncSlice VAProfileHEVCMain10 : VAEntrypointVLD VAProfileHEVCMain10 : VAEntrypointEncSlice VAProfileJPEGBaseline : VAEntrypointVLD VAProfileVP9Profile0 : VAEntrypointVLD VAProfileVP9Profile2 : VAEntrypointVLD VAProfileAV1Profile0 : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc ```

But also seems to have issues transcoding h264:

ffmpeg -vaapi_device /dev/dri/renderD128 -v debug -i "file.webm" -c:v h264_vaapi -vf 'format=nv12,hwupload' -c:a copy -y h264-vaapi.mkv (also without explicit nv12) ``` [graph 0 input from stream 0:0 @ 0xe4a6c0] Setting 'video_size' to value '1920x1080' [graph 0 input from stream 0:0 @ 0xe4a6c0] Setting 'pix_fmt' to value '0' [graph 0 input from stream 0:0 @ 0xe4a6c0] Setting 'time_base' to value '1/1000' [graph 0 input from stream 0:0 @ 0xe4a6c0] Setting 'pixel_aspect' to value '1/1' [graph 0 input from stream 0:0 @ 0xe4a6c0] Setting 'frame_rate' to value '19001/317' [graph 0 input from stream 0:0 @ 0xe4a6c0] w:1920 h:1080 pixfmt:yuv420p tb:1/1000 fr:19001/317 sar:1/1 [format @ 0xe4d3c0] Setting 'pix_fmts' to value 'vaapi' [auto_scale_0 @ 0xe4f240] w:iw h:ih flags:'' interl:0 [Parsed_format_0 @ 0xe43b40] auto-inserting filter 'auto_scale_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0' [AVFilterGraph @ 0xd79640] query_formats: 5 queried, 4 merged, 1 already done, 0 delayed [auto_scale_0 @ 0xe4f240] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x00000004 [hwupload @ 0xe3e800] Surface format is nv12. [AVHWFramesContext @ 0xe397c0] Created surface 0x1. [AVHWFramesContext @ 0xe397c0] Direct mapping disabled: deriving image does not work: 1 (operation failed). [auto_scale_0 @ 0xe4f240] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x00000004 Last message repeated 2 times [AVHWFramesContext @ 0xe397c0] Map surface 0x1. [AVHWFramesContext @ 0xe397c0] Unmap surface 0x1. [h264_vaapi @ 0xd77780] Using input frames context (format vaapi) with h264_vaapi encoder. [h264_vaapi @ 0xd77780] Input surface format is nv12. [h264_vaapi @ 0xd77780] Using VAAPI profile VAProfileH264High (7). [h264_vaapi @ 0xd77780] Using VAAPI entrypoint VAEntrypointEncSlice (6). [h264_vaapi @ 0xd77780] Using VAAPI render target format YUV420 (0x1). [h264_vaapi @ 0xd77780] Driver supports RC modes CQP, CBR, VBR. [h264_vaapi @ 0xd77780] Driver does not support ICQ RC mode. [h264_vaapi @ 0xd77780] No quality level set; using default (20). [h264_vaapi @ 0xd77780] RC mode: CQP. [h264_vaapi @ 0xd77780] RC quality: 20. [h264_vaapi @ 0xd77780] RC framerate: 19001/317 (59.94 fps). [h264_vaapi @ 0xd77780] Driver does not report any additional prediction constraints. [h264_vaapi @ 0xd77780] Using intra and P-frames (supported references: 1 / 0). [h264_vaapi @ 0xd77780] Driver does not support some wanted packed headers (wanted 0xd, found 0). [h264_vaapi @ 0xd77780] Driver does not support packed sequence headers, but a global header is requested. [h264_vaapi @ 0xd77780] No global header will be written: this may result in a stream which is not usable for some purposes (e.g. not muxable to some containers). [h264_vaapi @ 0xd77780] Using nv12 as format of reconstructed frames. [AVHWFramesContext @ 0xfb1ec0] Created surface 0x3. [AVHWFramesContext @ 0xfb1ec0] Direct mapping disabled: deriving image does not work: 1 (operation failed). [h264_vaapi @ 0xd77780] Using fixed QP = 20 / 20 / 24 for IDR- / P- / B-frames. [h264_vaapi @ 0xd77780] Using level 4.2. [matroska @ 0xd848c0] get_metadata_duration returned: 154581000 [matroska @ 0xd848c0] Write early duration from metadata = 154581 [out#0/matroska @ 0xdc5b40] Could not write header (incorrect codec parameters ?): Invalid data found when processing input [vost#0:0/h264_vaapi @ 0xd62d00] Error initializing output stream: [AVIOContext @ 0xd78dc0] Statistics: 293 bytes written, 0 seeks, 1 writeouts Terminating demuxer thread 0 [AVIOContext @ 0xd5f8c0] Statistics: 497750 bytes read, 0 seeks Conversion failed! ```

While HEVC:

ffmpeg -vaapi_device /dev/dri/renderD128 -v debug -i "file.webm" -c:v hevc_vaapi -vf 'format=nv12,hwupload' -c:a copy -y hevc-vaapi.mkv

even HDR:

ffmpeg -vaapi_device /dev/dri/renderD128 -v debug -i "file-hdr.webm" -c:v hevc_vaapi -vf 'hwupload' -c:a copy -y hevc-vaapi-hdr.mkv

are fine and confirmed playing.

AV1 of course wasn't encoding, as no VAEntrypointEncSlice is present with the current driver:

[av1_vaapi @ 0x1ad1fc0] Using input frames context (format vaapi) with av1_vaapi encoder.
[av1_vaapi @ 0x1ad1fc0] Input surface format is yuv420p.
[av1_vaapi @ 0x1ad1fc0] Using VAAPI profile VAProfileAV1Profile0 (32).
[av1_vaapi @ 0x1ad1fc0] No usable encoding entrypoint found for profile VAProfileAV1Profile0 (32).
[vost#0:0/av1_vaapi @ 0x1ad1d00] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

And: do to you by chance use VM rather then baremetal setup?

No, bare metal.

MikhailAMD commented 1 year ago

OK, several things - all for forced Vulkan Pro driver:

export VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json

  1. Provide the latest FFmpeg log with AMF failure.
  2. Provide output for

export AMDVLKXF="MME-4efe535a;MMD-edb8dc97;YUV-9c240ad2;MME-2ug4lyta" vulkaninfo |grep encode 3. export AMDVLKXF="MME-4efe535a;MMD-edb8dc97;YUV-9c240ad2;MME-2ug4lyta" ffmpeg - your command line

  1. Are you willing to provide remote access to the system to AMD developer? SSH?
cromefire commented 1 year ago

First of all, H264 and HEVC (8bit) seem to be working suddenly now. Double checking, it's only working if the pro driver is forced (which is okay I guess). Now to try and reproduce what when wrong that made it not work:

  1. dpkg still reports the same versions.
  2. unattended-upgrades has no logs
  3. vainfo output is still the same
  4. Installed all of the other stuff I had before again: sudo amdgpu-install --usecase="dkms,graphics,opencl,hip,rocm,mllib,amf" --opencl=rocr --vulkan=amdvlk,pro -y (the only thing I changed since 3 days ago)
  5. No changes in /var/log/apt/history.log
  6. Nothing in /var/log/dpkg.log

I have no idea what could have even changed (on the windows side the card had contact with the windows driver in between, but I believe the Windows driver doesn't just flash the VBIOS or so)... The system was rebooted multiple times (since it's a desktop), had multiple driver reinstalls and I always also tested with forced Vulkan driver. If you have anything else I could check, to see what changed I'm glad to try and track it down, but maybe confirmed working is good enough for now.

Maybe this helps (shows some errors eventhough it works):

[hevc_amf @ 0x17ca1c0] AMFVideoCore: 0123-01-27 22:51:27 67071800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc] Warning: Failed to create video core service!
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreBaseImpl: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreBaseImpl] Warning: Failed to QueryThroughput()!
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreBaseImpl: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreBaseImpl]    Info: AMFEncoderCoreBaseImpl::QueryThroughput - maxThroughputMBPerSec = 0, totalRequiredThroughputMBPerSec = 0
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcUsage:0
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcFrameSize:1920,1080
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcFrameRate:19001,317
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcProfile:1
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcTier:0
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcQualityPreset:10
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcAspectRatio:1,1
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcGOPSPerIDR:1
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcGOPSize:250
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcDeBlockingFilter:false
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcHeaderInsertionMode:0
[hevc_amf @ 0x17f5a00] Rate control turned to CBR
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcRateControlMethod:3
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcRateControlPreAnalysisEnable:false
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcEnableVBAQ:false
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcHalfPixel:true
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcQuarterPixel:true
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcEnforceHRD:false
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcFillerDataEnable:false
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcTargetBitrate:2000000
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcPeakBitrate:2000000
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcVBVBufferSize:50049
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcPeakBitrate:2000000
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::Init(YUV420P, 1920, 1080)
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreHevc: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreHevc] Warning: Failed to create video core service!
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreBaseImpl: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreBaseImpl] Warning: Failed to QueryThroughput()!
[hevc_amf @ 0x17ca1c0] AMFEncoderCoreBaseImpl: 0123-01-27 22:51:27 67071800 [AMFEncoderCoreBaseImpl]    Info: AMFEncoderCoreBaseImpl::QueryThroughput - maxThroughputMBPerSec = 0, totalRequiredThroughputMBPerSec = 0

So, what is not working yet is hevc 10bit (just encodes as 8bit), but that might be on ffmpeg not listing anything but yuv420p and nv12 as compatible and AV1. AV1 produces the following log:

[av1_amf @ 0x8a1dc0] AMF initialisation succeeded via Vulkan.
[av1_amf @ 0x8a1dc0] AMFVideoCore: 0123-01-27 23:00:32 DAE6E800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[av1_amf @ 0x8a1dc0] AMFEncoderCoreAv1: 0123-01-27 23:00:32 DAE6E800 [AMFEncoderCoreAv1] Warning: Failed to create video core service!
[av1_amf @ 0x8a1dc0] AMFEncoderCoreAv1: 0123-01-27 23:00:32 DAE6E800 [AMFEncoderCoreAv1] Warning: Codec disabled
[av1_amf @ 0x8a1dc0] AMFEncoderCoreAv1: 0123-01-27 23:00:32 DAE6E800 [AMFEncoderCoreAv1] Warning: CreateServices failed.
[av1_amf @ 0x8a1dc0] AMFEncoderCoreAv1: 0123-01-27 23:00:32 DAE6E800 [AMFEncoderCoreAv1] Warning: *****Failed to create AV1 encoder component.
[av1_amf @ 0x8a1dc0] AMFEncoderCoreAv1: 0123-01-27 23:00:32 DAE6E800 [AMFEncoderCoreAv1]   Debug: AMFEncoderCoreAv1Impl::Terminate()
[av1_amf @ 0x8c9600] CreateComponent(AMFVideoEncoderHW_AV1) failed with error 30

So it seems AV1 support just isn't enabled yet with the latest drivers, neither via VAAPI nor AMF (but I can create a new issue for that if you want, since this is a different error).

Thanks for all the support though, even though the culprit couldn't be identified precisely after all (or at least not confirmed).

MikhailAMD commented 1 year ago

Few things:

  1. Good thing that something is working
  2. Force Vulkan Pro driver is a must for AMF
  3. You may installed two Vulkan drivers because of "dkms,graphics,opencl,hip,rocm,mllib,amf" line. graphics installs open-source Vulkan driver and amf Vulkan Pro driver.
  4. AV1 vja AMF is supported in the driver. From the log it looks like you did not force Vulkan Pro driver
  5. HEVC 10-bit patch was submitted to FFmpeg but not merged yet, working on this.
  6. I suggest you provide successful FFmpeg log and CMD for H264 and failing for AV1 to compare.
  7. I cannot tell if VAAPI has AV1 encoder support or not.
cromefire commented 1 year ago

You may installed two Vulkan drivers because of "dkms,graphics,opencl,hip,rocm,mllib,amf" line. graphics installs open-source Vulkan driver and amf Vulkan Pro driver.

Yes I even installed all 3 now (RADV, AMDVLK and AMDVLK-PRO), but it's still working, so that didn't seem to be the issue. 🤷🏻‍♂️ (Just have to tell Vulkan which driver to use, which sounds totally reasonable)

  1. AV1 vja AMF is supported in the driver. From the log it looks like you did not force Vulkan Pro driver

  2. I suggest you provide successful FFmpeg log and CMD for H264 and failing for AV1 to compare.

AV1 with pro:

[av1_amf @ 0x1181dc0] AMF initialisation succeeded via Vulkan.
[av1_amf @ 0x1181dc0] AMFVideoCore: 0123-01-27 23:52:44 EC181800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[av1_amf @ 0x1181dc0] AMFEncoderCoreAv1: 0123-01-27 23:52:44 EC181800 [AMFEncoderCoreAv1] Warning: Failed to create video core service!
[av1_amf @ 0x1181dc0] AMFEncoderCoreAv1: 0123-01-27 23:52:44 EC181800 [AMFEncoderCoreAv1] Warning: Codec disabled
[av1_amf @ 0x1181dc0] AMFEncoderCoreAv1: 0123-01-27 23:52:44 EC181800 [AMFEncoderCoreAv1] Warning: CreateServices failed.
[av1_amf @ 0x1181dc0] AMFEncoderCoreAv1: 0123-01-27 23:52:44 EC181800 [AMFEncoderCoreAv1] Warning: *****Failed to create AV1 encoder component.
[av1_amf @ 0x1181dc0] AMFEncoderCoreAv1: 0123-01-27 23:52:44 EC181800 [AMFEncoderCoreAv1]   Debug: AMFEncoderCoreAv1Impl::Terminate()
[av1_amf @ 0x11a9600] CreateComponent(AMFVideoEncoderHW_AV1) failed with error 30

hevc with pro (working):

[hevc_amf @ 0x1613dc0] AMF initialisation succeeded via Vulkan.
[hevc_amf @ 0x1613dc0] AMFVideoCore: 0123-01-27 23:52:26 B064D800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc] Warning: Failed to create video core service!
[hevc_amf @ 0x1613dc0] AMFEncoderCoreBaseImpl: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreBaseImpl] Warning: Failed to QueryThroughput()!
[hevc_amf @ 0x1613dc0] AMFEncoderCoreBaseImpl: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreBaseImpl]    Info: AMFEncoderCoreBaseImpl::QueryThroughput - maxThroughputMBPerSec = 0, totalRequiredThroughputMBPerSec = 0
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcUsage:0
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcFrameSize:1920,1080
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcFrameRate:19001,317
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcProfile:1
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcTier:0
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcQualityPreset:10
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcAspectRatio:1,1
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcGOPSPerIDR:1
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcGOPSize:250
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcDeBlockingFilter:false
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcHeaderInsertionMode:0
[hevc_amf @ 0x163b600] Rate control turned to CBR
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcRateControlMethod:3
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcRateControlPreAnalysisEnable:false
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcEnableVBAQ:false
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcHalfPixel:true
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty HevcQuarterPixel:true
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcEnforceHRD:false
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcFillerDataEnable:false
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcTargetBitrate:2000000
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcPeakBitrate:2000000
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcVBVBufferSize:50049
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: SetProperty TL0.QL0.HevcPeakBitrate:2000000
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::Init(YUV420P, 1920, 1080)
[hevc_amf @ 0x1613dc0] AMFEncoderCoreHevc: 0123-01-27 23:52:26 B064D800 [AMFEncoderCoreHevc] Warning: Failed to create video core service!

AV1 without pro:

[av1_amf @ 0xaaadc0] AMF initialisation succeeded via Vulkan.
[av1_amf @ 0xaaadc0] AMFVideoCore: 0123-01-27 23:54:20 6E551800 [AMFVideoCore] Warning: AMFVideoCore::Init() Versions Differ, hostVersion=20003 videoCoreVersion=20002
[av1_amf @ 0xaaadc0] EncodeQueueVulkan: 0123-01-27 23:54:20 6E551800 [EncodeQueueVulkan]    Info: EncodeQueueServiceVulkanImpl::Initialize() new encode queue extension is not supported
[av1_amf @ 0xaaadc0] EncodeQueueService: 0123-01-27 23:54:20 6E551800 [EncodeQueueService] Warning: Failed to create encode queue serivce.
[av1_amf @ 0xaaadc0] AMFEncoderCoreBaseImpl: 0123-01-27 23:54:20 6E551800 [AMFEncoderCoreBaseImpl] Warning: Failed to initialize EncodeQueueFactory.
[av1_amf @ 0xaaadc0] AMFEncoderCoreBaseImpl: 0123-01-27 23:54:20 6E551800 [AMFEncoderCoreBaseImpl] Warning: Failed to create encode queue serivce.
[av1_amf @ 0xaaadc0] AMFEncoderCoreAv1: 0123-01-27 23:54:20 6E551800 [AMFEncoderCoreAv1] Warning: Encode Core dll not found
[av1_amf @ 0xaaadc0] AMFEncoderCoreAv1: 0123-01-27 23:54:20 6E551800 [AMFEncoderCoreAv1] Warning: CreateServices failed.
[av1_amf @ 0xaaadc0] AMFEncoderCoreAv1: 0123-01-27 23:54:20 6E551800 [AMFEncoderCoreAv1] Warning: *****Failed to create AV1 encoder component.
[av1_amf @ 0xaaadc0] AMFEncoderCoreAv1: 0123-01-27 23:54:20 6E551800 [AMFEncoderCoreAv1]   Debug: AMFEncoderCoreAv1Impl::Terminate()

HEVC 10-bit patch was submitted to FFmpeg but not merged yet, working on this.

Awesome, (AV1 also needs the same treatment it seems), also if you don't mind, do you have a link to the patch?

MikhailAMD commented 1 year ago

Hi @cromefire, thanks for the patience. AV1 issue has been reproduced, internal ticket will be created, We will push for the fix ASAP. HEVC 10-bit patch: http://ffmpeg.org/pipermail/ffmpeg-devel/2022-September/301111.html http://ffmpeg.org/pipermail/ffmpeg-devel/2022-September/301110.html

cromefire commented 1 year ago

Just realized I didn't answer it, but if SSH access is ever needed there's probably a way to get that done, you just would have to give me a little heads up, so I can set stuff up with port forwarding and so on. Otherwise I'm available to test whatever you need of course.

MikhailAMD commented 1 year ago

Thank you, as the issue reproduced on our side, we are good for now.

cromefire commented 1 year ago

Can confirm HEVC Main10 is also working correctly (hopefully ffmpeg will finally pull those patches...), although AV1 doesn't seem to be included in the patch, but it might be easy enough to at least get it working on my own.

Edit: Can't test it yet of course and it's only a best guess, with only a quick look at the actual documentation, but here's a (compiling) patch for 10bit AV1:

amf-av1-10bit.patch ```patch libavcodec/amfenc_av1.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c index 8093cb7357..fe621aeb20 100644 --- a/libavcodec/amfenc_av1.c +++ b/libavcodec/amfenc_av1.c @@ -110,6 +110,9 @@ static av_cold int amf_encode_init_av1(AVCodecContext* avctx) AMFGuid guid; AMFRate framerate; AMFSize framesize = AMFConstructSize(avctx->width, avctx->height); + amf_int64 color_depth; + amf_int64 color_profile; + enum AVPixelFormat pix_fmt; @@ -156,6 +159,45 @@ static av_cold int amf_encode_init_av1(AVCodecContext* avctx) AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_MAX_NUM_REFRAMES, avctx->refs); } + // Color Metadata + /// Color Space & Depth + pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format + : avctx->pix_fmt; + if (pix_fmt == AV_PIX_FMT_P010) { + color_depth = AMF_COLOR_BIT_DEPTH_10; + } + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN; + switch (avctx->colorspace) { + case AVCOL_SPC_SMPTE170M: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601; + } + break; + case AVCOL_SPC_BT709: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709; + } + break; + case AVCOL_SPC_BT2020_NCL: + case AVCOL_SPC_BT2020_CL: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020; + } + break; + } + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_COLOR_BIT_DEPTH, color_depth); + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PROFILE, color_profile); + /// Color Transfer Characteristics (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc); + /// Color Primaries (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries); + // Picture control properties AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size); ```
cromefire commented 1 year ago

Happy to confirm that AV1 is working now (with 5.5.1) as well.

If someone stumbles upon this here's what you need to achive full function right now:

Patches:

amf-hevc-10bit-02.patch ``` From: Michael Fabian 'Xaymar' Dirks added 10 bit support for amf hevc. before: command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file.mkv -an -c:v h264_amf res.dx11_hw_h264.mkv output - Format of input frames context (p010le) is not supported by AMF. command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file -an -c:v hevc_amf res.dx11_hw_hevc.mkv output - Format of input frames context (p010le) is not supported by AMF. after: command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file -an -c:v h264_amf res.dx11_hw_h264.mkv output - 8bit file command - ffmpeg.exe -hide_banner -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i test_10bit_file -an -c:v hevc_amf res.dx11_hw_hevc.mkv output - 10bit file v2 - lost line returned in ff_amf_pix_fmts --- libavcodec/amfenc.c | 2 ++ libavcodec/amfenc.h | 1 + libavcodec/amfenc_h264.c | 46 ++++++++++++++++++++++++++++++++- libavcodec/amfenc_hevc.c | 55 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 102 insertions(+), 2 deletions(-) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index a033e1220e..efff9b5ae8 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -60,6 +60,7 @@ const enum AVPixelFormat ff_amf_pix_fmts[] = { #if CONFIG_DXVA2 AV_PIX_FMT_DXVA2_VLD, #endif + AV_PIX_FMT_P010, AV_PIX_FMT_NONE }; @@ -72,6 +73,7 @@ static const FormatMap format_map[] = { { AV_PIX_FMT_NONE, AMF_SURFACE_UNKNOWN }, { AV_PIX_FMT_NV12, AMF_SURFACE_NV12 }, + { AV_PIX_FMT_P010, AMF_SURFACE_P010 }, { AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA }, { AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA }, { AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 }, diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h index 1ab98d2f78..c5ee9d7e35 100644 --- a/libavcodec/amfenc.h +++ b/libavcodec/amfenc.h @@ -21,6 +21,7 @@ #include +#include #include #include #include diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c index eaf7f974f3..7a0198e6a8 100644 --- a/libavcodec/amfenc_h264.c +++ b/libavcodec/amfenc_h264.c @@ -138,6 +138,9 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx) AMFRate framerate; AMFSize framesize = AMFConstructSize(avctx->width, avctx->height); int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0; + amf_int64 color_depth; + amf_int64 color_profile; + enum AVPixelFormat pix_fmt; if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den); @@ -195,10 +198,51 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx) AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_ASPECT_RATIO, ratio); } - /// Color Range (Partial/TV/MPEG or Full/PC/JPEG) + // Color Metadata + /// Color Range (Support for older Drivers) if (avctx->color_range == AVCOL_RANGE_JPEG) { AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 1); + } else { + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 0); + } + /// Color Space & Depth + pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format + : avctx->pix_fmt; + color_depth = AMF_COLOR_BIT_DEPTH_8; + if (pix_fmt == AV_PIX_FMT_P010) { + color_depth = AMF_COLOR_BIT_DEPTH_10; + } + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN; + switch (avctx->colorspace) { + case AVCOL_SPC_SMPTE170M: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601; + } + break; + case AVCOL_SPC_BT709: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709; + } + break; + case AVCOL_SPC_BT2020_NCL: + case AVCOL_SPC_BT2020_CL: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020; + } + break; } + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH, color_depth); + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE, color_profile); + /// Color Transfer Characteristics (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc); + /// Color Primaries (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries); // autodetect rate control method if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN) { diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c index 9b46946f1e..804d35bbd3 100644 --- a/libavcodec/amfenc_hevc.c +++ b/libavcodec/amfenc_hevc.c @@ -31,8 +31,9 @@ static const AVOption options[] = { { "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" }, { "webcam", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM }, 0, 0, VE, "usage" }, - { "profile", "Set the profile (default main)", OFFSET(profile), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, VE, "profile" }, + { "profile", "Set the profile (default main)", OFFSET(profile), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10, VE, "profile" }, { "main", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, 0, 0, VE, "profile" }, + { "main10", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10 }, 0, 0, VE, "profile" }, { "profile_tier", "Set the profile tier (default main)", OFFSET(tier), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN }, AMF_VIDEO_ENCODER_HEVC_TIER_MAIN, AMF_VIDEO_ENCODER_HEVC_TIER_HIGH, VE, "tier" }, { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN }, 0, 0, VE, "tier" }, @@ -105,6 +106,9 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx) AMFRate framerate; AMFSize framesize = AMFConstructSize(avctx->width, avctx->height); int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0; + amf_int64 color_depth; + amf_int64 color_profile; + enum AVPixelFormat pix_fmt; if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den); @@ -122,10 +126,14 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx) AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_FRAMERATE, framerate); + color_depth = AMF_COLOR_BIT_DEPTH_8; switch (avctx->profile) { case FF_PROFILE_HEVC_MAIN: profile = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN; break; + case FF_PROFILE_HEVC_MAIN_10: + profile = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10; + break; default: break; } @@ -154,6 +162,51 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx) AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO, ratio); } + // Color Metadata + /// Color Range (Support for older Drivers) + if (avctx->color_range == AVCOL_RANGE_JPEG) { + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 1); + } else { + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 0); + } + /// Color Space & Depth + pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format + : avctx->pix_fmt; + if (pix_fmt == AV_PIX_FMT_P010) { + color_depth = AMF_COLOR_BIT_DEPTH_10; + } + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN; + switch (avctx->colorspace) { + case AVCOL_SPC_SMPTE170M: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601; + } + break; + case AVCOL_SPC_BT709: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709; + } + break; + case AVCOL_SPC_BT2020_NCL: + case AVCOL_SPC_BT2020_CL: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020; + } + break; + } + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH, color_depth); + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE, color_profile); + /// Color Transfer Characteristics (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc); + /// Color Primaries (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries); + // Picture control properties AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr); AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size); -- 2.30.0.windows.2 ```
amf-hevc-10bit-03.patch ``` From: nyanmisaka --- libavcodec/amfenc.c | 83 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index efff9b5ae8..346f86bf00 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -36,6 +36,57 @@ #include "amfenc.h" #include "encode.h" #include "internal.h" +#include "libavutil/mastering_display_metadata.h" + +static int amf_save_hdr_metadata(AVCodecContext *avctx, const AVFrame *frame, AMFHDRMetadata *hdrmeta) +{ + AVFrameSideData *sd_display; + AVFrameSideData *sd_light; + AVMasteringDisplayMetadata *display_meta; + AVContentLightMetadata *light_meta; + + sd_display = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); + if (sd_display) { + display_meta = (AVMasteringDisplayMetadata *)sd_display->data; + if (display_meta->has_luminance) { + const unsigned int luma_den = 10000; + hdrmeta->maxMasteringLuminance = + (amf_uint32)(luma_den * av_q2d(display_meta->max_luminance)); + hdrmeta->minMasteringLuminance = + FFMIN((amf_uint32)(luma_den * av_q2d(display_meta->min_luminance)), hdrmeta->maxMasteringLuminance); + } + if (display_meta->has_primaries) { + const unsigned int chroma_den = 50000; + hdrmeta->redPrimary[0] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[0][0])), chroma_den); + hdrmeta->redPrimary[1] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[0][1])), chroma_den); + hdrmeta->greenPrimary[0] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[1][0])), chroma_den); + hdrmeta->greenPrimary[1] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[1][1])), chroma_den); + hdrmeta->bluePrimary[0] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[2][0])), chroma_den); + hdrmeta->bluePrimary[1] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->display_primaries[2][1])), chroma_den); + hdrmeta->whitePoint[0] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->white_point[0])), chroma_den); + hdrmeta->whitePoint[1] = + FFMIN((amf_uint16)(chroma_den * av_q2d(display_meta->white_point[1])), chroma_den); + } + + sd_light = av_frame_get_side_data(frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); + if (sd_light) { + light_meta = (AVContentLightMetadata *)sd_light->data; + if (light_meta) { + hdrmeta->maxContentLightLevel = (amf_uint16)light_meta->MaxCLL; + hdrmeta->maxFrameAverageLightLevel = (amf_uint16)light_meta->MaxFALL; + } + } + return 0; + } + return 1; +} #if CONFIG_D3D11VA #include @@ -673,6 +724,26 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer); } + // HDR10 metadata + if (frame->color_trc == AVCOL_TRC_SMPTE2084) { + AMFBuffer * hdrmeta_buffer = NULL; + res = ctx->context->pVtbl->AllocBuffer(ctx->context, AMF_MEMORY_HOST, sizeof(AMFHDRMetadata), &hdrmeta_buffer); + if (res == AMF_OK) { + AMFHDRMetadata * hdrmeta = (AMFHDRMetadata*)hdrmeta_buffer->pVtbl->GetNative(hdrmeta_buffer); + if (amf_save_hdr_metadata(avctx, frame, hdrmeta) == 0) { + switch (avctx->codec->id) { + case AV_CODEC_ID_H264: + AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_HDR_METADATA, hdrmeta_buffer); break; + case AV_CODEC_ID_HEVC: + AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA, hdrmeta_buffer); break; + } + res = amf_set_property_buffer(surface, L"av_frame_hdrmeta", hdrmeta_buffer); + AMF_RETURN_IF_FALSE(avctx, res == AMF_OK, AVERROR_UNKNOWN, "SetProperty failed for \"av_frame_hdrmeta\" with error %d\n", res); + } + hdrmeta_buffer->pVtbl->Release(hdrmeta_buffer); + } + } + surface->pVtbl->SetPts(surface, frame->pts); AMF_ASSIGN_PROPERTY_INT64(res, surface, PTS_PROP, frame->pts); @@ -731,6 +802,18 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) AMF_RETURN_IF_FALSE(ctx, ret >= 0, ret, "amf_copy_buffer() failed with error %d\n", ret); if (ctx->delayed_surface != NULL) { // try to resubmit frame + if (ctx->delayed_surface->pVtbl->HasProperty(ctx->delayed_surface, L"av_frame_hdrmeta")) { + AMFBuffer * hdrmeta_buffer = NULL; + res = amf_get_property_buffer((AMFData *)ctx->delayed_surface, L"av_frame_hdrmeta", &hdrmeta_buffer); + AMF_RETURN_IF_FALSE(avctx, res == AMF_OK, AVERROR_UNKNOWN, "GetProperty failed for \"av_frame_hdrmeta\" with error %d\n", res); + switch (avctx->codec->id) { + case AV_CODEC_ID_H264: + AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_HDR_METADATA, hdrmeta_buffer); break; + case AV_CODEC_ID_HEVC: + AMF_ASSIGN_PROPERTY_INTERFACE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA, hdrmeta_buffer); break; + } + hdrmeta_buffer->pVtbl->Release(hdrmeta_buffer); + } res = ctx->encoder->pVtbl->SubmitInput(ctx->encoder, (AMFData*)ctx->delayed_surface); if (res != AMF_INPUT_FULL) { int64_t pts = ctx->delayed_surface->pVtbl->GetPts(ctx->delayed_surface); -- 2.30.0.windows.2 ```
amf-av1-10bit.patch ``` libavcodec/amfenc_av1.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c index 8093cb7357..fe621aeb20 100644 --- a/libavcodec/amfenc_av1.c +++ b/libavcodec/amfenc_av1.c @@ -110,6 +110,9 @@ static av_cold int amf_encode_init_av1(AVCodecContext* avctx) AMFGuid guid; AMFRate framerate; AMFSize framesize = AMFConstructSize(avctx->width, avctx->height); + amf_int64 color_depth; + amf_int64 color_profile; + enum AVPixelFormat pix_fmt; @@ -156,6 +159,47 @@ static av_cold int amf_encode_init_av1(AVCodecContext* avctx) AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_MAX_NUM_REFRAMES, avctx->refs); } + // Color Metadata + /// Color Space & Depth + pix_fmt = avctx->hw_frames_ctx ? ((AVHWFramesContext*)avctx->hw_frames_ctx->data)->sw_format + : avctx->pix_fmt; + if (pix_fmt == AV_PIX_FMT_P010) { + color_depth = AMF_COLOR_BIT_DEPTH_10; + } else { + color_depth = AMF_COLOR_BIT_DEPTH_8; + } + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN; + switch (avctx->colorspace) { + case AVCOL_SPC_SMPTE170M: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601; + } + break; + case AVCOL_SPC_BT709: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709; + } + break; + case AVCOL_SPC_BT2020_NCL: + case AVCOL_SPC_BT2020_CL: + if (avctx->color_range == AVCOL_RANGE_JPEG) { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020; + } else { + color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020; + } + break; + } + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_COLOR_BIT_DEPTH, color_depth); + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PROFILE, color_profile); + /// Color Transfer Characteristics (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc); + /// Color Primaries (AMF matches ISO/IEC) + AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries); + // Picture control properties AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size); ```

@MikhailAMD If you want to and find some time maybe one of you can also upstream the AV1 patch (anyone has my explicit permission to do what ever they want with the patch without any credit) or add it to the HEVC patch or so, so maybe we can get all of that natively one day.