1 /*
2  * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef VA_GLX_PRIVATE_H
26 #define VA_GLX_PRIVATE_H
27 
28 #include "sysdeps.h"
29 #include "va.h"
30 #include "va_backend.h"
31 #include "va_x11.h"
32 #include "va_glx.h"
33 #include "va_backend_glx.h"
34 #include <GL/glxext.h>
35 
36 #if GLX_GLXEXT_VERSION < 18
37 typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
38 typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
39 #endif
40 
41 #if GLX_GLXEXT_VERSION < 27
42 /* XXX: this is not exactly that version but this is the only means to
43    make sure we have the correct <GL/glx.h> with those signatures */
44 typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
45 typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
46 #endif
47 
48 typedef struct VAOpenGLVTable *VAOpenGLVTableP;
49 
50 struct VAOpenGLVTable {
51     PFNGLXCREATEPIXMAPPROC              glx_create_pixmap;
52     PFNGLXDESTROYPIXMAPPROC             glx_destroy_pixmap;
53     PFNGLXBINDTEXIMAGEEXTPROC           glx_bind_tex_image;
54     PFNGLXRELEASETEXIMAGEEXTPROC        glx_release_tex_image;
55     PFNGLGENFRAMEBUFFERSEXTPROC         gl_gen_framebuffers;
56     PFNGLDELETEFRAMEBUFFERSEXTPROC      gl_delete_framebuffers;
57     PFNGLBINDFRAMEBUFFEREXTPROC         gl_bind_framebuffer;
58     PFNGLGENRENDERBUFFERSEXTPROC        gl_gen_renderbuffers;
59     PFNGLDELETERENDERBUFFERSEXTPROC     gl_delete_renderbuffers;
60     PFNGLBINDRENDERBUFFEREXTPROC        gl_bind_renderbuffer;
61     PFNGLRENDERBUFFERSTORAGEEXTPROC     gl_renderbuffer_storage;
62     PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer;
63     PFNGLFRAMEBUFFERTEXTURE2DEXTPROC    gl_framebuffer_texture_2d;
64     PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC  gl_check_framebuffer_status;
65 };
66 
67 typedef struct VADisplayContextGLX *VADisplayContextGLXP;
68 typedef struct VADriverContextGLX  *VADriverContextGLXP;
69 typedef struct VASurfaceGLX        *VASurfaceGLXP;
70 typedef struct VADriverVTableGLX   *VADriverVTableGLXP;
71 
72 typedef void (*vaDestroyFunc)(VADisplayContextP);
73 
74 struct VADisplayContextGLX {
75     vaDestroyFunc vaDestroy;
76 };
77 
78 #define VA_DRIVER_CONTEXT_GLX(ctx) ((VADriverContextGLXP)((ctx)->glx))
79 
80 struct VADriverContextGLX {
81     struct VADriverVTableGLX    vtable;
82     struct VAOpenGLVTable       gl_vtable;
83     unsigned int                is_initialized  : 1;
84 };
85 
86 #endif /* VA_GLX_PRIVATE_H */
87