FFmpeg
Loading...
Searching...
No Matches
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#ifndef DRM_FORMAT_VUY888
51#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4')
52#endif
53
54/* ARM AFBC (16x16) */
55#ifndef DRM_FORMAT_MOD_VENDOR_ARM
56#define DRM_FORMAT_MOD_VENDOR_ARM 0x08
57#endif
58#ifndef DRM_FORMAT_MOD_ARM_TYPE_AFBC
59#define DRM_FORMAT_MOD_ARM_TYPE_AFBC 0x00
60#endif
61#ifndef AFBC_FORMAT_MOD_BLOCK_SIZE_16x16
62#define AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 (1ULL)
63#endif
64#ifndef AFBC_FORMAT_MOD_SPARSE
65#define AFBC_FORMAT_MOD_SPARSE (1ULL << 6)
66#endif
67
68#define drm_is_afbc(mod) \
69 ((mod >> 52) == (DRM_FORMAT_MOD_ARM_TYPE_AFBC | \
70 (DRM_FORMAT_MOD_VENDOR_ARM << 4)))
71
72/* Rockchip RFBC (64x4) */
73#undef DRM_FORMAT_MOD_VENDOR_ROCKCHIP
74#define DRM_FORMAT_MOD_VENDOR_ROCKCHIP 0x0b
75#undef DRM_FORMAT_MOD_ROCKCHIP_TYPE_SHIFT
76#define DRM_FORMAT_MOD_ROCKCHIP_TYPE_SHIFT 52
77#undef DRM_FORMAT_MOD_ROCKCHIP_TYPE_MASK
78#define DRM_FORMAT_MOD_ROCKCHIP_TYPE_MASK 0xf
79#undef DRM_FORMAT_MOD_ROCKCHIP_TYPE_RFBC
80#define DRM_FORMAT_MOD_ROCKCHIP_TYPE_RFBC 0x1
81#undef ROCKCHIP_RFBC_BLOCK_SIZE_64x4
82#define ROCKCHIP_RFBC_BLOCK_SIZE_64x4 (1ULL)
83
84#undef fourcc_mod_code
85#define fourcc_mod_code(vendor, val) \
86 ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
87
88#undef DRM_FORMAT_MOD_ROCKCHIP_CODE
89#define DRM_FORMAT_MOD_ROCKCHIP_CODE(__type, __val) \
90 fourcc_mod_code(ROCKCHIP, ((__u64)(__type) << DRM_FORMAT_MOD_ROCKCHIP_TYPE_SHIFT) | \
91 ((__val) & 0x000fffffffffffffULL))
92
93#undef DRM_FORMAT_MOD_ROCKCHIP_RFBC
94#define DRM_FORMAT_MOD_ROCKCHIP_RFBC(mode) \
95 DRM_FORMAT_MOD_ROCKCHIP_CODE(DRM_FORMAT_MOD_ROCKCHIP_TYPE_RFBC, mode)
96
97#define drm_is_rfbc(mod) \
98 (((mod >> 56) & 0xff) == DRM_FORMAT_MOD_VENDOR_ROCKCHIP) && \
99 (((mod >> 52) & DRM_FORMAT_MOD_ROCKCHIP_TYPE_MASK) == DRM_FORMAT_MOD_ROCKCHIP_TYPE_RFBC)
100
101/**
102 * DRM Prime Frame descriptor for RKMPP HWDevice.
103 */
105 /**
106 * Backwards compatibility with AVDRMFrameDescriptor.
107 */
109
110 /**
111 * References to MppBuffer instances which are used
112 * on each drm frame index.
113 */
116
117/**
118 * RKMPP-specific data associated with a frame pool.
119 *
120 * Allocated as AVHWFramesContext.hwctx.
121 */
122typedef struct AVRKMPPFramesContext {
123 /**
124 * MPP buffer group.
125 */
126 MppBufferGroup buf_group;
127 /**
128 * MPP buffer allocation flags at frames context level.
129 */
130 int flags;
131
132 /**
133 * The descriptors of all frames in the pool after creation.
134 * Only valid if AVHWFramesContext.initial_pool_size was positive.
135 * These are intended to be used as the buffer of RKMPP decoder.
136 */
140
141/**
142 * RKMPP device details.
143 *
144 * Allocated as AVHWDeviceContext.hwctx
145 */
146typedef struct AVRKMPPDeviceContext {
147 /**
148 * MPP buffer allocation flags at device context level.
149 */
150 int flags;
152
153#endif /* AVUTIL_HWCONTEXT_RKMPP_H */
API-specific header for AV_HWDEVICE_TYPE_DRM.
@ AV_DRM_MAX_PLANES
The maximum number of layers/planes in a DRM frame.
DRM frame descriptor.
DRM Prime Frame descriptor for RKMPP HWDevice.
AVDRMFrameDescriptor drm_desc
Backwards compatibility with AVDRMFrameDescriptor.
MppBuffer buffers[AV_DRM_MAX_PLANES]
References to MppBuffer instances which are used on each drm frame index.
RKMPP device details.
int flags
MPP buffer allocation flags at device context level.
RKMPP-specific data associated with a frame pool.
AVRKMPPDRMFrameDescriptor * frames
The descriptors of all frames in the pool after creation.
int flags
MPP buffer allocation flags at frames context level.
MppBufferGroup buf_group
MPP buffer group.