summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-09-02 10:10:21 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-09-09 15:22:31 +0200
commitcf00f065fd5bb3dfc06e98ceacc2e218bd8f4e92 (patch)
treea77164201fcf02b9f836f20cc50f461e8c1f4c6e
parentd12dcedd6d3de29b9c7764d8b112d351c2830025 (diff)
downloadlibva-intel-driver-cf00f065fd5bb3dfc06e98ceacc2e218bd8f4e92.tar.gz
i965_drv_video: add git commit id to VA driver version string.
v2: renamed i965_drv_version.h to intel_version.h, changed macro definition to INTEL_DRIVER_GIT_VERSION, and displayed the git version string only in "pre" version modes. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r--configure.ac5
-rwxr-xr-xsrc/Makefile.am39
-rw-r--r--src/i965_drv_video.c7
-rw-r--r--src/intel_version.h.in36
4 files changed, 85 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 86c2b40d..7feb074a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,11 @@ PKG_CHECK_MODULES(GEN4ASM, [intel-gen4asm >= 1.5], [gen4asm=yes], [gen4asm=no])
AM_CONDITIONAL(HAVE_GEN4ASM, test x$gen4asm = xyes)
AC_PATH_PROG([GEN4ASM], [intel-gen4asm])
+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 b35d1ac9..acfa8492 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 \
@@ -120,6 +123,7 @@ source_h = \
intel_driver.h \
intel_media.h \
intel_memman.h \
+ intel_version.h \
object_heap.h \
sysdeps.h \
va_backend_compat.h \
@@ -145,12 +149,43 @@ 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
+
+intel_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 intel_version.h ]; then \
+ cp -f $(NEW_VERSION_FILE) $(OLD_VERSION_FILE); \
+ $(SED) -e "s|\@INTEL_DRIVER_GIT_VERSION\@|$${NV}|" \
+ $(srcdir)/intel_version.h.in > intel_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 += intel_version.h
+EXTRA_DIST += intel_version.h.in $(PKG_VERSION_FILE)
+
# Wayland protocol
protocol_source_h = wayland-drm-client-protocol.h
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_video.c b/src/i965_drv_video.c
index dec218f8..2b9f6ec4 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -38,6 +38,7 @@
# include "i965_output_wayland.h"
#endif
+#include "intel_version.h"
#include "intel_driver.h"
#include "intel_memman.h"
#include "intel_batchbuffer.h"
@@ -5630,6 +5631,12 @@ ensure_vendor_string(struct i965_driver_data *i965, const char *chipset)
if (ret < 0 || ret >= sizeof(i965->va_vendor))
goto error;
len += ret;
+
+ ret = snprintf(&i965->va_vendor[len], sizeof(i965->va_vendor) - len,
+ " (%s)", INTEL_DRIVER_GIT_VERSION);
+ if (ret < 0 || ret >= sizeof(i965->va_vendor))
+ goto error;
+ len += ret;
}
return true;
diff --git a/src/intel_version.h.in b/src/intel_version.h.in
new file mode 100644
index 00000000..050e8346
--- /dev/null
+++ b/src/intel_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 INTEL_VERSION_H
+#define INTEL_VERSION_H
+
+/**
+ * INTEL_DRIVER_GIT_VERSION:
+ *
+ * The full version identifier of libva-intel-driver, from a git
+ * repository, in string form (suitable for string concatenation).
+ */
+#define INTEL_DRIVER_GIT_VERSION "@INTEL_DRIVER_GIT_VERSION@"
+
+#endif /* INTEL_VERSION_H */