mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 12:40:09 +01:00
mediafoundation: Remove Agility v717 guards for features now available in v618
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37581>
This commit is contained in:
parent
b06b2fbaba
commit
3ba07819aa
8 changed files with 7 additions and 48 deletions
|
|
@ -422,16 +422,14 @@ CDX12EncHMFT::IsSupported( const GUID *Api )
|
|||
}
|
||||
}
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
if( (*Api == CODECAPI_AVEncWorkGlobalPriority) || (*Api == CODECAPI_AVEncWorkProcessPriority) )
|
||||
if( (*Api == CODECAPI_AVEncWorkGlobalPriority) || (*Api == CODECAPI_AVEncWorkProcessPriority) )
|
||||
{
|
||||
if(m_EncoderCapabilities.m_bHWSupportsQueuePriorityManagement)
|
||||
{
|
||||
if(m_EncoderCapabilities.m_bHWSupportsQueuePriorityManagement)
|
||||
{
|
||||
hr = S_OK;
|
||||
return hr;
|
||||
}
|
||||
hr = S_OK;
|
||||
return hr;
|
||||
}
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
}
|
||||
|
||||
if( m_EncoderCapabilities.m_TwoPassSupport.bits.supports_1pass_recon_writing_skip )
|
||||
{
|
||||
|
|
@ -931,7 +929,6 @@ CDX12EncHMFT::GetValue( const GUID *Api, VARIANT *Value )
|
|||
Value->vt = VT_BOOL;
|
||||
Value->boolVal = m_bRateControlFramePreAnalysisExternalReconDownscale ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
else if( *Api == CODECAPI_AVEncWorkGlobalPriority )
|
||||
{
|
||||
Value->vt = VT_UI4;
|
||||
|
|
@ -942,7 +939,6 @@ CDX12EncHMFT::GetValue( const GUID *Api, VARIANT *Value )
|
|||
Value->vt = VT_UI4;
|
||||
Value->ulVal = (UINT32) m_WorkProcessPriority;
|
||||
}
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
else if( *Api == CODECAPI_AVEncVideoInputDeltaQPBlockSettings )
|
||||
{
|
||||
InputQPSettings hevcDeltaQPSettings;
|
||||
|
|
@ -1659,10 +1655,8 @@ CDX12EncHMFT::SetValue( const GUID *Api, VARIANT *Value )
|
|||
{
|
||||
CHECKHR_GOTO( E_INVALIDARG, done );
|
||||
}
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
m_WorkProcessPriority = (D3D12_COMMAND_QUEUE_PROCESS_PRIORITY) (Value->ulVal);;
|
||||
m_bWorkProcessPrioritySet = TRUE;
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
}
|
||||
else if( *Api == CODECAPI_AVEncWorkGlobalPriority )
|
||||
{
|
||||
|
|
@ -1676,10 +1670,8 @@ CDX12EncHMFT::SetValue( const GUID *Api, VARIANT *Value )
|
|||
{
|
||||
CHECKHR_GOTO( E_INVALIDARG, done );
|
||||
}
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
m_WorkGlobalPriority = (D3D12_COMMAND_QUEUE_GLOBAL_PRIORITY) Value->ulVal;
|
||||
m_bWorkGlobalPrioritySet = TRUE;
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
}
|
||||
else if( *Api == CODECAPI_AVEncVideoOutputQPMapBlockSize )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,10 +38,8 @@ typedef class DX12EncodeContext
|
|||
struct pipe_fence_handle *pAsyncFence = NULL;
|
||||
std::vector<struct pipe_resource *> pOutputBitRes;
|
||||
std::vector<struct pipe_fence_handle *> pSliceFences;
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
D3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM_NOTIFICATION_MODE sliceNotificationMode =
|
||||
D3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM_NOTIFICATION_MODE_FULL_FRAME;
|
||||
#endif // (USE_D3D12_PREVIEW_HEADERS && (D3D12_PREVIEW_SDK_VERSION >= 717))
|
||||
pipe_resource *pPipeResourceQPMapStats = nullptr;
|
||||
pipe_resource *pPipeResourceSATDMapStats = nullptr;
|
||||
pipe_resource *pPipeResourceRCBitAllocMapStats = nullptr;
|
||||
|
|
|
|||
|
|
@ -477,8 +477,6 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
|
||||
pDX12EncodeContext->pVlScreen = m_pVlScreen; // weakref
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
//
|
||||
// Update the encoder priorities (if any set)
|
||||
//
|
||||
|
|
@ -509,8 +507,6 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
m_bWorkGlobalPrioritySet = FALSE;
|
||||
}
|
||||
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
// Call the helper for encoder specific work
|
||||
pDX12EncodeContext->encoderPicInfo.base.in_fence = pPipeEncoderInputFenceHandle;
|
||||
pDX12EncodeContext->encoderPicInfo.base.in_fence_value = pipeEncoderInputFenceHandleValue;
|
||||
|
|
@ -534,7 +530,6 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
std::max( 1u, pDX12EncodeContext->encoderPicInfo.av1enc.tile_rows * pDX12EncodeContext->encoderPicInfo.av1enc.tile_cols );
|
||||
#endif
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
pDX12EncodeContext->sliceNotificationMode = D3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM_NOTIFICATION_MODE_FULL_FRAME;
|
||||
if( m_EncoderCapabilities.m_HWSupportSlicedFences.bits.supported && ( num_output_buffers > 1 ) )
|
||||
{
|
||||
|
|
@ -551,7 +546,6 @@ CDX12EncHMFT::PrepareForEncode( IMFSample *pSample, LPDX12EncodeContext *ppDX12E
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif // (USE_D3D12_PREVIEW_HEADERS && (D3D12_PREVIEW_SDK_VERSION >= 717))
|
||||
{
|
||||
// Buffer byte size for full frame bitstream (when num_output_buffers == 1)
|
||||
templ.width0 = m_uiMaxOutputBitstreamSize;
|
||||
|
|
|
|||
|
|
@ -158,9 +158,7 @@ encoder_capabilities::initialize( pipe_screen *pScreen, pipe_video_profile video
|
|||
m_PSNRStatsSupport.value =
|
||||
pScreen->get_video_param( pScreen, videoProfile, PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_ENC_GPU_STATS_PSNR );
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
d3d12_interop_device_info1 screen_interop_info = {};
|
||||
bool successQuery = pScreen->interop_query_device_info(pScreen, sizeof(d3d12_interop_device_info1), &screen_interop_info) != 0;
|
||||
m_bHWSupportsQueuePriorityManagement = successQuery && screen_interop_info.set_context_queue_priority_manager != NULL;
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
}
|
||||
|
|
|
|||
|
|
@ -742,12 +742,10 @@ class __declspec( uuid( HMFT_GUID ) ) CDX12EncHMFT : CMFD3DManager,
|
|||
BOOL m_bRateControlFramePreAnalysis = FALSE;
|
||||
BOOL m_bRateControlFramePreAnalysisExternalReconDownscale = FALSE;
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
D3D12_COMMAND_QUEUE_PROCESS_PRIORITY m_WorkProcessPriority = {};
|
||||
BOOL m_bWorkProcessPrioritySet = FALSE;
|
||||
D3D12_COMMAND_QUEUE_GLOBAL_PRIORITY m_WorkGlobalPriority = {};
|
||||
BOOL m_bWorkGlobalPrioritySet = FALSE;
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
UINT m_uiMaxOutputBitstreamSize = 0u;
|
||||
struct pipe_video_codec *m_pPipeVideoCodec = nullptr;
|
||||
|
|
|
|||
|
|
@ -116,13 +116,11 @@ CMFD3DManager::Shutdown( bool bReleaseDeviceManager )
|
|||
m_pWinsys->destroy( this->m_pWinsys );
|
||||
m_pWinsys = nullptr;
|
||||
}
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
if(m_ContextPriorityMgr.base.register_work_queue)
|
||||
{
|
||||
mtx_destroy(&m_ContextPriorityMgr.m_lock);
|
||||
m_ContextPriorityMgr.base.register_work_queue = nullptr;
|
||||
}
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
@ -267,8 +265,6 @@ CMFD3DManager::UpdateGPUFeatureFlags()
|
|||
*/
|
||||
}
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
int MFTRegisterWorkQueue(struct d3d12_context_queue_priority_manager* manager, ID3D12CommandQueue* queue)
|
||||
{
|
||||
mft_context_queue_priority_manager* mft_mgr = (mft_context_queue_priority_manager*) manager;
|
||||
|
|
@ -320,17 +316,13 @@ int MFTUnregisterWorkQueue(struct d3d12_context_queue_priority_manager* manager,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
HRESULT
|
||||
CMFD3DManager::xOnSetD3DManager( ULONG_PTR ulParam )
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
Shutdown();
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
d3d12_interop_device_info1 screen_interop_info = {};
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
if( ulParam == 0 )
|
||||
{
|
||||
|
|
@ -352,7 +344,6 @@ CMFD3DManager::xOnSetD3DManager( ULONG_PTR ulParam )
|
|||
MF_E_DXGI_DEVICE_NOT_INITIALIZED,
|
||||
done );
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
if ((m_pVlScreen->pscreen->interop_query_device_info(m_pVlScreen->pscreen, sizeof(d3d12_interop_device_info1), &screen_interop_info) != 0) &&
|
||||
(screen_interop_info.set_context_queue_priority_manager != NULL))
|
||||
{
|
||||
|
|
@ -380,7 +371,7 @@ CMFD3DManager::xOnSetD3DManager( ULONG_PTR ulParam )
|
|||
MF_E_DXGI_DEVICE_NOT_INITIALIZED,
|
||||
done );
|
||||
}
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
CHECKHR_GOTO( MFCreateVideoSampleAllocatorEx( IID_PPV_ARGS( &m_spVideoSampleAllocator ) ), done );
|
||||
CHECKHR_GOTO( MFCreateVideoSampleAllocatorEx( IID_PPV_ARGS( &m_spSATDMapAllocator ) ), done );
|
||||
CHECKHR_GOTO( MFCreateVideoSampleAllocatorEx( IID_PPV_ARGS( &m_spBitsusedMapAllocator ) ), done );
|
||||
|
|
|
|||
|
|
@ -68,14 +68,12 @@ typedef union
|
|||
uint64_t version; // bits field
|
||||
} MFAdapterDriverVersion;
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
struct mft_context_queue_priority_manager
|
||||
{
|
||||
struct d3d12_context_queue_priority_manager base;
|
||||
std::vector<ID3D12CommandQueue*> m_registeredQueues;
|
||||
mtx_t m_lock;
|
||||
};
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
class CMFD3DManager
|
||||
{
|
||||
|
|
@ -110,9 +108,7 @@ class CMFD3DManager
|
|||
struct sw_winsys *m_pWinsys = nullptr;
|
||||
struct pipe_context *m_pPipeContext = nullptr;
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
struct mft_context_queue_priority_manager m_ContextPriorityMgr = {};
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
uint32_t m_deviceVendorId {};
|
||||
uint32_t m_deviceDeviceId {};
|
||||
|
|
|
|||
|
|
@ -943,14 +943,12 @@ CDX12EncHMFT::InitializeEncoder( pipe_video_profile videoProfile, UINT32 Width,
|
|||
}
|
||||
}
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
struct d3d12_interop_device_info1 screen_interop_info = {};
|
||||
if ((m_pPipeContext->screen->interop_query_device_info(m_pPipeContext->screen, sizeof(d3d12_interop_device_info1), &screen_interop_info) != 0) &&
|
||||
(screen_interop_info.set_video_encoder_max_async_queue_depth != nullptr))
|
||||
{
|
||||
screen_interop_info.set_video_encoder_max_async_queue_depth(m_pPipeContext, (m_bLowLatency ? 1 : MFT_INPUT_QUEUE_DEPTH));
|
||||
}
|
||||
#endif // ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
|
||||
CHECKNULL_GOTO( m_pPipeVideoCodec = m_pPipeContext->create_video_codec( m_pPipeContext, &encoderSettings ),
|
||||
MF_E_UNEXPECTED,
|
||||
|
|
@ -1184,7 +1182,6 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
|
|||
|
||||
metadata.encode_result = PIPE_VIDEO_FEEDBACK_METADATA_ENCODE_FLAG_FAILED; // default to failure
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
// If sliced fences supported, we asynchronously copy here every slice as it is ready
|
||||
// Otherwise, let's copy all the sliced together here after full frame completion (see below)
|
||||
if( pDX12EncodeContext->sliceNotificationMode == D3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM_NOTIFICATION_MODE_SUBREGIONS )
|
||||
|
|
@ -1269,7 +1266,6 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
|
|||
spMemoryBuffer->SetCurrentLength( static_cast<DWORD>( output_buffer_offset ) );
|
||||
spOutputSample->AddBuffer( spMemoryBuffer.Get() );
|
||||
}
|
||||
#endif // (USE_D3D12_PREVIEW_HEADERS && (D3D12_PREVIEW_SDK_VERSION >= 717))
|
||||
|
||||
// Still wait for pAsyncFence (full frame fence) before calling get_feedback for full frame stats
|
||||
// First wait on the D3D12 encoder_fence
|
||||
|
|
@ -1506,10 +1502,8 @@ CDX12EncHMFT::xThreadProc( void *pCtx )
|
|||
|
||||
// If sliced fences supported, we asynchronously copied every slice as it was ready (see above)
|
||||
// into spMemoryBuffer. Otherwise, let's copy all the sliced together here after full frame completion
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
if( pDX12EncodeContext->sliceNotificationMode ==
|
||||
D3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM_NOTIFICATION_MODE_FULL_FRAME )
|
||||
#endif // (USE_D3D12_PREVIEW_HEADERS && (D3D12_PREVIEW_SDK_VERSION >= 717))
|
||||
{
|
||||
// Readback full encoded frame bitstream from GPU memory onto CPU buffer
|
||||
struct pipe_box box = { 0 };
|
||||
|
|
@ -2200,7 +2194,6 @@ CDX12EncHMFT::ProcessInput( DWORD dwInputStreamIndex, IMFSample *pSample, DWORD
|
|||
pDX12EncodeContext->pPipeVideoBuffer,
|
||||
&pDX12EncodeContext->encoderPicInfo.base );
|
||||
|
||||
#if ( USE_D3D12_PREVIEW_HEADERS && ( D3D12_PREVIEW_SDK_VERSION >= 717 ) )
|
||||
if( pDX12EncodeContext->sliceNotificationMode == D3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM_NOTIFICATION_MODE_SUBREGIONS )
|
||||
{
|
||||
m_pPipeVideoCodec->encode_bitstream_sliced( m_pPipeVideoCodec,
|
||||
|
|
@ -2211,7 +2204,6 @@ CDX12EncHMFT::ProcessInput( DWORD dwInputStreamIndex, IMFSample *pSample, DWORD
|
|||
&pDX12EncodeContext->pAsyncCookie );
|
||||
}
|
||||
else
|
||||
#endif // (USE_D3D12_PREVIEW_HEADERS && (D3D12_PREVIEW_SDK_VERSION >= 717))
|
||||
{
|
||||
m_pPipeVideoCodec->encode_bitstream( m_pPipeVideoCodec,
|
||||
pDX12EncodeContext->pPipeVideoBuffer,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue