From: Gwenole Beauchesne Date: Wed, 8 Jul 2009 07:55:42 +0000 (+0000) Subject: Add for versioning helpers. X-Git-Tag: 20091130_Alpha4~46^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e118290c1055891339fd7b0591f0e9f47c839d5;p=platform%2Fupstream%2Flibva.git Add for versioning helpers. Signed-off-by: Austin Yuan --- diff --git a/configure.ac b/configure.ac index db1c0cb..b6f7923 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,7 @@ AC_SUBST([libvabackendlib]) 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 26671d3..5fac8b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,18 +33,15 @@ libva_ladir = $(libdir) libva_la_LDFLAGS = $(LDADD) -no-undefined libva_la_LIBADD = $(LIBVA_LIBS) -ldl -lX11 -lXext x11/libva_x11.la -ldrm -lXfixes -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 cbba8f8..d7afedc 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 #include #include @@ -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" @@ -334,7 +328,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 4218d35..a52895c 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 +#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 */