Skip to content

kernel: Scan out A9 and A10 display planes through the display DART and SMMU - #158

Merged
henrikklee merged 14 commits into
OrchardLinux:mainfrom
brkosebay:a9-display-dart
Nov 17, 2026
Merged

henrikklee merged 14 commits into
OrchardLinux:mainfrom
brkosebay:a9-display-dart

Conversation

@brkosebay

Copy link
Copy Markdown
Contributor

Depends on #150. Only the last 6 commits are new in this PR.

Summary

Scan out fullscreen client buffers through the display DART and SMMU, so an
imported, scattered dma-buf can go straight to the plane instead of through
a full-screen compositor pass. This does not depend on #151, #152 or the
other performance series.

Translated scanout is on by default, behind a mandatory pipe-CRC self-check
that is the same on the A9 and the A10. Probe maps the live boot framebuffer
before the DART attaches. The check then shows an owned pattern three times:
in bypass (reference), through a non-identity IOVA, and through an alias with
two 16 KiB pages swapped. It enables the blend CRC at ADP +0x1074 for the
check and restores the previous value afterwards. PASS needs a stable,
nonzero reference, the same CRC through translation, a different CRC for the
swapped alias, no pipe read errors and no DART/SMMU faults. The previous
framebuffer is put back after every shown pattern, PASS included.

Anything else returns to verified bypass and logs why. A CRC enable that
does not read back is INCONCLUSIVE before any pattern is shown or anything
attaches. A zero, unstable or permutation-insensitive CRC is INCONCLUSIVE;
wrong pixels, a pipe error or a fault is FAIL. If the hardware state cannot
be confirmed after rollback, the driver leaves the display to simpledrm and
keeps the mappings alive. There is no option to skip the check;
dart_scanout=0 turns the feature off.

Commits

  • Defer attachment of DMA masters left running by the boot loader and
    export the existing deferred-attach helper.
  • Describe the two display IOMMU windows, fault interrupts and scanout DMA
    master in the bindings. The T8010 compatible is already accepted.
  • Enable the S5L8960X SMMU alongside the DART, including its reflector,
    diagnostic word and fault handler; mask each faulting IRQ after 16 faults
    until translation or bypass setup rearms it.
  • Add translated ADBE allocations/imports, framebuffer lifetime tracking,
    the mandatory pattern/CRC check, verified rollback and shutdown.
  • Describe the S8003 display DART/SMMU and the deferred-attach scanout child.
  • Describe the T8010 display DART/SMMU and scanout child on the same checked
    path; mark the new A10 capability untested.

Hardware

On the iPad 5, after a warm restart from a cold boot, the self-check passed:

display DART self-check passed: pattern crc d2e4a5c9 translated d2e4a5c9 permuted 3cbcc392 faults +0 ...

The desktop renders correctly. In landscape, a pre-rotated Vulkan client
(1536x2048 BGRA8) was scanned out directly: the plane's framebuffer in DRM
debugfs state showed imported=yes.

An earlier portrait fullscreen glmark2 run with direct scanout forced scored
701 composited versus 822 direct (+17%). That number is unconfirmed: the
reversed dart_scanout A/B is pending, and glmark2 drifts about 16% run to
run on this device.

Tested on Orchard main plus this series and our other pending patches (the J71t charging series and the rest of our iPad 5 development series), as one development kernel.

A10

Enabled on the iPad 6 (J71b/J72b) behind the same self-check; untested by
us. The iPad 7 (J171/J172) keeps simpledrm. Its device tree inherits disp0
from the iPad 6 include, but ADBE only adopts a 1536x2048 boot framebuffer
and stops at probe ("no 1536x2048 boot framebuffer") before any DART code,
so its display DART is never enabled.

The T8010 node follows the J71b and J171 ADT dart-disp0: DART 0x206304000
and SMMU 0x206300000 (0x4000 each), IRQs 156/157, compatible dart,t8010 +
dart,s5l8960x, fetch-config 0xe0303, diag-config 256, and the same error
reflector (0x20fffc000) as the A9. ADT power gate 37 (DISP0_DART) has no
power-state register of its own; PMGR lists it as a child of DISP0_BE,
so the node uses ps_disp0_be (the A9's gate 36 is the same kind of child
of its display domain). Unlike the A9, the A10 ADT also has
smmu-options = 2 and dart-options = 5; nothing here acts on them.

There is no separate A10 code path: the same check writes and restores
+0x1074 on the A10's display pipe, and any non-PASS result returns to
bypass as above.

A10 testers on an iPad 6: please post the full display DART self-check ...
line (passed, FAIL or INCONCLUSIVE, with all CRCs, fault counts, step error
bits and crcctl values) and say whether the desktop looks right.

How to test

sudo dmesg | grep -E 'display DART|translated scanout|boot framebuffer'
cat /sys/module/apple_adbe_drm/parameters/dart_scanout
# while a fullscreen client runs:
sudo find /sys/kernel/debug/dri -name state -exec grep imported= {} +
  • A9: display DART self-check passed: pattern crc X translated X permuted Y faults +0 ...,
    then scanout through the display DART; the parameter reads Y; a fullscreen
    client the compositor hands to the plane shows imported=yes.
  • A10: passed means translation works there too. FAIL (...) or
    INCONCLUSIVE (...) ending in back to bypass, with the parameter N, means
    the display stays in bypass as today; the bracket says which step failed.
    rollback unconfirmed (simpledrm stays) is a bug: please report it. On the iPad 7
    expect only no 1536x2048 boot framebuffer (from the code; not run by us).
  • Off switch: apple_adbe_drm.dart_scanout=0 on the kernel command line, then
    reboot; the parameter is read-only at runtime.

Testing

  • A9 / apple-16k: PASS; image, modules and device trees built; no new warnings.
  • A10 / apple-4k: PASS; image, modules and device trees built (t8010-j71b.dtb and
    t8010-j171.dtb included); DTC output identical to the head without the T8010
    commit; no new warnings.

Both branch configs are unchanged and match the effective config after
olddefconfig byte for byte. Both enable CONFIG_DRM_APPLE_ADBE and
CONFIG_APPLE_DART, so the 4k build also compiles this display and IOMMU
code. Each build compiles every platform DTB, including t8010-j71b.dtb and
t8010-j171.dtb. In the built T8010 DTBs, the display DART node matches the
ADT values above and starts disabled until the driver sets it up; disp0 is
enabled on J71b/J72b and, as on #150, on J171/J172 through the iPad 6
include. Only local compiler debug output is suppressed. The
inherited PMGR whitespace warning when the patch series is applied, and
DTC diagnostics at sites unchanged from #150, are not new; no new
warnings are accepted.

…ial pages

On the iPad 5, vkCreateDevice() fails with VK_ERROR_INITIALIZATION_FAILED.
CREATE_HWRT_DATASET returns -EINVAL without a log line when Mesa creates
the dummy render target used during device creation.

The A9 allocates the parameter manager's pages itself. Its free list is
not grown by pvr_free_list_create(), so current_pages stays zero, but
hwrt_init_kernel_structure() still checks it against the minimum.

For chips with own_pm_pages, check initial_num_pages instead. This is
the limit used to size the S8003 parameter manager's render blocks.

Affects the Apple A9 (S8003). The A10 is unchanged.

Assisted-by: LLM
…rejected

After a rejected command stream on the iPad 5, the next exec in another
process oopses in free_bprm with a bad rss-counter. slub_debug reports
"Object already free" on kmalloc-512: the object was allocated and freed
in pvr_fw_cmd_init(), then freed again from pvr_job_put().

When stream parsing fails, pvr_job_process_stream() frees the command.
The caller then releases the job, whose release path frees it again.
Clear the command pointer and length after freeing the rejected command.

Upstream has the same code. Affects every PowerVR device.

Fixes: eaf01ee5ba28 ("drm/imagination: Implement job submission and scheduling")

Assisted-by: LLM
Every geometry and fragment job on the iPad 5 is refused with -EINVAL,
without a log line. The stream parser requires the A10's type-1 register
extension on every Apple chip, while the A9 supplies its registers in
extension type 2.

Put each chip's required extension type and mask beside its stream
definitions and obtain them through an Apple accessor. Keep the A10's
values and leave compute without an Apple must-have entry.

Affects the Apple A9 (S8003). The A10's validation values are unchanged.

Assisted-by: LLM
…ry job

Once rendering works on the iPad 5, every fragment job warns at
WARN_ON(job->paired_job) in pvr_job.c, thousands of times a minute.
Geometry jobs are never freed, and clients hang when destroying a
render target: glmark2 and vkcube run until killed.

Apple queues receive jobs linked by pvr_jobs_link_geom_frag(), but their
free path does not drop the fragment job's paired geometry reference.
That reference also keeps the geometry job's HWRT and context alive.

Follow pvr_queue_free_job(): drop the paired geometry reference and
clear paired_job before dropping the scheduler's reference.

Affects the shared Apple queue used by the A9 (S8003) and A10 (T8010).
The A10 has been build-tested only.

Assisted-by: LLM
A client's first render on the iPad 5 fails without a log line when
another client rendered last. Its geometry job returns -EBUSY, then
its fragment job is refused with "fragment job without a geometry job".

The call that takes a VM's PM sets is inside the dependency choice for
consecutive jobs of the same VM. A new VM can therefore reach submission
without a PM set when the previous fragment belonged to another VM.

Call vm_scenes for every geometry job before selecting its dependency.
Keep the existing prev_frag/last_frag choice and locking context.

Affects the Apple A9 (S8003). The A10 has no vm_scenes callback and is
unchanged.

Assisted-by: LLM
The iPad 5's rejected geometry and fragment streams return -EINVAL
without explaining which check failed. Applications fail to render,
and the kernel gives no values with which to diagnose the rejection.

Report malformed headers, invalid destination entries, short input,
unsupported extensions and missing must-have bits at the rejecting
check. Include the command type, entry or extension, and checked values.
Use one rate-limited warning per rejected stream; callers log short
reads so that propagated errors do not produce duplicate messages.

Keep successful parsing and error returns unchanged. Affects every
PowerVR device.

Assisted-by: LLM
Render failures on the iPad 5 can leave a fragment job without its
geometry job. S8003 submission errors otherwise return silently, so
the kernel does not say which engine or stage failed.

Add one rate-limited warning at each failing submission stage with the
engine, error, VM and reason. Separate the PM pool build and record
slot wait checks so that their errors can be distinguished.

Keep submission and recovery behaviour unchanged. A fragment without
its geometry scene is still refused.

Affects the Apple A9 (S8003). The A10 is unchanged.

Assisted-by: LLM
…e it loads

The iPad 5 loses Firefox's WebGL context under multiple GPU clients.
Firmware slot loads return -EIO, geometry jobs fail, and their fragment
jobs are refused. Single-client runs do not hit the failure.

VM map and unmap flushes take tag_lock but not submit_lock. They can
bump a slot's host tag while DC_SLOT loads its root. With two or more
bumps, firmware can copy an intermediate tag that matches neither the
loaded tag nor the current host tag, falsely failing the load check.

Mark each slot as loading under tag_lock while publishing its root and
tag. Defer flushes on those slots, verify the exact loaded tag, then
clear loading and apply any pending bump through the shared helper on
both success and failure. submit_lock keeps the VM's job behind the
pending bump, so firmware still invalidates stale translations before
using the slot. Report the slot, loaded, firmware and current tags on
a mismatch.

Affects: Apple A9 (S8003). The A10 is unchanged.

Assisted-by: LLM
The boot loader leaves display scanout fetching its framebuffer through a
bypassed DART. Attaching an empty DMA domain under those reads can blank
or corrupt the display before its driver has mapped the live addresses.

Let a DMA master request apple,dart-deferred-attach and export the existing
iommu_deferred_attach() helper. The display driver can populate its default
domain before enabling translation. Other masters keep their attach policy.

Affects: Apple display DMA masters left running by the boot loader.

Assisted-by: LLM
The display fetch path has a DART and a second SMMU front end. Describe
both named register windows and fault interrupts for the S5L8960X layout,
and the display pipe's optional deferred-attach scanout DMA master.
Existing single-window IOMMUs and display pipes remain valid.

Affects: Apple S5L8960X display DART and scanout device trees.

Assisted-by: LLM
Translated display fetches can read unrelated DRAM without a DART fault
when the second front end remains in bypass. Mirror stream translation in
DART then SMMU order and program the second error reflector and diagnostic
word, following AppleS5L8960XDART enableStream and hardware initialization.
Only the primary DART owns page tables and invalidation commands.

Handle both fault interrupts, expose their combined count for the display
self-check, and mask each faulting line after 16 faults until translation
or bypass setup rearms it. This path requires an explicitly described
second window; existing single-window DARTs retain their setup.

Affects: S5L8960X display DARTs with an SMMU window.

Assisted-by: LLM
Fullscreen client buffers cannot scan out directly while the display
fetches physically contiguous memory in bypass, adding a compositor pass.
Map scanout buffers through the display DART so imported dma-bufs form a
single device-address range. Preserve the boot framebuffer mapping before
deferred attachment and hold each displayed buffer through its last fetch.

Require a live pipe-CRC self-check before using translated planes. Scan out
an owned asymmetric pattern in bypass, through a nonidentity mapping, and
through an alias with two 16 KiB pages swapped. Enable blend CRC directly at
ADP +0x1074, restore its previous value, and require stable nonzero reference
CRCs, matching translated CRCs, a different permuted CRC and no DART/SMMU
faults. Report per-step pipe errors; output underrun alone is diagnostic.

Always restore the previous framebuffer after the check. On failure or an
inconclusive result, restore bypass and verify both translation controls.
Retain live mappings if the previous framebuffer or rollback cannot be
confirmed. Shutdown parks on the boot framebuffer before disabling both
front ends. There is no option to bypass verification; the existing
read-only dart_scanout parameter remains a boot-time disable switch.

Only a display pipe with a scanout DMA child takes the new path. Both SoCs
use the same mapping-before-attach and mandatory CRC check. If the CRC enable
does not read back, restore its control without flipping or attaching. A
zero or unstable reference, or an ineffective page permutation, also returns
to bypass. Restore the prior image before returning from any displayed test.

Affects: Apple A9 and A10 display scanout.

Assisted-by: LLM
The display pipe fetches through two translation front ends. Describe
the DART and SMMU windows, both fault interrupts, and the deferred-attach
scanout master so the boot framebuffer can be mapped before attachment.
Keep the IOMMU disabled until the display driver prepares the live mapping.
Only S8003 gets this node; T8010 scanout is unchanged.
Record the supplied J71t display proof in the hardware catalog and
regenerate its support matrix; other boards retain their recorded status.

Affects: Apple A9 S8003 display DART.

Assisted-by: LLM
Fullscreen imported buffers otherwise require a compositor pass on the
1536x2048 iPad 6 panel. Describe the display DART and SMMU with their ADT
windows, reflector, configuration and fault interrupts, and give disp0 a
deferred-attach scanout master. Reuse the same map-before-attach and mandatory
pipe-CRC gate as S8003; no unchecked T8010 translation path is introduced.

Use the display back-end domain, which keeps its front end powered, because
there is no separate DISP0_DART domain in the current PMGR description.
The ADT's smmu-options=2 and dart-options=5 are noted for hardware testers;
no speculative properties or register writes are added for them.
disp0 is enabled on the iPad 6 and, through the shared iPad 6 include, on
the iPad 7. On the iPad 7 the display driver rejects the boot framebuffer
size at probe, before any DART code runs, so it stays on simpledrm and the
scanout master is never attached there. Translated scanout is untested on
A10 hardware.

Affects: Apple A10 iPad 6 display scanout; the iPad 7 stays on simpledrm.

Assisted-by: LLM
@brkosebay

Copy link
Copy Markdown
Contributor Author

Confirmed the performance number with a reverse-order A/B. The setup was an iPad 5 running the full development kernel (Orchard main plus this series and the other open A9 PRs), the desktop session under labwc, portrait, and full glmark2-es2-wayland --fullscreen (all scenes). Each arm ran on its own boot, switched only by apple_adbe_drm.dart_scanout on the kernel command line:

Order dart_scanout glmark2 GPU fragment busy Plane during the run
1 on (default) 522 81.8 % client buffer (imported dma-buf)
2 0 432 77.5 % compositor buffer
3 on (default) 524 — client buffer

Direct scanout is +21 % on the full benchmark in both run orders, which replaces the unconfirmed +17 % in the description. The display DART self-check passed on every boot (pattern CRC equals the translated one, the swapped alias differs, no faults), and the GPU logged 0 faults across all three runs.

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