@ -35,7 +35,11 @@ namespace MediaBrowser.Controller.MediaEncoding
private readonly IMediaEncoder _mediaEncoder ;
private readonly ISubtitleEncoder _subtitleEncoder ;
private readonly IConfiguration _config ;
private readonly Version _minKernelVersioni915Hang = new Version ( 5 , 18 ) ;
// i915 hang was fixed by linux 6.2 (3f882f2)
private readonly Version _minKerneli915Hang = new Version ( 5 , 18 ) ;
private readonly Version _maxKerneli915Hang = new Version ( 6 , 1 , 3 ) ;
private readonly Version _minFixedKernel60i915Hang = new Version ( 6 , 0 , 18 ) ;
private static readonly string [ ] _videoProfilesH264 = new [ ]
{
@ -1309,7 +1313,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// which will reduce overhead in performance intensive tasks such as 4k transcoding and tonemapping.
var intelLowPowerHwEncoding = false ;
// Workaround for linux 5.18 + i915 hang at cost of performance.
// Workaround for linux 5.18 to 6.1.3 i915 hang at cost of performance.
// https://github.com/intel/media-driver/issues/1456
var enableWaFori915Hang = false ;
@ -1328,18 +1332,25 @@ namespace MediaBrowser.Controller.MediaEncoding
}
else if ( string . Equals ( encodingOptions . HardwareAccelerationType , "qsv" , StringComparison . OrdinalIgnoreCase ) )
{
if ( OperatingSystem . IsLinux ( ) & & Environment . OSVersion . Version > = _minKernelVersioni915Hang )
if ( OperatingSystem . IsLinux ( ) )
{
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 ) ;
var ver = Environment . OSVersion . Version ;
var isFixedKernel60 = ver . Major = = 6 & & ver . Minor = = 0 & & ver > = _minFixedKernel60i915Hang ;
var isUnaffectedKernel = ver < _minKerneli915Hang | | ver > _maxKerneli915Hang ;
enableWaFori915Hang = isIntelDecoder & & doOclTonemap ;
if ( ! ( isUnaffectedKernel | | isFixedKernel60 ) )
{
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 ) )