Repository navigation
Conversation
Port the MacBook Air M5 (J813, G17G) native graphics work onto the AGX3c branch, replacing the aurora-wip based pull requests. The tree builds with meson/ninja and the asahi unit tests pass 38/38 on the J813. Highlights: - PPP HAL300 packing uses the agx3c field set (general varyings, varying counts, output select, fragment depth/visibility state). - Sample-mask lowering uses agx3c's deferred M5 lowering where the G17G unrolled-sample path does not apply. - G17G sampler handles and custom borders stay within the banks the M5 uploader reserves; query-lod redirection is disabled where no bank exists, and custom-border shadow gathers use the hardware-qualified reference-shifted algorithm. - rt0-resident tilebuffer layout with Gen10 descriptors for spilled render targets, and pixel-interlock seeding for framebuffer fetch epilogs. - Gen10 PBE admission for 2D arrays, 3D and multisample shapes, with unit tests. - G17G framebuffer paths: split MRT and layered clears, layered draws, CPU mipmap generation, CPU transform feedback, the SW-TNL fallback, and the compute-prepass/render submission split the M5 kernel requires. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
agx_nir_fragment_output_temporaries() moves repeated and conditional fragment exports to the reconverged exit so the validator sees a single export block. It accepted only 32-bit exports, so a shader exporting half floats left its exports in place and the AGX IR validator rejected the program with "Invalid block form after IR translation" (alacritty's glyph shader). Accept 16-bit exports as well and give each export index a local of its own width. Exports to one index must agree on the width; a mixed-width index still bails out. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The G17G fsat lowering is an add of minifloat negative zero with
saturation. The AGX3C immediate half-add path excluded saturating adds,
so the packer refused `hadd.sat ..., #0x80` ("no grounded AGX3
encoding") and the fragment shader could not be built.
Pass saturation through agx3_alu_hadd_minifloat() as field 14. A
saturating add selects the ep2 f16add form the tables already expose;
non-saturating adds keep the shorter ep1 encoding. Extend the M5
instruction test with the encoded saturating form.
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
HAL200 texture/sampler table pointers occupy fragment uniform halves 0..7, overlapping the legacy dynamic blend constants at halves 4..11. The epilog linker already relocates the blend constants after the main shader's uniform footprint, but the relocation and agx3_g17p_fragment_blend_constant_base() were both gated on the native AGX3 chips, which exclude G17G. Admit G17G in both so a textured fragment shader with blending links and builds: alacritty's text shader was refused at the blend-constant base check. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The PPP single-mode varying shape stops at eight vertex varying components and three coefficient bindings; larger layouts belong to the general (linker varying counts) shape. G17G selected the general shape only for mixed interpolation and noperspective colour, so alacritty's ten-component, four-binding smooth shader fell into the single-mode shape and every draw was refused. The batch was dropped and alacritty rendered nothing. Select the general shape for a colour layout with more than eight varying components or more than three coefficient bindings too. For these layouts the linker's counts equal the single-mode shift, so only the admission envelope changes and previously admitted shapes keep their bytes. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The kernel refuses a submission outside its admitted M5 profile with ENOTSUPP (524), before any command is queued. The failed-submit path waited on fences that will never signal and marked the context faulty; the next submit then retired itself without reaching the kernel, so one refused stencil render dropped the rest of the process's rendering. Treat ENOTSUPP as a clean refusal: drop the batch, skip the completion wait and do not set any_faults or report a context reset. The stencil clear tests on the M5 now submit every case and a following draw renders again. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
M5's rounding/log/exp funops have no half-destination form over a word source (agx3_alu_unary_m5 refuses it), and rsqrt and the gradients take a single width. The optimizer pulled the f32-to-f16 move into those producers, so exp, log2, floor, ceil, trunc and rsqrt shaders were refused and their draws skipped: GLES2's exponential and common_functions groups failed on a solid clear colour. Keep the explicit f32-to-f16 move, and compute at word width, when the producer reads a word. Half sources still fold into their half form. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The M5 dynamic stack-load encoder only knows word and packed-byte forms, so a half vector load from a dynamically indexed array was refused and its shader skipped. A half vector covers whole registers and the same bytes as the word load of half its length, so translate an even, contiguous half vector into that witnessed form. GLES2's indexing.tmp_array dynamic-index fragment and vertex tests now encode and pass. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
G17G takes the Gen10 out-of-bounds predicate for a robust texel fetch, and that predicate reads the texture descriptor. The bindings pass force-bindlesses every fetch whose descriptor agx_nir_lower_texture() crawls, but the G17P/G17G plain-txf trigger was gated on agx_native_graphics(), which excludes G17G. A statically bound 2D texel fetch therefore reached the predicate without a handle and asserted. Admit G17G in the plain txf crawl; Firefox's WebGL context compiles such a fetch and crashed on the assertion. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…agx3c M5 (J813): native G17G Gallium path on the agx3c line
GL_EXT_shader_texture_lod adds the explicit-LOD and explicit-gradient texture functions texture2DLodEXT, texture2DProjLodEXT, textureCubeLodEXT, texture2DGradEXT, texture2DProjGradEXT and textureCubeGradEXT to GLSL ES fragment shaders. Mesa has no entry for the extension anywhere, so even a driver that sets PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD rejects #extension GL_EXT_shader_texture_lod : require with "extension `GL_EXT_shader_texture_lod' unsupported in fragment shader". Firefox's WebGL context creation compiles exactly that probe on every page and logs the failure. Advertise the extension for GL_EXT_shader_texture_lod for OpenGL ES 2.0 contexts from fragment_shader_texture_lod, parse the directive, and add the six built-ins. They reuse the ARB_shader_texture_lod lowering but are restricted to GLSL ES fragment shaders, as the extension specifies. On the M5 (J813, AGX3C, Mesa 26.3.0-devel, kernel 7.3.0-aurora-j813+) the extension is in glGetString(GL_EXTENSIONS), the probe shader compiles and a program calling all six functions links in both ES2 and ES3 contexts, and Firefox's WebGL probe no longer reports the extension as unsupported. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
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.
Firefox's WebGL context creation probes
#extension GL_EXT_shader_texture_lod : requireon every page and logs the compile failure on the M5:The driver capability was already there (asahi sets
fragment_shader_texture_lod, andst_extensionsmaps it toARB_shader_texture_lod), but Mesa had no entry for the ES extension: no row inextensions_table.h, no GLSL parser entry and no built-ins. A stock Mesa 26.1.6 radeonsi stack rejects the same probe.src/mesa/main/extensions_table.h: advertiseGL_EXT_shader_texture_lodfor the GLES2 API whenfragment_shader_texture_lodis set; ES1 and desktop keep it unsupported, as the extension spec says.src/compiler/glsl/glsl_parser_extras.{h,cpp}: the extension's enable/warn flags and the supported-extension table entry.src/compiler/glsl/builtin_functions.cpp:shader_texture_lod_es()(GLSL ES, fragment stage, extension enabled) and the six functionstexture2DLodEXT,texture2DProjLodEXT,textureCubeLodEXT,texture2DGradEXT,texture2DProjGradEXTandtextureCubeGradEXT, reusing the existingir_txl/ir_txdlowering withTEX_PROJECTfor the projected forms.Tested on the J813 (M5, AGX3C, Mesa 26.3.0-devel, kernel 7.3.0-aurora-j813+):
GL_EXT_shader_texture_lodis inglGetString(GL_EXTENSIONS), the probe shader compiles, and a program calling all six functions compiles and links.about:support#graphicsshows WEBRENDER and WEBGL enabled with noGetShaderInfoLogextension error in its log (it was there on the previous stack).gl.getExtension("EXT_shader_texture_lod")returns a capability and the exact shader from the report (#extension GL_EXT_shader_texture_lod : require/void main() {}) compiles with an empty info log.cc @Acelogic @DjDeveloperr @RyanTheTide @LiamRay10