Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DMA2D syscalls #4683

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

DMA2D syscalls #4683

wants to merge 7 commits into from

Conversation

cepetr
Copy link
Contributor

@cepetr cepetr commented Feb 26, 2025

This PR moves DMA2D operations entirely into the kernel. Applications must now use new syscalls instead of directly accessing the DMA2D peripheral. This change enhances security at the cost of some extra CPU cycles due to syscall overhead (approximately 3 microseconds per syscall).

Additionally, the new DMA2D syscalls, along with the existing display syscalls, have improved verifiers so that unprivileged applications cannot pass invalid pointers or coordinates in the bitblt structure.

A few final optimizations were completed in 36b866f, but there is still room for further improvements (e.g., replacing HAL_DMA2D_xxx calls with our own implementation).

On most screens, the impact on final framerate is negligible. However, on a few screens with intensive drawing - such as a homescreen with five concentric circles - the drawing time can increase significantly (from 15ms to 23ms in case of the homescreen). This change has no visible effect since we already missed the 60Hz framerate deadline before the change, maintaining a framerate of 30Hz both before and after.

resolves #4206 and #4273

@cepetr cepetr self-assigned this Feb 26, 2025
Copy link

github-actions bot commented Feb 26, 2025

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@cepetr cepetr force-pushed the cepetr/dma2d-syscalls branch from b1435fa to ed48679 Compare February 26, 2025 16:09
@cepetr cepetr requested a review from TychoVrahe February 26, 2025 16:12
@cepetr cepetr force-pushed the cepetr/dma2d-syscalls branch 4 times, most recently from 7997f8f to 1622b81 Compare February 27, 2025 12:42
@cepetr cepetr marked this pull request as ready for review February 27, 2025 13:35
@cepetr cepetr requested a review from prusnak as a code owner February 27, 2025 13:36
@TychoVrahe TychoVrahe linked an issue Feb 27, 2025 that may be closed by this pull request
@cepetr cepetr force-pushed the cepetr/dma2d-syscalls branch from 6167057 to 25c8296 Compare March 3, 2025 15:35
@cepetr cepetr force-pushed the cepetr/dma2d-syscalls branch from 25c8296 to 336ddab Compare March 3, 2025 16:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Status: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

Improve display syscall verification hide DMA2D in kernel
2 participants