Commit Graph

16 Commits

Author SHA1 Message Date
Andreas Rheinhardt d92f38c179 avdevice: Constify all devices
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Marton Balint 2d32aed85c avdevice: use av_gettime_relative() for elapsed time calculations
av_gettime_relative() is using the monotonic clock therefore more suitable for
elapsed time calculations. Packet timestamps are still kept absolute, although
that should be configurable in the future.

Related to ticket #9089.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:41:50 +01:00
Bas Nieuwenhuizen 4386060164 kmsgrab: Do not require the modifier to stay constant.
As we get a new set of objects each frame anyway, we
do not gain anything by keeping the modifier constant.

This helps with capturing when switching your setup a
bit, e.g. from ingame to desktop or from X11 to wayland.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-13 23:08:02 +00:00
Bas Nieuwenhuizen 03f4b203ba kmsgrab: Use invalid modifier if modifiers weren't used.
The kernel defaults to initializing the field to 0 when modifiers
are not used and this happens to be linear. If we end up actually
passing the modifier to a driver, tiling issues happen.

So if the kernel doesn't return a modifier set it explicitly to
INVALID. That way later processing knows there is no explicit
modifier.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-13 23:07:36 +00:00
Mark Thompson 6e951d0cf8 kmsgrab: Add more supported formats
X2RGB10 tested on both Intel Gen9 and AMD Polaris 11.  NV12 tested on
Intel Gen9 only - since it has multiple planes, this requires GetFB2.

Also add some comments to split the list up a bit.
2020-08-09 20:18:49 +01:00
Mark Thompson ff14858a60 kmsgrab: Don't require the user to set framebuffer format
This is provided by GetFB2, but we still need the option for cases where
that isn't available.
2020-08-09 20:18:49 +01:00
Mark Thompson ef934dba2d kmsgrab: Use GetFB2 if available
The most useful feature here is the ability to automatically extract the
framebuffer format and modifiers.  It also makes support for multi-plane
framebuffers possible, though none are added to the format table in this
patch.

This requires libdrm 2.4.101 (from April 2020) to build, so it includes a
configure check to allow compatibility with existing distributions.  Even
with libdrm support, it still won't do anything at runtime if you are
running Linux < 5.7 (before June 2020).
2020-08-09 20:18:48 +01:00
Mark Thompson fa0b064cf2 kmsgrab: Refactor and clean error cases 2020-08-09 20:18:48 +01:00
Jun Zhao ac6e27d74f kmsgrab: add category for kmsgrab
Makes kmsgrab visible in "ffmpeg -devices".

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-03-26 22:39:12 +01:00
Carl Eugen Hoyos 5cb70381d9 lavd/kmsgrab: Remove the mapping for AV_PIX_FMT_RGB8.
The definitions are different: 3:3:2 vs 2:3:3.
2017-09-20 00:56:29 +02:00
Carl Eugen Hoyos f952edaa73 kmsgrab: Add more DRM plane formats 2017-09-19 22:47:06 +01:00
Mark Thompson 9f9625ea80 kmsgrab: Remove multiple-plane formats
The planes are unlikely to be contiguous, assuming they are results in
very broken output.  (Tested with NV12/NV16 on Rockchip.)
2017-09-19 22:47:03 +01:00
Mark Thompson 22afa87a8e kmsgrab: Fix DRM format definitions
All DRM formats are defined in terms of little-endian words, so RGB formats
like XRGB actually have the elements in the opposite order order in memory
to the order they are in the name.

This does not affect YUYV and similar YUV 4:2:2 formats, which are in the
expected order.
2017-09-19 22:47:01 +01:00
Jun Zhao 462568185b kmsgrab: Fix build failure with old libdrm
DRM_FORMAT_R8 was added in libdrm 2.4.68.
DRM_FORMAT_R16 was added in libdrm 2.4.82.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-09-14 22:40:09 +01:00
Mark Thompson 16b44d9ab9 lavd/kmsgrab: Fix packet flag setting
Found-by: James Almer <jamrial@gmail.com>
2017-09-14 09:14:36 +01:00
Mark Thompson 52194f0bcb lavd: Add KMS screen grabber 2017-09-13 22:31:05 +01:00