diff --git a/starboard/shared/uwp/extended_resources_manager.cc b/starboard/shared/uwp/extended_resources_manager.cc index 287ee93ddc5f..3fbf5ac5dea9 100644 --- a/starboard/shared/uwp/extended_resources_manager.cc +++ b/starboard/shared/uwp/extended_resources_manager.cc @@ -70,9 +70,15 @@ const SbTime kReleaseTimeout = kSbTimeSecond; // To make playback more smooth it is better to increase the output queue size // up to 30-50 frames, but it should not exceed memory budgetd. // Compromise value was found out experimentally. -// 400 Mb leaves enough memory for stable working of the rest system. -// Just in case to be more sure we reduce this value down to 380 Mb. -const uint64_t kFrameBuffersPoolMemorySize = 380 * 1024 * 1024; +// In XBOX ONE S/Base 400 Mb leaves enough memory for stable working of the rest +// system. Just in case to be more sure we reduce this value down to 380 Mb. In +// Sereies devices (if to use gpu based decoders) the max available frame size +// size is 4K instead of 2K. On the other hand the memory budget is greater than +// for Base/S. So we can use more memory for output queue. +const uint64_t kFrameBuffersPoolMemorySizeForXB1 = 380 * 1024 * 1024; +// +8 extra frames 4K HDR DXGI_FORMAT_R10G10B10A2_UNORM +const uint64_t kFrameBuffersPoolMemorySizeForXBSeries = + kFrameBuffersPoolMemorySizeForXB1 + 8 * 16588800; bool IsExtendedResourceModeRequired() { if (!::starboard::xb1::shared::CanAcquire()) { @@ -174,6 +180,10 @@ void ExtendedResourcesManager::Quit() { pending_extended_resources_release_.store(true); } +void ExtendedResourcesManager::ReleaseBuffersHeap() { + d3d12FrameBuffersHeap_.Reset(); +} + bool ExtendedResourcesManager::GetD3D12Objects( Microsoft::WRL::ComPtr* device, Microsoft::WRL::ComPtr* buffer_heap, @@ -263,8 +273,13 @@ bool ExtendedResourcesManager::GetD3D12ObjectsInternal() { SB_DCHECK(d3d12queue_); } if (!d3d12FrameBuffersHeap_) { + const bool isSeries = ::starboard::shared::uwp::GetXboxType() == + ::starboard::shared::uwp::kXboxSeriesS || + ::starboard::shared::uwp::GetXboxType() == + ::starboard::shared::uwp::kXboxSeriesX; D3D12_HEAP_DESC heap_desc; - heap_desc.SizeInBytes = kFrameBuffersPoolMemorySize; + heap_desc.SizeInBytes = isSeries ? kFrameBuffersPoolMemorySizeForXBSeries + : kFrameBuffersPoolMemorySizeForXB1; heap_desc.Properties.Type = D3D12_HEAP_TYPE_DEFAULT; heap_desc.Properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; heap_desc.Properties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; diff --git a/starboard/shared/uwp/extended_resources_manager.h b/starboard/shared/uwp/extended_resources_manager.h index 54b966f58e78..78d3fee1d9c8 100644 --- a/starboard/shared/uwp/extended_resources_manager.h +++ b/starboard/shared/uwp/extended_resources_manager.h @@ -46,6 +46,7 @@ class ExtendedResourcesManager { void AcquireExtendedResources(); void ReleaseExtendedResources(); void Quit(); + void ReleaseBuffersHeap(); // Returns true when the d3d12 device, buffer heap // and command queue can be used. diff --git a/starboard/shared/uwp/player_components_factory.cc b/starboard/shared/uwp/player_components_factory.cc index c8511be2d08b..c29420afbd85 100644 --- a/starboard/shared/uwp/player_components_factory.cc +++ b/starboard/shared/uwp/player_components_factory.cc @@ -196,6 +196,7 @@ class PlayerComponentsFactory : public PlayerComponents::Factory { } using MftVideoDecoder = ::starboard::xb1::shared::VideoDecoderUwp; + using ExtendedResourcesManager = shared::uwp::ExtendedResourcesManager; const auto output_mode = creation_parameters.output_mode(); const auto is_hdr_video = @@ -208,6 +209,9 @@ class PlayerComponentsFactory : public PlayerComponents::Factory { MftVideoDecoder::IsHardwareAv1DecoderSupported())) { video_render_algorithm->reset( new VideoRenderAlgorithmImpl(std::bind(GetRefreshRate))); + // The memory heap for gpu decoders isn't used by hw decoders. + // Release it. + ExtendedResourcesManager::GetInstance()->ReleaseBuffersHeap(); video_decoder->reset(new MftVideoDecoder( video_codec, output_mode, creation_parameters.decode_target_graphics_context_provider(),