dzn: Use unrestricted copy alignments when available

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22639>
This commit is contained in:
Jesse Natalie
2023-04-21 08:43:52 -07:00
committed by Marge Bot
parent 71f36568cb
commit 11cad58125
3 changed files with 12 additions and 4 deletions
+6 -2
View File
@@ -2390,6 +2390,8 @@ dzn_cmd_buffer_copy_buf2img_region(struct dzn_cmd_buffer *cmdbuf,
{
VK_FROM_HANDLE(dzn_buffer, src_buffer, info->srcBuffer);
VK_FROM_HANDLE(dzn_image, dst_image, info->dstImage);
struct dzn_physical_device *pdev =
container_of(cmdbuf->vk.base.device->physical, struct dzn_physical_device, vk);
ID3D12GraphicsCommandList1 *cmdlist = cmdbuf->cmdlist;
@@ -2409,7 +2411,7 @@ dzn_cmd_buffer_copy_buf2img_region(struct dzn_cmd_buffer *cmdbuf,
D3D12_TEXTURE_COPY_LOCATION src_buf_loc =
dzn_buffer_get_copy_loc(src_buffer, dst_image->vk.format, &region, aspect, l);
if (dzn_buffer_supports_region_copy(&src_buf_loc)) {
if (dzn_buffer_supports_region_copy(pdev, &src_buf_loc)) {
/* RowPitch and Offset are properly aligned, we can copy
* the whole thing in one call.
*/
@@ -2469,6 +2471,8 @@ dzn_cmd_buffer_copy_img2buf_region(struct dzn_cmd_buffer *cmdbuf,
{
VK_FROM_HANDLE(dzn_image, src_image, info->srcImage);
VK_FROM_HANDLE(dzn_buffer, dst_buffer, info->dstBuffer);
struct dzn_physical_device *pdev =
container_of(cmdbuf->vk.base.device->physical, struct dzn_physical_device, vk);
ID3D12GraphicsCommandList1 *cmdlist = cmdbuf->cmdlist;
@@ -2488,7 +2492,7 @@ dzn_cmd_buffer_copy_img2buf_region(struct dzn_cmd_buffer *cmdbuf,
D3D12_TEXTURE_COPY_LOCATION dst_buf_loc =
dzn_buffer_get_copy_loc(dst_buffer, src_image->vk.format, &region, aspect, l);
if (dzn_buffer_supports_region_copy(&dst_buf_loc)) {
if (dzn_buffer_supports_region_copy(pdev, &dst_buf_loc)) {
/* RowPitch and Offset are properly aligned on 256 bytes, we can copy
* the whole thing in one call.
*/
+4 -1
View File
@@ -2954,8 +2954,11 @@ dzn_buffer_get_line_copy_loc(const struct dzn_buffer *buf, VkFormat format,
}
bool
dzn_buffer_supports_region_copy(const D3D12_TEXTURE_COPY_LOCATION *loc)
dzn_buffer_supports_region_copy(struct dzn_physical_device *pdev,
const D3D12_TEXTURE_COPY_LOCATION *loc)
{
if (pdev->options13.UnrestrictedBufferTextureCopyPitchSupported)
return true;
return !(loc->PlacedFootprint.Offset & (D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT - 1)) &&
!(loc->PlacedFootprint.Footprint.RowPitch & (D3D12_TEXTURE_DATA_PITCH_ALIGNMENT - 1));
}
+2 -1
View File
@@ -1164,7 +1164,8 @@ dzn_buffer_get_line_copy_loc(const struct dzn_buffer *buf, VkFormat format,
uint32_t y, uint32_t z, uint32_t *start_x);
bool
dzn_buffer_supports_region_copy(const D3D12_TEXTURE_COPY_LOCATION *loc);
dzn_buffer_supports_region_copy(struct dzn_physical_device *pdev,
const D3D12_TEXTURE_COPY_LOCATION *loc);
struct dzn_buffer_view {
struct vk_object_base base;