From: Ganesh Belgur Ramachandra Date: Mon, 19 Jun 2023 19:53:18 +0000 (-0500) Subject: d3d12: implementation for get_resources() X-Git-Tag: upstream/23.3.3~5888 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=025dcbea661e25a6eb9ad99d11459f5913cd1ce0;p=platform%2Fupstream%2Fmesa.git d3d12: implementation for get_resources() Reviewed-by: Jesse Natalie Reviewed-by: Marek Olšák Reviewed-by: Karol Herbst Part-of: --- diff --git a/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp b/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp index 24872be..62a1d27 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_buffer.cpp @@ -62,6 +62,7 @@ d3d12_video_buffer_create_impl(struct pipe_context *pipe, // Fill vtable pD3D12VideoBuffer->base.destroy = d3d12_video_buffer_destroy; + pD3D12VideoBuffer->base.get_resources = d3d12_video_buffer_resources; pD3D12VideoBuffer->base.get_sampler_view_planes = d3d12_video_buffer_get_sampler_view_planes; pD3D12VideoBuffer->base.get_sampler_view_components = d3d12_video_buffer_get_sampler_view_components; pD3D12VideoBuffer->base.get_surfaces = d3d12_video_buffer_get_surfaces; @@ -234,6 +235,32 @@ error: } /** + * get an individual resource for each plane, + * only returns existing resources by reference + */ +void +d3d12_video_buffer_resources(struct pipe_video_buffer *buffer, + struct pipe_resource **resources) +{ + struct d3d12_video_buffer *pD3D12VideoBuffer = (struct d3d12_video_buffer *) buffer; + assert(pD3D12VideoBuffer); + + // 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 + // starting with the plane 0 being the overall resource + struct pipe_resource *pCurPlaneResource = &pD3D12VideoBuffer->texture->base.b; + + for (uint i = 0; i < pD3D12VideoBuffer->num_planes; ++i) { + assert(pCurPlaneResource); // the d3d12_resource has a linked list with the exact name of number of elements + // as planes + + resources[i] = pCurPlaneResource; + pCurPlaneResource = pCurPlaneResource->next; + } +} + +/** * get an individual sampler view for each plane */ struct pipe_sampler_view ** diff --git a/src/gallium/drivers/d3d12/d3d12_video_buffer.h b/src/gallium/drivers/d3d12/d3d12_video_buffer.h index 292ac12..c608b99 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_buffer.h +++ b/src/gallium/drivers/d3d12/d3d12_video_buffer.h @@ -54,6 +54,14 @@ void d3d12_video_buffer_destroy(struct pipe_video_buffer *buffer); /** + * get an individual resource for each plane, + * only returns existing resources by reference + */ +void +d3d12_video_buffer_resources(struct pipe_video_buffer *buffer, + struct pipe_resource **resources); + +/** * get an individual sampler view for each plane */ struct pipe_sampler_view **