rusticl/mem: fix Image::read for 1Darray images

Some drivers do not return identical strides when mapping 1Darray images
leading to data being written in the wrong place.

Cc: mesa-stable
Tested-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37284>
(cherry picked from commit b584b47d01)
This commit is contained in:
Karol Herbst 2025-09-10 23:10:58 +02:00 committed by Eric Engestrom
parent 283734b598
commit 3df08d2657
2 changed files with 6 additions and 2 deletions

View file

@ -6114,7 +6114,7 @@
"description": "rusticl/mem: fix Image::read for 1Darray images",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1948,7 +1948,7 @@ impl Image {
let pixel_size = self.image_format.pixel_size().unwrap();
let tx;
let src_row_pitch;
let mut src_row_pitch;
let src_slice_pitch;
if let Some(Mem::Buffer(buffer)) = self.parent() {
src_row_pitch = self.image_desc.image_row_pitch;
@ -1966,6 +1966,10 @@ impl Image {
tx = self.tx_image(ctx, &bx, RWFlags::RD)?;
src_row_pitch = tx.row_pitch() as usize;
src_slice_pitch = tx.slice_pitch();
if self.mem_type == CL_MEM_OBJECT_IMAGE1D_ARRAY {
src_row_pitch = src_slice_pitch;
}
};
perf_warning!("clEnqueueReadImage and clEnqueueMapImage stall the GPU");