Commit Graph

57 Commits

Author SHA1 Message Date
Cameron Gutman
3ea62c0800 Call drmModeDirtyFB() for the modified composition regions 2026-01-10 23:53:07 -06:00
Cameron Gutman
7643cc929e Implement DRM overlay composition
This allows overlays to work on drivers that only have one usable
overlay plane and when we are using the primary plane (which often
must be exactly CRTC-sized) to overlay on top of a video underlay.
2026-01-10 23:40:12 -06:00
Cameron Gutman
9ffe5218d5 Hoist the logic to keep an AVFrame reference up to Pacer 2026-01-07 17:50:43 -06:00
Cameron Gutman
a3237b741c Support underlay planes by turning off unused active planes 2026-01-06 01:59:34 -06:00
Cameron Gutman
80ddd5ba13 Fix software upload for DRM renderer with non-720p resolutions
The buffer allocated for the 720p test frame was left around
and we would attempt to reuse it even if the stream had frames
of a different size.
2026-01-06 00:35:36 -06:00
Cameron Gutman
50a094c917 Fix percentage math 2026-01-05 21:01:23 -06:00
Cameron Gutman
d14cf984f4 Print flip stats after the DrmRenderer is destroyed 2026-01-05 20:52:53 -06:00
Cameron Gutman
13d9d79fe3 Implement support for adjusting zpos to make planes visible 2026-01-05 20:39:12 -06:00
Cameron Gutman
70d4f24455 Fix pending frame leak on destruction 2026-01-05 19:15:58 -06:00
Cameron Gutman
ea5b062da3 Set VRR, BPC, and content type properties 2026-01-05 18:58:21 -06:00
Cameron Gutman
e6f41f5574 Improve DRM renderer plane compatibility testing
For atomic drivers, use a test-only commit to fully exercise the
path that we will be using when rendering.

For legacy drivers, mask the variable portion of Broadcom modifiers
before matching with IN_FORMATS.
2026-01-05 18:20:39 -06:00
Cameron Gutman
25e2d39e26 Fix copy-paste mistake in 8726c1 2026-01-04 21:52:12 -06:00
Cameron Gutman
bd32370b6d Fix libdrm return value vs errno confusion
libdrm is inconsistent between returning -1 with an errno set
and just returning -errno as the return value. Figuring out which
behavior a given libdrm function has require reading the source :/
2026-01-04 21:50:40 -06:00
Cameron Gutman
8726c1c7d0 Bring back atomic async page flip support
Now that we're referencing the AVFrame to keep the buffers from
being reused during scanout, this should hopefully work better.
2026-01-04 19:34:13 -06:00
Cameron Gutman
34881599f5 Reference the AVFrame while the backing DMA-BUFs are used for scanout
This prevents tearing and other artifacts caused by the decoder
writing to a DMA-BUF that is currently being displayed.
2026-01-04 18:47:00 -06:00
Cameron Gutman
46c76534bc Use AVBufferRefs to keep EGLImages and DRM FDs around for the lifetime of the frame 2026-01-04 18:06:24 -06:00
Cameron Gutman
2972022ced Remove async and non-blocking page flip support
It doesn't work well in practice for a few major reasons:
- It can result in the decoder writing on DMA-BUFs being used by the display
- It can generate page flip events that collide with Qt/SDL
- It can stall the decoder if the DMA-BUF has a fence on it from the display driver
2026-01-03 00:41:14 -06:00
Cameron Gutman
c0846155c3 Fix page flipping bugs 2026-01-02 20:01:54 -06:00
Cameron Gutman
ac6dadffc6 Use page flip events to correctly synchronize with async flips 2026-01-02 19:47:43 -06:00
Cameron Gutman
745ac34b15 Improve page flipping and modifier handling in DrmRenderer 2026-01-02 18:44:18 -06:00
Cameron Gutman
5f89636ed7 Improve robustness of DRM property value handling 2026-01-02 02:06:11 -06:00
Cameron Gutman
d50ba06321 Implement DRM atomic renderer with overlay support
Fixes #1733
2026-01-02 01:24:35 -06:00
Cameron Gutman
3e5aa9b127 Simplify EGLImageFactory and remove caching logic for now
The platforms that would most benefit (embedded V4L2 decoders)
either don't use frame pooling or don't synchronize with
modified DMA-BUFs unless eglCreateImage() is called each time.
2025-12-28 17:54:31 -06:00
Cameron Gutman
085480e9f4 Add EGLImage caching to improve performance 2025-12-28 17:08:45 -06:00
Cameron Gutman
d501a627f0 Test all renderers before use
Every renderer except SDL had opted-in for testing due to various
quirks discovered over the years, so just do away with this option
and test all renderers.
2025-12-22 23:58:26 -06:00
Cameron Gutman
a2670dd568 Use hasFrameFormatChanged() in DRMRenderer 2025-11-06 00:04:08 -06:00
Cameron Gutman
023b6b2772 Fix DRM FD leak with Vulkan windows 2024-09-21 21:41:43 -05:00
Cameron Gutman
6f39d120cb Unify handling of DRM devices between DRM and VAAPI
SDL may not be able to give us a DRM FD for Vulkan windows.
2024-09-21 20:46:11 -05:00
Cameron Gutman
369f614b59 Rewrite format handling in DRM renderer 2024-08-19 00:57:07 -05:00
Cameron Gutman
1bb16be183 Allow DrmRenderer to act as a non-DRM hwaccel backend
This case basically works like a degenerate case of a DRM hwaccel
without DRM master where we just provide EGL export functionality
except that we don't even need a DRM FD in this case.

There are patches floating around the FFmpeg list for this:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=12604
2024-08-17 17:04:30 -05:00
Cameron Gutman
c707dab70a Plumb YUV444 logic into additional renderers 2024-07-25 06:36:40 -05:00
Cameron Gutman
dff02eab7d Fix DrmRenderer build 2024-06-25 23:29:37 -05:00
Cameron Gutman
e76780e105 Add a new prepareToRender() callback for renders to perform their initial window clears
This consolidates all the clearing that was strewn across the codebase.
2024-06-25 23:12:18 -05:00
Cameron Gutman
0f57abf6f8 Don't select an overlay plane with a lower zpos than the primary plane 2024-06-23 17:55:27 -05:00
Cameron Gutman
5974980aff Use BT.709 in DrmRenderer only on Starfive devices 2023-10-05 18:10:36 -05:00
Cameron Gutman
b6d4f97e96 Check that the chosen plane supports the decoded frame pixel format 2023-09-29 17:22:49 -05:00
Cameron Gutman
b01dfea343 Refactor EGLImage creation into a separate shared class 2023-09-26 21:03:19 -05:00
Cameron Gutman
c8182dfab3 Use BT.709 for DrmRenderer 2023-09-05 19:28:22 -05:00
Cameron Gutman
50255dd896 Set Colorspace connector property when streaming HDR 2023-08-09 23:02:43 -05:00
Cameron Gutman
90f26dfa45 Support direct KMSDRM output for platforms with slow GL implementations 2023-03-26 19:46:22 -05:00
Cameron Gutman
99885f5b4b Centralize colorspace and color range handling 2022-09-24 12:28:23 -05:00
Cameron Gutman
cf089fdfe9 Add support for HDR with VAAPI using DRM frontend renderer 2022-01-29 18:16:39 -06:00
Cameron Gutman
e0fd84d6f5 Fix build with old libdrm headers 2022-01-29 00:28:46 -06:00
Cameron Gutman
443720c3de Plumb HDR metadata into DRM renderer 2022-01-28 22:40:07 -06:00
Cameron Gutman
ad0afb5fc9 Prefer direct rendering when using HDR 2022-01-27 22:36:49 -06:00
Cameron Gutman
f5bc4e7a24 Add color properties to DRM renderer 2022-01-23 21:03:56 -06:00
Cameron Gutman
26d04b5f9c Render DRM-PRIME frames as opaque images
We can't always assume they are NV12. Even if they _are_ NV12,
they may have DRM format modifiers that are incompatible with
simply assuming linear Y and UV buffers (such as tiling).
2021-03-21 23:23:12 -05:00
Cameron Gutman
c3895f06c0 Fix handling of preferred/compatible pixel formats with EGLRenderer and VAAPI/DRM backends 2021-02-04 19:39:18 -06:00
Cameron Gutman
ed57c54d06 Move EGL definitions into renderer.h to try to fix build on Armbian 2021-01-31 17:01:11 -06:00
Cameron Gutman
80137848dc Add DMA-BUF export compatibility with EGL 1.4 2021-01-31 16:24:31 -06:00