Skip to content

pvr/g5p: refuse a draw into a colour attachment that is not stored - #57

Merged
henrikklee merged 1 commit into
OrchardLinux:mainfrom
jeroentrappers:g5p-unstored-colour
Dec 5, 2026
Merged

henrikklee merged 1 commit into
OrchardLinux:mainfrom
jeroentrappers:g5p-unstored-colour

Conversation

@jeroentrappers

Copy link
Copy Markdown
Contributor

A G5P pipeline writes its colour outputs to the render's end-of-tile targets. A colour attachment with store op DONT_CARE (and no resolve) is not one of them. g5p_mrt_draw_check() compares only the counts, so a draw can pass with one target on each side while its output really goes through another attachment's end-of-tile setup. With a 32-bit channel format (R32_, R32G32_), the fragment job then never finishes, and the device is lost: no MMU fault, just the job timeout.

How it's reached: with refused work skipped (pvr_skip_refused_work, on by default in #48):

  • in the render-pass input-attachment cases, the subpass that reads the attachment is refused (image_deref_load);
  • the pass is no longer dropped as a whole, so the first subpass's draw runs.

On an iPhone 6s (A9) with skipping on, renderpass1.*.formats.{r32,r32g32}_{sint,uint,sfloat}.input.*.dont_care.draw hangs for all 6 formats. Other formats fail without hanging.

The fix: refuse the draw unless every colour attachment of the subpass is an end-of-tile target, or resolves into one. Two cases stay allowed, each because an earlier version without the exception lost passes:

  • the driver's own vkCmdClearAttachments quads, which write a constant (3 *.dont_care.clear cases);
  • a render with no end-of-tile target at all, whose outputs go nowhere. Occlusion queries draw like that (occlusion_query.copy_results_size_32_stride_4_without_availability).

Tested on an iPhone 6s (A9), 340 MHz, on 58db632; rebased onto current main without conflicts, retest there pending:

Found while answering henrikklee's question on #48.

A G5P pipeline writes its colour outputs to the render's end-of-tile
targets. A colour attachment with store op DONT_CARE (and no resolve)
is not one of them, so g5p_mrt_draw_check() can count one target on
both sides while the draw's output really goes through another
attachment's end-of-tile setup. With a 32-bit channel format (R32_*,
R32G32_*) the fragment job then never finishes and the device is lost.

That draw is reached once refused work is skipped: in the render-pass
input-attachment cases, the subpass that reads the attachment is
refused (image_deref_load), and its pass is no longer dropped as a
whole. With pvr_skip_refused_work on, every
renderpass1.*.formats.{r32,r32g32}_*.input.*.dont_care.draw case hung
the fragment job on an iPhone 6s.

Refuse the draw unless every colour attachment of the subpass is an
end-of-tile target, or resolves into one. Two cases stay allowed:
the driver's own vkCmdClearAttachments quads, which write a constant
and have not hung, and a render with no end-of-tile target at all,
whose outputs go nowhere (occlusion queries draw like that).

Generated-by: LLM
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
@henrikklee
henrikklee merged commit a2aeba0 into OrchardLinux:main Dec 5, 2026
1 check passed
@henrikklee

Copy link
Copy Markdown
Contributor

Merged, thank you Jeroen! Turning that GPU hang into a clean refusal is exactly the kind of fix that makes the driver safer for everyone, and the CTS sample with and without the change (plus the r32 probe cases going from 6 lost devices to 0) made it easy to land with confidence.

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