2
* gstvaapiutils_glx.h - GLX utilties
4
* Copyright (C) 2010-2011 Splitted-Desktop Systems
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public License
8
* as published by the Free Software Foundation; either version 2.1
9
* of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free
18
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301 USA
22
#ifndef GST_VAAPI_UTILS_GLX_H
23
#define GST_VAAPI_UTILS_GLX_H
29
#include <GL/glxext.h>
30
#include <glib/gtypes.h>
32
#if GLX_GLXEXT_VERSION < 18
33
typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
34
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
37
#if GLX_GLXEXT_VERSION < 27
38
/* XXX: this is not exactly that version but this is the only means to
39
make sure we have the correct <GL/glx.h> with those signatures */
40
typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
41
typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
44
#ifndef GL_FRAMEBUFFER_BINDING
45
#define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
49
gl_get_error_string(GLenum error)
61
gl_get_param(GLenum param, guint *pval)
65
gl_get_texture_param(GLenum target, GLenum param, guint *pval)
69
gl_set_bgcolor(guint32 color)
73
gl_resize(guint width, guint height)
76
typedef struct _GLContextState GLContextState;
77
struct _GLContextState {
82
guint swapped_buffers : 1;
86
gl_create_context(Display *dpy, int screen, GLContextState *parent)
90
gl_destroy_context(GLContextState *cs)
94
gl_get_current_context(GLContextState *cs)
98
gl_set_current_context(GLContextState *new_cs, GLContextState *old_cs)
102
gl_swap_buffers(GLContextState *cs)
105
typedef struct _GLTextureState GLTextureState;
106
struct _GLTextureState {
109
guint was_enabled : 1;
114
gl_bind_texture(GLTextureState *ts, GLenum target, GLuint texture)
118
gl_unbind_texture(GLTextureState *ts)
122
gl_create_texture(GLenum target, GLenum format, guint width, guint height)
125
typedef struct _GLVTable GLVTable;
127
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
128
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
129
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
130
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
131
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;
132
PFNGLDELETEFRAMEBUFFERSEXTPROC gl_delete_framebuffers;
133
PFNGLBINDFRAMEBUFFEREXTPROC gl_bind_framebuffer;
134
PFNGLGENRENDERBUFFERSEXTPROC gl_gen_renderbuffers;
135
PFNGLDELETERENDERBUFFERSEXTPROC gl_delete_renderbuffers;
136
PFNGLBINDRENDERBUFFEREXTPROC gl_bind_renderbuffer;
137
PFNGLRENDERBUFFERSTORAGEEXTPROC gl_renderbuffer_storage;
138
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer;
139
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC gl_framebuffer_texture_2d;
140
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC gl_check_framebuffer_status;
141
PFNGLGENPROGRAMSARBPROC gl_gen_programs;
142
PFNGLDELETEPROGRAMSARBPROC gl_delete_programs;
143
PFNGLBINDPROGRAMARBPROC gl_bind_program;
144
PFNGLPROGRAMSTRINGARBPROC gl_program_string;
145
PFNGLGETPROGRAMIVARBPROC gl_get_program_iv;
146
PFNGLPROGRAMLOCALPARAMETER4FVARBPROC gl_program_local_parameter_4fv;
147
PFNGLACTIVETEXTUREPROC gl_active_texture;
148
PFNGLMULTITEXCOORD2FPROC gl_multi_tex_coord_2f;
149
guint has_texture_from_pixmap : 1;
150
guint has_framebuffer_object : 1;
151
guint has_fragment_program : 1;
152
guint has_multitexture : 1;
159
typedef struct _GLPixmapObject GLPixmapObject;
160
struct _GLPixmapObject {
164
GLTextureState old_texture;
168
GLXPixmap glx_pixmap;
173
gl_create_pixmap_object(Display *dpy, guint width, guint height)
177
gl_destroy_pixmap_object(GLPixmapObject *pixo)
181
gl_bind_pixmap_object(GLPixmapObject *pixo)
185
gl_unbind_pixmap_object(GLPixmapObject *pixo)
188
typedef struct _GLFramebufferObject GLFramebufferObject;
189
struct _GLFramebufferObject {
197
GLFramebufferObject *
198
gl_create_framebuffer_object(
206
gl_destroy_framebuffer_object(GLFramebufferObject *fbo)
210
gl_bind_framebuffer_object(GLFramebufferObject *fbo)
214
gl_unbind_framebuffer_object(GLFramebufferObject *fbo)
217
#endif /* GST_VAAPI_UTILS_GLX_H */