summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-07-08 07:55:42 +0000
committerAustin Yuan <shengquan.yuan@intel.com>2009-07-08 17:06:30 +0800
commitd623e258e7022e776c6c34fae49aac5825c8acb6 (patch)
tree6d5187779516ef21a9be1a8022c16eef1aa9e324
parent2f6ebd9df9140f689b33e9bc1b1cf971a4e94230 (diff)
downloadlibva-d623e258e7022e776c6c34fae49aac5825c8acb6.tar.gz
Add <va_version.h> for versioning helpers.
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
-rw-r--r--configure.ac1
-rw-r--r--dummy_drv_video/dummy_drv_video.c4
-rw-r--r--src/Makefile.am17
-rw-r--r--src/va.c8
-rw-r--r--src/va.h6
-rw-r--r--src/va_version.h.in87
6 files changed, 104 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index a4693bc..041c367 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,6 +118,7 @@ AC_SUBST(LIBVA_DISPLAY)
AC_OUTPUT([
Makefile
src/Makefile
+ src/va_version.h
src/x11/Makefile
dummy_drv_video/Makefile
i965_drv_video/Makefile
diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c
index 6ba6ebd..1eb51a0 100644
--- a/dummy_drv_video/dummy_drv_video.c
+++ b/dummy_drv_video/dummy_drv_video.c
@@ -1218,8 +1218,8 @@ VAStatus __vaDriverInit_0_30( VADriverContextP ctx )
struct dummy_driver_data *driver_data;
int i;
- ctx->version_major = 0;
- ctx->version_minor = 29;
+ ctx->version_major = VA_MAJOR_VERSION;
+ ctx->version_minor = VA_MINOR_VERSION;
ctx->max_profiles = DUMMY_MAX_PROFILES;
ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
diff --git a/src/Makefile.am b/src/Makefile.am
index 413052f..3849e8f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,18 +41,15 @@ libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS
libva_x11_la_LDFLAGS = $(LDADD)
libva_x11_la_DEPENDENCIES = $(libvacorelib)
-nodist_libva_la_SOURCES = va_version.h
-BUILT_SOURCES = va_version.h
-
-CLEANFILES = va_version.h
-
-va_version.h: Makefile
- echo "#define VA_BUILD_DATE \"$(shell date +'%Y%m%d') $(shell date +'1%H%M%S') \"" > va_version.h
- echo "#define VA_BUILD_GIT \"($(shell git log | head -n1 | cut -f2 -d' ')) \" " >> va_version.h
-
SUBDIRS = x11
libva_la_SOURCES = va.c
libvaincludedir = ${includedir}/va
-libvainclude_HEADERS = va.h va_backend.h
+libvainclude_HEADERS = va.h va_backend.h va_version.h
+
+DISTCLEANFILES = \
+ va_version.h
+
+EXTRA_DIST = \
+ va_version.h.in
diff --git a/src/va.c b/src/va.c
index ec5273a..8452304 100644
--- a/src/va.c
+++ b/src/va.c
@@ -26,8 +26,6 @@
#include "va.h"
#include "va_backend.h"
-#include "va_version.h"
-
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
@@ -41,10 +39,6 @@
#include "va_dricommon.h"
-#define VA_STR_VERSION VA_BUILD_DATE VA_BUILD_GIT
-
-#define VA_MAJOR_VERSION 0
-#define VA_MINOR_VERSION 30
#define DRIVER_INIT_FUNC "__vaDriverInit_0_30"
#define DRIVER_EXTENSION "_drv_video.so"
@@ -338,7 +332,7 @@ VAStatus vaInitialize (
va_debug_trace = (getenv("LIBVA_DEBUG_TRACE") != NULL);
- va_infoMessage("libva build on %s\n", VA_STR_VERSION);
+ va_infoMessage("libva version %s\n", VA_VERSION_S);
vaStatus = va_getDriverName(dpy, &driver_name);
va_infoMessage("va_getDriverName() returns %d\n", vaStatus);
diff --git a/src/va.h b/src/va.h
index 5587d97..c947a2c 100644
--- a/src/va.h
+++ b/src/va.h
@@ -63,6 +63,12 @@
#ifndef _VA_H_
#define _VA_H_
+#ifdef IN_LIBVA
+#include "va_version.h"
+#else
+#include <va/va_version.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/va_version.h.in b/src/va_version.h.in
new file mode 100644
index 0000000..c9ea97a
--- /dev/null
+++ b/src/va_version.h.in
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2009 Splitted-Desktop Systems. 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 PRECISION INSIGHT 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.
+ */
+
+#ifndef VA_VERSION_H
+#define VA_VERSION_H
+
+/**
+ * VA_MAJOR_VERSION:
+ *
+ * The major version of the VA library (1, if %VA_VERSION is 1.2.3)
+ */
+#define VA_MAJOR_VERSION (@LIBVA_MAJOR_VERSION@)
+
+/**
+ * VA_MINOR_VERSION:
+ *
+ * The minor version of the VA library (2, if %VA_VERSION is 1.2.3)
+ */
+#define VA_MINOR_VERSION (@LIBVA_MINOR_VERSION@)
+
+/**
+ * VA_MICRO_VERSION:
+ *
+ * The micro version of the VA library (3, if %VA_VERSION is 1.2.3)
+ */
+#define VA_MICRO_VERSION (@LIBVA_MICRO_VERSION@)
+
+/**
+ * VA_VERSION:
+ *
+ * The full version of the VA library, like 1.2.3
+ */
+#define VA_VERSION @LIBVA_VERSION@
+
+/**
+ * VA_VERSION_S:
+ *
+ * The full version of the VA library, in string form (suited for
+ * string concatenation)
+ */
+#define VA_VERSION_S "@LIBVA_VERSION@"
+
+/**
+ * VA_VERSION_HEX:
+ *
+ * Numerically encoded version of the VA library, like 0x010203
+ */
+#define VA_VERSION_HEX ((VA_MAJOR_VERSION << 24) | \
+ (VA_MINOR_VERSION << 16) | \
+ (VA_MICRO_VERSION << 8))
+
+/**
+ * VA_CHECK_VERSION:
+ * @major: major version, like 1 in 1.2.3
+ * @minor: minor version, like 2 in 1.2.3
+ * @micro: micro version, like 3 in 1.2.3
+ *
+ * Evaluates to %TRUE if the version of the VA library is greater
+ * than @major, @minor and @micro
+ */
+#define VA_CHECK_VERSION(major,minor,micro) \
+ (VA_MAJOR_VERSION > (major) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
+ (VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
+
+#endif /* VA_VERSION_H */