Re: [FFmpeg-devel] [PATCH 01/14] lavu: Add DRM hwcontext

2017-09-19 Thread wm4
On Sun, 10 Sep 2017 21:53:25 +0100
Mark Thompson  wrote:

> ---
> This is the same patch as the one in the kmsgrab and rkmpp sets, included 
> here because the ARM DRM mapping depends on it.
> 
> 
>  configure  |   3 +
>  libavutil/Makefile |   2 +
>  libavutil/hwcontext.c  |   4 +
>  libavutil/hwcontext.h  |   1 +
>  libavutil/hwcontext_drm.c  | 291 
> +
>  libavutil/hwcontext_drm.h  | 166 +++
>  libavutil/hwcontext_internal.h |   1 +
>  libavutil/pixdesc.c|   4 +
>  libavutil/pixfmt.h |   7 +
>  9 files changed, 479 insertions(+)
>  create mode 100644 libavutil/hwcontext_drm.c
>  create mode 100644 libavutil/hwcontext_drm.h
> 

LGTM
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 01/14] lavu: Add DRM hwcontext

2017-09-10 Thread Mark Thompson
---
This is the same patch as the one in the kmsgrab and rkmpp sets, included here 
because the ARM DRM mapping depends on it.


 configure  |   3 +
 libavutil/Makefile |   2 +
 libavutil/hwcontext.c  |   4 +
 libavutil/hwcontext.h  |   1 +
 libavutil/hwcontext_drm.c  | 291 +
 libavutil/hwcontext_drm.h  | 166 +++
 libavutil/hwcontext_internal.h |   1 +
 libavutil/pixdesc.c|   4 +
 libavutil/pixfmt.h |   7 +
 9 files changed, 479 insertions(+)
 create mode 100644 libavutil/hwcontext_drm.c
 create mode 100644 libavutil/hwcontext_drm.h

diff --git a/configure b/configure
index 4dd11efe5e..3ba27c5175 100755
--- a/configure
+++ b/configure
@@ -307,6 +307,7 @@ External library support:
   --disable-cuvid  disable Nvidia CUVID support [autodetect]
   --disable-d3d11vadisable Microsoft Direct3D 11 video acceleration 
code [autodetect]
   --disable-dxva2  disable Microsoft DirectX 9 video acceleration code 
[autodetect]
+  --enable-libdrm  enable DRM code (Linux) [no]
   --enable-libmfx  enable Intel MediaSDK (AKA Quick Sync Video) code 
via libmfx [no]
   --enable-libnpp  enable Nvidia Performance Primitives-based code [no]
   --enable-mmalenable Broadcom Multi-Media Abstraction Layer 
(Raspberry Pi) via MMAL [no]
@@ -1567,6 +1568,7 @@ EXTERNAL_LIBRARY_LIST="
 libcaca
 libcelt
 libdc1394
+libdrm
 libflite
 libfontconfig
 libfreetype
@@ -5871,6 +5873,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
 enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h 
dc1394_new
+enabled libdrm&& require_pkg_config libdrm xf86drm.h drmGetVersion
 enabled libfdk_aac&& { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" 
aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac &&
  warn "using libfdk without pkg-config"; } }
diff --git a/libavutil/Makefile b/libavutil/Makefile
index e45871fd11..65e285a701 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -34,6 +34,7 @@ HEADERS = adler32.h   
  \
   hwcontext.h   \
   hwcontext_cuda.h  \
   hwcontext_d3d11va.h   \
+  hwcontext_drm.h   \
   hwcontext_dxva2.h \
   hwcontext_qsv.h   \
   hwcontext_vaapi.h \
@@ -161,6 +162,7 @@ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
 OBJS-$(CONFIG_D3D11VA)  += hwcontext_d3d11va.o
 OBJS-$(CONFIG_DXVA2)+= hwcontext_dxva2.o
 OBJS-$(CONFIG_QSV)   += hwcontext_qsv.o
+OBJS-$(CONFIG_LIBDRM)   += hwcontext_drm.o
 OBJS-$(CONFIG_LZO)  += lzo.o
 OBJS-$(CONFIG_OPENCL)   += opencl.o opencl_internal.o
 OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 2a755a6878..aa6b3ad176 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -35,6 +35,9 @@ static const HWContextType *const hw_table[] = {
 #if CONFIG_D3D11VA
 &ff_hwcontext_type_d3d11va,
 #endif
+#if CONFIG_LIBDRM
+&ff_hwcontext_type_drm,
+#endif
 #if CONFIG_DXVA2
 &ff_hwcontext_type_dxva2,
 #endif
@@ -55,6 +58,7 @@ static const HWContextType *const hw_table[] = {
 
 static const char *const hw_type_names[] = {
 [AV_HWDEVICE_TYPE_CUDA]   = "cuda",
+[AV_HWDEVICE_TYPE_DRM]= "drm",
 [AV_HWDEVICE_TYPE_DXVA2]  = "dxva2",
 [AV_HWDEVICE_TYPE_D3D11VA] = "d3d11va",
 [AV_HWDEVICE_TYPE_QSV]= "qsv",
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index afb0d80d59..03334e20e0 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -33,6 +33,7 @@ enum AVHWDeviceType {
 AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
 AV_HWDEVICE_TYPE_NONE,
 AV_HWDEVICE_TYPE_D3D11VA,
+AV_HWDEVICE_TYPE_DRM,
 };
 
 typedef struct AVHWDeviceInternal AVHWDeviceInternal;
diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c
new file mode 100644
index 00..e7be9abd4c
--- /dev/null
+++ b/libavutil/hwcontext_drm.c
@@ -0,0 +1,291 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public