d3d12: implement the get_decoder_fence vfunc

Implement the get_decoder_fence vfunc. Note that the waiting for
completion in this driver happens in the end_frame vfunc itself.

Signed-off-by: Sil Vilerino <sivileri@microsoft.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20133>
This commit is contained in:
Sil Vilerino
2022-12-04 09:39:09 -03:00
committed by Marge Bot
parent 5e1bd07ac5
commit e8e7f06f10
2 changed files with 31 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ d3d12_video_create_decoder(struct pipe_context *context, const struct pipe_video
pD3D12Dec->base.decode_bitstream = d3d12_video_decoder_decode_bitstream;
pD3D12Dec->base.end_frame = d3d12_video_decoder_end_frame;
pD3D12Dec->base.flush = d3d12_video_decoder_flush;
pD3D12Dec->base.get_decoder_fence = d3d12_video_decoder_get_decoder_fence;
pD3D12Dec->m_decodeFormat = d3d12_convert_pipe_video_profile_to_dxgi_format(codec->profile);
pD3D12Dec->m_d3d12DecProfileType = d3d12_video_decoder_convert_pipe_video_profile_to_profile_type(codec->profile);
@@ -665,6 +666,29 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec *codec,
pD3D12Screen->base.fence_reference(&pD3D12Screen->base, &completion_fence, NULL);
pipe_resource_reference(&pPipeSrc, NULL);
}
// We do not use the async fence for now but set it to
// NULL to avoid uninitialized memory in VA frontend
*picture->fence = NULL;
}
/**
* Get decoder fence.
*/
int d3d12_video_decoder_get_decoder_fence(struct pipe_video_codec *codec,
struct pipe_fence_handle *fence,
uint64_t timeout)
{
/* No need to wait for anything, we're already flushing
and waiting in d3d12_video_decoder_end_frame */
// We set NULL in d3d12_video_decoder_end_frame
assert(fence == NULL);
// Return semantics based on p_video_codec interface
// ret == 0 -> Decode in progress
// ret != 0 -> Decode completed
return 1;
}
/**

View File

@@ -77,6 +77,13 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec * codec,
void
d3d12_video_decoder_flush(struct pipe_video_codec *codec);
/**
* Get decoder fence.
*/
int d3d12_video_decoder_get_decoder_fence(struct pipe_video_codec *codec,
struct pipe_fence_handle *fence,
uint64_t timeout);
///
/// Pipe video interface ends
///