diff mbox series

[FFmpeg-devel,5/5] kmsgrab: Add more supported formats

Message ID bf01a90d-d96c-36d5-9d3e-78da30562343@jkqxz.net
State New
Headers show
Series [FFmpeg-devel,1/4] kmsgrab: Refactor and clean error cases
Related show

Checks

Context Check Description
andriy/default pending
andriy/configure warning Failed to apply patch

Commit Message

Mark Thompson Aug. 1, 2020, 5:57 p.m. UTC
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.
---
  libavdevice/kmsgrab.c | 9 +++++++++
  1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/libavdevice/kmsgrab.c b/libavdevice/kmsgrab.c
index b859f202aa..59c3358f5f 100644
--- a/libavdevice/kmsgrab.c
+++ b/libavdevice/kmsgrab.c
@@ -362,6 +362,7 @@  static const struct {
      enum AVPixelFormat pixfmt;
      uint32_t drm_format;
  } kmsgrab_formats[] = {
+    // Monochrome.
  #ifdef DRM_FORMAT_R8
      { AV_PIX_FMT_GRAY8,    DRM_FORMAT_R8       },
  #endif
@@ -369,6 +370,7 @@  static const struct {
      { AV_PIX_FMT_GRAY16LE, DRM_FORMAT_R16      },
      { AV_PIX_FMT_GRAY16BE, DRM_FORMAT_R16      | DRM_FORMAT_BIG_ENDIAN },
  #endif
+    // <8-bit RGB.
      { AV_PIX_FMT_BGR8,     DRM_FORMAT_BGR233   },
      { AV_PIX_FMT_RGB555LE, DRM_FORMAT_XRGB1555 },
      { AV_PIX_FMT_RGB555BE, DRM_FORMAT_XRGB1555 | DRM_FORMAT_BIG_ENDIAN },
@@ -378,6 +380,7 @@  static const struct {
      { AV_PIX_FMT_RGB565BE, DRM_FORMAT_RGB565   | DRM_FORMAT_BIG_ENDIAN },
      { AV_PIX_FMT_BGR565LE, DRM_FORMAT_BGR565   },
      { AV_PIX_FMT_BGR565BE, DRM_FORMAT_BGR565   | DRM_FORMAT_BIG_ENDIAN },
+    // 8-bit RGB.
      { AV_PIX_FMT_RGB24,    DRM_FORMAT_RGB888   },
      { AV_PIX_FMT_BGR24,    DRM_FORMAT_BGR888   },
      { AV_PIX_FMT_0RGB,     DRM_FORMAT_BGRX8888 },
@@ -388,6 +391,12 @@  static const struct {
      { AV_PIX_FMT_ABGR,     DRM_FORMAT_RGBA8888 },
      { AV_PIX_FMT_RGBA,     DRM_FORMAT_ABGR8888 },
      { AV_PIX_FMT_BGRA,     DRM_FORMAT_ARGB8888 },
+    // 10-bit RGB.
+    { AV_PIX_FMT_X2RGB10LE, DRM_FORMAT_XRGB2101010 },
+    { AV_PIX_FMT_X2RGB10BE, DRM_FORMAT_XRGB2101010 | DRM_FORMAT_BIG_ENDIAN },
+    // 8-bit YUV 4:2:0.
+    { AV_PIX_FMT_NV12,     DRM_FORMAT_NV12     },
+    // 8-bit YUV 4:2:2.
      { AV_PIX_FMT_YUYV422,  DRM_FORMAT_YUYV     },
      { AV_PIX_FMT_YVYU422,  DRM_FORMAT_YVYU     },
      { AV_PIX_FMT_UYVY422,  DRM_FORMAT_UYVY     },