d3d12: Remove requirement of surface creation/clearing functions for video

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35900>
This commit is contained in:
Sil Vilerino 2025-07-03 16:08:11 -04:00 committed by Marge Bot
parent 1959a352ea
commit 9fc42666f4
2 changed files with 17 additions and 3 deletions

View file

@ -272,9 +272,6 @@ d3d12_video_buffer_get_surfaces(struct pipe_video_buffer *buffer)
(pD3D12VideoBuffer->base.bind & PIPE_BIND_VIDEO_ENCODE_DPB))
return nullptr;
if (!pipe->create_surface)
return nullptr;
// pCurPlaneResource refers to the planar resource, not the overall resource.
// in d3d12_resource this is handled by having a linked list of planes with
// d3dRes->base.next ptr to next plane resource

View file

@ -2818,6 +2818,23 @@ d3d12_screen_get_video_param(struct pipe_screen *pscreen,
} else if (entrypoint == PIPE_VIDEO_ENTRYPOINT_PROCESSING) {
return d3d12_screen_get_video_param_postproc(pscreen, profile, entrypoint, param);
}
// Some frontends call get_video_param with PIPE_VIDEO_ENTRYPOINT_UNKNOWN
// to get some capabilities not entrypoint specific.
switch (param) {
case PIPE_VIDEO_CAP_SKIP_CLEAR_SURFACE:
{
// D3D12 does not require clearing the surface on creation for video
// as it doesn't use D3D12_HEAP_FLAG_CREATE_NOT_ZEROED
// Furthermore, on PIPE_CONTEXT_MEDIA_ONLY contexts, the
// clear_render_target function is not implemented
return 1;
} break;
default:
debug_printf("[d3d12_screen_get_video_param] unknown video param: %d\n", param);
return 0;
}
return 0;
}