diff --git a/src/gallium/drivers/d3d12/d3d12_resource.cpp b/src/gallium/drivers/d3d12/d3d12_resource.cpp index c8658382911..cb0346b7938 100644 --- a/src/gallium/drivers/d3d12/d3d12_resource.cpp +++ b/src/gallium/drivers/d3d12/d3d12_resource.cpp @@ -705,6 +705,7 @@ d3d12_resource_from_resource(struct pipe_screen *pscreen, handle.type = WINSYS_HANDLE_TYPE_D3D12_RES; handle.format = d3d12_get_pipe_format(input_desc.Format); handle.com_obj = input_res; + input_res->AddRef(); struct pipe_resource templ; memset(&templ, 0, sizeof(templ)); diff --git a/src/gallium/drivers/d3d12/d3d12_video_dec.cpp b/src/gallium/drivers/d3d12/d3d12_video_dec.cpp index 15bd7ff4fb6..178f5b29805 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_dec.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_dec.cpp @@ -408,6 +408,7 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec *codec, "buffer_subdata to upload compressed bitstream.\n"); pD3D12Screen->base.fence_finish(&pD3D12Screen->base, NULL, pUploadGPUCompletionFence, PIPE_TIMEOUT_INFINITE); pD3D12Screen->base.fence_reference(&pD3D12Screen->base, &pUploadGPUCompletionFence, NULL); + pipe_resource_reference(&pPipeCompressedBufferObj, NULL); // [After buffer_subdata GPU work is finished] Clear CPU staging buffer now that end_frame is called and was uploaded // to GPU for DecodeFrame call. @@ -648,6 +649,7 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec *codec, "resource_copy_region on decoded frame.\n"); pD3D12Screen->base.fence_finish(&pD3D12Screen->base, NULL, completion_fence, PIPE_TIMEOUT_INFINITE); pD3D12Screen->base.fence_reference(&pD3D12Screen->base, &completion_fence, NULL); + pipe_resource_reference(&pPipeSrc, NULL); } } diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp index c71751d6220..99c082c2da8 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp @@ -1631,6 +1631,7 @@ d3d12_video_encoder_extract_encode_metadata( // Unmap the buffer tmp storage pipe_buffer_unmap(pD3D12Enc->base.context, mapTransfer); + pipe_resource_reference(&pPipeResolvedMetadataBuffer, NULL); } /**