OSDN Git Service

API: add compat glue for older vaCreateSurfaces().
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Jan 2012 16:28:45 +0000 (17:28 +0100)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 5 Jun 2013 01:38:35 +0000 (09:38 +0800)
va/Makefile.am
va/libva.syms [new file with mode: 0644]
va/va_compat.c [new file with mode: 0644]
va/va_compat.h [new file with mode: 0644]

index d6a47a7..59b6c64 100644 (file)
@@ -31,6 +31,7 @@ LDADD = \
 
 libva_source_c = \
        va.c                    \
+       va_compat.c             \
        va_fool.c               \
        va_trace.c              \
        $(NULL)
@@ -40,6 +41,7 @@ libva_source_h = \
        va_backend.h            \
        va_backend_tpi.h        \
        va_backend_vpp.h        \
+       va_compat.h             \
        va_dec_jpeg.h           \
        va_drmcommon.h          \
        va_enc_h264.h           \
@@ -55,12 +57,18 @@ libva_source_h_priv = \
        va_trace.h              \
        $(NULL)
 
+libva_ldflags = \
+       $(LDADD) -no-undefined  \
+       -Wl,-version-script,libva.syms \
+       $(NULL)
+
 lib_LTLIBRARIES                        = libva.la
 libvaincludedir                        = ${includedir}/va
 libvainclude_HEADERS           = $(libva_source_h)
 noinst_HEADERS                 = $(libva_source_h_priv)
 libva_la_SOURCES               = $(libva_source_c)
-libva_la_LDFLAGS               = $(LDADD) -no-undefined
+libva_la_LDFLAGS               = $(libva_ldflags)
+libva_la_DEPENDENCIES          = libva.syms
 libva_la_LIBADD                        = $(LIBVA_LIBS) -ldl
 
 lib_LTLIBRARIES                        += libva-tpi.la
diff --git a/va/libva.syms b/va/libva.syms
new file mode 100644 (file)
index 0000000..b15d546
--- /dev/null
@@ -0,0 +1,11 @@
+VA_API_0.32.0 {
+    local:
+        vaCreateSurfaces_0_32_0;
+};
+
+VA_API_0.33.0 {
+    global:
+        vaCreateSurfaces;
+    local:
+        vaCreateSurfaces_0_33_0;
+} VA_API_0.32.0;
diff --git a/va/va_compat.c b/va/va_compat.c
new file mode 100644 (file)
index 0000000..113591f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define VA_COMPAT_DISABLED 1
+#include "sysdeps.h"
+#include "va.h"
+#include "va_compat.h"
+
+VAStatus
+vaCreateSurfaces_0_32_0(
+    VADisplay    dpy,
+    int          width,
+    int          height,
+    int          format,
+    int          num_surfaces,
+    VASurfaceID *surfaces
+)
+{
+    return vaCreateSurfaces(dpy, format, width, height, surfaces, num_surfaces,
+                            NULL, 0);
+}
+VA_CPP_HELPER_ALIAS(vaCreateSurfaces, 0,32,0);
diff --git a/va/va_compat.h b/va/va_compat.h
new file mode 100644 (file)
index 0000000..41a3f73
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file va_compat.h
+ * \brief The Compatibility API
+ *
+ * This file contains the \ref api_compat "Compatibility API".
+ */
+
+#ifndef VA_COMPAT_H
+#define VA_COMPAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup api_compat Compatibility API
+ *
+ * The Compatibility API allows older programs that are not ported to
+ * the current API to still build and run correctly. In particular,
+ * this exposes older API to allow for backwards source compatibility.
+ *
+ * @{
+ */
+
+/**
+ * Makes a string literal out of the macro argument
+ */
+#define VA_CPP_HELPER_STRINGIFY(x) \
+    VA_CPP_HELPER_STRINGIFY_(x)
+#define VA_CPP_HELPER_STRINGIFY_(x) \
+    #x
+
+/**
+ * Concatenates two macro arguments at preprocessing time.
+ */
+#define VA_CPP_HELPER_CONCAT(a, b) \
+    VA_CPP_HELPER_CONCAT_(a, b)
+#define VA_CPP_HELPER_CONCAT_(a, b) \
+    a ## b
+
+/**
+ * Generates the number of macro arguments at preprocessing time.
+ * <http://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4a3fb/346fc464319b1ee5>
+ *
+ * Note: this doesn't work for macros with no arguments
+ */
+#define VA_CPP_HELPER_N_ARGS(...) \
+    VA_CPP_HELPER_N_ARGS_(__VA_ARGS__, VA_CPP_HELPER_N_ARGS_LIST_REV())
+#define VA_CPP_HELPER_N_ARGS_(...) \
+    VA_CPP_HELPER_N_ARGS_LIST(__VA_ARGS__)
+#define VA_CPP_HELPER_N_ARGS_LIST(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a12, a13, a14, a15, a16, N, ...) N
+#define VA_CPP_HELPER_N_ARGS_LIST_REV() \
+    15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+
+/**
+ * Generates a versioned function alias.
+ *
+ * VA_CPP_HELPER_ALIAS(vaSomeFunction, 0,32,0) will generate
+ *   .symber vaSomeFunction_0_32_0, vaSomeFunction@VA_API_0.32.0
+ */
+#define VA_CPP_HELPER_ALIAS(func, major, minor, micro) \
+    VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@")
+#define VA_CPP_HELPER_ALIAS_DEFAULT(func, major, minor, micro) \
+    VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@@")
+#define VA_CPP_HELPER_ALIAS_(func, major, minor, micro, binding)        \
+    asm(".symver " #func "_" #major "_" #minor "_" #micro ", "          \
+        #func binding "VA_API_" #major "." #minor "." #micro)
+
+/* vaCreateSurfaces() */
+
+#ifndef VA_COMPAT_DISABLED
+#define vaCreateSurfaces(dpy, ...)                                      \
+    VA_CPP_HELPER_CONCAT(vaCreateSurfaces,                              \
+                         VA_CPP_HELPER_N_ARGS(dpy, __VA_ARGS__))        \
+    (dpy, __VA_ARGS__)
+#endif
+
+#define vaCreateSurfaces6(dpy, width, height, format, num_surfaces, surfaces) \
+    (vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
+                       NULL, 0)
+
+#define vaCreateSurfaces8(dpy, format, width, height, surfaces, num_surfaces, attribs, num_attribs) \
+    (vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
+                       attribs, num_attribs)
+
+/*@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_COMPAT_H */