hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 3396f052277c2e85222011fb633a3d7634d25c1a Mon Sep 17 00:00:00 2001
From: Francis Fan <francis.fan@rock-chips.com>
Date: Tue, 2 Jul 2019 20:48:29 +0800
Subject: [PATCH 10/11] add ion type for hwcontext table
 
Change-Id: I609145796477221df5daa79f2a4771718c34794f
Signed-off-by: Francis Fan <francis.fan@rock-chips.com>
---
 libavutil/hwcontext.c     |  3 +++
 libavutil/hwcontext_ion.h | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 libavutil/hwcontext_ion.h
 
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index f1e404a..6caa742 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -27,6 +27,7 @@
 #include "mem.h"
 #include "pixdesc.h"
 #include "pixfmt.h"
+#include "hwcontext_ion.h"
 
 static const HWContextType * const hw_table[] = {
 #if CONFIG_CUDA
@@ -37,6 +38,8 @@ static const HWContextType * const hw_table[] = {
 #endif
 #if CONFIG_LIBDRM
     &ff_hwcontext_type_drm,
+#elif CONFIG_ION
+    &ff_hwcontext_type_ion,
 #endif
 #if CONFIG_DXVA2
     &ff_hwcontext_type_dxva2,
diff --git a/libavutil/hwcontext_ion.h b/libavutil/hwcontext_ion.h
new file mode 100644
index 0000000..5a5d98f
--- /dev/null
+++ b/libavutil/hwcontext_ion.h
@@ -0,0 +1,37 @@
+/*
+ * 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_HWCONTEXT_ION_H
+#define AVUTIL_HWCONTEXT_ION_H
+
+#include "hwcontext_internal.h"
+#include "pixfmt.h"
+
+const HWContextType ff_hwcontext_type_ion = {
+    .type                   = AV_HWDEVICE_TYPE_DRM,
+    .name                   = "ION",
+
+    .device_hwctx_size      = sizeof(int),
+
+    .pix_fmts = (const enum AVPixelFormat[]) {
+        AV_PIX_FMT_DRM_PRIME,
+        AV_PIX_FMT_NONE
+    },
+};
+
+#endif /* AVUTIL_HWCONTEXT_ION_H */
-- 
2.7.4