Repository navigation
simpledrm: a NEON turned copy, and landscape for a turned scanout - #163
Merged
henrikklee merged 2 commits intoDec 5, 2026
Merged
Conversation
At native resolution the iPad 3's simpledrm spent 73.6 ms on each full-screen update (23 ns a pixel at 1 GHz), most of it in the scalar gather that builds each scanout run one pixel at a time. On ARM with kernel-mode NEON and simpledrm built in, the unzoomed rotation-90 case now gathers a tile in 4x4 blocks instead: four upright rows loaded, transposed with VTRN, and stored as four runs of a scanout row. Other cases, partial blocks and contexts where may_use_simd() is false keep the scalar loop. simpledrm_neon.c includes only the compiler's arm_neon.h, because its stdint.h and the kernel's types do not mix (as in crypto/aegis128-neon-inner.c). It is therefore built in only, with CC_FLAGS_FPU. Checked against the scalar mapping on 2000 random tiles under QEMU. Assisted-by: LLM Signed-off-by: Developerr86 <138863457+Developerr86@users.noreply.github.com>
A turned scanout was offered only upright. Offer its own shape as a second mode, copied unturned, so that a compositor can put the picture on its side by a mode change instead of turning every frame itself, which costs pixman about three times as much per frame here. Assisted-by: LLM Signed-off-by: Developerr86 <138863457+Developerr86@users.noreply.github.com> [Orchard: dropped the flip parameter; rotation should use the plane rotation property] Signed-off-by: Henrik Klee <henrik@goat-code.com>
henrikklee
force-pushed
the
ipad3-simpledrm-landscape
branch
from
December 5, 2026 01:14
e765f28 to
82cf642
Compare
henrikklee
marked this pull request as ready for review
December 5, 2026 01:14
|
Thank you, Ashish! Cutting the full-screen copy from 73.6 ms to 28.6 ms is a big win on the A5X, and offering the scanout's own shape as a second mode is a clean, standard way to get landscape. What we changed on your branch:
Nothing is lost: your original commit is tagged Upside down through the plane's standard |
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.
Two changes to simpledrm's turned copy (the opt-in
rotationfrom #103), for GPU-less boards whose scanout is turned.What users get: on the iPad 3, full-screen updates cost less than half as much CPU, and the desktop can turn to landscape and upside down (auto-rotation) at no extra cost per frame.
1. drm/tiny: simpledrm: Gather turned tiles with NEON
The rotation-90 tile copy gathered one pixel at a time: about 23 cycles a pixel on the A5X, 73.6 ms per full 1536×2048 frame.
simpledrm_neon.ctransposes 4×4 blocks with VTRN. It includes onlyarm_neon.h(ascrypto/aegis128-neon-inner.cdoes, hence theuint32_t), is built withCC_FLAGS_FPUonly when simpledrm is built in on ARM withKERNEL_MODE_NEON, and runs betweenkernel_neon_begin()/end()whenmay_use_simd(). The scalar path stays for everything else. It matched the scalar mapping on 2000 random tiles under QEMU (0 wrong pixels). Measured on the iPad3,3: 28.6 ms per full frame (11.5 ns a pixel), from 73.6 ms.2. drm/tiny: simpledrm: Offer a turned scanout in its own shape too, and flip
A turned scanout was offered upright only. Turning the picture in the compositor (
wlr-randr --transform) makes pixman turn every frame, which on the A5X cost about 3× per full frame. That's 2.5 s of labwc CPU for the turn itself and 0.3 s per full-screen frame afterwards, so auto-rotation was unusable. So:flipparameter (/sys/module/simpledrm/parameters/flip) turns either mode a further 180°. Setting it reverses what is on the scanout in place, so nothing has to redraw. One mutex orders it against the copies.A compositor reaches all four orientations with a mode change and
flip, and keeps transform normal. Touch follows with a libinput calibration matrix. Without arotationproperty nothing changes: one mode, no flip.On the interface:
flipis a presentation choice likezoom, not hardware behaviour. The standard alternative would be the primary plane'srotationproperty (DRM_MODE_ROTATE_180), but wlroots never sets it and renders transforms itself. I'm happy to switch to it, or to another shape, if you prefer. The user offlipis omarchy-a's rotation daemon; the change for it is in his fork's image script (j2a-rotate/rotate-patch.py) and will be an omarchy-a PR.Testing
orchard_applearmv7_defconfig(simpledrm built in, NEON on) andW=1, no warnings.checkpatch --strict: only theAssisted-bytrailer, MAINTAINERS for the new file, and the intendeduint32_tin the NEON file. Not booted in this exact form yet (it is the same code minus the counters), hence draft; I'll boot it on the J2A and mark it ready.simple-framebufferhasrotation. Here that is the iPad 3 (s5l8945x-ipad3.dtsi) and the A6X iPad 4 (s5l8955x.dtsi, P101-P103, untested): they get the NEON copy and the second mode. Boards withoutrotationare unchanged.Proposed CHANGELOG line (Unreleased): iPad 3 and iPad 4: a twice-as-fast screen copy, and landscape and upside-down without a GPU.