Repository navigation
Conversation
The port of 57654c67d9e and 65c0a5ba355 to main (7f5c0a1 and 3b559c1) gated skip_refused_work behind driconf on A9, while 778ab41 enabled it by default on A8 only. On A9, any single unsupported render pass or draw returned VK_ERROR_OUT_OF_HOST_MEMORY from vkEndCommandBuffer(), causing wgpu/Firefox WebGPU to lose the device at startup. Enable skip_refused_work by default across all G5P chips so refused passes, graphics pipelines, draws and vkCmdClearAttachments calls remain named and logged via G5P_REFUSE and are skipped instead of failing the command buffer or device. PVR_G5P_STRICT_DRAWS=1 (and PVR_A8_STRICT=1 on A8) restores strict failure. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
…used_work When skip_refused_work is enabled, a refused non-internal compute pipeline is admitted without a shader BO (matching graphics pipelines) and its dispatches are named via G5P_REFUSE and skipped instead of failing the command buffer or losing the WebGPU device. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Support 4x multisampled render passes with 1 to 4 colour targets where each logical target is stored, resolved via the PBE (into either a linear mip-0 view or a twiddled 2D single-layer view), or both stored and resolved in one end-of-tile pass (StoreAndMultisampleResolve, in either VkRenderPass [resolve, store] or dynamic-rendering [store, resolve] eot_surfaces order). - Decompose 4x eot_surfaces by mrt_idx via pvr_arch_g5p_msaa_build_plan() and count logical colour outputs via pvr_arch_g5p_colour_outputs() in pvr_arch_g5p_mrt.c, pvr_arch_g5p_ds.c, pvr_arch_g5p_gfx.c, and pvr_arch_g5p.c. - Generalise 4x EOT USC emission to pvr_g5p_msaa_eot_usc_mask() for 1..8 PBE emits with per-entry store (1c 09) vs resolve (1c 05) sample mode and per-entry output-half offsets (g5p_mrt_pbe_block_offsets()), cached lazily per (emits, store_mask). Verified byte-identical against Apple's A9 builtin compiler across 14 cases (1..4 targets, store, resolve, mixed, and StoreAndMultisampleResolve up to 8 emits). - Upload sample-rate clear kicks for 1, 2, and 4 logical targets (clear_kick_ms[0..2]; clear USC bytes are identical at 1x and 4x) and enable 4x vkCmdClearAttachments clear quads. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Accept graphics pipelines with only VK_SHADER_STAGE_VERTEX_BIT (no fragment shader), as used by WebGPU shadow-map and depth pre-passes (e.g. shadowMapping). When no fragment stage is present, blend state is ignored, write_mask is forced to 0, and the minimal fragment stub is compiled with write_mask = 0 so the backend emits the empty no-colour program (0 varyings, 0 uploads) and ISP uses Apple's no-colour depth/stencil form (tag_write_disable = 1, upass = 0). Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
…h MRT Apple's A9 compiler emits the same two-word packed-f16 per-target output (four f16 halves at output half 4t) for BGRA8, RGBA8, sRGB, RGB10A2, RGBA16F, R8, RG8, R16F, RG16F and RG11B10F, with each target packed by its own PBE state word (gles3-tex.md §1.2; gles3-continued107.md §0.3). pvr_arch_g5p.c already encodes each target's PBE state independently from its own format, and ZLS depth/stencil registers are orthogonal to colour target count. - Allow any combination of two-word f16-output renderable colour formats (including VK_FORMAT_R16G16B16A16_SFLOAT + VK_FORMAT_B8G8R8A8_UNORM, as used by WebGPU deferredRendering's G-buffer) for 2 to 4 colour targets in pvr_arch_g5p_mrt.c; keep 5..8 compact UNORM8 targets homogeneous BGRA8/RGBA8 and raw32 pairs unchanged. - Store the padding fourth target of a 3-target pass as 16x16 R8_UNORM so 8-byte targets (RGBA16F) do not overflow the 1024-byte null_rt. - Remove the multi-target refusal in pvr_arch_g5p_ds_admit() so MRT passes with a depth/stencil attachment (G-buffers) run. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
WebGPU shaders use separate VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE bindings with textureLoad() (nir_texop_txf) and no sampler. Previously, only qualified vertex programs emitted PCO_G5P_UPLOAD_FETCH_SAMPLER; fragment programs emitted PCO_G5P_UPLOAD_SAMPLER referencing the texture binding at +32 bytes, reading past the 32-byte image descriptor and failing with "set 0 binding 2: a sampler without A9 words" (deferredRendering). - Emit PCO_G5P_UPLOAD_FETCH_SAMPLER for samplerless fragment txf reads on A9 (at each texture's sampler slot in non-compact layout, or shared at fetch_sampler_common in compact layout). - Handle PCO_G5P_UPLOAD_FETCH_SAMPLER in pvr_arch_g5p_gfx.c (supplying pvr_g5p_fetch_sampler_word() on A9 and pvr_g5p_a8_fetch_sampler() on A8), and synthesize the A8 fetch sampler for standalone SAMPLED_IMAGE descriptors under PCO_G5P_UPLOAD_SAMPLER_FETCH. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
A 4x depth/stencil-only (or colour-store-dont-care) render pass has
eot_surface_count == 0 and was refused by pvr_arch_g5p_msaa_admit()
("4x with 0 end-of-tile surfaces"), hitting Babylon.js WebGPU scenes and
4x depth-only clears.
Mirror the 1x null_target path in g5p_job_init(): admit 4x passes with
zero colour EOT surfaces and resolve a single 16x16 BGRA8 dummy target
into the existing 1024-byte 64-byte-aligned null_rt using the
hardware-proven msaa4-resolve pass shape (sample-rate clear kick,
1-emit resolve EOT 1c 05, PBE resolve bit, PVR_G5P_MSAA_FLAG_RESOLVE)
alongside 4x ZLS depth/stencil.
Assisted-by: LLM
Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
…mpute WebGPU compute shaders that query textureDimensions() on a storage image (e.g. webgpu-samples particles/probabilityMap.wgsl::export_level) emit nir_intrinsic_image_deref_size, which the A9 compute backend did not handle. In addition, G9P_A9_UP_SIZE was hardcoded to common dwords 40/44 and g9p_a9_compile_compute() unconditionally refused any size query when a storage image occupied common 40..47. Implement a9_image_size() reusing G9P_A9_UP_SIZE (pvr_g5p_image_size() already reads the A9 image state at offset 0 of storage descriptors), pre-scan storage and sampled image counts in a9_generate_init() so size blocks are placed in unused 4-dword common slots (40/44 when no storage images exist, else 32/36 and/or 48/52), and replace the blanket sizes+num_textures refusal with an exact common-store overlap check. Also surface the backend refusal reason in vk_errorf() and give bind_code room for storage images combined with uploads and fences. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Commits 5eb2d3f ("pvr/g9p: A9 image stores of 8- and 16-bit integer formats") and 000b849 ("pvr/g9p: A9 image loads of 8- and 16-bit integer formats") implemented and proved A9 compute storage image loads and stores for R8/RG8/RGBA8 and R16/RG16/RGBA16 UINT/SINT on S8003, but pvr_g5p_format_table.h did not yet set PVR_G5P_FMT_STORAGE on those rows. As a result, pvr_get_image_format_properties() returned VK_ERROR_FORMAT_NOT_SUPPORTED when WebGPU probed core storage texture formats rgba8uint, rgba8sint, rgba16uint, and rgba16sint at device creation. Set PVR_G5P_FMT_STORAGE on the 12 proven 8- and 16-bit integer rows; unimplemented storage formats (rgba8snorm, rg32uint/sint/float) remain unadvertised. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
…d programs Commit 5c997f1 switched samplerless fragment nir_texop_txf to emit PCO_G5P_UPLOAD_FETCH_SAMPLER (kind 9). The internal colour LOAD programs (pvr_g5p_compile_load*()) also use samplerless txf and therefore emit PCO_G5P_UPLOAD_FETCH_SAMPLER, which g5p_upload_load() in pvr_arch_g5p.c did not recognise, causing every colour LOAD pass to be refused. Accept PCO_G5P_UPLOAD_FETCH_SAMPLER in g5p_upload_load() and supply pvr_g5p_fetch_sampler_word() at +16 in g5p_load_background()'s sampler upload buffer. Also name PCO_G5P_UPLOAD_FETCH_SAMPLER in g5p_up_kind_str(). Fixes: bf7c56d ("pvr/g5p: use PCO_G5P_UPLOAD_FETCH_SAMPLER for samplerless fragment txf") Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Commit 5c997f1 moved every A9 fragment nir_texop_txf to the shared PCO_G5P_UPLOAD_FETCH_SAMPLER (kind 9). The driver's colour LOAD background programs (g5p_compile_load_type() and pvr_g5p_compile_load_mrt()) read the attachment with a samplerless txf as well, so they changed layout and emitted kind 9, which g5p_upload_load() refused ("a load program upload of kind 9"): every pass that LOADs a colour attachment was refused (Firefox's WebRender UI corrupted, Google Maps blank). Add pco_g5p_fs_key.txf_own_sampler and set it for those programs. With it plan_common() keeps the pre-5c997f12743 layout (one PCO_G5P_UPLOAD_SAMPLER slot per texture, no fetch sampler, the texel read's sampler qword at the texture's own slot), so the LOAD programs and g5p_load_background()'s nearest/clamped sampler are byte-identical to before. The 4x LOAD (pvr_g5p_compile_load_ms()) samples with a sampler and is unaffected. The other internal programs: the clear quad reads push constants only; vk_meta pipelines go through g5p_pipeline_build() and fs_uploads(), which take kind 9 since 5c997f1; compute uses the G9P uploads. Fixes: bf7c56d ("pvr/g5p: use PCO_G5P_UPLOAD_FETCH_SAMPLER for samplerless fragment txf") Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
|
Note on the commit messages: |
|
A related A9 compute bug that this PR's The bug: a null storage image descriptor is all zeroes, and the A9 compute image access has no bounds check of its own. So robustness2 Two commits on top of this branch: jeroentrappers/orchard-mesa
On an iPhone 6s, this branch against this branch plus the two commits:
One cost to weigh: every guarded storage image binding now takes a size upload slot, so a shader near the A9's slot limits could start being refused. I didn't see that in the CTS, but you know the slot budget better. Would you rather fold these into this PR, or should I open a PR on top once it merges? |
|
Thank you @brkosebay. WebGPU on the A9 going from "device lost" to rendering is a big step. We'd like to merge this. One check first: @jeroentrappers saw 14 lost devices in render-pass CTS groups on this branch (one 4x: Could one of you run those render-pass groups on an A9 with main's Mesa and with this branch, and post both counts? If the branch adds no new lost devices, we merge right away. Optional, not required: fold 21daf4e into bf7c56d (so no commit in between breaks LOAD of colour attachments) and drop d95c0cb. |
|
Counts, as asked. Main is 58db632, this branch is 21daf4e, on an iPhone 6s (A9) at 340 MHz. The case list is one 1000-case slice of a 1-in-200 sample of the Vulkan CTS: 90 cases run, mostly render passes and robustness2.
So they are new with this branch. Two separate causes: 1. A bug that is already on main, exposed by skipping refused work by default (fragment job never finishes).
2. Texture-unit MMU faults that occur only on this branch.
Happy to share the logs or run anything you'd like on the A9. |
WebGPU in Firefox on the A9 brought the adapter and device up, then lost the device before the first frame (
Device lost: Out of memory), even for helloTriangle. wgpu records a pass with two colour targets at 4 samples. G5P refused it, and on main one refused pass failedvkEndCommandBufferwithVK_ERROR_OUT_OF_HOST_MEMORY: skipping refused work had stayed driconf-only on the A9 when it was ported to main (on by default only on the A8).This series:
vkCmdClearAttachments. Each is still named and logged (G5P_REFUSE,PVR_DEBUG=errors) instead of failing the command buffer.PVR_G5P_STRICT_DRAWS=1(andPVR_A8_STRICT=1on the A8) restores strict failure.texelFetchthrough the fetch sampler;image_deref_sizein A9 compute;STORAGE_IMAGEfor 8- and 16-bit integer formats.Fixes:for the samplerless-fetch commit, which had changed the LOAD background programs).Tested on the iPad 5 (j71t): this exact series is in the Mesa the device has run since 2026-12-03 (Firefox 161 with WebGPU enabled, daily sites, scroll benchmarks). Built on this head (Vulkan imagination with asserts on, and the Zink GL build); the G5P meson host tests pass, 9/9.
How to test
On a stock Orchard install with Mesa built from this branch, in Firefox with
dom.webgpu.enabled=trueandgfx.webgpu.ignore-blocklist=trueset in about:config:Expected on the iPad 5: the samples render and nothing prints
Device lost. Anything still refused is named on stderr and skipped. A10: unchanged, because these are G5P paths and the A10 is G9P. Theg9p/g9p_a9_*headers touched here are the A9's own compute path.