One page, one import: compile fixes (a Pages placement accessor, raw handle bits in Debug, an unshadowed test heap)

The first build of ed11f23e9a failed: bind_in_import read Pages' private
memory field, InImport's Debug printed handle flags ash gives no Debug for,
and a test's heap binding shadowed its heap helper. Found by potluck job
m3-max-18250 (lavapipe build on ms01).
This commit is contained in:
Anees Iqbal committed 2026-11-11 19:01:50 -08:00
1 parent cfd7bc829e
commit 4f3bc2e7a3
4 files changed
+11 -5

No files matched your search

@@ -2001,6 +2001,12 @@ impl Drop for HostPages {
}
impl Pages {
/// The placement the pages are bound in: what a buffer bound inside their import binds in
/// (`Device::bind_in_import`).
pub(super) fn placement(&self) -> &Placement {
&self.memory.placement
}
/// Destroy the `VkBuffer` of a host import's pages and free their memory, on `device`, once
/// their sparse binding completed, and note it (`Device::note_import_freed`): an import's
/// last hold lets go. Left to the process's end while it exits. `after` goes once the memory
@@ -1804,7 +1804,7 @@ impl Device {
if matches!(pages, ImportPages::StandIn(_)) {
return None;
}
let within = &pages.memory.placement;
let within = pages.placement();
// One dma-buf a buffer's own import made is dedicated to its `VkBuffer`
// (`VUID-vkBindBufferMemory-memory-01508`); a guest RAM chunk's import of one is not.
let dedicated = within.over_dma_buf() && !within.over_ram_chunk();
+1 -1
View File
@@ -1839,7 +1839,7 @@ pub(super) struct InImport {
impl std::fmt::Debug for InImport {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("InImport")
.field("handle", &self.handle)
.field("handle", &self.handle.as_raw())
.finish_non_exhaustive()
}
}
@@ -244,7 +244,7 @@ fn heaps_and_buffers_over_a_buffers_pages_lie_inside_its_import() {
plus(start, [1, 0, 0, 0]),
"the buffer's own import"
);
let Some(heap) = heap(&device, &pages, 0, HEAP) else {
let Some(over) = heap(&device, &pages, 0, HEAP) else {
return;
};
assert_eq!(
@@ -252,7 +252,7 @@ fn heaps_and_buffers_over_a_buffers_pages_lie_inside_its_import() {
after_first,
"a heap over the buffer's exact bytes"
);
let placed = heap.new_buffer(8192, ResourceOptions::shared()).unwrap();
let placed = over.new_buffer(8192, ResourceOptions::shared()).unwrap();
blits(&queue, |blit| {
blit.fill_buffer(&placed, 0..8192, 0x5c).unwrap()
});
@@ -296,5 +296,5 @@ fn heaps_and_buffers_over_a_buffers_pages_lie_inside_its_import() {
blit.fill_buffer(&in_copy, 0..4096, 0x7f).unwrap()
});
assert!(pages.bytes(2 << 20, 4096).iter().all(|&byte| byte == 0x7f));
drop((in_copy, around, small, part, placed, heap, first));
drop((in_copy, around, small, part, placed, over, first));
}