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
|
commit 483bc9e67afa9bcd8f99f08a74a78e7dfad4651f
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Thu Jul 2 09:24:04 2009 +0000
Fix make dist (va_compat_template.h).
commit 0e0da9ea861f14e8129767dbf6f11be5c051d85f
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Date: Wed Jun 24 11:40:56 2009 +0000
Add compatibility layer with original libva 0.29.
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,7 +44,7 @@ libva_x11_la_DEPENDENCIES = $(libvacorelib)
libva_x11_la_DEPENDENCIES = $(libvacorelib)
-libva_la_SOURCES = va.c
+libva_la_SOURCES = va.c va_compat.c
libvaincludedir = ${includedir}/va
libvainclude_HEADERS = va.h va_backend.h va_version.h
@@ -53,4 +53,8 @@ DISTCLEANFILES = \
va_version.h
EXTRA_DIST = \
- va_version.h.in
+ va_version.h.in \
+ va_compat.h \
+ va_compat_template.h
+
+va_compat.c: va_compat_template.h
--- a/src/va.c
+++ b/src/va.c
@@ -25,6 +25,7 @@
#define _GNU_SOURCE 1
#include "va.h"
#include "va_backend.h"
+#include "va_compat.h"
#include <assert.h>
#include <stdarg.h>
@@ -41,6 +42,8 @@
#define DRIVER_INIT_FUNC "__vaDriverInit_0_31"
#define DRIVER_INIT_FUNC_SDS "__vaDriverInit_0_31_sds"
+#define DRIVER_INIT_FUNC_0_29 "__vaDriverInit_0_29"
+#define DRIVER_INIT_FUNC_0_30 "__vaDriverInit_0_30"
#define DRIVER_EXTENSION "_drv_video.so"
@@ -168,11 +171,22 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
else
{
VADriverInit init_func;
- init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC);
+ int compat_version = 0;
+ /* First, try SDS extensions (VDPAU and XvBA backends) */
+ init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_SDS);
if (!init_func)
{
- /* Then try SDS extensions (VDPAU and XvBA backends) */
- init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_SDS);
+ /* Otherwise, we need the compatibility layer for some buffers */
+ init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC);
+ compat_version = VA_MINOR_VERSION;
+ if (!init_func) {
+ init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_0_29);
+ compat_version = 29;
+ }
+ if (!init_func) {
+ init_func = (VADriverInit) dlsym(handle, DRIVER_INIT_FUNC_0_30);
+ compat_version = 30;
+ }
}
if (!init_func)
{
@@ -181,7 +195,36 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
}
else
{
- vaStatus = (*init_func)(ctx);
+ struct VADriverContext_0_29 ctx_0_29;
+ struct VADriverContext_0_30 ctx_0_30;
+ void *compat_ctx = NULL;
+
+ switch (compat_version) {
+ case 29:
+ compat_ctx = &ctx_0_29;
+ ctx_0_29.pDriverData = NULL;
+ ctx_0_29.x11_dpy = ctx->x11_dpy;
+ ctx_0_29.x11_screen = ctx->x11_screen;
+ break;
+ case 30:
+ compat_ctx = &ctx_0_30;
+ ctx_0_30.pDriverData = NULL;
+ ctx_0_30.x11_dpy = ctx->x11_dpy;
+ ctx_0_30.x11_screen = ctx->x11_screen;
+ break;
+ case VA_MINOR_VERSION:
+ compat_ctx = ctx;
+ break;
+ default:
+ ASSERT(compat_version == 0);
+ vaStatus = VA_STATUS_ERROR_UNKNOWN;
+ break;
+ }
+
+ vaStatus = (*init_func)(compat_ctx ? compat_ctx : ctx);
+
+ if (VA_STATUS_SUCCESS == vaStatus)
+ vaStatus = va_compat_init(dpy, compat_version, compat_ctx);
if (VA_STATUS_SUCCESS == vaStatus)
{
@@ -377,6 +422,8 @@ VAStatus vaTerminate (
old_ctx->handle = NULL;
}
+ va_compat_fini(dpy);
+
if (VA_STATUS_SUCCESS == vaStatus)
pDisplayContext->vaDestroy(pDisplayContext);
return vaStatus;
--- a/src/va_backend.h
+++ b/src/va_backend.h
@@ -426,6 +426,7 @@ struct VADriverContext
void *dri_state;
void *glx; /* opaque for GLX code */
+ void *compat; /* opaque for compat code */
};
struct VADisplayContext
|