Skip to content

gallium: add the Apple SGX543 driver for armv7 - #32

Draft
brkosebay wants to merge 1 commit into
OrchardLinux:mainfrom
brkosebay:pr/n42-sgx-gallium
Draft

brkosebay wants to merge 1 commit into
OrchardLinux:mainfrom
brkosebay:pr/n42-sgx-gallium

Conversation

@brkosebay

@brkosebay brkosebay commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Add the optional Gallium sgx driver used by Labwc on iPhone5,2 (A6, SGX543MP3). The sources come from Project Cascadia at 52ba1a0, with the A6 and Mesa 27 port. This branch is based on the exact Orchard Mesa release commit used by the packages repository. The hardware run used the same driver sources on Mesa 27 and reported GPU-PROBE PASS renderer=PowerVR SGX543MP3 at 640×1136.

The DRM UAPI header matches OrchardLinux/linux#61 byte for byte. Enable the driver with -Dgallium-drivers=sgx. Firmware for the kernel and the frame template pack for userspace are separate, locally derived inputs. The GLES2 framebuffer and NIR alignment corrections in this import also affect other drivers. This draft carries source code only.

Import the MIT-licensed Project Cascadia SGX driver from 52ba1a0 with the A6 render-target, submission and Mesa 27 changes tested on iPhone5,2. Keep the Cascadia copyright notices. The optional sgx target registers apple-sgx with the DRM loader. The kernel firmware and the user-provided frame pack are external inputs.

The uniform offset correction accounts for vec4 units when assigning align_offset. GLES2 framebuffer completeness rejects half-float RGB attachments as required by EXT_color_buffer_half_float.

Assisted-by: LLM
Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
@henrikklee

Copy link
Copy Markdown
Contributor

Hi @brkosebay, thanks for bringing the SGX driver over. Using the 32-bit GPU at all is exciting. We reviewed it; since it's a draft, nothing is changed. Here's what it needs before it could ship:

  1. Licence (blocking): the files say MIT, but Project Cascadia's LICENSE and README say the project is GPL-2.0. A GPL-2.0-only driver can't go into libgallium, which links Apache-2.0 LLVM. I'll ask on the Cascadia side; a written MIT confirmation from rzxvx would settle it.
  2. Authorship: about 99 % of the code is Cascadia's (commit 52ba1a0). Per our CONTRIBUTING, the imported code keeps its author (rzxvx) as git author, with an [Orchard: from …] note. Your A6 port and build changes go in separate commits under your name.
  3. Fallback: without /usr/local/lib/sgx2d/pack.txt the driver starts and drops every draw: a black screen. It should refuse to start, so the system falls back to CPU drawing. The path should also match what orchard installs (/lib/firmware/apple/sgx543-n42/gl-event.pds today), and the error messages shouldn't point to Cascadia's tool.
  4. Shared Mesa changes: the fbobject.c change makes half-float RGB targets incomplete in GLES2 for every driver, llvmpipe included. The extension allows them to be renderable, so please move that into sgx's is_format_supported. The nir_lower_uniforms_to_ubo.c fix looks right, but please make it its own nir: commit.
  5. Coverage: the A5X (iPad 3, SGX543MP4) isn't covered: the occlusion-query loop stops at 3 cores, and the renderer name would read MP2.
  6. Scaffolding: please keep the ~25 SGX_* debug environment switches on your fork.
  7. Release bar: we'd need a comparison against CPU drawing (frame rate, CPU, RAM; ideally Firefox) on a device.

There are two separate prerequisites for users: an armv7 Mesa build in packages, and linux#61 for the A6. Thanks again!

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