Skip to content

iOS 27 camera, display side: the memoryless fetch is right; the preview reaches backboardd's framebuffer and goes to the display as its own layer (diagnostics) - #418

Draft
claudiusthebot wants to merge 3 commits into
mainfrom
agent/fbfetch/memoryless-fetch
Draft

claudiusthebot wants to merge 3 commits into
mainfrom
agent/fbfetch/memoryless-fetch

Conversation

@claudiusthebot

Copy link
Copy Markdown
Collaborator

Builds on #416 (its two commits are under this one). Diagnostics only, all off unless set in /var/local/mtl2-env. Draft: nothing here fixes the viewfinder; it moves the search out of the Metal layer.

Measured on phone 1 (iOS 27.2.1, kernel k1 + cam_trace=1 cam_metal=1, root as handed back + this StarbiteMetal), 24 November:

  • SWEET_MTL2_FBPROBE=1: framebuffer fetch through a memoryless RGBA16Float color 1 (written by a draw with color 0 masked off, then read by [[color(1)]] into color 0) is exact on PanVK/Mali-G72 (B G R 191 128 64). Private color 1, two attachments, clear + fetch, and self-fetch of color 0 are right too. Mechanism: metal2vulkan's input attachments with VK_EXT_rasterization_order_attachment_access (PanVK v6 has it through mesa26-panvk-ios.patch), lowered to LD_TILE from the tile buffer.
  • SWEET_MTL2_FBPROBE=2: in a camera session the 828x1702 main pass's color 1, made a stored private texture, is empty in all 20 reads. The S1 draws into color 1 belong to the flip animation, not steady frames. The _Isup inputs are a sampled backdrop texture, not color 1.
  • SWEET_MTL2_FBPROBE=3: the steady preview draw (TimgA3Xhf_Ixrg, format 500 texture over the sink's surfaces) puts the picture into backboardd's framebuffer surface (viewfinder RGB 16-21, 10-17 of 64 lit; sink luma mean 21 in that dim room). The screen at the same moment is 0 over the viewfinder.
  • The kernel framebuffer logged layer 2 surface 284 at 0,0 828x1702: surface 284 is a 420f sink surface. backboardd hands the preview to the display as its own layer. SwapEnd (SweetFramebuffer.cpp in the xnu fork) copies and blends 4-byte BGRA layers only (read in the code).

Next: the display path (what SwapEnd gets for the preview layer, and a YCbCr layer there), not the Metal layer. The .mm edits keep it at its size allowance. The last refactor (FetchProbe.h included from DrawNote.h, the constants read through the existing property) was built but not booted; the logic booted as builds F1-F5. Notes: ~/s9/agents/fbfetch-1124/NOTES.md on the mini.

… preview, and note CoreAnimation's draw of it

Diagnostics in the Metal frontend, all off unless set in /var/local/mtl2-env:
- SWEET_MTL2_YCCPROBE=1 (YCbCrProbe.h/.metal): at bindings of a converted two-plane YCbCr
  texture (formats 500-510), read an 8x8 grid on the process's own GPU (compute read, linear
  and nearest samples; fragment-stage half samples from slot 3, linear and nearest) beside
  the processor's read of the surface.
- SWEET_MTL2_DRAWNOTE=1 (DrawNote.h): once per pipeline, the full state of a draw that
  samples such a texture (fragment function, attachments, blending, samplers, fragment
  bytes, first vertex floats).
- SWEET_MTL2_YCCFLAT=1: a test switch that binds a BGRA8 copy of such a texture instead.

Run on phone 1 (24 Nov, D1-D7): the texture reads the picture in every mode; with the
BGRA8 copy the viewfinder is still black. CoreAnimation draws the camera into a memoryless
color attachment (TimgA3S1Xhfu_Ixrg) and composites it later in the pass; that is the next
place to measure. docs/ios27/CAMERA.md, 'The display side'.

The frontend's size allowance goes from 2767 to 2777 lines for the three hooks.
…ttachment is right on PanVK; the steady preview is drawn into backboardd's framebuffer and handed to the display as a layer of its own

FetchProbe.h/.metal (SWEET_MTL2_FBPROBE=1/2/3, off by default): a self-test of a draw that writes a memoryless RGBA16Float color 1
read back by framebuffer fetch (right on phone 1), a stored shadow of the main pass's color 1 during a camera session (empty on
steady frames), and a read of color 0's surface after the steady camera draw (holds the picture). DrawNote.h modes 2 and 3.
docs/ios27/CAMERA.md: the measurements, and the display layer (SweetFramebuffer SwapEnd) as the next place.
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