forked from linux-sunxi/libvdpau-sunxi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nv_interop.h
157 lines (139 loc) · 3.99 KB
/
nv_interop.h
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
* Copyright (c) 2016 Andreas Baierl <[email protected]>
*
* This library 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.
*
* This library 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 this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __NV_INTEROP_H__
#define __NV_INTEROP_H__
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglplatform.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <ump/ump.h>
#include <ump/ump_ref_drv.h>
#include <cedrus/cedrus.h>
#define MAX_NUM_TEXTURES 4
#define USE_TILE 0
/* GLES interop */
#define SURFACE_STATE_NV 0x86EB
#define SURFACE_REGISTERED_NV 0x86FD
#define SURFACE_MAPPED_NV 0x8700
#define READ_ONLY 0x88B8
#define READ_WRITE 0x88BA
#define WRITE_DISCARD_NV 0x88BE
#define VDP_FUNC_ID_Init_NV (VdpFuncId)100
#define VDP_FUNC_ID_Fini_NV (VdpFuncId)101
#define VDP_FUNC_ID_RegisterVideoSurface_NV (VdpFuncId)102
#define VDP_FUNC_ID_RegisterOutputSurface_NV (VdpFuncId)103
#define VDP_FUNC_ID_IsSurface_NV (VdpFuncId)104
#define VDP_FUNC_ID_UnregisterSurface_NV (VdpFuncId)105
#define VDP_FUNC_ID_GetSurfaceiv_NV (VdpFuncId)106
#define VDP_FUNC_ID_SurfaceAccess_NV (VdpFuncId)107
#define VDP_FUNC_ID_MapSurfaces_NV (VdpFuncId)108
#define VDP_FUNC_ID_UnmapSurfaces_NV (VdpFuncId)109
#ifdef __cplusplus
extern "C" {
#endif
/* FBDEV */
typedef enum
{
FBDEV_PIXMAP_SUPPORTS_UMP = (1 << 0)
} fbdev_pixmap_flags;
typedef struct fbdev_pixmap
{
unsigned int height;
unsigned int width;
unsigned int bytes_per_pixel;
unsigned char buffer_size;
unsigned char red_size;
unsigned char green_size;
unsigned char blue_size;
unsigned char alpha_size;
unsigned char luminance_size;
fbdev_pixmap_flags flags;
unsigned short *data;
unsigned int format;
} fbdev_pixmap;
typedef GLintptr vdpauSurfaceNV;
enum VdpauNVState
{
NV_UNREGISTERED = 0,
NV_REGISTERED,
NV_MAPPED
};
enum VdpauNVAccess
{
NV_READ_ONLY = 1,
NV_READ_WRITE,
NV_WRITE_DISCARD_NV
};
enum VdpauNVSurfaceType
{
NV_SURFACE_RGBA = 0,
NV_SURFACE_VIDEO
};
enum color_plane
{
y_plane,
uv_plane,
argb_plane
};
typedef struct
{
enum VdpauNVState state;
enum VdpauNVSurfaceType type;
enum VdpauNVAccess access;
void *vdpsurface;
uint32_t target;
GLsizei numTextureNames;
uint textureNames[MAX_NUM_TEXTURES];
struct fbdev_pixmap pixmap[MAX_NUM_TEXTURES];
EGLImageKHR eglImage[MAX_NUM_TEXTURES];
uint32_t conv_width, conv_height;
cedrus_mem_t *yuvY;
cedrus_mem_t *yuvUV;
} nv_surface_ctx_t;
void glVDPAUInitNV(const void *vdpDevice,
const void *getProcAddress,
EGLContext shared_context,
EGLDisplay shared_display);
void glVDPAUFiniNV(void);
vdpauSurfaceNV glVDPAURegisterVideoSurfaceNV(const void *vdpSurface,
uint32_t target,
GLsizei numTextureNames,
const uint *textureNames);
vdpauSurfaceNV glVDPAURegisterOutputSurfaceNV(const void *vdpSurface,
uint32_t target,
GLsizei numTextureNames,
const uint *textureNames);
int glVDPAUIsSurfaceNV(vdpauSurfaceNV surface);
void glVDPAUUnregisterSurfaceNV(vdpauSurfaceNV surface);
void glVDPAUGetSurfaceivNV(vdpauSurfaceNV surface,
uint32_t pname,
GLsizei bufSize,
GLsizei *length,
int *values);
void glVDPAUSurfaceAccessNV(vdpauSurfaceNV surface,
uint32_t access);
void glVDPAUMapSurfacesNV(GLsizei numSurfaces,
const vdpauSurfaceNV *surfaces);
void glVDPAUUnmapSurfacesNV(GLsizei numSurfaces,
const vdpauSurfaceNV *surfaces);
#ifdef __cplusplus
}
#endif
#endif