Pooled bound: a texture that only samples bytes the CPU writes lies in place at any size

The 48 KiB bound weighs a DRM_FORMAT_MOD_LINEAR image at Metal's pitch
against a shadow that renders into its own optimal image, or samples it
copied in once. A texture that only samples a Shared or Managed buffer's
bytes (or an untracked texture that only samples) has no such shadow: its
shadow is copied in whole at every command buffer that samples it, as the
CPU may have written the bytes. The guest's large device caches are
WebKit's tiles, about 5 MiB each, CPU-painted and only sampled; past the
bound each was a shadow re-copied in every command buffer.

Measured on the Iris Xe (ANV, Mesa 26.2.6; job m3-max-8243,
runtime_lane::pooled_draw_costs::pooled_sample_costs), a frame that
samples four such textures whole after the CPU wrote a texel of each,
GPU microseconds as shadows at the padded pitch against linear images at
the tight one: over Shared buffers 1308x512 (2.7 MB) 327.8/215.9,
1324x940 (5.0 MB) 802.2/380.1, 3648x2038 (30 MB) 5789.3/2601.6; over
Private buffers, whose shadows stand copied in once, 237.7/216.2,
404.4/409.4, 2028.1/2433.2. So the bound keeps covering textures that
render or are written, and those that only sample bytes only the
runtime's commands write (Texels::only_commands_write, the predicate a
shadow's standing uses).

Test: a_sampled_texture_past_the_pooled_bound_lies_in_place_over_bytes_the_cpu_writes
(164x82 at 704-byte rows, past the bound, sampled: over a Shared buffer a
pitched image where the pooled reads check passed and never
Shadow(LinearCost); over a Private buffer Shadow(LinearCost) where the
device makes such images).

(cherry picked from commit d99c9c507b00e7b1537257a7a2fddd18d9563e2f)
This commit is contained in:
Anees Iqbal committed 2026-11-08 05:20:54 -08:00
1 parent 2332605efc
commit f8caa83975
7 files changed
+145 -9

No files matched your search

+4 -1
View File
@@ -1625,7 +1625,10 @@ bound.
change, as the declaration does, and no byte past the last row's pitch); past a bound in bytes of its rows to their
pitch, the same on every device, such a texture stays a shadow too
(`TextureShadowReason::LinearCost`): there a linear image renders and samples slower than the
shadow's own image with its copies, and over the device's own memory both give the same answer;
shadow's own image with its copies, and over the device's own memory both give the same answer
(a texture that only samples a `Shared` or `Managed` buffer's bytes, or an untracked one that
only samples, takes the image at any size, as its shadow would be copied in at every command
buffer);
or the buffer is over the caller's
`VkBuffer`, whose memory backs no image of the runtime's; or it is a tiled texture of more than
one level (`Buffer::new_tiled_texture`), over any buffer: no image over the buffer's memory holds