Exported-memory texture tests follow the in-place check's verdict
On an RX 550 under RADV (POLARIS12) the device makes no image over a
dma-buf, so the in-place check leaves the runtime's memory exported as
dma-bufs Unchecked (a cause that lasts), and textures over such memory
are the shadows their verdict decides. The two tests asserted in place
there: an_nv12_picture_s_planes_over_exported_memory_go_in_place_naming
_its_handle_type now expects in place where the placement query answers
NotHostPages after the check, else a shadow of TextureShadowReason
Unchecked or CheckFailed (any other answer fails), moves only the
planes the check passed for, and counts a shadow made after the check
only where it did not pass; a_frame_a_second_device_writes_through_its
_dma_buf_reads_in_the_runtime_s_textures expects the plain frame's
aliasing where the check's reads over exported dma-bufs passed for both
row ends, and a shadow where neither passed.
Seen: m3-max-10151 on the RX 550 (the run meant for the 780M, its
device not pinned): OpaqueFd planes in place (alignment 256, row pitch
3840, offset 0), DmaBuf planes Shadow(Unchecked { Reads, OnLines }),
both tests failing on their in-place assertion. The re-runs follow.
(cherry picked from commit 03f36709eefb7b649975900aa7b6430c380d023d)
This commit is contained in:
1 parent
7ebb4bd2aa
commit
4b4e19937a
2 files changed
+80
-22
No files matched your search
@@ -14,8 +14,10 @@
|
||||
//! - **The read.** The planes' textures over the buffer (`R8Unorm` 1024x64 at `0x20`, `RG8Unorm`
|
||||
//! 512x32 after it, rows 1024 bytes apart) are each the linear image aliasing the buffer's
|
||||
//! memory (no `shadowed_textures`), made for its dma-buf handle type once the device's check of
|
||||
//! that exported memory answered, wherever the same texture at offset 0 of a plain buffer is
|
||||
//! one, and a blit of each reads the second device's bytes.
|
||||
//! that exported memory answered and passed, wherever the same texture at offset 0 of a plain
|
||||
//! buffer is one; where the check did not pass for a texture that reads (a device that makes no
|
||||
//! image over a dma-buf: the RX 550 under RADV), each is a shadow. A blit of each reads the
|
||||
//! second device's bytes.
|
||||
//! - **Refusals.** A device without the export refuses the making
|
||||
//! (`NotImplemented(RuntimeGap::DmaBufExport)`) only where it lacks an extension or the export;
|
||||
//! `NoCopy` contents with `exported_as` are `Invalid` (`ExportedNoCopy`); a buffer not made
|
||||
@@ -28,6 +30,7 @@
|
||||
|
||||
use super::blit_holds::{device, Host, Scratch, WAIT};
|
||||
use crate::error::{Error, Invalid, Problem, RuntimeGap};
|
||||
use crate::in_place::{Access, PagesClass, RowEnds, Verdict};
|
||||
use crate::{
|
||||
BlitOption, Buffer, BufferContents, BufferDescriptor, Device, IoSurfacePlane, MemoryExport,
|
||||
Origin, ResourceOptions, Size, Texture, TextureDescriptor,
|
||||
@@ -442,14 +445,28 @@ fn a_frame_a_second_device_writes_through_its_dma_buf_reads_in_the_runtime_s_tex
|
||||
device.settle_in_place_checks(WAIT),
|
||||
"{name}: the check answered"
|
||||
);
|
||||
// The check's verdicts for a texture that reads over the memory, each row end.
|
||||
let reads = RowEnds::ALL.map(|rows| {
|
||||
let verdict =
|
||||
(device.shared().in_place).verdict(PagesClass::ExportedDmaBuf, Access::Reads, rows);
|
||||
verdict == Verdict::Passed
|
||||
});
|
||||
for plane in PLANES {
|
||||
let (texture, aliases) = plane_texture(&device, &buffer, (plane, plane.at));
|
||||
let (_, plain_aliases) = plane_texture(&device, &plain, (plane, plane.at));
|
||||
eprintln!(
|
||||
"DMA-BUF-EXPORT on {name}: {options:?} {plane:?}: aliases its buffer {aliases} \
|
||||
(a plain frame's {plain_aliases})"
|
||||
(a plain frame's {plain_aliases}; the check's reads over exported dma-bufs \
|
||||
passed {reads:?})"
|
||||
);
|
||||
assert_eq!(aliases, plain_aliases, "{options:?} {plane:?}: no shadow");
|
||||
if reads.iter().all(|&passed| passed) {
|
||||
assert_eq!(aliases, plain_aliases, "{options:?} {plane:?}: no shadow");
|
||||
} else if !reads.iter().any(|&passed| passed) {
|
||||
assert!(
|
||||
!aliases,
|
||||
"{options:?} {plane:?}: a shadow where the check did not pass"
|
||||
);
|
||||
}
|
||||
let want: Vec<u8> = (plane.at..plane.at + plane.row * plane.size[1])
|
||||
.map(decoded_byte)
|
||||
.collect();
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
//! bind.
|
||||
//! - **A shadow first, then in place.** Made before the device's check of that exported memory
|
||||
//! answered, each texture is a shadow (`TexturePlacement::Pending`), whose blit reads the
|
||||
//! buffer's bytes; once the check answered (`Device::settle_in_place_checks`), the next commit
|
||||
//! moves both in place (`WorkCounts::pooled_textures_moved_in_place`), and their blits read the
|
||||
//! same bytes through the image in the buffer's memory. A texture made after is in place at once
|
||||
//! (`TexturePlacement::NotHostPages`, no shadow counted).
|
||||
//! buffer's bytes; once the check answered (`Device::settle_in_place_checks`) and passed, the
|
||||
//! next commit moves both in place (`WorkCounts::pooled_textures_moved_in_place`), and their
|
||||
//! blits read the same bytes through the image in the buffer's memory. A texture made after is
|
||||
//! in place at once (`TexturePlacement::NotHostPages`, no shadow counted). Where the check did
|
||||
//! not pass for that memory (a device that makes no image over a dma-buf: the RX 550 under
|
||||
//! RADV), each texture stays the shadow its verdict decided (`TextureShadowReason::Unchecked`
|
||||
//! or `CheckFailed`), and reads the same bytes.
|
||||
//! - **Each handle type, each storage.** Of an opaque file descriptor and of a dma-buf where the
|
||||
//! device exports one, `Private` (its bytes written by a blit, as a decoder writes a cache the CPU
|
||||
//! never maps) and `Shared` (written through its contents). Where the device exports such memory
|
||||
@@ -285,28 +288,61 @@ fn an_nv12_picture_s_planes_over_exported_memory_go_in_place_naming_its_handle_t
|
||||
"{export:?} {options:?} {plane:?}: the texels, read as made"
|
||||
);
|
||||
}
|
||||
// Once the check answered: in place where its verdict for the memory passed, else a
|
||||
// shadow its verdict decided.
|
||||
let answer = |plane: Plane| {
|
||||
let descriptor = descriptor(plane, options);
|
||||
let placement = (picture.texture_placement(&descriptor, plane.at, ROW)).unwrap();
|
||||
assert!(
|
||||
matches!(
|
||||
placement,
|
||||
TexturePlacement::NotHostPages
|
||||
| TexturePlacement::Shadow(
|
||||
TextureShadowReason::Unchecked { .. }
|
||||
| TextureShadowReason::CheckFailed { .. }
|
||||
)
|
||||
),
|
||||
"{export:?} {options:?} {plane:?}: in place, or a shadow the device's check \
|
||||
of that memory decided: {placement:?}"
|
||||
);
|
||||
placement
|
||||
};
|
||||
if first {
|
||||
let counts = device.work_counts();
|
||||
assert!(device.settle_in_place_checks(WAIT), "the check answered");
|
||||
// The next commit moves the shadows in place.
|
||||
let passed = PLANES
|
||||
.iter()
|
||||
.filter(|&&plane| answer(plane) == TexturePlacement::NotHostPages)
|
||||
.count() as u64;
|
||||
// The next commit moves the shadows in place where the check passed.
|
||||
let plane = PLANES[0];
|
||||
assert!(read(&device, &textures[0].0, plane) == want(plane));
|
||||
let moved = device.work_counts().pooled_textures_moved_in_place
|
||||
- counts.pooled_textures_moved_in_place;
|
||||
assert_eq!(
|
||||
moved, 2,
|
||||
"{export:?} {options:?}: both planes moved in place"
|
||||
moved, passed,
|
||||
"{export:?} {options:?}: the planes the check passed for moved in place"
|
||||
);
|
||||
first = false;
|
||||
}
|
||||
for (plane, (texture, _)) in PLANES.iter().zip(&textures) {
|
||||
let descriptor = descriptor(*plane, options);
|
||||
let placement = (picture.texture_placement(&descriptor, plane.at, ROW)).unwrap();
|
||||
assert_eq!(
|
||||
placement,
|
||||
TexturePlacement::NotHostPages,
|
||||
"{export:?} {options:?} {plane:?}: in place once the check passed"
|
||||
);
|
||||
let placement = answer(*plane);
|
||||
if placement != TexturePlacement::NotHostPages {
|
||||
assert!(
|
||||
texture.shadow().is_some(),
|
||||
"{export:?} {options:?} {plane:?}: a shadow"
|
||||
);
|
||||
assert!(
|
||||
read(&device, texture, *plane) == want(*plane),
|
||||
"{export:?} {options:?} {plane:?}: the texels, read through the shadow"
|
||||
);
|
||||
eprintln!(
|
||||
"EXPORTED-TEXTURES on {name}: {export:?} {options:?} {:?} {}x{}: a \
|
||||
shadow, the device's check of that memory did not pass: {placement:?}",
|
||||
plane.format, plane.size[0], plane.size[1]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
assert!(
|
||||
texture.shadow().is_none(),
|
||||
"{export:?} {options:?} {plane:?}: the image in place"
|
||||
@@ -326,17 +362,22 @@ fn an_nv12_picture_s_planes_over_exported_memory_go_in_place_naming_its_handle_t
|
||||
assert_eq!(at % alignment, 0);
|
||||
assert_eq!((row_pitch, offset), (ROW, 0));
|
||||
}
|
||||
// Made after the check answered: in place at once.
|
||||
// Made after the check answered: in place at once where it passed, else a shadow.
|
||||
let shadows = device.work_counts().shadowed_textures;
|
||||
let mut kept = 0;
|
||||
for plane in PLANES {
|
||||
let expected = answer(plane);
|
||||
let (texture, placement) = made(plane);
|
||||
assert_eq!(placement, TexturePlacement::NotHostPages, "{plane:?}");
|
||||
assert_eq!(placement, expected, "{plane:?}");
|
||||
if placement != TexturePlacement::NotHostPages {
|
||||
kept += 1;
|
||||
}
|
||||
assert!(read(&device, &texture, plane) == want(plane));
|
||||
}
|
||||
assert_eq!(
|
||||
device.work_counts().shadowed_textures,
|
||||
shadows,
|
||||
"{export:?} {options:?}: no shadow made after the check"
|
||||
shadows + kept,
|
||||
"{export:?} {options:?}: a shadow made after the check only where it did not pass"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user