Merge pull request #9584 from nyanmisaka/wa-va-vk-tearing

pull/9609/head
Bond-009 2 years ago committed by GitHub
commit 10659f9be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -842,12 +842,11 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
var filterDevArgs = GetFilterHwDeviceArgs(VaapiAlias); var filterDevArgs = GetFilterHwDeviceArgs(VaapiAlias);
var doOclTonemap = isHwTonemapAvailable && IsOpenclFullSupported();
if (isHwTonemapAvailable && IsOpenclFullSupported())
{
if (_mediaEncoder.IsVaapiDeviceInteliHD || _mediaEncoder.IsVaapiDeviceInteli965) if (_mediaEncoder.IsVaapiDeviceInteliHD || _mediaEncoder.IsVaapiDeviceInteli965)
{ {
if (!isVaapiDecoder) if (doOclTonemap && !isVaapiDecoder)
{ {
args.Append(GetOpenclDeviceArgs(0, null, VaapiAlias, OpenclAlias)); args.Append(GetOpenclDeviceArgs(0, null, VaapiAlias, OpenclAlias));
filterDevArgs = GetFilterHwDeviceArgs(OpenclAlias); filterDevArgs = GetFilterHwDeviceArgs(OpenclAlias);
@ -855,26 +854,26 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
else if (_mediaEncoder.IsVaapiDeviceAmd) else if (_mediaEncoder.IsVaapiDeviceAmd)
{ {
if (!IsVulkanFullSupported() if (IsVulkanFullSupported()
|| !_mediaEncoder.IsVaapiDeviceSupportVulkanFmtModifier && _mediaEncoder.IsVaapiDeviceSupportVulkanFmtModifier
|| Environment.OSVersion.Version < _minKernelVersionAmdVkFmtModifier) && Environment.OSVersion.Version >= _minKernelVersionAmdVkFmtModifier)
{
args.Append(GetOpenclDeviceArgs(0, "Advanced Micro Devices", null, OpenclAlias));
filterDevArgs = GetFilterHwDeviceArgs(OpenclAlias);
}
else
{ {
// libplacebo wants an explicitly set vulkan filter device. // libplacebo wants an explicitly set vulkan filter device.
args.Append(GetVulkanDeviceArgs(0, null, VaapiAlias, VulkanAlias)); args.Append(GetVulkanDeviceArgs(0, null, VaapiAlias, VulkanAlias));
filterDevArgs = GetFilterHwDeviceArgs(VulkanAlias); filterDevArgs = GetFilterHwDeviceArgs(VulkanAlias);
} }
else if (doOclTonemap)
{
// ROCm/ROCr OpenCL runtime
args.Append(GetOpenclDeviceArgs(0, "Advanced Micro Devices", null, OpenclAlias));
filterDevArgs = GetFilterHwDeviceArgs(OpenclAlias);
} }
else }
else if (doOclTonemap)
{ {
args.Append(GetOpenclDeviceArgs(0, null, null, OpenclAlias)); args.Append(GetOpenclDeviceArgs(0, null, null, OpenclAlias));
filterDevArgs = GetFilterHwDeviceArgs(OpenclAlias); filterDevArgs = GetFilterHwDeviceArgs(OpenclAlias);
} }
}
args.Append(filterDevArgs); args.Append(filterDevArgs);
} }
@ -4269,7 +4268,8 @@ namespace MediaBrowser.Controller.MediaEncoding
// sw => hw // sw => hw
if (doVkTonemap) if (doVkTonemap)
{ {
mainFilters.Add("hwupload_vaapi"); mainFilters.Add("hwupload=derive_device=vaapi");
mainFilters.Add("format=vaapi");
mainFilters.Add("hwmap=derive_device=vulkan"); mainFilters.Add("hwmap=derive_device=vulkan");
mainFilters.Add("format=vulkan"); mainFilters.Add("format=vulkan");
} }
@ -4380,12 +4380,15 @@ namespace MediaBrowser.Controller.MediaEncoding
// prefer vaapi hwupload to vulkan hwupload, // prefer vaapi hwupload to vulkan hwupload,
// Mesa RADV does not support a dedicated transfer queue. // Mesa RADV does not support a dedicated transfer queue.
subFilters.Add("hwupload_vaapi"); subFilters.Add("hwupload=derive_device=vaapi");
subFilters.Add("format=vaapi");
subFilters.Add("hwmap=derive_device=vulkan"); subFilters.Add("hwmap=derive_device=vulkan");
subFilters.Add("format=vulkan"); subFilters.Add("format=vulkan");
overlayFilters.Add("overlay_vulkan=eof_action=endall:shortest=1:repeatlast=0"); overlayFilters.Add("overlay_vulkan=eof_action=endall:shortest=1:repeatlast=0");
overlayFilters.Add("scale_vulkan=format=nv12");
// TODO: figure out why libplacebo can sync without vaSyncSurface VPP support in radeonsi.
overlayFilters.Add("libplacebo=format=nv12:apply_filmgrain=0:apply_dolbyvision=0:upscaler=none:downscaler=none:dithering=none");
// OUTPUT vaapi(nv12/bgra) surface(vram) // OUTPUT vaapi(nv12/bgra) surface(vram)
// reverse-mapping via vaapi-vulkan interop. // reverse-mapping via vaapi-vulkan interop.

Loading…
Cancel
Save