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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
commit f0b352251894becfcec50de1430bda12c314a464
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Tue Sep 22 13:00:34 2009 +0000
Fix libva-glx pkgconfig dependencies.
commit df0953a951d8a2e5e4b0a28a95ae0f1ac735726e
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Tue Sep 8 12:25:14 2009 +0000
Add generic VA/GLX implementation with TFP and FBO.
commit f640b1cf9eab4e5d478239b608ed0d8b68f6c5f6
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Tue Sep 8 12:15:35 2009 +0000
Move GLX VTable to a new file.
commit 70d9cb6d1aa2fc2dde6646f3b692433e0d93d431
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Fri Aug 28 11:15:51 2009 +0000
Add OpenGL extensions (v3).
diff --git a/Makefile.am b/Makefile.am
index 07385e6..6fb4cae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,10 +32,13 @@ endif
pcfiles = libva.pc
pcfiles += libva-x11.pc
+if USE_GLX
+pcfiles += libva-glx.pc
+endif
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = $(pcfiles)
-EXTRA_DIST = libva.pc.in libva-x11.pc.in
+EXTRA_DIST = libva.pc.in libva-x11.pc.in libva-glx.pc.in
CLEANFILES = $(pcfiles)
diff --git a/configure.ac b/configure.ac
index c3aba90..abef435 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +55,11 @@ AC_SUBST(LIBVA_MINOR_VERSION)
AC_SUBST(LIBVA_LT_VERSION)
AC_SUBST(LIBVA_LT_LDFLAGS)
+AC_ARG_ENABLE(glx,
+ [AC_HELP_STRING([--enable-glx],
+ [build with OpenGL for X11 support])],
+ [], [enable_glx=yes])
+
AC_ARG_ENABLE(dummy-driver,
[AC_HELP_STRING([--enable-dummy-driver],
[build dummy video driver])],
@@ -100,6 +132,23 @@ if test x$enable_i965_driver = xyes && ! $PKG_CONFIG --atleast-version=2.4 libdr
AC_DEFINE_UNQUOTED([ATTRIBUTE_HIDDEN], [$ATTRIBUTE_HIDDEN],
[Defined to __attribute__((visibility("hidden"))) when available])
+# Check for OpenGL (X11)
+USE_GLX="no"
+GL_DEPS_CFLAGS=""
+GL_DEPS_LIBS=""
+
+if test x$enable_glx = xyes; then
+ AC_CHECK_HEADERS([GL/gl.h])
+ AC_CHECK_HEADERS([GL/glx.h])
+ AC_CHECK_LIB(GL, glXCreateContext, [
+ USE_GLX="yes"
+ GL_DEPS_LIBS="-lX11 -lGL"
+ ])
+fi
+AC_SUBST(GL_DEPS_CFLAGS)
+AC_SUBST(GL_DEPS_LIBS)
+AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
+
# We only need the headers, we don't link against the DRM libraries
LIBVA_CFLAGS="$DRM_CFLAGS"
AC_SUBST(LIBVA_CFLAGS)
@@ -119,6 +192,7 @@ AC_OUTPUT([
src/Makefile
src/va_version.h
src/x11/Makefile
+ src/glx/Makefile
dummy_drv_video/Makefile
i965_drv_video/Makefile
i965_drv_video/shaders/Makefile
@@ -128,5 +202,6 @@ AC_OUTPUT([
test/Makefile
libva.pc
libva-x11.pc
+ libva-glx.pc
])
diff --git a/libva-glx.pc.in b/libva-glx.pc.in
new file mode 100644
index 0000000..20ba20a
--- /dev/null
+++ b/libva-glx.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+display=glx
+
+Name: libva-${display}
+Description: Userspace Video Acceleration (VA) ${display} interface
+Requires: libva
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lva-${display}
+Cflags: -I${includedir}
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f4210a..e50a15f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,9 +28,17 @@ INCLUDES = \
LDADD = \
$(LIBVA_LT_LDFLAGS)
-lib_LTLIBRARIES = \
- libva.la \
- libva-x11.la
+libva_x11_backend = libva-x11.la
+libva_x11_backenddir = x11
+if USE_GLX
+libva_glx_backend = libva-glx.la
+libva_glx_backenddir = glx
+else
+libva_glx_backend =
+libva_glx_backenddir =
+endif
+
+lib_LTLIBRARIES = libva.la $(libva_x11_backend) $(libva_glx_backend)
libva_ladir = $(libdir)
libva_la_LDFLAGS = $(LDADD) -no-undefined
@@ -41,7 +49,14 @@ libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS
libva_x11_la_LDFLAGS = $(LDADD)
libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la
-SUBDIRS = x11
+libva_glx_la_SOURCES =
+libva_glx_la_LIBADD = $(libvacorelib) glx/libva_glx.la libva-x11.la $(GL_DEPS_LIBS) -ldl
+libva_glx_la_LDFLAGS = $(LDADD)
+libva_glx_la_DEPENDENCIES = $(libvacorelib) glx/libva_glx.la libva-x11.la
+
+SUBDIRS = $(libva_x11_backenddir) $(libva_glx_backenddir)
+
+DIST_SUBDIRS = x11 glx
libva_la_SOURCES = va.c
diff --git a/src/va_backend.h b/src/va_backend.h
index 6f858f5..8f722a3 100644
--- a/src/va_backend.h
+++ b/src/va_backend.h
@@ -32,9 +32,11 @@
#ifdef IN_LIBVA
#include "va.h"
#include "x11/va_x11.h"
+#include "glx/va_backend_glx.h"
#else
#include <va/va.h>
#include <va/va_x11.h>
+#include <va/va_backend_glx.h>
#endif
#include <stdlib.h>
@@ -372,6 +374,9 @@ struct VADriverVTable
unsigned int *chroma_v_offset,
void **buffer
);
+
+ /* Optional: GLX support hooks */
+ struct VADriverVTableGLX glx;
};
struct VADriverContext
@@ -394,6 +399,7 @@ struct VADriverContext
void *handle; /* dlopen handle */
void *dri_state;
+ void *glx; /* opaque for GLX code */
};
struct VADisplayContext
@@ -413,6 +420,8 @@ struct VADisplayContext
VADisplayContextP ctx,
char **driver_name
);
+
+ void *opaque; /* opaque for display extensions (e.g. GLX) */
};
typedef VAStatus (*VADriverInit) (
diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
index 9de904e..b8c60fa 100644
--- a/src/x11/va_x11.c
+++ b/src/x11/va_x11.c
@@ -243,6 +243,7 @@ VADisplay vaGetDisplay (
pDisplayContext->vaIsValid = va_DisplayContextIsValid;
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
+ pDisplayContext->opaque = NULL;
pDisplayContexts = pDisplayContext;
pDriverContext->dri_state = dri_state;
dpy = (VADisplay)pDisplayContext;
|