d3d12: Fix leak in d3d12_resource_from_resource and usage in d3d12 video dec, enc

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18328>
This commit is contained in:
Sil Vilerino
2022-07-20 13:31:19 -04:00
parent cdd83c6110
commit 59c45e1ed7
3 changed files with 4 additions and 0 deletions

View File

@@ -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));

View File

@@ -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);
}
}

View File

@@ -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);
}
/**