Skip to content

st/mesa, zink: RG16 copies, sample-count minimums, failed batches - #40

Merged
henrikklee merged 4 commits into
OrchardLinux:mainfrom
jeroentrappers:st-zink-g5p
Dec 2, 2026
Merged

henrikklee merged 4 commits into
OrchardLinux:mainfrom
jeroentrappers:st-zink-g5p

Conversation

@jeroentrappers

Copy link
Copy Markdown
Contributor

Four fixes in shared code that the A9 (Zink on the PowerVR G5P driver) exposed:

  • st/mesa: copy R16G16 images as UINT when R16G16_UNORM cannot be rendered. glCopyImageSubData blits two-channel 16-bit data through R16G16_UNORM; a GLES driver need not render or sample it, and util_blitter then refused the blit, losing every copy into RG16UI/RG16I/RG16F. R16G16_UINT is bit-exact.
  • st/mesa: at least one integer, colour and depth texture sample. get_max_samples_for_formats() counts from 2 samples, so a driver without multisampled integer formats or multisample colour/depth textures reported GL_MAX_INTEGER_SAMPLES / GL_MAX_COLOR_TEXTURE_SAMPLES / GL_MAX_DEPTH_TEXTURE_SAMPLES as 0; GL's minimum is 1.
  • zink: end a command buffer once. VRAM_ALLOC_LOOP retried vkEndCommandBuffer on a command buffer that had already ended.
  • zink: a batch whose recording failed does not lose the context. A batch whose recording failed (a draw the driver refused) set the device-lost state, and every later test in the process failed. The batch is dropped and logged, its semaphores signalled, and the context goes on. This reverses how Zink treats a failed recording: a refused draw in one batch is not a lost device on a driver that refuses forms it does not support, and losing the context turned one refusal into hundreds of failures.

Tested on an iPhone 6s (S8003): GLES3.1 copy_image +46 (RG16 destinations), +12 (state_query.internal_format samples, sample_variables); the context fix removed a cascade of up to 500 failures after one refused draw.

glCopyImageSubData between formats blits through canonical formats, and
two-channel 16-bit data takes R16G16_UNORM (for G16R16's sake). A GLES
driver need not render or sample R16G16_UNORM: it is not a core GLES
format. Without it util_blitter refuses the blit ("ZINK: blit
unsupported") and every copy into an RG16UI, RG16I or RG16F image is
lost. Copy R16G16 as R16G16_UINT then, which is bit-exact.

On an iPhone 6s (Zink on the PowerVR G5P driver): the 51 GLES3.1
copy_image cases of the sample with an RG16 destination pass (5 before);
the sample's other 769 non-3D copy_image cases are unchanged.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
get_max_samples_for_formats() counts sample counts from 2, so a driver
without multisampled integer formats, or without multisample textures
of colour or depth formats, reported GL_MAX_INTEGER_SAMPLES,
GL_MAX_COLOR_TEXTURE_SAMPLES or GL_MAX_DEPTH_TEXTURE_SAMPLES as 0. GL's
minimum for each is 1 (single-sampled formats count), and ES 3.1
queries each format against it. Report 1 when the driver has
multisampling at all.

On an iPhone 6s (Zink on the PowerVR G5P driver): 12 more GLES3.1
cases of the sample pass (state_query.internal_format samples,
sample_variables).

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
submit_queue() ended each batch's command buffer inside VRAM_ALLOC_LOOP,
which calls vkEndCommandBuffer() again after VK_ERROR_OUT_OF_DEVICE_MEMORY.
That error is the recording's own (a draw whose pipeline the driver could
not create), so the command buffer is already invalid, and ending it
again is invalid usage: the Vulkan runtime asserts in
vk_command_buffer_end(). Call it once and keep the error handling.

On the iPhone 6s (G5P): draw_buffers_indexed and fragment_out cases with
a colour set G5P refuses aborted in that assert; they now fail.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
When vkEndCommandBuffer() reports the recording's error (a render or
draw the driver refused, on G5P an attachment set it does not render),
the batch is submitted without its command buffers so that its
semaphores are still signalled, and the context was marked lost. Every
later draw of that context then failed: under the CTS, the rest of the
test process.

Drop that batch's work only. The device is not lost and neither is the
context's other work; a real device loss still reports as before.

On an iPhone 6s (S8003), the iPhone 6's sample lists:
- GLES3 sample: 3278 -> 4247 passes (75.9 % -> 96.7 % of supported);
  the 1801-2700 slice alone 476 -> 855.
- GLES3.1 sample: 1776 -> 2191 passes (61.1 % -> 75.4 %), with the
  narrow integer colour targets of the commit before.
Most of the cases this turns into passes had nothing refused: they ran
after a refused case in the same process.

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
@henrikklee
henrikklee merged commit 955eabc into OrchardLinux:main Dec 2, 2026
1 check passed
henrikklee added a commit to ricktav/mesa that referenced this pull request Dec 2, 2026
Brings the A7 desktop branch up to date with jeroentrappers' A8/A9 fixes
(OrchardLinux#34-OrchardLinux#43), including OrchardLinux#40's Zink behaviour (a batch whose recording failed is
dropped without losing the context).

pvr_arch_g5p_gfx.c: both sides added helpers before
g5p_clear_attachments(): the A7's g5p_a7_clear_dirty() and main's
g5p_attachment_format()/g5p_render_extent() for secondaries. Both are kept;
the A7's clear quad now uses the render extent main computes.

pvr_arch_cmd_buffer.c: main skips Rogue's transparent object on every
apple_g5p device because it hangs the A9. The A7 also sets apple_g5p but
draws through upstream's Rogue path, so it keeps the transparent object as
before this merge; the A8 and A9 skip it as on main.

Assisted-by: LLM
Signed-off-by: Henrik Klee <henrik@goat-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants