d3d12: Fix Map/Unmap of YUV resources
authorSil Vilerino <sivileri@microsoft.com>
Fri, 25 Aug 2023 21:02:00 +0000 (17:02 -0400)
committerSil Vilerino <sivileri@microsoft.com>
Mon, 28 Aug 2023 17:15:55 +0000 (13:15 -0400)
Restore transfer box original size after temporal per plane
dimension calculation.

Currently the returned transfer object on Map will have the
size (usually downsampled) of the latest plane instead of
the overall resource size. Then on unmap, when flushing the
changes the received transfer box has the wrong dimensions
and only partial data is flushed.

Fixes: 12a4f2c1328 ("frontends/va: Also map VAImageBufferType for reading")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24909>

src/gallium/drivers/d3d12/d3d12_resource.cpp

index a625347..05d0359 100644 (file)
@@ -1716,7 +1716,7 @@ d3d12_transfer_map(struct pipe_context *pctx,
                return NULL;
             }
          }
-
+         ptrans->box = original_box;
          d3d12_flush_cmdlist_and_wait(ctx);
       }
 
@@ -1868,6 +1868,7 @@ d3d12_transfer_unmap(struct pipe_context *pctx,
 
                transfer_buf_to_image(ctx, d3d12_resource(planes[plane_slice]), staging_res, trans, 0);
             }
+            ptrans->box = original_box;
          }
 
          pipe_resource_reference(&trans->staging_res, NULL);