mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
144 lines
4.7 KiB
Diff
144 lines
4.7 KiB
Diff
commit 94db34ae392a7787afac9087799bb0421c844b83
|
|
Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
|
|
Date: Wed Jun 24 11:40:56 2009 +0000
|
|
|
|
Add compatibility layer with original VA-API 0.29 to 0.31.
|
|
|
|
diff --git a/va/Makefile.am b/va/Makefile.am
|
|
index ebff3d5..1752526 100644
|
|
--- a/va/Makefile.am
|
|
+++ b/va/Makefile.am
|
|
@@ -57,7 +57,7 @@ SUBDIRS = $(libva_x11_backenddir) $(libva_glx_backenddir)
|
|
|
|
DIST_SUBDIRS = x11 glx
|
|
|
|
-libva_la_SOURCES = va.c va_crystalhd.c
|
|
+libva_la_SOURCES = va.c va_crystalhd.c va_compat.c
|
|
|
|
libvaincludedir = ${includedir}/va
|
|
libvainclude_HEADERS = va.h va_x11.h va_backend.h va_version.h
|
|
@@ -67,4 +67,8 @@ DISTCLEANFILES = \
|
|
|
|
EXTRA_DIST = \
|
|
va_version.h.in \
|
|
- va_crystalhd.h
|
|
+ va_crystalhd.h \
|
|
+ va_compat.h \
|
|
+ va_compat_template.h
|
|
+
|
|
+va_compat.c: va_compat_template.h
|
|
diff --git a/va/va.c b/va/va.c
|
|
index 0d208d8..ad201fa 100644
|
|
--- a/va/va.c
|
|
+++ b/va/va.c
|
|
@@ -28,6 +28,7 @@
|
|
#include "va.h"
|
|
#include "va_backend.h"
|
|
#include "va_crystalhd.h"
|
|
+#include "va_compat.h"
|
|
|
|
#include <assert.h>
|
|
#include <stdarg.h>
|
|
@@ -39,6 +40,8 @@
|
|
|
|
|
|
#define DRIVER_INIT_FUNC "__vaDriverInit_0_31"
|
|
+#define DRIVER_INIT_FUNC_0_29 "__vaDriverInit_0_29"
|
|
+#define DRIVER_INIT_FUNC_0_30 "__vaDriverInit_0_30"
|
|
|
|
#define DRIVER_EXTENSION "_drv_video.so"
|
|
|
|
@@ -163,13 +166,24 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
|
|
{
|
|
VADriverInit init_func;
|
|
char driver_init_func_sds[32];
|
|
+ int compat_version = 0;
|
|
/* First, try SDS extensions (VDPAU and XvBA backends) */
|
|
sprintf(driver_init_func_sds, "%s_%d_sds%d",
|
|
DRIVER_INIT_FUNC, VA_MICRO_VERSION, VA_SDS_VERSION);
|
|
init_func = (VADriverInit) dlsym(handle, driver_init_func_sds);
|
|
if (!init_func)
|
|
{
|
|
+ /* 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)
|
|
{
|
|
@@ -178,7 +192,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)
|
|
{
|
|
@@ -399,6 +442,8 @@ VAStatus vaTerminate (
|
|
old_ctx->handle = NULL;
|
|
}
|
|
|
|
+ va_compat_fini(dpy);
|
|
+
|
|
if (VA_STATUS_SUCCESS == vaStatus)
|
|
pDisplayContext->vaDestroy(pDisplayContext);
|
|
return vaStatus;
|
|
diff --git a/va/va_backend.h b/va/va_backend.h
|
|
index 06fef7f..9cf8911 100644
|
|
--- a/va/va_backend.h
|
|
+++ b/va/va_backend.h
|
|
@@ -391,6 +391,7 @@ struct VADriverContext
|
|
|
|
void *dri_state;
|
|
void *glx; /* opaque for GLX code */
|
|
+ void *compat; /* opaque for compat code */
|
|
};
|
|
|
|
#define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
|
|
diff --git a/va/va_compat.c b/va/va_compat.c
|
|
new file mode 100644
|
|
index 0000000..af43188
|
|
diff --git a/va/va_compat.h b/va/va_compat.h
|
|
new file mode 100644
|
|
index 0000000..2c9d801
|
|
diff --git a/va/va_compat_template.h b/va/va_compat_template.h
|
|
new file mode 100644
|
|
index 0000000..18349de
|