Skip to content

drm/asahi: g17: ray queries in render stages - #309

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
claude/g17-render-ray-query
Oct 15, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
claude/g17-render-ray-query

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Summary

Let render commands carry ray-query state for their vertex (tiling) and fragment stages, as compute commands already do. This is the kernel side of aurora-silicon/mesa "asahi/hk: G17P hardware ray tracing and mesh shaders". Mesa exposes VK_KHR_ray_query only when this feature is present.

UAPI

  • DRM_ASAHI_FEATURE_RENDER_RAY_QUERY
  • struct drm_asahi_render_ray_query_stage
  • drm_asahi_cmd_render.ray_query[2], appended at the end. Shorter commands from older userspace are read with both stages zeroed.
  • drm_asahi_queue_create.render_scs_layout[2], which sizes the queue's render pool. Zero keeps the existing size.

Firmware programming

For each stage that has ray-query scratch:

  • the scratch and intersection-table words go into that stage's register program;
  • SCS is enabled with register 0x017d9;
  • the kick sets the SCS-enabled header bit.

Stages without ray queries keep their existing register programs.

Hardware validation

Tested on Neo with exactly this commit's driver source on aurora-wip 11646ff, using the Mesa series.

Area Result
Ray-query flow and null_as (vertex, tessellation, geometry, fragment, compute, RT stages) 41/48 pass
Position fetch 60/60 runnable pass
amber RT pipeline cases 5/5 pass in isolation

No GPU faults or firmware crashes occurred in these runs.

🤖 Generated with Claude Code

Let render commands carry ray query state for their vertex (tiling) and
fragment stages, as compute commands already do.

UAPI:
- DRM_ASAHI_FEATURE_RENDER_RAY_QUERY advertises the feature.
- struct drm_asahi_render_ray_query_stage describes one stage: its ray
  query scratch layout and intersection tables. drm_asahi_cmd_render gains
  ray_query[2] at its end; shorter commands from older userspace are read
  with both stages zeroed.
- drm_asahi_queue_create gains render_scs_layout[2], the largest layouts
  the queue will submit, which sizes the queue's render pool. Zero keeps
  the existing pool size.

Firmware programming: for each stage with ray query scratch, the tiling
or fragment register program carries the scratch size, tail, stack and
window words and the intersection table registers, and enables SCS with
register 0x017d9; its kick sets the SCS-enabled header bit. Stages without
ray queries keep the existing register programs unchanged.

Validation rejects intersection pools and default programs outside the
VM and a scratch layout whose enable state disagrees with the
intersection tables. The render pool is sized from both stages' scratch
demand at queue creation, and a command needing more than was reserved
is rejected.

Tested on Neo (A18 Pro) with the matching Mesa series: ray_query
builtin.flow and advanced.null_as cases 41 of 48 pass across vertex,
tessellation, geometry, fragment, compute and ray tracing stages (the
failures are tessellation evaluation and three null acceleration
structure cases); position fetch 60 of 60 runnable cases; earlier
builds of the same render path passed 883 ray query stage cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant