Repository navigation
drm/asahi: g17: ray queries in render stages - #309
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_queryonly when this feature is present.UAPI
DRM_ASAHI_FEATURE_RENDER_RAY_QUERYstruct drm_asahi_render_ray_query_stagedrm_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:
0x017d9;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.
null_as(vertex, tessellation, geometry, fragment, compute, RT stages)No GPU faults or firmware crashes occurred in these runs.
🤖 Generated with Claude Code