mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
d3d12: Have d3d12_video_encoder keep separate references for enc, heap and dpb allocations for in flight resources
Reviewed-by: Giancarlo Devich <gdevich@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18715>
This commit is contained in:
parent
24433f3a29
commit
5269d660af
2 changed files with 22 additions and 1 deletions
|
|
@ -123,6 +123,13 @@ d3d12_video_encoder_flush(struct pipe_video_codec *codec)
|
|||
goto flush_fail;
|
||||
}
|
||||
|
||||
debug_printf("[d3d12_video_encoder] d3d12_video_encoder_sync_with_token - resetting ID3D12CommandAllocator %p suceeded.\n",
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_spCommandAllocator.Get());
|
||||
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_spEncoder.Reset();
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_spEncoderHeap.Reset();
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_References.reset();
|
||||
|
||||
// Validate device was not removed
|
||||
hr = pD3D12Enc->m_pD3D12Screen->dev->GetDeviceRemovedReason();
|
||||
if (hr != S_OK) {
|
||||
|
|
@ -1709,6 +1716,12 @@ d3d12_video_encoder_end_frame(struct pipe_video_codec * codec,
|
|||
// Signal finish of current frame encoding to the picture management tracker
|
||||
pD3D12Enc->m_upDPBManager->end_frame();
|
||||
|
||||
// Save extra references of Encoder, EncoderHeap and DPB allocations in case
|
||||
// there's a reconfiguration that trigers the construction of new objects
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_spEncoder = pD3D12Enc->m_spVideoEncoder;
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_spEncoderHeap = pD3D12Enc->m_spVideoEncoderHeap;
|
||||
pD3D12Enc->m_inflightResourcesPool[d3d12_video_encoder_pool_current_index(pD3D12Enc)].m_References = pD3D12Enc->m_upDPBStorageManager;
|
||||
|
||||
debug_printf("[d3d12_video_encoder] d3d12_video_encoder_end_frame finalized for fenceValue: %" PRIu64 "\n",
|
||||
pD3D12Enc->m_fenceValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ struct d3d12_video_encoder
|
|||
std::vector<D3D12_RESOURCE_BARRIER> m_transitionsBeforeCloseCmdList = {};
|
||||
|
||||
std::unique_ptr<d3d12_video_encoder_references_manager_interface> m_upDPBManager = {};
|
||||
std::unique_ptr<d3d12_video_dpb_storage_manager_interface> m_upDPBStorageManager = {};
|
||||
std::shared_ptr<d3d12_video_dpb_storage_manager_interface> m_upDPBStorageManager = {};
|
||||
std::unique_ptr<d3d12_video_bitstream_builder_interface> m_upBitstreamBuilder = {};
|
||||
|
||||
struct EncodedBitstreamResolvedMetadata
|
||||
|
|
@ -260,6 +260,14 @@ struct d3d12_video_encoder
|
|||
|
||||
struct InFlightEncodeResources
|
||||
{
|
||||
// In case of reconfigurations that trigger creation of new
|
||||
// encoder or encoderheap or reference frames allocations
|
||||
// we need to keep a reference alive to the ones that
|
||||
// are currently in-flight
|
||||
ComPtr<ID3D12VideoEncoder> m_spEncoder = {};
|
||||
ComPtr<ID3D12VideoEncoderHeap> m_spEncoderHeap = {};
|
||||
std::shared_ptr<d3d12_video_dpb_storage_manager_interface> m_References = {};
|
||||
|
||||
ComPtr<ID3D12CommandAllocator> m_spCommandAllocator = {};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue