Commit Graph

113 Commits

Author SHA1 Message Date
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 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 46d58e55a3 Add macro for printing FourCC values 2026-01-02 01:46:20 -06:00
Cameron Gutman be460970a8 Remove use of DMA_BUF_IOCTL_SYNC
It's only necessary on "real" DMA-BUFs, not dumb buffers.
2026-01-02 01:30:03 -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 4f08d52754 Enable DRM_PRIME frames for the TH1520 2025-12-27 15:40:59 -06:00
Cameron Gutman 41ad3c0938 Add environment variable override helper function
This allows FORCE_QT_GLES and SEPARATE_TEST_DECODER to override both true and false.
2025-12-27 15:33:39 -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
armin-25689 1fd545ae1f build: fix no <linux/dma-buf.h> for BSDs 2025-08-31 15:05:03 -05:00
Cameron Gutman 351aaa6759 Add an enum type for each renderer 2025-02-18 18:58:04 -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 6b11f43302 Don't set the output rect until after modesetting
It's possible that modesetting will also change the resolution
not just the refresh rate. This can happen in cases where the
CRTC is currently set to 4K 30 Hz and we choose 1080p 60 Hz as
a better mode match for displaying a 1080p 60 FPS stream.
2024-09-19 22:43:34 -05:00
Cameron Gutman 76fd502262 Reintroduce support for FFmpeg 4
Some SBCs still depend on patched FFmpeg 4.x builds for hardware acceleration.
2024-08-24 16:50:27 -05:00
Cameron Gutman ea724a05a6 Fix compilation with older FFmpeg versions 2024-08-19 01:03:03 -05:00
Cameron Gutman 369f614b59 Rewrite format handling in DRM renderer 2024-08-19 00:57:07 -05:00
Cameron Gutman 8606b2c95e Add support for VUYX and XV30LE for YUV 4:4:4 2024-08-18 23:45:26 -05:00
Cameron Gutman fafddddfe0 Fix size and pitch calculation for dumb buffer uploads 2024-08-18 23:08:20 -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 45ccd1a811 Add plane selection workaround for Spacemit driver bug
Expose plane bug workaround logic through new envvars:
- DRM_MIN_PLANE_ZPOS
- DRM_ALLOW_PRIMARY_PLANE
2024-07-12 19:37:56 -05:00
Cameron Gutman d085722911 Don't attempt to use mismatched 8-bit formats with 10-bit codecs
In addition to silently truncating the samples, this also tickles
some nasty bugs in the VF2's out-of-tree OMX decoder.
2024-07-06 02:27:46 -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 a9d7c8e495 Move forced KMSDRM modesetting operation into Session init code
Performing this each time DrmRenderer is initialized leads to long
delays when choosing a decoder on embedded platforms, particularly
those like TH1520/JH7110 which lack accelerated GL drivers.
2024-06-25 21:57:02 -05:00
Cameron Gutman ac0e1098b9 Take COLOR_ENCODING values into account when choosing a colorspace
Replace the generic starfive hack with proper logic to examine the
supported enum values to select a colorspace. This fixes incorrect
colors with vs-drm on the TH1520.
2024-06-23 19:33:37 -05:00
Cameron Gutman 35695642d5 Use the first available plane that meets the zpos requirement
Planes seem to be listed in descending order of capabilities
with later planes sometimes lacking scaling capabilities, which
is the case with vs-drm on the TH1520.
2024-06-23 19:03:35 -05:00
Cameron Gutman e458682a23 Refactor plane property loop to avoid leak 2024-06-23 18:13:20 -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 ec7137e693 Flush window events in MMAL and DRM renderers 2024-06-09 14:26:26 -05:00
boogie bdc7d53515 Only give "pixel_format=nv12" option to v4l2m2m or v4l2requests decoders
pixel_format is a global option which changes avctx->pix_fmt to the
given format, and overrides the AV_PIX_FMT_DRM_PRIME requirement of a
decoder. So v4l2 out of tree patches has done some exception which is
not perfectly nice, therefore limit this option only if the given
decoder is v4l2 decoder. Otherwise rockchip mpp based ffmpeg decoders
can not work properly
2024-02-06 00:09:34 -06:00
Cameron Gutman c3e886fbcc Use drmIoctl() instead of bare ioctl() to handle EINTR/EAGAIN 2024-01-05 18:33:17 -06:00
Cameron Gutman 9cba449092 Add config option to allow EGL usage when built with MMAL 2023-10-15 13:03:47 -05:00
Cameron Gutman 9120fd01a8 Adjust MMAL and RPi workarounds for Pi 5 and Bookworm support 2023-10-12 18:46:11 -05:00
Cameron Gutman c14cc70a6a Also check for V3D compatible IDs 2023-10-08 16:52:54 -05:00
Cameron Gutman 7e4fddbe62 Only block EGL rendering on Pi 4 and earlier
Hopefully Pi 5 is powerful enough to at least render 1080p 60 FPS.
2023-10-08 16:16:33 -05:00
Cameron Gutman 5974980aff Use BT.709 in DrmRenderer only on Starfive devices 2023-10-05 18:10:36 -05:00
Cameron Gutman 18130fd8de Use BT.601 for planes that lack COLOR_ENCODING properties 2023-09-29 18:30:39 -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 0dd0112518 Don't export EGLImages for software frames 2023-09-29 17:20:50 -05:00
Cameron Gutman 5711e6064e Allow reuse of an active plane for devices with only one usable plane per CRTC 2023-09-29 17:19:44 -05:00
Cameron Gutman b01dfea343 Refactor EGLImage creation into a separate shared class 2023-09-26 21:03:19 -05:00
Cameron Gutman f420dc740a Set EGL_IMAGE_PRESERVED_KHR=EGL_TRUE on our EGLImages
They're mapped read-only and may be saved internally as reference frames,
so they must not be modified by the EGL implementation.
2023-09-26 02:38:46 -05:00
Cameron Gutman 654be492a0 Avoid using LFS64 interfaces with Musl 2023-09-18 20:07:56 -05:00
Cameron Gutman fd41226cdd Support fully-planar output in DrmRenderer 2023-09-12 18:08:48 -05:00