[Libva] [PATCH 2/2] i965_drv_video: add git commit id to VA driver version string.

Gwenole Beauchesne gb.devel at gmail.com
Tue Sep 2 01:13:44 PDT 2014


Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 configure.ac              |    5 +++++
 src/Makefile.am           |   39 +++++++++++++++++++++++++++++++++++++--
 src/i965_drv_version.h.in |   36 ++++++++++++++++++++++++++++++++++++
 src/i965_drv_video.c      |    7 +++++++
 4 files changed, 85 insertions(+), 2 deletions(-)
 create mode 100644 src/i965_drv_version.h.in

diff --git a/configure.ac b/configure.ac
index 1c7583f..913ba55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,6 +81,11 @@ AC_PATH_PROG([GEN4ASM], [intel-gen4asm])
 AS_IF([test "x$GEN4ASM" = "x" ], [AM_CONDITIONAL(HAVE_GEN4ASM, false)],
     [AM_CONDITIONAL(HAVE_GEN4ASM, [test x$gen4asm = xyes])])
 
+dnl Check for git
+AC_ARG_VAR([GIT], [Path to git program, if any])
+AC_PATH_PROG([GIT], [git])
+AM_CONDITIONAL([HAVE_GIT], [test -n "$GIT"])
+
 dnl Check for VA-API
 PKG_CHECK_MODULES(LIBVA_DEPS,     [libva >= va_api_version])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 2d92f4d..999d7e4 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,10 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-SUBDIRS = shaders
+SUBDIRS		= shaders
+DIST_SUBDIRS	= $(SUBDIRS)
+EXTRA_DIST	=
+BUILT_SOURCES	=
 
 AM_CPPFLAGS = \
 	-DPTHREADS		\
@@ -102,6 +105,7 @@ source_h = \
 	i965_decoder.h		\
 	i965_decoder_utils.h	\
 	i965_defines.h          \
+	i965_drv_version.h	\
 	i965_drv_video.h        \
 	i965_encoder.h		\
 	i965_encoder_utils.h	\
@@ -145,11 +149,42 @@ source_h			+= i965_output_wayland.h
 driver_cflags			+= $(WAYLAND_CFLAGS)
 endif
 
+# git version
+VERSION_FILE			= .VERSION
+OLD_VERSION_FILE		= $(VERSION_FILE).old
+NEW_VERSION_FILE		= $(VERSION_FILE).new
+PKG_VERSION_FILE		= $(VERSION_FILE).pkg
+
+i965_drv_version.h: gen-version
+	$(AM_V_GEN)							    \
+	OV=`[ -f $(OLD_VERSION_FILE) ] && cat $(OLD_VERSION_FILE) || :`;    \
+	NV=`cat $(NEW_VERSION_FILE)`;					    \
+	if [ "$$OV" != "$$NV" -o ! -f i965_drv_version.h ]; then	    \
+		cp -f $(NEW_VERSION_FILE) $(OLD_VERSION_FILE);		    \
+		$(SED) -e "s|\@I965_DRV_VERSION_ID\@|$${NV}|"		    \
+			$(srcdir)/i965_drv_version.h.in > i965_drv_version.h; \
+	fi
+
+gen-version:
+	@echo $(VERSION) > $(NEW_VERSION_FILE)
+if HAVE_GIT
+	@[ -d $(top_srcdir)/.git ] && \
+	(cd $(top_srcdir) && $(GIT) describe --tags) > $(NEW_VERSION_FILE) || :
+endif
+	@[ -f $(srcdir)/$(PKG_VERSION_FILE) ] && \
+	cp -f $(srcdir)/$(PKG_VERSION_FILE) $(NEW_VERSION_FILE) || :
+
+$(PKG_VERSION_FILE): $(NEW_VERSION_FILE)
+	@cp -f $< $@
+
+BUILT_SOURCES	+= i965_drv_version.h
+EXTRA_DIST	+= i965_drv_version.h.in $(PKG_VERSION_FILE)
+
 # Wayland protocol
 i965_output_wayland.c: $(protocol_source_h)
 @wayland_scanner_rules@
 
-DIST_SUBDIRS = $(SUBDIRS) wayland
+DIST_SUBDIRS	+= wayland
 
 # Extra clean files so that maintainer-clean removes *everything*
 MAINTAINERCLEANFILES = Makefile.in config.h.in
diff --git a/src/i965_drv_version.h.in b/src/i965_drv_version.h.in
new file mode 100644
index 0000000..586ba54
--- /dev/null
+++ b/src/i965_drv_version.h.in
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * 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 I965_DRV_VERSION_H
+#define I965_DRV_VERSION_H
+
+/**
+ * I965_DRV_VERSION_ID:
+ *
+ * The full version identifier of libva-intel-driver, in string form
+ * (suitable for string concatenation).
+ */
+#define I965_DRV_VERSION_ID "@I965_DRV_VERSION_ID@"
+
+#endif /* I965_DRV_VERSION_H */
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 811f886..f606acf 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -43,6 +43,7 @@
 #include "intel_batchbuffer.h"
 #include "i965_defines.h"
 #include "i965_drv_video.h"
+#include "i965_drv_version.h"
 #include "i965_decoder.h"
 #include "i965_encoder.h"
 
@@ -5637,6 +5638,12 @@ ensure_vendor_string(struct i965_driver_data *i965, const char *chipset)
             goto error;
         len += ret;
     }
+
+    ret = snprintf(&i965->va_vendor[len], sizeof(i965->va_vendor) - len,
+        " (%s)", I965_DRV_VERSION_ID);
+    if (ret < 0 || ret >= sizeof(i965->va_vendor))
+        goto error;
+    len += ret;
     return true;
 
 error:
-- 
1.7.9.5



More information about the Libva mailing list