FFmpeg  4.2.2
hwcontext_rkmpp.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVUTIL_HWCONTEXT_RKMPP_H
20 #define AVUTIL_HWCONTEXT_RKMPP_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 #include <drm_fourcc.h>
25 #include <rockchip/rk_mpi.h>
26 
27 #include "hwcontext_drm.h"
28 
29 #ifndef DRM_FORMAT_P010
30 #define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')
31 #endif
32 #ifndef DRM_FORMAT_P210
33 #define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0')
34 #endif
35 #ifndef DRM_FORMAT_NV15
36 #define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5')
37 #endif
38 #ifndef DRM_FORMAT_NV20
39 #define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0')
40 #endif
41 #ifndef DRM_FORMAT_YUV420_8BIT
42 #define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8')
43 #endif
44 #ifndef DRM_FORMAT_YUV420_10BIT
45 #define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0')
46 #endif
47 #ifndef DRM_FORMAT_Y210
48 #define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0')
49 #endif
50 
51 #ifndef DRM_FORMAT_MOD_VENDOR_ARM
52 #define DRM_FORMAT_MOD_VENDOR_ARM 0x08
53 #endif
54 #ifndef DRM_FORMAT_MOD_ARM_TYPE_AFBC
55 #define DRM_FORMAT_MOD_ARM_TYPE_AFBC 0x00
56 #endif
57 
58 #define drm_is_afbc(mod) \
59  ((mod >> 52) == (DRM_FORMAT_MOD_ARM_TYPE_AFBC | \
60  (DRM_FORMAT_MOD_VENDOR_ARM << 4)))
61 
62 /**
63  * DRM Prime Frame descriptor for RKMPP HWDevice.
64  */
65 typedef struct AVRKMPPDRMFrameDescriptor {
66  /**
67  * Backwards compatibility with AVDRMFrameDescriptor.
68  */
70 
71  /**
72  * References to MppBuffer instances which are used
73  * on each drm frame index.
74  */
77 
78 /**
79  * RKMPP-specific data associated with a frame pool.
80  *
81  * Allocated as AVHWFramesContext.hwctx.
82  */
83 typedef struct AVRKMPPFramesContext {
84  /**
85  * MPP buffer group.
86  */
87  MppBufferGroup buf_group;
88 
89  /**
90  * The descriptors of all frames in the pool after creation.
91  * Only valid if AVHWFramesContext.initial_pool_size was positive.
92  * These are intended to be used as the buffer of RKMPP decoder.
93  */
95  int nb_frames;
97 
98 /**
99  * RKMPP device details.
100  *
101  * Allocated as AVHWDeviceContext.hwctx
102  */
103 typedef struct AVRKMPPDeviceContext {
104  /**
105  * MPP buffer allocation flags.
106  */
107  int flags;
109 
110 #endif /* AVUTIL_HWCONTEXT_RKMPP_H */
AVRKMPPDeviceContext
RKMPP device details.
Definition: hwcontext_rkmpp.h:103
AVDRMFrameDescriptor
DRM frame descriptor.
Definition: hwcontext_drm.h:133
AVRKMPPFramesContext::frames
AVRKMPPDRMFrameDescriptor * frames
The descriptors of all frames in the pool after creation.
Definition: hwcontext_rkmpp.h:94
AVRKMPPFramesContext::buf_group
MppBufferGroup buf_group
MPP buffer group.
Definition: hwcontext_rkmpp.h:87
AVRKMPPDRMFrameDescriptor::buffers
MppBuffer buffers[AV_DRM_MAX_PLANES]
References to MppBuffer instances which are used on each drm frame index.
Definition: hwcontext_rkmpp.h:75
AVRKMPPDRMFrameDescriptor::drm_desc
AVDRMFrameDescriptor drm_desc
Backwards compatibility with AVDRMFrameDescriptor.
Definition: hwcontext_rkmpp.h:69
AVRKMPPFramesContext
RKMPP-specific data associated with a frame pool.
Definition: hwcontext_rkmpp.h:83
AVRKMPPFramesContext::nb_frames
int nb_frames
Definition: hwcontext_rkmpp.h:95
hwcontext_drm.h
AVRKMPPDeviceContext::flags
int flags
MPP buffer allocation flags.
Definition: hwcontext_rkmpp.h:107
AV_DRM_MAX_PLANES
@ AV_DRM_MAX_PLANES
The maximum number of layers/planes in a DRM frame.
Definition: hwcontext_drm.h:39
AVRKMPPDRMFrameDescriptor
DRM Prime Frame descriptor for RKMPP HWDevice.
Definition: hwcontext_rkmpp.h:65