mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Workaround for linux 5.18+ i915 hang at cost of performance
This commit is contained in:
parent
47c2c536e4
commit
58f61ed118
1 changed files with 28 additions and 0 deletions
|
@ -35,6 +35,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
private readonly ISubtitleEncoder _subtitleEncoder;
|
private readonly ISubtitleEncoder _subtitleEncoder;
|
||||||
private readonly IConfiguration _config;
|
private readonly IConfiguration _config;
|
||||||
|
private readonly Version _minKernelVersioni915Hang = new Version(5, 18);
|
||||||
|
|
||||||
private static readonly string[] _videoProfilesH264 = new[]
|
private static readonly string[] _videoProfilesH264 = new[]
|
||||||
{
|
{
|
||||||
|
@ -1302,6 +1303,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
// which will reduce overhead in performance intensive tasks such as 4k transcoding and tonemapping.
|
// which will reduce overhead in performance intensive tasks such as 4k transcoding and tonemapping.
|
||||||
var intelLowPowerHwEncoding = false;
|
var intelLowPowerHwEncoding = false;
|
||||||
|
|
||||||
|
// Workaround for linux 5.18+ i915 hang at cost of performance.
|
||||||
|
// https://github.com/intel/media-driver/issues/1456
|
||||||
|
var enableWaFori915Hang = false;
|
||||||
|
|
||||||
if (string.Equals(encodingOptions.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(encodingOptions.HardwareAccelerationType, "vaapi", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var isIntelVaapiDriver = _mediaEncoder.IsVaapiDeviceInteliHD || _mediaEncoder.IsVaapiDeviceInteli965;
|
var isIntelVaapiDriver = _mediaEncoder.IsVaapiDeviceInteliHD || _mediaEncoder.IsVaapiDeviceInteli965;
|
||||||
|
@ -1317,6 +1322,20 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
}
|
}
|
||||||
else if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
if (OperatingSystem.IsLinux() && Environment.OSVersion.Version >= _minKernelVersioni915Hang)
|
||||||
|
{
|
||||||
|
var vidDecoder = GetHardwareVideoDecoder(state, encodingOptions) ?? string.Empty;
|
||||||
|
var isIntelDecoder = vidDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| vidDecoder.Contains("vaapi", StringComparison.OrdinalIgnoreCase);
|
||||||
|
var doOclTonemap = _mediaEncoder.SupportsHwaccel("qsv")
|
||||||
|
&& IsVaapiSupported(state)
|
||||||
|
&& IsOpenclFullSupported()
|
||||||
|
&& !IsVaapiVppTonemapAvailable(state, encodingOptions)
|
||||||
|
&& IsHwTonemapAvailable(state, encodingOptions);
|
||||||
|
|
||||||
|
enableWaFori915Hang = isIntelDecoder && doOclTonemap;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
intelLowPowerHwEncoding = encodingOptions.EnableIntelLowPowerH264HwEncoder;
|
intelLowPowerHwEncoding = encodingOptions.EnableIntelLowPowerH264HwEncoder;
|
||||||
|
@ -1325,6 +1344,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
intelLowPowerHwEncoding = encodingOptions.EnableIntelLowPowerHevcHwEncoder;
|
intelLowPowerHwEncoding = encodingOptions.EnableIntelLowPowerHevcHwEncoder;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
enableWaFori915Hang = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intelLowPowerHwEncoding)
|
if (intelLowPowerHwEncoding)
|
||||||
|
@ -1332,6 +1355,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
param += " -low_power 1";
|
param += " -low_power 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enableWaFori915Hang)
|
||||||
|
{
|
||||||
|
param += " -async_depth 1";
|
||||||
|
}
|
||||||
|
|
||||||
var isVc1 = string.Equals(state.VideoStream?.Codec, "vc1", StringComparison.OrdinalIgnoreCase);
|
var isVc1 = string.Equals(state.VideoStream?.Codec, "vc1", StringComparison.OrdinalIgnoreCase);
|
||||||
var isLibX265 = string.Equals(videoEncoder, "libx265", StringComparison.OrdinalIgnoreCase);
|
var isLibX265 = string.Equals(videoEncoder, "libx265", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue