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

+3 -1
View File
@@ -347,7 +347,9 @@ the device makes `DRM_FORMAT_MOD_LINEAR` images (`VK_EXT_image_drm_format_modifi
pitch where its in-place check passed for its pooled memory (for a texture that renders, the
check of renders that lets a pass change those bytes, as the declaration does, and no byte past the
last row's pitch) and its rows take no more bytes than a
bound past which such an image renders and samples slower than the shadow
bound past which such an image renders and samples slower than the shadow (a texture that only
samples a `Shared` or `Managed` buffer's bytes takes it at any size, as its shadow would be copied
in at every command buffer)
(`WorkCounts::pooled_pitched_images`; `TextureShadowReason::LinearCost` past it;
`HostPageTexturePolicy::Shadow` turns it off), its subresources holding each row's bytes after its
texels to its pitch (the last row's included) and nothing past the last row's pitch; those bytes