RUNTIME 2431: Shadows: splice a copy back into host pages on devices that write lines back
What: a shadow's copy back (Step::Back) of a 2D texture's image, or of a texture buffer's staging buffer, into a no-copy buffer's host pages is spliced where the device's check of those pages (DmaBuf or Pointer) failed, or has not answered, the copies or shader writes of texels whose rows end inside a line (Access::Copies or Access::Writes of RowEnds::InLines, Failed or Pending). The GPU copies only the columns that fill whole lines of memory (nonCoherentAtomSize): one region a slice where its rows are a multiple of a line apart, else one a row. Each row's head and tail columns go by the GPU into a line-aligned region of the command buffer's arena, and a host step of a batch of its own (Deferred::ShadowSplice, after the work before it completed) copies them into the pages a byte at a time, as the CPU's stores go. The encoder notes the truth's writes after the step. A copy whose texels fill whole lines alone copies back as before; a device where both verdicts passed copies back as before. New count WorkCounts::shadow_copies_back_spliced. Why: on the Iris Xe (ANV) a copy of texels into a buffer's rows writes back the 64-byte line holding each row's last texels whole, putting back older values over the CPU's writes beside them. The lane's probe (m3-max-35510) lost 3,539 to 14,319 bytes a kind in 300 command buffers through a shadow's copy back and merge, where Metal keeps every such byte (row_padding_writes.m). This breaks Metal's contract on the guest's bytes; the merge is the next change. Where the copy stays (docs/FAST-PATHS.md, known gaps): a copy back between a render pass's instances or before its tile dispatch, into a held pass's command buffer, at a segment's end recorded at a commit or a host step, of rotated, two-plane, tiled or heap depth/stencil textures, and into the runtime's own memory. Tests: tests::shadow_splice (the cut run as GPU and CPU over a map of host bytes: every texel once, no GPU byte in a shared line, every shape of texel, width, pitch and phase); tests::shadow_write_lines (the probe made a device test: the guest's 34x34 RGBA16Float target over dma-buf pages, buffer and plane forms, a clear's copies back put back no byte the CPU wrote beside them and are spliced; and a copy back spliced exactly as the device's measured verdicts say). Degradation kinds added: none. Verified (fplend): msi m3-max-35614 clippy 0, tests 0, signatures 0; 35623 clippy m2v_gpu 0; lavapipe 35625 clippy m2v_cpu_icd 0, 216 passed, rustdoc 0; PHOENIX 35632 (um790) in-place + shadow suites 287/287, shadow_write_lines 2/2: under the measured verdicts (Copies and Writes Passed) 0 spliced; under HostPageTexturePolicy::Shadow (no check, verdicts Pending) every copy back splices (+300 in 300 rounds, 0 bytes put back). The Iris run follows.
This commit is contained in:
1 parent
45d2a94af9
commit
9ea0a9c1f6
14 files changed
+1479
-45
No files matched your search
@@ -4554,15 +4554,18 @@ impl CommandBuffer {
|
||||
return Err(error);
|
||||
}
|
||||
};
|
||||
// The first segment a host step records, which the device announces (a loop's check
|
||||
// and a staged scatter's CPU copy record nothing).
|
||||
// The first segment a host step records, which the device announces (a loop's check, a
|
||||
// staged scatter's CPU copy and a splice's record nothing).
|
||||
let announced = segments
|
||||
.iter()
|
||||
.zip(&prepared)
|
||||
.find(|((work, host), prepared)| {
|
||||
*host
|
||||
&& !prepared.for_good
|
||||
&& !matches!(work, Deferred::Loop(_) | Deferred::ScatterDrain(_))
|
||||
&& !matches!(
|
||||
work,
|
||||
Deferred::Loop(_) | Deferred::ScatterDrain(_) | Deferred::ShadowSplice(_)
|
||||
)
|
||||
})
|
||||
.map(|((work, _), _)| work.clone());
|
||||
// A host step may record commands after the commit (a segment not recorded for good).
|
||||
|
||||
@@ -20,6 +20,7 @@ use super::pipeline::ComputePipelineState;
|
||||
use super::render::DeferredPass;
|
||||
use super::resource::ResourceKey;
|
||||
use super::shadow::GatedCopyIn;
|
||||
use super::shadow_splice::ShadowSplices;
|
||||
use super::sparse::emulated::Scrub;
|
||||
use super::tracker::{EncoderUses, Summary, Use};
|
||||
use super::Device;
|
||||
@@ -67,6 +68,11 @@ pub(super) enum Deferred {
|
||||
/// ([`StagedScatter::drain`]): the host step of a batch of its own records nothing, once the
|
||||
/// work before it completed.
|
||||
ScatterDrain(Arc<StagedScatter>),
|
||||
/// The CPU's part of an encoder's copies back spliced at one place (`shadow_splice.rs`,
|
||||
/// [`ShadowSplices::drain`]): its texels' bytes in lines the GPU's copies left, copied from
|
||||
/// the arena into the pages by the host step of a batch of its own, which records nothing,
|
||||
/// once the work before it completed.
|
||||
ShadowSplice(Arc<ShadowSplices>),
|
||||
}
|
||||
|
||||
// SAFETY: a `Deferred` holds one `Arc` of its variant's work, which is `Send` and `Sync` for every
|
||||
@@ -96,6 +102,7 @@ const _: fn(&Deferred) = |work| {
|
||||
Deferred::GatherStage(work) => shared(work),
|
||||
Deferred::ScatterStage(work) => shared(work),
|
||||
Deferred::ScatterDrain(work) => shared(work),
|
||||
Deferred::ShadowSplice(work) => shared(work),
|
||||
}
|
||||
};
|
||||
|
||||
@@ -189,6 +196,7 @@ impl Deferred {
|
||||
(Deferred::GatherStage(a), Deferred::GatherStage(b)) => Arc::ptr_eq(a, b),
|
||||
(Deferred::ScatterStage(a), Deferred::ScatterStage(b)) => Arc::ptr_eq(a, b),
|
||||
(Deferred::ScatterDrain(a), Deferred::ScatterDrain(b)) => Arc::ptr_eq(a, b),
|
||||
(Deferred::ShadowSplice(a), Deferred::ShadowSplice(b)) => Arc::ptr_eq(a, b),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@@ -202,7 +210,8 @@ impl Deferred {
|
||||
/// which is one of the encoder's shadow copies, nor a run's merge (`pass_runs.rs`): a linear
|
||||
/// attachment's touches no shadowed texture, and a shadowed texture's is the copy back its
|
||||
/// encoder took out of its shadows to leave there. A staged copy's do: a gather's writes the
|
||||
/// buffer, a scatter's reads it and writes the pages, after every command before them.
|
||||
/// buffer, a scatter's reads it and writes the pages, after every command before them. A
|
||||
/// splice's CPU part does not: it ends copies back its encoder just recorded.
|
||||
pub(super) fn leaves_shadows(&self) -> bool {
|
||||
match self {
|
||||
Deferred::Execute(_)
|
||||
@@ -215,7 +224,8 @@ impl Deferred {
|
||||
Deferred::RenderPass(_)
|
||||
| Deferred::Pending(_)
|
||||
| Deferred::GatedCopyIn(_)
|
||||
| Deferred::RunMerge(_) => false,
|
||||
| Deferred::RunMerge(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,13 +238,17 @@ impl Deferred {
|
||||
/// before it may write. A render pass's, whether such a route met the buffer of one of its
|
||||
/// executions, or one of them reads its range from a buffer. A staged scatter's CPU copy
|
||||
/// reads the staging the GPU's copy before it wrote; a staged gather's reads guest RAM pages
|
||||
/// a command before it may write (`StagedGather::after_the_gpu`).
|
||||
/// a command before it may write (`StagedGather::after_the_gpu`); a splice's CPU part reads
|
||||
/// the region its copies back wrote.
|
||||
pub(super) fn gpu_written(&self) -> bool {
|
||||
match self {
|
||||
Deferred::Execute(execute) => {
|
||||
execute.icb.gpu_written() || execute.indirect() || execute.predicated()
|
||||
}
|
||||
Deferred::Dispatch(_) | Deferred::Loop(_) | Deferred::ScatterDrain(_) => true,
|
||||
Deferred::Dispatch(_)
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => true,
|
||||
Deferred::GatherStage(gather) => gather.after_the_gpu(),
|
||||
Deferred::SparseScrub(_)
|
||||
| Deferred::GatedCopyIn(_)
|
||||
@@ -461,23 +475,27 @@ impl Deferred {
|
||||
held: false,
|
||||
}),
|
||||
// Recorded by host steps: a gather's and a scatter's GPU copy by its batch's
|
||||
// (`records_at_its_step`); a scatter's CPU copy, which records nothing on the GPU,
|
||||
// once the work before it completed. Their uses are their encoder's, noted at the call
|
||||
// (`host_ram/copy.rs`): the steps' recordings name none of their own.
|
||||
Deferred::GatherStage(_) | Deferred::ScatterStage(_) | Deferred::ScatterDrain(_) => {
|
||||
Ok(Prepared {
|
||||
recorded: None,
|
||||
for_good: false,
|
||||
inputs: StepInputs::Staged,
|
||||
retained: None,
|
||||
pipelines: false,
|
||||
bound: match self {
|
||||
Deferred::ScatterDrain(_) => Some(EncoderUses::new(true).finish()),
|
||||
_ => None,
|
||||
},
|
||||
held: false,
|
||||
})
|
||||
}
|
||||
// (`records_at_its_step`); a scatter's CPU copy, and a splice's, which record nothing
|
||||
// on the GPU, once the work before it completed. Their uses are their encoder's, noted
|
||||
// at the call (`host_ram/copy.rs`, `EncoderCore::shadow_copies`): the steps'
|
||||
// recordings name none of their own.
|
||||
Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => Ok(Prepared {
|
||||
recorded: None,
|
||||
for_good: false,
|
||||
inputs: StepInputs::Staged,
|
||||
retained: None,
|
||||
pipelines: false,
|
||||
bound: match self {
|
||||
Deferred::ScatterDrain(_) | Deferred::ShadowSplice(_) => {
|
||||
Some(EncoderUses::new(true).finish())
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
held: false,
|
||||
}),
|
||||
// Recorded now where its pipelines are made; else by a host step once they are,
|
||||
// which makes again one whose making failed.
|
||||
Deferred::Pending(dispatch) => {
|
||||
@@ -539,7 +557,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => None,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,7 +613,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => Ok(None),
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,6 +668,7 @@ impl Deferred {
|
||||
Deferred::GatherStage(gather) => gather.stage(command_buffer),
|
||||
Deferred::ScatterStage(scatter) => scatter.stage(command_buffer),
|
||||
Deferred::ScatterDrain(scatter) => scatter.drain(command_buffer.device()),
|
||||
Deferred::ShadowSplice(splices) => Ok(splices.drain()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +689,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => false,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,7 +710,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => false,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,9 +720,10 @@ impl Deferred {
|
||||
pub(super) fn holds(&self) -> bool {
|
||||
match self {
|
||||
Deferred::Loop(check) => check.running(),
|
||||
Deferred::GatherStage(_) | Deferred::ScatterStage(_) | Deferred::ScatterDrain(_) => {
|
||||
false
|
||||
}
|
||||
Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
Deferred::Execute(_)
|
||||
| Deferred::Dispatch(_)
|
||||
| Deferred::SparseScrub(_)
|
||||
@@ -734,7 +758,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => false,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,7 +781,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => false,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,7 +799,8 @@ impl Deferred {
|
||||
/// shadowed texture's truth, whose uses its pass noted): a rebind of them encodes that
|
||||
/// encoder again, the merge with it. So do a staged copy's steps, between the buffer its call
|
||||
/// resolved (`blit_at`) and the pages it named. Everything else its step resolves as it
|
||||
/// records: a rebind meanwhile is refused.
|
||||
/// records: a rebind meanwhile is refused; a splice's CPU part among it, which writes the
|
||||
/// pages the truth's buffer lay in at its encoder's call, so they stay until it completes.
|
||||
pub(super) fn resolved_at_its_calls(&self, pipelines: bool) -> bool {
|
||||
match self {
|
||||
Deferred::Pending(_)
|
||||
@@ -786,7 +813,8 @@ impl Deferred {
|
||||
| Deferred::Dispatch(_)
|
||||
| Deferred::SparseScrub(_)
|
||||
| Deferred::GatedCopyIn(_)
|
||||
| Deferred::Loop(_) => false,
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,7 +835,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => false,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -830,7 +859,8 @@ impl Deferred {
|
||||
| Deferred::GatedCopyIn(_)
|
||||
| Deferred::RunMerge(_)
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::ScatterDrain(_) => None,
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -847,7 +877,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => {}
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,7 +896,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => {}
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,7 +913,8 @@ impl Deferred {
|
||||
| Deferred::Loop(_)
|
||||
| Deferred::GatherStage(_)
|
||||
| Deferred::ScatterStage(_)
|
||||
| Deferred::ScatterDrain(_) => {}
|
||||
| Deferred::ScatterDrain(_)
|
||||
| Deferred::ShadowSplice(_) => {}
|
||||
Deferred::RenderPass(pass) => pass.degrade(device),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ use super::shadow::{
|
||||
};
|
||||
use super::shadow_copy_in::CopyIn;
|
||||
use super::shadow_merge::{MergeLease, ShadowMerge};
|
||||
use super::shadow_splice::{self, ShadowSplices, SpliceDrain, SplicePlan};
|
||||
use super::shadow_standing::Unskipped;
|
||||
use super::sparse::encoder::SparseUpdate;
|
||||
use super::texture::decoded_twin::TwinWrite;
|
||||
@@ -553,6 +554,11 @@ pub(super) struct EncoderCore {
|
||||
/// records again work a commit recorded (`command_buffer/reencode.rs`): its commands take
|
||||
/// what they use without holding it (`Rebinds::pin`).
|
||||
replaying: bool,
|
||||
/// Whether a copy back it records may leave its CPU part to a host step after it
|
||||
/// (`shadow_splice.rs`): an encoder's core, and one that encodes an ended encoder again,
|
||||
/// whose segments go on; not a segment's or a capture's, which records at a commit or a host
|
||||
/// step, where none may follow.
|
||||
splices_apart: bool,
|
||||
/// The set 0 its last command allocated and wrote, which a later command that writes the same
|
||||
/// into a set of the same layout binds again ([`set_zero`](Self::set_zero)).
|
||||
last_set_zero: LastSetZero,
|
||||
@@ -906,6 +912,7 @@ impl EncoderCore {
|
||||
gathers: GatherRuns::default(),
|
||||
id: CORES.fetch_add(1, Ordering::Relaxed),
|
||||
replaying: false,
|
||||
splices_apart: true,
|
||||
last_set_zero: LastSetZero::default(),
|
||||
pushed_zero: PushedSetZero::default(),
|
||||
recordings: 0,
|
||||
@@ -951,6 +958,7 @@ impl EncoderCore {
|
||||
) -> Result<EncoderCore, Error> {
|
||||
let mut core = EncoderCore::segment_raw(command_buffer, ordered)?;
|
||||
core.replaying = true;
|
||||
core.splices_apart = true;
|
||||
// Its first uses of copies taken at use take them where its first encoding's did, whose
|
||||
// recording is never submitted (`shadow::Takes`, `command_buffer/reencode.rs`).
|
||||
let first = command_buffer.state().replaying_takes.clone();
|
||||
@@ -1087,6 +1095,7 @@ impl EncoderCore {
|
||||
id: CORES.fetch_add(1, Ordering::Relaxed),
|
||||
// A segment a rebind records again, its command buffer committed.
|
||||
replaying: crate::replay::is_replaying(),
|
||||
splices_apart: false,
|
||||
last_set_zero: LastSetZero::default(),
|
||||
pushed_zero: PushedSetZero::default(),
|
||||
recordings: 0,
|
||||
@@ -2919,7 +2928,11 @@ impl EncoderCore {
|
||||
/// dispatch (`shadow_copy_back.rs`), a merged texture's copy in and its keep are one dispatch
|
||||
/// at the copy in where the device takes it (`shadow_copy_in.rs`), and the rows a copy back
|
||||
/// moves out of a staging buffer are a copy of rows (`row_copies.rs`); the command buffer
|
||||
/// retains each until it completes.
|
||||
/// retains each until it completes. A copy back into host pages the CPU may write beside its
|
||||
/// texels, on a device whose stores write back the lines they end in, is spliced where a host
|
||||
/// step may follow, outside a pass the encoder holds: the GPU copies the texels that fill
|
||||
/// whole lines, and the host step after the copies the rest (`shadow_splice.rs`,
|
||||
/// [`drain_splices`](Self::drain_splices)).
|
||||
pub(super) fn shadow_copies(&mut self, copies: &[ShadowCopy]) {
|
||||
let device = self.device().clone();
|
||||
let mut run = ShadowRun::default();
|
||||
@@ -2927,6 +2940,9 @@ impl EncoderCore {
|
||||
// the staging buffer their copy in filled.
|
||||
let mut taken = Vec::new();
|
||||
let mut staged = Vec::new();
|
||||
// The CPU's parts of the copies back spliced, with their writes of their truths' bytes.
|
||||
let mut spliced = Vec::new();
|
||||
let splices = self.splices_apart && self.pass.is_none();
|
||||
for (i, copy) in copies.iter().enumerate() {
|
||||
if taken.contains(&i) {
|
||||
continue;
|
||||
@@ -2963,6 +2979,10 @@ impl EncoderCore {
|
||||
if let Some((log, bytes)) = copy.written_log(&device) {
|
||||
self.open.command_buffer.dirty().wrote_back(log, bytes);
|
||||
}
|
||||
if let Some(plan) = splices.then(|| copy.splice_plan(&device)).flatten() {
|
||||
spliced.extend(self.splice(&mut run, copy, plan));
|
||||
continue;
|
||||
}
|
||||
// A shadow takes the view a dispatch reads on a device that dispatches alone.
|
||||
let dispatched = copy.dispatched(&device);
|
||||
let rows = match dispatched {
|
||||
@@ -3076,6 +3096,71 @@ impl EncoderCore {
|
||||
if run.recorded() {
|
||||
self.barrier(Barrier::everything());
|
||||
}
|
||||
self.drain_splices(spliced);
|
||||
}
|
||||
|
||||
/// Record `copy`, a copy back cut as `plan` cuts it (`shadow_splice.rs`), in `run`, as
|
||||
/// [`shadow_command`](Self::shadow_command) records any shadowed texture's copy: the texels
|
||||
/// that fill whole lines into its truth's bytes, the rest into a region of the command
|
||||
/// buffer's arena. The CPU's part, and the copy's write of its truth's bytes, where it
|
||||
/// recorded. Where the region cannot be had, the command buffer fails, as a recording that
|
||||
/// fails does.
|
||||
fn splice(
|
||||
&mut self,
|
||||
run: &mut ShadowRun,
|
||||
copy: &ShadowCopy,
|
||||
plan: SplicePlan,
|
||||
) -> Option<(SpliceDrain, Use<ResourceKey>)> {
|
||||
let device = self.device().clone();
|
||||
let line = device.shared().in_place.line();
|
||||
let region = {
|
||||
let mut state = self.open.command_buffer.state();
|
||||
shadow_splice::region(&mut state.uploads, &device, plan.length(), line)
|
||||
};
|
||||
let region = match region {
|
||||
Ok(region) => region,
|
||||
Err(error) => {
|
||||
self.fail_command_buffer(recording_error(&device, error));
|
||||
return None;
|
||||
}
|
||||
};
|
||||
let splice = plan.place(region);
|
||||
let uses = copy.uses();
|
||||
let recorded = std::cell::Cell::new(false);
|
||||
let record = |device: &Vk, raw: vk::CommandBuffer| {
|
||||
// SAFETY: the encoder's command buffer is recording outside a render pass; its
|
||||
// commands retain the shadowed texture (its image and staging buffer) and its arena
|
||||
// (the region) until it completes, and every image rests in the `GENERAL` layout.
|
||||
recorded.set(unsafe { copy.record_spliced(device, raw, &splice) });
|
||||
};
|
||||
self.shadow_command(run, (copy.stages(), &uses, true), record);
|
||||
if !recorded.get() {
|
||||
return None;
|
||||
}
|
||||
device.shared().counts.shadow_copy_back_spliced();
|
||||
let written = uses.into_iter().find(|used| !used.write.is_empty())?;
|
||||
Some((splice.drain, written))
|
||||
}
|
||||
|
||||
/// Leave the CPU's parts of the copies back [`shadow_copies`](Self::shadow_copies) just
|
||||
/// spliced, `spliced` with each one's write of its truth's bytes, to the host step of a batch
|
||||
/// of their own, once the work before them completed (`Deferred::ShadowSplice`), and note
|
||||
/// those writes there: the encoder goes on in a new `VkCommandBuffer` after it, so its later
|
||||
/// commands, and every later batch, run after the CPU's copies. Where the step cannot be
|
||||
/// left, the command buffer fails, as a recording that fails does.
|
||||
fn drain_splices(&mut self, spliced: Vec<(SpliceDrain, Use<ResourceKey>)>) {
|
||||
if spliced.is_empty() {
|
||||
return;
|
||||
}
|
||||
let (drains, writes): (Vec<SpliceDrain>, Vec<Use<ResourceKey>>) =
|
||||
spliced.into_iter().unzip();
|
||||
let work = Deferred::ShadowSplice(Arc::new(ShadowSplices(drains)));
|
||||
if let Err(error) = self.defer(work) {
|
||||
let device = self.device().clone();
|
||||
self.fail_command_buffer(recording_error(&device, error));
|
||||
return;
|
||||
}
|
||||
self.note_left_uses(vk::PipelineStageFlags2::TRANSFER, &writes);
|
||||
}
|
||||
|
||||
/// Record one shadowed texture's copy, of `uses` in `stages`, writing its truth where
|
||||
|
||||
@@ -236,6 +236,7 @@ mod shadow_copy_back;
|
||||
mod shadow_copy_in;
|
||||
mod shadow_log;
|
||||
mod shadow_merge;
|
||||
mod shadow_splice;
|
||||
mod shadow_standing;
|
||||
mod shadow_stencil;
|
||||
mod shards;
|
||||
|
||||
@@ -280,6 +280,7 @@ use super::rotated::{RotatedCopies, Turn};
|
||||
use super::row_copies::RowCopies;
|
||||
use super::shadow_copy_back::{CopyBack, WordView};
|
||||
use super::shadow_merge::{ScratchSpares, ShadowMerge, UnormView};
|
||||
use super::shadow_splice::{self, PlannedCut, Splice, SpliceCopies, SplicePlan};
|
||||
use super::shadow_standing::{Missed, StandingAcross};
|
||||
use super::texture::copy_images::UseMaker;
|
||||
use super::texture::decoded_twin::DecodePass;
|
||||
@@ -2022,6 +2023,154 @@ impl ShadowCopy {
|
||||
CopyBack::new(device, *words, buffer.raw(), ®ion)
|
||||
}
|
||||
|
||||
/// This copy back's splice (`shadow_splice.rs`), cut now over the buffer's `VkBuffer` as it
|
||||
/// is recorded: a copy back of a 2D texture's image (copied in place, or through its staging
|
||||
/// buffer), or of a texture buffer's staging buffer, into a no-copy buffer's host pages, on a
|
||||
/// device whose check splices those pages' copies back ([`shadow_splice::splices`]). `None`
|
||||
/// for any other copy, one that moves no texel, and a buffer whose pages went.
|
||||
pub(super) fn splice_plan(&self, device: &Device) -> Option<SplicePlan> {
|
||||
let (
|
||||
Step::Back,
|
||||
None,
|
||||
ShadowSource::Bytes {
|
||||
buffer: ShadowBuffer::Rebound(buffer),
|
||||
target,
|
||||
..
|
||||
},
|
||||
) = (&self.step, &self.clear, &self.copies.source)
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
let buffer = buffer.upgrade()?;
|
||||
let class = shadow_splice::class(&buffer)?;
|
||||
let checks = &device.shared().in_place;
|
||||
if !shadow_splice::splices(checks, class) {
|
||||
return None;
|
||||
}
|
||||
let contents = buffer.mapped_contents()?.as_ptr().addr() as u64;
|
||||
let (truth, at) = buffer.attached_at(0)?;
|
||||
// The `VkBuffer`'s byte `v` lies at the host address `v + base`.
|
||||
let base = contents.wrapping_sub(at);
|
||||
let line = checks.line();
|
||||
let cut = match target {
|
||||
ShadowTarget::Image {
|
||||
staging: None,
|
||||
texel: Some(texel),
|
||||
..
|
||||
} => {
|
||||
// Cut to the copy's rectangle as `record` cuts it.
|
||||
let regions = target.image_regions(false)?;
|
||||
let regions = match (self.area, regions) {
|
||||
(Some(area), [region]) => vec![part_of(region, area, *texel)?],
|
||||
_ => regions.to_vec(),
|
||||
};
|
||||
PlannedCut::Image(shadow_splice::image(®ions, *texel, base, line))
|
||||
}
|
||||
ShadowTarget::Image {
|
||||
staging: Some(staging),
|
||||
..
|
||||
}
|
||||
| ShadowTarget::Buffer(staging) => {
|
||||
PlannedCut::Staged(shadow_splice::staged(&staging.back, base, line))
|
||||
}
|
||||
ShadowTarget::Image { texel: None, .. }
|
||||
| ShadowTarget::Rotated { .. }
|
||||
| ShadowTarget::Planes { .. }
|
||||
| ShadowTarget::Tiled { .. } => return None,
|
||||
};
|
||||
// A copy whose texels fill whole lines alone shares no line: copied back as before.
|
||||
let pieces = match &cut {
|
||||
PlannedCut::Image(cut) => cut.pieces.len(),
|
||||
PlannedCut::Staged(cut) => cut.pieces.len(),
|
||||
};
|
||||
(pieces > 0).then_some(SplicePlan { buffer, truth, cut })
|
||||
}
|
||||
|
||||
/// Record this copy back as `splice` cuts it ([`splice_plan`](Self::splice_plan)): the
|
||||
/// texels that fill whole lines into the buffer, the rest into the region its host step
|
||||
/// copies them out of (`shadow_splice.rs`); through the staging buffer where the copy goes
|
||||
/// through it, after the image's copy into it and a barrier. Whether it recorded: not for a
|
||||
/// splice cut from another copy's target.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// As [`record`](Self::record); the region lives until the command buffer completes (its
|
||||
/// arena's).
|
||||
pub(super) unsafe fn record_spliced(
|
||||
&self,
|
||||
device: &Vk,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
splice: &Splice,
|
||||
) -> bool {
|
||||
let ShadowSource::Bytes { target, .. } = &self.copies.source else {
|
||||
return false;
|
||||
};
|
||||
let general = vk::ImageLayout::GENERAL;
|
||||
// SAFETY: the caller's contract; the regions lie in the image, the staging buffer, the
|
||||
// buffer's bytes (cut from the copy's own) and the region (cut to its length), and the
|
||||
// staging buffer lives with the texture.
|
||||
unsafe {
|
||||
match (&splice.copies, target) {
|
||||
(
|
||||
SpliceCopies::Image { whole, edges },
|
||||
ShadowTarget::Image {
|
||||
image,
|
||||
staging: None,
|
||||
..
|
||||
},
|
||||
) => {
|
||||
if !whole.is_empty() {
|
||||
device.cmd_copy_image_to_buffer(
|
||||
command_buffer,
|
||||
*image,
|
||||
general,
|
||||
splice.truth,
|
||||
whole,
|
||||
);
|
||||
}
|
||||
if !edges.is_empty() {
|
||||
device.cmd_copy_image_to_buffer(
|
||||
command_buffer,
|
||||
*image,
|
||||
general,
|
||||
splice.region,
|
||||
edges,
|
||||
);
|
||||
}
|
||||
true
|
||||
}
|
||||
(
|
||||
SpliceCopies::Staged { whole, edges },
|
||||
ShadowTarget::Image {
|
||||
staging: Some(staging),
|
||||
..
|
||||
}
|
||||
| ShadowTarget::Buffer(staging),
|
||||
) => {
|
||||
if let ShadowTarget::Image { image, .. } = target {
|
||||
let regions = target.image_regions(false).unwrap_or_default();
|
||||
device.cmd_copy_image_to_buffer(
|
||||
command_buffer,
|
||||
*image,
|
||||
general,
|
||||
staging.raw(),
|
||||
regions,
|
||||
);
|
||||
Barrier::everything().record(device, command_buffer);
|
||||
}
|
||||
if !whole.is_empty() {
|
||||
device.cmd_copy_buffer(command_buffer, staging.raw(), splice.truth, whole);
|
||||
}
|
||||
if !edges.is_empty() {
|
||||
device.cmd_copy_buffer(command_buffer, staging.raw(), splice.region, edges);
|
||||
}
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The texels a copy in of a one-region, one-slice 2D texture's image over a buffer's bytes
|
||||
/// copied in place moves, as `record` cuts its region (where they lie in the buffer, and in
|
||||
/// the image): what a merge's keep may take with it (`ShadowMerge::keep_in`). `None` for any
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
//! A shadowed texture's copy back into bytes the CPU may write beside its texels, spliced: the
|
||||
//! GPU writes only the lines of memory its texels fill, and the CPU writes the rest.
|
||||
//!
|
||||
//! A device may write back a line of memory a store of its ends in whole (`in_place::RowEnds`: a
|
||||
//! line is `nonCoherentAtomSize` bytes at a multiple of it, "the size and alignment in bytes that
|
||||
//! bounds concurrent access to host-mapped device memory", vkspec, Limits): on an Iris Xe under
|
||||
//! ANV, a copy back of a 34x34 `RGBA16Float` shadow into rows 512 bytes apart over host pages put
|
||||
//! back older values over the CPU's writes to the padding in the line that holds each row's last
|
||||
//! texels, a few thousand bytes in 300 command buffers, and so did a merge's stores
|
||||
//! (`tests/shadow_write_lines.rs`). Metal keeps every byte the CPU writes beside a texture's
|
||||
//! texels (`crates/metal2vulkan-conformance/probes/row_padding_writes.m`: the bytes between an
|
||||
//! IOSurface plane's rows under clears, stores, draws and kernels on every Mac it ran on).
|
||||
//!
|
||||
//! **Where.** A copy back ([`Step::Back`](crate::shadow::Step)) of a 2D texture's image, or of a
|
||||
//! texture buffer's staging buffer, into a no-copy buffer's host pages (not a copy of them,
|
||||
//! `copied.rs`), on a device whose check of such pages ([`PagesClass::DmaBuf`] where they are
|
||||
//! imported as dma-bufs, else [`PagesClass::Pointer`]) failed, or has not answered, the copies or
|
||||
//! the shader writes of texels that share a line with bytes beside them ([`Access::Copies`],
|
||||
//! [`Access::Writes`] of [`RowEnds::InLines`], [`splices`]); a device where both passed copies
|
||||
//! back as before. Recorded by the encoder's own copies (`EncoderCore::shadow_copies`), outside a
|
||||
//! render pass it holds and outside a segment's recording, where a host step may follow.
|
||||
//!
|
||||
//! **How** ([`image`], [`staged`]). Each row of the copy's texels (each region's, each slice's)
|
||||
//! is cut at the first and last line boundaries it holds: the columns between them, whose lines
|
||||
//! hold that row's texels alone, are copied by the GPU straight into the buffer, one region for
|
||||
//! every row of a slice where its rows are a multiple of a line apart (each row's boundaries then
|
||||
//! fall at the same columns), else one a row; the columns before the first boundary and after
|
||||
//! the last are copied by the GPU into a region of the command buffer's arena (`upload.rs`), its
|
||||
//! own lines whole ([`region`]), and from there by the CPU into the pages, by a host step of a
|
||||
//! batch of its own once that copy completed ([`ShadowSplices::drain`], `Deferred::ShadowSplice`),
|
||||
//! a byte at a time as the CPU's stores go: the CPU's own writes beside them stay. A row whose
|
||||
//! texels hold no whole line goes to the CPU whole. A texel the boundary cuts goes to the CPU
|
||||
//! with its row's edge. The encoder notes the CPU's writes of the truth's bytes after the step,
|
||||
//! so the commands after it order after them; and the work after it goes in a later batch, which
|
||||
//! the step precedes.
|
||||
//!
|
||||
//! **Where the copy stays.** A copy back between a render pass's instances or before its tile
|
||||
//! dispatch (`render/pass_steps.rs`), into a pass's held command buffer
|
||||
//! (`render/inline_splits.rs`), or at a segment's end (`EncoderCore::end_segment`), where no host
|
||||
//! step may follow before the commands after it that read the bytes; a rotated texture's, a
|
||||
//! heap's two-plane or tiled texture's, a heap's depth or stencil texture's; and a copy back into
|
||||
//! the runtime's own memory (a `Shared` buffer's): each copies back as before
|
||||
//! (`docs/FAST-PATHS.md`, known gaps).
|
||||
|
||||
use super::buffer::Buffer;
|
||||
use super::encoder::RecordedSegment;
|
||||
use super::error::{internal, Error};
|
||||
use super::in_place::{Access, InPlaceChecks, PagesClass, RowEnds, Verdict};
|
||||
use super::upload::{Upload, Uploads};
|
||||
use super::Device;
|
||||
use ash::vk;
|
||||
|
||||
/// The alignment of each edge's bytes in the region: a multiple of every texel's size a copy
|
||||
/// into it takes (1, 2, 4, 8 or 16 bytes), as `bufferOffset` must be.
|
||||
const EDGE_ALIGNMENT: u64 = 16;
|
||||
|
||||
/// Whether a copy back into host pages of `class` is spliced, by the device's check: where the
|
||||
/// copies or the shader writes of texels that share a line with bytes beside them failed, or have
|
||||
/// no answer yet.
|
||||
pub(crate) fn splices(checks: &InPlaceChecks, class: PagesClass) -> bool {
|
||||
[Access::Copies, Access::Writes].into_iter().any(|access| {
|
||||
matches!(
|
||||
checks.decided(class, access, RowEnds::InLines),
|
||||
Verdict::Failed | Verdict::Pending
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// The class of host pages a no-copy buffer's bytes lie in, as the device's check measures them:
|
||||
/// `None` for a buffer over no host pages, or over a copy of them (`copied.rs`), which the CPU
|
||||
/// does not write while a command buffer runs.
|
||||
pub(super) fn class(buffer: &Buffer) -> Option<PagesClass> {
|
||||
if buffer.host_pages().is_none() || buffer.copied() {
|
||||
return None;
|
||||
}
|
||||
Some(match buffer.over_dma_buf() {
|
||||
true => PagesClass::DmaBuf,
|
||||
false => PagesClass::Pointer,
|
||||
})
|
||||
}
|
||||
|
||||
/// The columns of a row of `width` texels of `texel` bytes, whose first byte lies `phase` bytes
|
||||
/// past a line of `line` bytes, that fill whole lines: from the first texel at or past the first
|
||||
/// line boundary to the last texel that ends at or before the last. `(0, 0)` where none does.
|
||||
fn columns(phase: u64, width: u32, texel: u64, line: u64) -> (u32, u32) {
|
||||
let (first, last) = boundaries(phase, u64::from(width) * texel, line);
|
||||
let (c0, c1) = (first.div_ceil(texel), last / texel);
|
||||
match c1 > c0 {
|
||||
// At most the row's texels: the last boundary lies at or before its end.
|
||||
true => (c0 as u32, c1 as u32),
|
||||
false => (0, 0),
|
||||
}
|
||||
}
|
||||
|
||||
/// The first and last line boundaries of `bytes` bytes whose first lies `phase` bytes past a line
|
||||
/// of `line` bytes, counted from that first byte; the last before the first where no line lies
|
||||
/// whole among them.
|
||||
fn boundaries(phase: u64, bytes: u64, line: u64) -> (u64, u64) {
|
||||
let first = (line - phase % line) % line;
|
||||
let end = phase % line + bytes;
|
||||
let last = (end - end % line).saturating_sub(phase % line);
|
||||
(first, last)
|
||||
}
|
||||
|
||||
/// A copy back cut for its splice: the GPU's copies `R` of whole lines into the buffer
|
||||
/// (`whole`) and of the rest into the region (`edges`, their offsets from its start), and the
|
||||
/// CPU's pieces: each one's host address, length and byte of the region.
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct Cut<R> {
|
||||
pub(crate) whole: Vec<R>,
|
||||
pub(crate) edges: Vec<R>,
|
||||
pub(crate) pieces: Vec<(u64, u64, u64)>,
|
||||
/// The bytes of the region the edges take.
|
||||
pub(crate) length: u64,
|
||||
}
|
||||
|
||||
impl<R> Cut<R> {
|
||||
/// Take `bytes` bytes of the region for an edge: where they start.
|
||||
fn take(&mut self, bytes: u64) -> u64 {
|
||||
let at = self.length.next_multiple_of(EDGE_ALIGNMENT);
|
||||
self.length = at + bytes;
|
||||
at
|
||||
}
|
||||
}
|
||||
|
||||
/// `regions` of a copy back from a 2D texture's image into a `VkBuffer` whose byte `v` lies at
|
||||
/// the host address `v + base` (wrapping), `texel` bytes a texel, cut for lines of `line` bytes
|
||||
/// (the module docs' **How**).
|
||||
pub(crate) fn image(
|
||||
regions: &[vk::BufferImageCopy],
|
||||
texel: u64,
|
||||
base: u64,
|
||||
line: u64,
|
||||
) -> Cut<vk::BufferImageCopy> {
|
||||
let mut cut = Cut::default();
|
||||
for region in regions {
|
||||
let extent = region.image_extent;
|
||||
let layers = region.image_subresource.layer_count;
|
||||
if extent.width == 0 || extent.height == 0 || extent.depth == 0 || layers == 0 {
|
||||
continue;
|
||||
}
|
||||
let row = match region.buffer_row_length {
|
||||
0 => extent.width,
|
||||
row => row,
|
||||
};
|
||||
let pitch = u64::from(row) * texel;
|
||||
let height = match region.buffer_image_height {
|
||||
0 => extent.height,
|
||||
height => height,
|
||||
};
|
||||
let slice_pitch = u64::from(height) * pitch;
|
||||
// Each slice apart: a layer of an array's (whose depth is 1), or a depth slice.
|
||||
for slice in 0..layers.max(extent.depth) {
|
||||
let (layer, z) = match layers > 1 {
|
||||
true => (slice, 0),
|
||||
false => (0, slice),
|
||||
};
|
||||
let start = region.buffer_offset + u64::from(slice) * slice_pitch;
|
||||
let place = Place {
|
||||
region,
|
||||
layer,
|
||||
z,
|
||||
row,
|
||||
pitch,
|
||||
texel,
|
||||
};
|
||||
match pitch.is_multiple_of(line) {
|
||||
true => cut.band(&place, (0, extent.height), start, (base, line)),
|
||||
false => {
|
||||
for y in 0..extent.height {
|
||||
let at = start + u64::from(y) * pitch;
|
||||
cut.band(&place, (y, 1), at, (base, line));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cut
|
||||
}
|
||||
|
||||
/// Where a band of a region's rows lies: the region, its slice's layer and depth, its rows'
|
||||
/// length in texels and their pitch, and a texel's bytes.
|
||||
struct Place<'a> {
|
||||
region: &'a vk::BufferImageCopy,
|
||||
layer: u32,
|
||||
z: u32,
|
||||
row: u32,
|
||||
pitch: u64,
|
||||
texel: u64,
|
||||
}
|
||||
|
||||
impl Cut<vk::BufferImageCopy> {
|
||||
/// Cut `rows` rows of `place` from row `y`, whose first byte is the `VkBuffer`'s `at`, each
|
||||
/// cut at the same columns (one row, or rows a multiple of a line apart).
|
||||
fn band(
|
||||
&mut self,
|
||||
place: &Place<'_>,
|
||||
(y, rows): (u32, u32),
|
||||
at: u64,
|
||||
(base, line): (u64, u64),
|
||||
) {
|
||||
let region = place.region;
|
||||
let width = region.image_extent.width;
|
||||
let phase = at.wrapping_add(base) % line;
|
||||
let (c0, c1) = columns(phase, width, place.texel, line);
|
||||
let subresource = vk::ImageSubresourceLayers {
|
||||
base_array_layer: region.image_subresource.base_array_layer + place.layer,
|
||||
layer_count: 1,
|
||||
..region.image_subresource
|
||||
};
|
||||
let offset = |x: u32| vk::Offset3D {
|
||||
x: region.image_offset.x + x as i32,
|
||||
y: region.image_offset.y + y as i32,
|
||||
z: region.image_offset.z + place.z as i32,
|
||||
};
|
||||
if c1 > c0 {
|
||||
self.whole.push(vk::BufferImageCopy {
|
||||
buffer_offset: at + u64::from(c0) * place.texel,
|
||||
buffer_row_length: place.row,
|
||||
buffer_image_height: 0,
|
||||
image_subresource: subresource,
|
||||
image_offset: offset(c0),
|
||||
image_extent: vk::Extent3D {
|
||||
width: c1 - c0,
|
||||
height: rows,
|
||||
depth: 1,
|
||||
},
|
||||
});
|
||||
}
|
||||
let (head, tail) = match c1 > c0 {
|
||||
true => ((0, c0), (c1, width)),
|
||||
false => ((0, 0), (0, width)),
|
||||
};
|
||||
for (x0, x1) in [head, tail].into_iter().filter(|(x0, x1)| x1 > x0) {
|
||||
let bytes = u64::from(x1 - x0) * place.texel;
|
||||
let into = self.take(bytes * u64::from(rows));
|
||||
self.edges.push(vk::BufferImageCopy {
|
||||
buffer_offset: into,
|
||||
buffer_row_length: 0,
|
||||
buffer_image_height: 0,
|
||||
image_subresource: subresource,
|
||||
image_offset: offset(x0),
|
||||
image_extent: vk::Extent3D {
|
||||
width: x1 - x0,
|
||||
height: rows,
|
||||
depth: 1,
|
||||
},
|
||||
});
|
||||
for r in 0..u64::from(rows) {
|
||||
let from = at + r * place.pitch + u64::from(x0) * place.texel;
|
||||
self.pieces
|
||||
.push((from.wrapping_add(base), bytes, into + r * bytes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `back`, the copies of a staging buffer's rows into a `VkBuffer` whose byte `v` lies at the
|
||||
/// host address `v + base` (wrapping), cut for lines of `line` bytes: each copy's bytes between
|
||||
/// its first and last line boundaries go straight in, and the rest through the region.
|
||||
pub(crate) fn staged(back: &[vk::BufferCopy], base: u64, line: u64) -> Cut<vk::BufferCopy> {
|
||||
let mut cut = Cut::default();
|
||||
for copy in back.iter().filter(|copy| copy.size > 0) {
|
||||
let phase = copy.dst_offset.wrapping_add(base) % line;
|
||||
let (first, last) = boundaries(phase, copy.size, line);
|
||||
let edges = match last > first {
|
||||
true => {
|
||||
cut.whole.push(vk::BufferCopy {
|
||||
src_offset: copy.src_offset + first,
|
||||
dst_offset: copy.dst_offset + first,
|
||||
size: last - first,
|
||||
});
|
||||
[(0, first), (last, copy.size)]
|
||||
}
|
||||
false => [(0, 0), (0, copy.size)],
|
||||
};
|
||||
for (a, b) in edges.into_iter().filter(|(a, b)| b > a) {
|
||||
let into = cut.take(b - a);
|
||||
cut.edges.push(vk::BufferCopy {
|
||||
src_offset: copy.src_offset + a,
|
||||
dst_offset: into,
|
||||
size: b - a,
|
||||
});
|
||||
let from = copy.dst_offset + a;
|
||||
cut.pieces.push((from.wrapping_add(base), b - a, into));
|
||||
}
|
||||
}
|
||||
cut
|
||||
}
|
||||
|
||||
/// A region of `length` bytes of `uploads`, its first byte at a line of `line` bytes and its
|
||||
/// length a multiple of one: no line holds a byte of another region, so the GPU's copies into it
|
||||
/// write back no line another region's bytes lie in, as a host step writes those of a later batch
|
||||
/// while the GPU runs this one's.
|
||||
pub(super) fn region(
|
||||
uploads: &mut Uploads,
|
||||
device: &Device,
|
||||
length: u64,
|
||||
line: u64,
|
||||
) -> Result<Upload, Error> {
|
||||
let rounded = length.next_multiple_of(line);
|
||||
let region = uploads.unset(device, rounded + line)?;
|
||||
let (chunk, offset) = region.buffer();
|
||||
let Some(at) = chunk.mapped_contents() else {
|
||||
return Err(internal("an arena chunk the CPU does not map"));
|
||||
};
|
||||
let host = (at.as_ptr().addr() as u64).wrapping_add(offset);
|
||||
let pad = (line - host % line) % line;
|
||||
let region = region.part(pad, rounded);
|
||||
// Its offset in its `VkBuffer` takes every texel's size too: a chunk's `VkBuffer` lies from
|
||||
// the start of its memory, which the CPU maps from a page.
|
||||
if !region.offset().is_multiple_of(EDGE_ALIGNMENT) {
|
||||
return Err(internal(
|
||||
"an arena region a line apart from its offset's alignment",
|
||||
));
|
||||
}
|
||||
Ok(region)
|
||||
}
|
||||
|
||||
/// A copy back's splice, cut and its region taken: what the copy records.
|
||||
pub(super) struct Splice {
|
||||
pub(super) copies: SpliceCopies,
|
||||
/// The truth's `VkBuffer`, as the copy is recorded.
|
||||
pub(super) truth: vk::Buffer,
|
||||
/// The region's `VkBuffer`.
|
||||
pub(super) region: vk::Buffer,
|
||||
/// What the host step copies.
|
||||
pub(super) drain: SpliceDrain,
|
||||
}
|
||||
|
||||
/// The GPU's copies of a splice, their offsets in the region its `VkBuffer`'s.
|
||||
pub(super) enum SpliceCopies {
|
||||
/// From a 2D texture's image.
|
||||
Image {
|
||||
whole: Vec<vk::BufferImageCopy>,
|
||||
edges: Vec<vk::BufferImageCopy>,
|
||||
},
|
||||
/// From the staging buffer: a texture buffer's, or a 2D texture's after its image's copy
|
||||
/// into it.
|
||||
Staged {
|
||||
whole: Vec<vk::BufferCopy>,
|
||||
edges: Vec<vk::BufferCopy>,
|
||||
},
|
||||
}
|
||||
|
||||
/// A copy back cut for its splice, its region not yet taken: the truth's buffer and `VkBuffer`,
|
||||
/// and the cut.
|
||||
pub(super) struct SplicePlan {
|
||||
pub(super) buffer: Buffer,
|
||||
pub(super) truth: vk::Buffer,
|
||||
pub(super) cut: PlannedCut,
|
||||
}
|
||||
|
||||
/// A [`SplicePlan`]'s cut, of either form.
|
||||
pub(super) enum PlannedCut {
|
||||
Image(Cut<vk::BufferImageCopy>),
|
||||
Staged(Cut<vk::BufferCopy>),
|
||||
}
|
||||
|
||||
impl SplicePlan {
|
||||
/// The bytes of the region its edges take.
|
||||
pub(super) fn length(&self) -> u64 {
|
||||
match &self.cut {
|
||||
PlannedCut::Image(cut) => cut.length,
|
||||
PlannedCut::Staged(cut) => cut.length,
|
||||
}
|
||||
}
|
||||
|
||||
/// The splice, its edges in `region`.
|
||||
pub(super) fn place(self, region: Upload) -> Splice {
|
||||
let into = region.offset();
|
||||
let (copies, pieces) = match self.cut {
|
||||
PlannedCut::Image(mut cut) => {
|
||||
for edge in &mut cut.edges {
|
||||
edge.buffer_offset += into;
|
||||
}
|
||||
let copies = SpliceCopies::Image {
|
||||
whole: cut.whole,
|
||||
edges: cut.edges,
|
||||
};
|
||||
(copies, cut.pieces)
|
||||
}
|
||||
PlannedCut::Staged(mut cut) => {
|
||||
for edge in &mut cut.edges {
|
||||
edge.dst_offset += into;
|
||||
}
|
||||
let copies = SpliceCopies::Staged {
|
||||
whole: cut.whole,
|
||||
edges: cut.edges,
|
||||
};
|
||||
(copies, cut.pieces)
|
||||
}
|
||||
};
|
||||
Splice {
|
||||
copies,
|
||||
truth: self.truth,
|
||||
region: region.raw(),
|
||||
drain: SpliceDrain {
|
||||
_buffer: self.buffer,
|
||||
region,
|
||||
pieces,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The CPU's part of one copy back's splice: the pieces it copies from the region into the
|
||||
/// truth's pages.
|
||||
pub(super) struct SpliceDrain {
|
||||
/// Kept until the CPU's copy, whose command buffer keeps its pages until it completes.
|
||||
_buffer: Buffer,
|
||||
region: Upload,
|
||||
/// Each piece's host address, its length and its byte of the region.
|
||||
pieces: Vec<(u64, u64, u64)>,
|
||||
}
|
||||
|
||||
/// The CPU's parts of an encoder's copies back spliced at one place (`Deferred::ShadowSplice`):
|
||||
/// held by its segment until its command buffer completes.
|
||||
pub(super) struct ShadowSplices(pub(super) Vec<SpliceDrain>);
|
||||
|
||||
impl ShadowSplices {
|
||||
/// The host step, once every batch submitted before its own completed, the GPU's copies into
|
||||
/// the regions among them (each batch ends with the barrier to the host): each piece's bytes
|
||||
/// copied from its region into the pages, a byte at a time as the CPU's stores go. It records
|
||||
/// nothing.
|
||||
pub(super) fn drain(&self) -> RecordedSegment {
|
||||
for drain in &self.0 {
|
||||
for &(host, length, at) in &drain.pieces {
|
||||
// SAFETY: the piece's host bytes lie in the truth's pages (its texels' bytes,
|
||||
// `image` and `staged`), which stay mapped while the command buffer runs (its
|
||||
// segment's uses name the buffer, whose pages it holds until it completes); the
|
||||
// region is memory of the runtime's own, apart from them, and no command writes
|
||||
// it any more.
|
||||
unsafe { drain.region.copy_out(at, host as *mut u8, length) };
|
||||
}
|
||||
}
|
||||
RecordedSegment::submitted(Vec::new())
|
||||
}
|
||||
}
|
||||
@@ -761,11 +761,14 @@ mod shadow_host_writes;
|
||||
mod shadow_merge_read;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod shadow_runs;
|
||||
mod shadow_splice;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod shadow_standing_device;
|
||||
mod shadow_stencil;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod shadow_twins;
|
||||
#[cfg(all(any(m2v_gpu, m2v_cpu_icd), target_os = "linux"))]
|
||||
mod shadow_write_lines;
|
||||
#[cfg(all(debug_assertions, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
mod shared_draw_locks;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
//! A copy back's cut for its splice (`shadow_splice.rs`): run as the GPU and the CPU would, over a
|
||||
//! map of host bytes, it leaves every texel's bytes in its place and no other byte written, and no
|
||||
//! copy the GPU makes into the buffer writes a byte whose line holds a byte outside its row's
|
||||
//! texels.
|
||||
|
||||
use crate::shadow_splice::{image, staged, Cut};
|
||||
use ash::vk;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
const LINE: u64 = 64;
|
||||
|
||||
/// Byte `k` of the texel at `(x, y)` of layer `layer`.
|
||||
fn value(x: i64, y: i64, layer: u32, k: u64) -> u8 {
|
||||
(x * 31 + y * 17 + i64::from(layer) * 7 + k as i64) as u8
|
||||
}
|
||||
|
||||
/// A region of `width` x `height` texels at `(x, y)` of `layer`, from byte `offset` of the
|
||||
/// buffer, rows `row` texels apart.
|
||||
fn region(
|
||||
offset: u64,
|
||||
row: u32,
|
||||
(x, y): (i32, i32),
|
||||
(width, height): (u32, u32),
|
||||
layer: u32,
|
||||
) -> vk::BufferImageCopy {
|
||||
vk::BufferImageCopy {
|
||||
buffer_offset: offset,
|
||||
buffer_row_length: row,
|
||||
buffer_image_height: 0,
|
||||
image_subresource: vk::ImageSubresourceLayers {
|
||||
aspect_mask: vk::ImageAspectFlags::COLOR,
|
||||
mip_level: 0,
|
||||
base_array_layer: layer,
|
||||
layer_count: 1,
|
||||
},
|
||||
image_offset: vk::Offset3D { x, y, z: 0 },
|
||||
image_extent: vk::Extent3D {
|
||||
width,
|
||||
height,
|
||||
depth: 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// The host bytes a copy of `regions` writes, by host address: each texel's at its place.
|
||||
fn texels(regions: &[vk::BufferImageCopy], texel: u64, base: u64) -> BTreeMap<u64, u8> {
|
||||
let mut bytes = BTreeMap::new();
|
||||
for r in regions {
|
||||
let row = u64::from(r.buffer_row_length.max(r.image_extent.width)) * texel;
|
||||
for y in 0..u64::from(r.image_extent.height) {
|
||||
for x in 0..u64::from(r.image_extent.width) {
|
||||
for k in 0..texel {
|
||||
let at = base + r.buffer_offset + y * row + x * texel + k;
|
||||
let (ix, iy) = (
|
||||
i64::from(r.image_offset.x) + x as i64,
|
||||
i64::from(r.image_offset.y) + y as i64,
|
||||
);
|
||||
let layer = r.image_subresource.base_array_layer;
|
||||
bytes.insert(at, value(ix, iy, layer, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bytes
|
||||
}
|
||||
|
||||
/// Run `cut` as the GPU and the CPU would: the whole copies into the host bytes, each checked to
|
||||
/// write only lines its row's texels fill (`rows`, each row's host bytes), the edges into an
|
||||
/// arena, and the pieces from it.
|
||||
fn run(
|
||||
cut: &Cut<vk::BufferImageCopy>,
|
||||
texel: u64,
|
||||
base: u64,
|
||||
rows: &[(u64, u64)],
|
||||
) -> BTreeMap<u64, u8> {
|
||||
let mut host = texels(&cut.whole, texel, base);
|
||||
for &at in host.keys() {
|
||||
let line = at - at % LINE;
|
||||
assert!(
|
||||
rows.iter()
|
||||
.any(|&(start, end)| start <= line && line + LINE <= end),
|
||||
"the GPU writes byte {at:#x}, whose line holds a byte outside its row's texels"
|
||||
);
|
||||
}
|
||||
let mut arena = vec![None; cut.length as usize];
|
||||
for (&at, &byte) in &texels(&cut.edges, texel, 0) {
|
||||
assert!(
|
||||
arena[at as usize].is_none(),
|
||||
"two edges write arena byte {at}"
|
||||
);
|
||||
arena[at as usize] = Some(byte);
|
||||
}
|
||||
for &(at, length, from) in &cut.pieces {
|
||||
for i in 0..length {
|
||||
let byte =
|
||||
arena[(from + i) as usize].expect("a piece reads an arena byte no edge wrote");
|
||||
assert!(
|
||||
host.insert(at + i, byte).is_none(),
|
||||
"byte {:#x} written twice",
|
||||
at + i
|
||||
);
|
||||
}
|
||||
}
|
||||
host
|
||||
}
|
||||
|
||||
/// Each row's host bytes of `regions`.
|
||||
fn rows_of(regions: &[vk::BufferImageCopy], texel: u64, base: u64) -> Vec<(u64, u64)> {
|
||||
let mut rows = Vec::new();
|
||||
for r in regions {
|
||||
let row = u64::from(r.buffer_row_length.max(r.image_extent.width)) * texel;
|
||||
for y in 0..u64::from(r.image_extent.height) {
|
||||
let start = base + r.buffer_offset + y * row;
|
||||
rows.push((start, start + u64::from(r.image_extent.width) * texel));
|
||||
}
|
||||
}
|
||||
rows
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_guest_render_target_s_rows_splice_at_their_last_line() {
|
||||
// 34x34 `RGBA16Float` at rows 512 bytes apart from a line: 32 texels (four lines) a row
|
||||
// straight in, the last two (16 bytes of the fifth line) through the arena.
|
||||
let regions = [region(0, 64, (0, 0), (34, 34), 0)];
|
||||
let cut = image(®ions, 8, 0x10_0000, LINE);
|
||||
assert_eq!(cut.whole.len(), 1);
|
||||
assert_eq!(cut.whole[0].image_extent.width, 32);
|
||||
assert_eq!(cut.whole[0].image_extent.height, 34);
|
||||
assert_eq!(cut.edges.len(), 1);
|
||||
assert_eq!(cut.edges[0].image_offset.x, 32);
|
||||
assert_eq!(cut.pieces.len(), 34);
|
||||
assert!(cut.pieces.iter().all(|&(_, length, _)| length == 16));
|
||||
// A 1920x1080 one whose rows end on lines: nothing through the arena.
|
||||
let wide = [region(0, 1920, (0, 0), (1920, 1080), 0)];
|
||||
let cut = image(&wide, 8, 0x10_0000, LINE);
|
||||
assert!(cut.pieces.is_empty() && cut.edges.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_cut_writes_each_texel_once_and_no_shared_line_from_the_gpu() {
|
||||
for texel in [1, 2, 4, 8, 16] {
|
||||
for width in [1, 2, 3, 5, 7, 8, 13, 31, 33, 64, 65, 100] {
|
||||
for extra in [0, 3, 8, 64] {
|
||||
for phase in [0, 4, 16, 48, 60] {
|
||||
for (x, y) in [(0, 0), (3, 1)] {
|
||||
let row = width + extra + x as u32;
|
||||
let regions = [
|
||||
region(16 * texel, row, (x, y), (width, 3), 0),
|
||||
region(
|
||||
16 * texel + u64::from(row) * 4 * texel,
|
||||
row,
|
||||
(x, y),
|
||||
(width, 2),
|
||||
1,
|
||||
),
|
||||
];
|
||||
let base = 0x10_0000 + phase;
|
||||
let cut = image(®ions, texel, base, LINE);
|
||||
let rows = rows_of(®ions, texel, base);
|
||||
let ran = run(&cut, texel, base, &rows);
|
||||
assert_eq!(
|
||||
ran,
|
||||
texels(®ions, texel, base),
|
||||
"texel {texel}, width {width}, extra {extra}, phase {phase}"
|
||||
);
|
||||
assert!(cut
|
||||
.edges
|
||||
.iter()
|
||||
.all(|e| e.buffer_offset.is_multiple_of(texel)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_staged_cut_writes_each_byte_once_and_no_shared_line_from_the_gpu() {
|
||||
for size in [1, 15, 16, 63, 64, 65, 200, 1000] {
|
||||
for phase in [0, 1, 32, 63] {
|
||||
let back = [
|
||||
vk::BufferCopy {
|
||||
src_offset: 0,
|
||||
dst_offset: 100,
|
||||
size,
|
||||
},
|
||||
vk::BufferCopy {
|
||||
src_offset: size,
|
||||
dst_offset: 100 + size + 37,
|
||||
size,
|
||||
},
|
||||
];
|
||||
let base = 0x10_0000 + phase;
|
||||
let cut = staged(&back, base, LINE);
|
||||
let source = |at: u64| (at * 13 + 5) as u8;
|
||||
let mut host = BTreeMap::new();
|
||||
for copy in &cut.whole {
|
||||
for i in 0..copy.size {
|
||||
let at = base + copy.dst_offset + i;
|
||||
let line = at - at % LINE;
|
||||
assert!(
|
||||
back.iter().any(|b| {
|
||||
let (start, end) = (base + b.dst_offset, base + b.dst_offset + b.size);
|
||||
start <= line && line + LINE <= end
|
||||
}),
|
||||
"size {size}, phase {phase}: the GPU writes a shared line"
|
||||
);
|
||||
host.insert(at, source(copy.src_offset + i));
|
||||
}
|
||||
}
|
||||
let mut arena = vec![None; cut.length as usize];
|
||||
for copy in &cut.edges {
|
||||
for i in 0..copy.size {
|
||||
arena[(copy.dst_offset + i) as usize] = Some(source(copy.src_offset + i));
|
||||
}
|
||||
}
|
||||
for &(at, length, from) in &cut.pieces {
|
||||
for i in 0..length {
|
||||
let byte = arena[(from + i) as usize].unwrap();
|
||||
assert!(host.insert(at + i, byte).is_none());
|
||||
}
|
||||
}
|
||||
let mut want = BTreeMap::new();
|
||||
for b in &back {
|
||||
for i in 0..b.size {
|
||||
want.insert(base + b.dst_offset + i, source(b.src_offset + i));
|
||||
}
|
||||
}
|
||||
assert_eq!(host, want, "size {size}, phase {phase}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,457 @@
|
||||
//! A shadow's copy back into host pages imported as dma-bufs keeps the bytes the CPU writes
|
||||
//! beside its texels in their lines of memory while it runs (`shadow_splice.rs`). On the Iris Xe
|
||||
//! (ANV) a copy of texels into a buffer's rows writes back the 64-byte line that holds each row's
|
||||
//! last texels whole, putting back older values over the CPU's writes to the row's padding there
|
||||
//! (docs/FAST-PATHS.md, **Known gaps**): the control below, a blit into the rows, loses some on
|
||||
//! every run there; a shadow's copy back, spliced, loses none.
|
||||
//!
|
||||
//! The shape is a guest's render target: a 34x34 `RGBA16Float` texture that reads, writes and
|
||||
//! renders, rows 512 bytes apart from the first byte of a no-copy buffer of 32768 bytes over a
|
||||
//! `memfd`'s pages, imported as dma-bufs (the device made without `VK_EXT_external_memory_host`),
|
||||
//! a shadow by the device's policy (`HostPageTexturePolicy::Shadow`): over the buffer
|
||||
//! (`Buffer::new_texture`) and as an IOSurface plane over it
|
||||
//! (`Buffer::new_texture_with_iosurface_plane`). Each row's texels end 16 bytes into a 64-byte
|
||||
//! line, whose other 48 bytes are the row's padding.
|
||||
//!
|
||||
//! Each kind of round runs [`ROUNDS`] command buffers, one after another, each waited for, while a
|
||||
//! thread of the test writes the padding bytes in the lines that hold the rows' last texels
|
||||
//! (`hot`), sweep after sweep, one byte a line each sweep, and every 16th sweep a line of each
|
||||
//! row's padding that holds no texel (`cold`) and the lines just past the image and at the
|
||||
//! buffer's end (`past`), reading each byte before it writes it: a byte that no longer holds the
|
||||
//! thread's last write was put back. The kinds:
|
||||
//!
|
||||
//! - `copy`, the control: a blit of a `Private` texture of the shape into the buffer's rows (the
|
||||
//! check's copies rounds' operation), whose losses show the device writes such lines back.
|
||||
//! - `clear`: a pass that clears the shadowed target and stores it (it replaces every texel: a
|
||||
//! copy back), which must lose none, its copies back spliced.
|
||||
//! - `draw`: a pass that loads it, draws a rectangle over its right half (its last column among
|
||||
//! it) in a color of the round's and stores it (a keep and a merge), its losses printed.
|
||||
//! - `idle`: the thread alone, which must find none.
|
||||
//!
|
||||
//! The device's policy runs no check of its own, so its verdicts stay unanswered and every copy
|
||||
//! back over the pages is spliced. A second test gives such a device the verdicts the device's
|
||||
//! check measured under the default policy, and finds a copy back spliced exactly where they
|
||||
//! splice: copied back as before where both the copies and the shader writes passed.
|
||||
|
||||
use super::blit_holds::{options, WAIT};
|
||||
use super::encoder_holds::{bytes_of, library};
|
||||
use super::host_residency::{host_page, udmabuf_openable, Ram, Scratch};
|
||||
use super::merge_scratch::blit;
|
||||
use super::no_pointer_import::lists_dma_buf_route;
|
||||
use crate::in_place::{Access, PagesClass, RowEnds};
|
||||
use crate::{
|
||||
BlitOption, Buffer, ClearColor, CommandQueue, Device, HostMemory, IoSurfacePlane, LoadAction,
|
||||
Origin, PipelineOptions, RenderPassDescriptor, RenderPipelineState, ResourceOptions, Size,
|
||||
StoreAction, Texture, TextureDescriptor, WorkCounts,
|
||||
};
|
||||
use metal2vulkan::device::{HostPageTexturePolicy, VkExtension};
|
||||
use metal2vulkan::metal::{PixelFormat, PrimitiveType, TextureUsage};
|
||||
use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource};
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
const TEST: &str = "SHADOW-WRITE-LINES";
|
||||
const WIDTH: u64 = 34;
|
||||
const HEIGHT: u64 = 34;
|
||||
const ROW_BYTES: u64 = 8 * WIDTH;
|
||||
const ROW: u64 = 512;
|
||||
const LENGTH: u64 = 32768;
|
||||
/// The device's line of memory the shape is laid against (the Iris Xe's `nonCoherentAtomSize`).
|
||||
const LINE: u64 = 64;
|
||||
/// The command buffers of each kind of round.
|
||||
const ROUNDS: usize = 300;
|
||||
/// How long the second test waits for the device's check.
|
||||
const CHECK_WAIT: Duration = Duration::from_secs(120);
|
||||
|
||||
/// The device made without `VK_EXT_external_memory_host`, so that a no-copy buffer is imported as
|
||||
/// dma-bufs of its pages, every texture over host pages a shadow.
|
||||
fn device(cache: &Path) -> Device {
|
||||
let mut options = options(cache);
|
||||
options.withheld_extensions = [VkExtension::ExtExternalMemoryHost].into_iter().collect();
|
||||
options.policy.host_page_textures = HostPageTexturePolicy::Shadow;
|
||||
let device = Device::system_default_with(&options).unwrap();
|
||||
assert!(
|
||||
device.settle_submit_checks(crate::tests::SETTLE),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
device
|
||||
}
|
||||
|
||||
/// The state that draws a rectangle (`tob_rect`, corners from vertex buffer 0) of the color in
|
||||
/// fragment buffer 0 (`tob_solid`) into an `RGBA16Float` color.
|
||||
fn drawing(device: &Device) -> RenderPipelineState {
|
||||
let library = library(device, "engine/tob_renders.ll");
|
||||
let function = |name: &str| {
|
||||
let function = library.new_function_with_name(name).unwrap();
|
||||
StageSource::Function(function.function_descriptor())
|
||||
};
|
||||
let mut descriptor = RenderPipelineDescriptor::new(function("tob_rect"));
|
||||
descriptor.fragment = Some(function("tob_solid"));
|
||||
descriptor.color_attachments[0] =
|
||||
Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA16Float));
|
||||
device
|
||||
.new_render_pipeline_state(&descriptor, &PipelineOptions::default())
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// What a round does (the module docs).
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
enum Kind {
|
||||
Copy,
|
||||
Clear,
|
||||
Draw,
|
||||
}
|
||||
|
||||
/// Round `i` of `kind`: over `target` (the shadowed texture) or, for a copy, from `source` into
|
||||
/// `buffer`'s rows; committed and waited for.
|
||||
fn round(
|
||||
queue: &CommandQueue,
|
||||
kind: Kind,
|
||||
(target, source, buffer): (&Texture, &Texture, &Buffer),
|
||||
state: &RenderPipelineState,
|
||||
i: usize,
|
||||
) {
|
||||
let value = (i % 7) as f64 / 6.0;
|
||||
match kind {
|
||||
Kind::Copy => blit(queue, |encoder| {
|
||||
(encoder.copy_from_texture_to_buffer(
|
||||
source,
|
||||
0,
|
||||
0,
|
||||
Origin::new(0, 0, 0),
|
||||
Size::new(WIDTH, HEIGHT, 1),
|
||||
buffer,
|
||||
0,
|
||||
ROW,
|
||||
ROW * HEIGHT,
|
||||
BlitOption::None,
|
||||
))
|
||||
.unwrap()
|
||||
}),
|
||||
Kind::Clear | Kind::Draw => {
|
||||
let command_buffer = queue.command_buffer().unwrap();
|
||||
let mut descriptor = RenderPassDescriptor::new();
|
||||
let color = &mut descriptor.color_attachments[0];
|
||||
color.texture = Some(target.clone());
|
||||
color.store_action = StoreAction::Store;
|
||||
match kind {
|
||||
Kind::Clear => {
|
||||
color.load_action = LoadAction::Clear;
|
||||
color.clear_color = ClearColor::new(value, 1.0 - value, 0.5, 1.0);
|
||||
}
|
||||
_ => color.load_action = LoadAction::Load,
|
||||
}
|
||||
let mut encoder = command_buffer.render_command_encoder(&descriptor).unwrap();
|
||||
if let Kind::Draw = kind {
|
||||
encoder.set_render_pipeline_state(state).unwrap();
|
||||
let corners: [f32; 4] = [0.0, -1.0, 1.0, 1.0];
|
||||
let rgba: [f32; 4] = [value as f32, 0.25, 1.0 - value as f32, 1.0];
|
||||
(encoder.set_vertex_bytes(&bytes_of(&corners, f32::to_le_bytes), 0)).unwrap();
|
||||
(encoder.set_fragment_bytes(&bytes_of(&rgba, f32::to_le_bytes), 0)).unwrap();
|
||||
(encoder.draw_primitives(PrimitiveType::Triangle, 0, 6, 1, 0)).unwrap();
|
||||
}
|
||||
encoder.end_encoding().unwrap();
|
||||
command_buffer.commit().unwrap();
|
||||
command_buffer.wait_until_completed_for(WAIT).unwrap();
|
||||
assert_eq!(command_buffer.error(), None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The bytes a writer found put back, by where they lie, and its sweeps.
|
||||
#[derive(Debug, Default)]
|
||||
struct Tally {
|
||||
hot: u64,
|
||||
cold: u64,
|
||||
past: u64,
|
||||
sweeps: u64,
|
||||
}
|
||||
|
||||
/// The offsets the writer writes: the padding in each row's line that holds its last texels; a
|
||||
/// line of each row's padding that holds no texel; the line past the image and the buffer's last.
|
||||
fn offsets() -> (Vec<Vec<u64>>, Vec<u64>, Vec<u64>) {
|
||||
let hot = (0..HEIGHT)
|
||||
.map(|row| (row * ROW + ROW_BYTES..row * ROW + ROW_BYTES.next_multiple_of(LINE)).collect())
|
||||
.collect();
|
||||
let cold = (0..HEIGHT)
|
||||
.flat_map(|row| row * ROW + ROW - LINE..row * ROW + ROW)
|
||||
.collect();
|
||||
let past = (ROW * HEIGHT..ROW * HEIGHT + LINE)
|
||||
.chain(LENGTH - LINE..LENGTH)
|
||||
.collect();
|
||||
(hot, cold, past)
|
||||
}
|
||||
|
||||
/// Write the bytes [`offsets`] names at `base` until `stop`, each read first (the module docs).
|
||||
fn write_beside(base: usize, stop: &AtomicBool) -> Tally {
|
||||
let (hot, cold, past) = offsets();
|
||||
// SAFETY: every offset lies in the buffer's pages, mapped while the writer runs; the GPU's
|
||||
// accesses of them are what the test observes, through atomic bytes.
|
||||
let byte = |offset: u64| unsafe { AtomicU8::from_ptr((base + offset as usize) as *mut u8) };
|
||||
let mut expected = vec![0u8; LENGTH as usize];
|
||||
for &offset in hot.iter().flatten().chain(&cold).chain(&past) {
|
||||
expected[offset as usize] = byte(offset).load(Ordering::Relaxed);
|
||||
}
|
||||
let mut tally = Tally::default();
|
||||
let mut step = |offset: u64, count: &mut u64| {
|
||||
let at = byte(offset);
|
||||
let want = &mut expected[offset as usize];
|
||||
if at.load(Ordering::Relaxed) != *want {
|
||||
*count += 1;
|
||||
}
|
||||
*want = want.wrapping_add(1);
|
||||
at.store(*want, Ordering::Relaxed);
|
||||
};
|
||||
let mut last = false;
|
||||
loop {
|
||||
let width = hot[0].len() as u64;
|
||||
for line in &hot {
|
||||
step(line[(tally.sweeps % width) as usize], &mut tally.hot);
|
||||
}
|
||||
if tally.sweeps.is_multiple_of(16) || last {
|
||||
for &offset in &cold {
|
||||
step(offset, &mut tally.cold);
|
||||
}
|
||||
for &offset in &past {
|
||||
step(offset, &mut tally.past);
|
||||
}
|
||||
}
|
||||
tally.sweeps += 1;
|
||||
if last {
|
||||
break;
|
||||
}
|
||||
last = stop.load(Ordering::Acquire);
|
||||
}
|
||||
// The last read of every byte, after the GPU's work.
|
||||
for &offset in hot.iter().flatten() {
|
||||
if byte(offset).load(Ordering::Relaxed) != expected[offset as usize] {
|
||||
tally.hot += 1;
|
||||
}
|
||||
}
|
||||
tally
|
||||
}
|
||||
|
||||
/// Run `work` while a writer writes beside the texels at `base`: what it found, and how long the
|
||||
/// work took.
|
||||
fn beside(base: usize, work: impl FnOnce()) -> (Tally, Duration) {
|
||||
let stop = Arc::new(AtomicBool::new(false));
|
||||
let writer = {
|
||||
let stop = Arc::clone(&stop);
|
||||
std::thread::spawn(move || write_beside(base, &stop))
|
||||
};
|
||||
let start = Instant::now();
|
||||
work();
|
||||
let took = start.elapsed();
|
||||
stop.store(true, Ordering::Release);
|
||||
(writer.join().unwrap(), took)
|
||||
}
|
||||
|
||||
/// The counts a line names.
|
||||
fn counted(before: &WorkCounts, after: &WorkCounts) -> String {
|
||||
format!(
|
||||
"shadow copies +{}, copies back spliced +{}, copies back dispatched +{}, merge \
|
||||
dispatches planned +{}, merge copies dispatched +{}, merges fetched +{}, merges kept in \
|
||||
images +{}",
|
||||
after.shadow_copies - before.shadow_copies,
|
||||
spliced(before, after),
|
||||
after.shadow_copies_back_dispatched - before.shadow_copies_back_dispatched,
|
||||
after.shadow_merge_dispatches_planned - before.shadow_merge_dispatches_planned,
|
||||
after.shadow_merge_copies_dispatched - before.shadow_merge_copies_dispatched,
|
||||
after.shadow_merges_fetched - before.shadow_merges_fetched,
|
||||
after.shadow_merges_kept_in_images - before.shadow_merges_kept_in_images,
|
||||
)
|
||||
}
|
||||
|
||||
/// The copies back spliced between two counts.
|
||||
fn spliced(before: &WorkCounts, after: &WorkCounts) -> u64 {
|
||||
after.shadow_copies_back_spliced - before.shadow_copies_back_spliced
|
||||
}
|
||||
|
||||
/// A no-copy buffer of [`LENGTH`] bytes over `ram`'s pages, imported as dma-bufs.
|
||||
fn over_dma_bufs(device: &Device, ram: &Ram, calls: &Arc<AtomicUsize>) -> Buffer {
|
||||
// SAFETY: the view outlives the buffer, and the source makes dma-bufs of its pages.
|
||||
let buffer = unsafe {
|
||||
device.new_buffer_with_bytes_no_copy(
|
||||
HostMemory::with_dma_buf(ram.pointer(0), ram.source(calls)),
|
||||
LENGTH,
|
||||
ResourceOptions::default(),
|
||||
None,
|
||||
)
|
||||
}
|
||||
.unwrap();
|
||||
assert!(
|
||||
buffer.over_dma_buf(),
|
||||
"{TEST}: the buffer lies over dma-bufs"
|
||||
);
|
||||
buffer
|
||||
}
|
||||
|
||||
/// The shape's descriptor (the module docs).
|
||||
fn shape() -> TextureDescriptor {
|
||||
let mut descriptor =
|
||||
TextureDescriptor::texture_2d(PixelFormat::RGBA16Float, WIDTH, HEIGHT, false);
|
||||
descriptor.usage =
|
||||
TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE | TextureUsage::RENDER_TARGET;
|
||||
descriptor
|
||||
}
|
||||
|
||||
/// A `Private` texture of the shape, the control's source.
|
||||
fn source(device: &Device) -> Texture {
|
||||
let mut d = TextureDescriptor::texture_2d(PixelFormat::RGBA16Float, WIDTH, HEIGHT, false);
|
||||
d.usage = TextureUsage::RENDER_TARGET;
|
||||
d.resource_options = ResourceOptions::private();
|
||||
device.new_texture(&d).unwrap()
|
||||
}
|
||||
|
||||
/// The texture of the shape over `buffer`, in `form` (`buffer` or `plane`), a shadow.
|
||||
fn target(buffer: &Buffer, form: &str) -> Texture {
|
||||
let descriptor = shape();
|
||||
let texture = match form {
|
||||
"buffer" => buffer.new_texture(&descriptor, 0, ROW).unwrap(),
|
||||
_ => (buffer
|
||||
.new_texture_with_iosurface_plane(&descriptor, IoSurfacePlane::new(0, ROW, false)))
|
||||
.unwrap(),
|
||||
};
|
||||
// SAFETY: the handle is only compared, while the texture lives.
|
||||
assert!(
|
||||
unsafe { texture.vk_image() }.is_none(),
|
||||
"{TEST}: the {form} texture is a shadow"
|
||||
);
|
||||
texture
|
||||
}
|
||||
|
||||
/// The first test the module docs describe: no byte beside the texels is put back by a pass that
|
||||
/// replaces them, its copies back spliced.
|
||||
#[test]
|
||||
fn a_shadow_s_copy_back_keeps_the_cpu_s_writes_beside_its_texels() {
|
||||
if !udmabuf_openable(TEST) {
|
||||
return;
|
||||
}
|
||||
let scratch = Scratch::new();
|
||||
let device = device(&scratch.0);
|
||||
let name = device.name();
|
||||
if !lists_dma_buf_route(&device) {
|
||||
println!("{TEST}: {name} lists no dma-buf route: not run");
|
||||
return;
|
||||
}
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let state = drawing(&device);
|
||||
let file = (LENGTH as usize).next_multiple_of(host_page());
|
||||
let ram = Ram::new(file, 0, file);
|
||||
let calls = Arc::new(AtomicUsize::new(0));
|
||||
let buffer = over_dma_bufs(&device, &ram, &calls);
|
||||
let base = ram.pointer(0).as_ptr().addr();
|
||||
let source = source(&device);
|
||||
|
||||
let (idle, _) = beside(base, || std::thread::sleep(Duration::from_millis(500)));
|
||||
assert_eq!(
|
||||
(idle.hot, idle.cold, idle.past),
|
||||
(0, 0, 0),
|
||||
"{TEST}: the writer alone finds every byte it wrote: {idle:?}"
|
||||
);
|
||||
let (copied, took) = beside(base, || {
|
||||
for i in 0..ROUNDS {
|
||||
round(&queue, Kind::Copy, (&source, &source, &buffer), &state, i);
|
||||
}
|
||||
});
|
||||
println!("{TEST} on {name}: copy (the control): {ROUNDS} rounds in {took:?}: {copied:?}");
|
||||
for form in ["buffer", "plane"] {
|
||||
let target = target(&buffer, form);
|
||||
for kind in [Kind::Clear, Kind::Draw] {
|
||||
let before = device.work_counts();
|
||||
let (tally, took) = beside(base, || {
|
||||
for i in 0..ROUNDS {
|
||||
round(&queue, kind, (&target, &source, &buffer), &state, i);
|
||||
}
|
||||
});
|
||||
let after = device.work_counts();
|
||||
println!(
|
||||
"{TEST} on {name}: {form} {kind:?}: {ROUNDS} rounds in {took:?}: {tally:?}; {}",
|
||||
counted(&before, &after)
|
||||
);
|
||||
if let Kind::Clear = kind {
|
||||
assert_eq!(
|
||||
(tally.hot, tally.cold, tally.past),
|
||||
(0, 0, 0),
|
||||
"{TEST}: a {form} texture's copies back put back no byte the CPU wrote \
|
||||
beside its texels (the control put back {}): {tally:?}",
|
||||
copied.hot + copied.cold + copied.past
|
||||
);
|
||||
assert!(
|
||||
spliced(&before, &after) >= ROUNDS as u64,
|
||||
"{TEST}: every {form} copy back was spliced: {}",
|
||||
counted(&before, &after)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
drop(buffer);
|
||||
drop(queue);
|
||||
drop(device);
|
||||
drop(ram);
|
||||
}
|
||||
|
||||
/// The second test the module docs describe: a copy back spliced as the device's measured
|
||||
/// verdicts say, given to a device whose policy runs no check.
|
||||
#[test]
|
||||
fn a_copy_back_splices_by_the_device_s_check() {
|
||||
if !udmabuf_openable(TEST) {
|
||||
return;
|
||||
}
|
||||
let scratch = Scratch::new();
|
||||
let measured = {
|
||||
let mut options = options(&scratch.0);
|
||||
options.withheld_extensions = [VkExtension::ExtExternalMemoryHost].into_iter().collect();
|
||||
options.policy.host_page_textures = HostPageTexturePolicy::InPlace;
|
||||
let checked = Device::system_default_with(&options).unwrap();
|
||||
if !lists_dma_buf_route(&checked) {
|
||||
println!("{TEST}: {} lists no dma-buf route: not run", checked.name());
|
||||
return;
|
||||
}
|
||||
assert!(
|
||||
checked.settle_in_place_checks(CHECK_WAIT),
|
||||
"{TEST}: the device's check"
|
||||
);
|
||||
let checks = &checked.shared().in_place;
|
||||
let class = PagesClass::DmaBuf;
|
||||
[Access::Copies, Access::Writes]
|
||||
.map(|access| (access, checks.decided(class, access, RowEnds::InLines)))
|
||||
};
|
||||
let device = device(&scratch.0);
|
||||
let name = device.name();
|
||||
let checks = &device.shared().in_place;
|
||||
for (access, verdict) in measured {
|
||||
checks.set(PagesClass::DmaBuf, access, RowEnds::InLines, verdict);
|
||||
}
|
||||
let splices = crate::shadow_splice::splices(checks, PagesClass::DmaBuf);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let state = drawing(&device);
|
||||
let file = (LENGTH as usize).next_multiple_of(host_page());
|
||||
let ram = Ram::new(file, 0, file);
|
||||
let calls = Arc::new(AtomicUsize::new(0));
|
||||
let buffer = over_dma_bufs(&device, &ram, &calls);
|
||||
let source = source(&device);
|
||||
for form in ["buffer", "plane"] {
|
||||
let target = target(&buffer, form);
|
||||
let before = device.work_counts();
|
||||
round(&queue, Kind::Clear, (&target, &source, &buffer), &state, 0);
|
||||
let after = device.work_counts();
|
||||
println!(
|
||||
"{TEST} on {name}: the check's verdicts for rows that end inside a line {measured:?}, \
|
||||
so spliced {splices}: {form} Clear: {}",
|
||||
counted(&before, &after)
|
||||
);
|
||||
assert_eq!(
|
||||
spliced(&before, &after) > 0,
|
||||
splices,
|
||||
"{TEST}: a {form} copy back spliced as the verdicts {measured:?} say: {}",
|
||||
counted(&before, &after)
|
||||
);
|
||||
}
|
||||
drop(buffer);
|
||||
drop(queue);
|
||||
drop(device);
|
||||
drop(ram);
|
||||
}
|
||||
@@ -706,6 +706,7 @@ pub(crate) struct Counters {
|
||||
shadow_texels_recopied_in_large_surfaces: AtomicU64,
|
||||
shadow_texels_copied_back: AtomicU64,
|
||||
shadow_copies_back_dispatched: AtomicU64,
|
||||
shadow_copies_back_spliced: AtomicU64,
|
||||
shadow_copies_in_dispatched: AtomicU64,
|
||||
shadow_keeps_from_staging: AtomicU64,
|
||||
shadow_merge_copies_dispatched: AtomicU64,
|
||||
@@ -5655,6 +5656,12 @@ impl Counters {
|
||||
.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// An encoder recorded a shadowed texture's copy back spliced (`shadow_splice.rs`).
|
||||
pub(crate) fn shadow_copy_back_spliced(&self) {
|
||||
self.shadow_copies_back_spliced
|
||||
.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// An encoder recorded a merged shadowed texture's copy in and keep as one dispatch
|
||||
/// (`shadow_copy_in.rs`).
|
||||
pub(crate) fn shadow_copy_in_dispatched(&self) {
|
||||
@@ -11056,6 +11063,13 @@ pub struct WorkCounts {
|
||||
/// words, where the device runs one faster than its copy
|
||||
/// (`DriverFact::ShadowCopyBackDispatchFaster`): the same bytes either way.
|
||||
pub shadow_copies_back_dispatched: u64,
|
||||
/// Of those copies back, the ones into a no-copy buffer's host pages recorded spliced, on a
|
||||
/// device whose check found its copies or shader writes of texels writing back a line of
|
||||
/// memory they end in whole, or has not answered (`shadow_splice.rs`): the GPU copies the
|
||||
/// texels that fill whole lines, and a host step after them copies each row's texels in the
|
||||
/// lines it shares with bytes beside them, a byte at a time, as the CPU's stores go, so the
|
||||
/// CPU's writes to those bytes stay.
|
||||
pub shadow_copies_back_spliced: u64,
|
||||
/// Of the copies in among `shadow_copies`, those recorded with their texture's keep after
|
||||
/// them (one of `shadow_merge_copies_dispatched`) as one dispatch that stores the texels in
|
||||
/// the shadow and in the merge's scratch, where the device runs them faster so
|
||||
@@ -13411,6 +13425,7 @@ impl Device {
|
||||
shadow_copies_back_dispatched: counters
|
||||
.shadow_copies_back_dispatched
|
||||
.load(Ordering::Relaxed),
|
||||
shadow_copies_back_spliced: counters.shadow_copies_back_spliced.load(Ordering::Relaxed),
|
||||
shadow_copies_in_dispatched: counters
|
||||
.shadow_copies_in_dispatched
|
||||
.load(Ordering::Relaxed),
|
||||
|
||||
Vendored
+1
-1
@@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 523;
|
||||
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
|
||||
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
|
||||
/// keeps no history.
|
||||
pub const RUNTIME_VERSION: u32 = 2430;
|
||||
pub const RUNTIME_VERSION: u32 = 2431;
|
||||
|
||||
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
|
||||
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles
|
||||
|
||||
@@ -3659,6 +3659,7 @@ field metal2vulkan-runtime::WorkCounts.shadow_attachment_tiles_bounded pub shado
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_attachment_tiles_covered pub shadow_attachment_tiles_covered: u64
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_copies pub shadow_copies: u64
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_copies_back_dispatched pub shadow_copies_back_dispatched: u64
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_copies_back_spliced pub shadow_copies_back_spliced: u64
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_copies_in_against_standing pub shadow_copies_in_against_standing: u64
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_copies_in_dispatched pub shadow_copies_in_dispatched: u64
|
||||
field metal2vulkan-runtime::WorkCounts.shadow_copies_in_skipped_by_standing pub shadow_copies_in_skipped_by_standing: u64
|
||||
|
||||
|
Can't render this file because it is too large.
|
+7
-1
@@ -2507,7 +2507,13 @@ bound.
|
||||
runtime orders another queue's commands that touch them before or after the command buffer, as
|
||||
Metal does), and are copied back (`shadow_texels_copied_back`), as a command that replaces every
|
||||
texel is. The scratch keeps the rectangle the commands write in, where they bound it and the
|
||||
copies are cut so (`WorkCounts::shadow_texels_kept`). Where the device is measured to run it
|
||||
copies are cut so (`WorkCounts::shadow_texels_kept`). A copy back into a no-copy buffer's host
|
||||
pages whose rows share a line of memory (`nonCoherentAtomSize`) with bytes beside them, on a
|
||||
device whose check of those pages finds its copies or shader writes writing such a line back
|
||||
whole, or has not answered, is spliced: the GPU copies the texels that fill whole lines, and a
|
||||
host step after the copies writes the rest, so a CPU write beside them stays
|
||||
(`WorkCounts::shadow_copies_back_spliced`; docs/FAST-PATHS.md, **Known gaps**, the Iris Xe's
|
||||
line write-back). Where the device is measured to run it
|
||||
faster so (`DriverFact::ShadowCopyBackDispatchFaster`), a copy back of a one-slice texture of 4-,
|
||||
8- or 16-byte texels is a compute dispatch that stores the same bytes
|
||||
(`WorkCounts::shadow_copies_back_dispatched`), and so is a merge's copy of such a texture's image
|
||||
|
||||
+12
-2
@@ -905,8 +905,18 @@ driver's. Each is open work.
|
||||
line. Bytes in other lines are kept, and so are another GPU command's bytes in the same line: a
|
||||
render pass's clear and store or a kernel's writes of a plane in place over a `Private` buffer,
|
||||
and a blit's copy or a kernel's stores into the bytes beside it in its first and last lines,
|
||||
with no dependency between the two, each keep the other's bytes (`tests::line_beside`). No
|
||||
product form avoids the CPU's loss, as the shadow's own copy back is such a copy. A texture that
|
||||
with no dependency between the two, each keep the other's bytes (`tests::line_beside`). The
|
||||
program's own commands keep that loss. A shadow's copy back into a no-copy buffer's host pages
|
||||
does not, where the device's check of those pages finds copies or shader writes writing such
|
||||
lines back, or has not answered: the GPU copies only the texels that fill whole lines, and a
|
||||
host step after the copies writes each row's texels in the lines it shares, as the CPU's
|
||||
stores go (`shadow_splice.rs`, `WorkCounts::shadow_copies_back_spliced`). Still lost, by the
|
||||
same write-back: a CPU write beside the texels a shadow's merge stores (`shadow_merge.rs`), and
|
||||
beside a copy back between a render pass's instances or before its tile dispatch, into a
|
||||
pass's held command buffer, at the end of a segment recorded at a commit or a host step, of a
|
||||
rotated texture's, a heap's two-plane, tiled, depth or stencil texture's, or into the
|
||||
runtime's own memory (a `Shared` buffer's), each of which still writes whole rows from the
|
||||
GPU. A texture that
|
||||
renders over host pages whose rows end inside a line, with the rows' padding free, takes the
|
||||
image in place where the device's check finds its copies losing those bytes too, over its kind
|
||||
of pages or over another kind whose pages lay in memory of a type of the same property flags
|
||||
|
||||
Reference in new issue
Block a user