[Mesa-dev] [PATCH mesa 2/3] bin: make MESA_GIT_SHA1 directly usable in code

Eric Engestrom eric.engestrom at intel.com
Tue Aug 14 17:24:12 UTC 2018


Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
 bin/git_sha1_gen.py                                | 2 +-
 src/gallium/drivers/svga/svga_screen.c             | 6 +-----
 src/gallium/state_trackers/clover/api/device.cpp   | 6 +-----
 src/gallium/state_trackers/clover/api/platform.cpp | 6 +-----
 src/git_sha1.h.in                                  | 2 +-
 src/mesa/main/context.c                            | 6 +-----
 src/mesa/main/version.c                            | 6 +-----
 7 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py
index bc0279ccef16d42bb88d..bcc29de1c6218ab3af79 100755
--- a/bin/git_sha1_gen.py
+++ b/bin/git_sha1_gen.py
@@ -53,4 +53,4 @@ def write_if_different(contents):
         new_sha1 = git_sha1_h_in.read().replace('@VCS_TAG@', git_sha1)
         write_if_different(new_sha1)
 else:
-    write_if_different('')
+    write_if_different('#define MESA_GIT_SHA1 ""')
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index b8f936ee96730d97c570..355aaa38f6ba5510f3fe 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -889,11 +889,7 @@ init_logging(struct pipe_screen *screen)
    svga_host_log(host_log);
 
    util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix),
-                 "%s%s"
-#ifdef MESA_GIT_SHA1
-                 " (" MESA_GIT_SHA1 ")"
-#endif
-                 , log_prefix, PACKAGE_VERSION);
+                 "%s%s%s", log_prefix, PACKAGE_VERSION, MESA_GIT_SHA1);
    svga_host_log(host_log);
 
    /* If the SVGA_EXTRA_LOGGING env var is set, log the process's command
diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index 3572bb0c921f83ee9411..5a4f94c114143a4d1dc0 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -322,11 +322,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_VERSION:
-      buf.as_string() = "OpenCL " + dev.device_version() + " Mesa " PACKAGE_VERSION
-#ifdef MESA_GIT_SHA1
-                        " (" MESA_GIT_SHA1 ")"
-#endif
-			;
+      buf.as_string() = "OpenCL " + dev.device_version() + " Mesa " PACKAGE_VERSION MESA_GIT_SHA1;
       break;
 
    case CL_DEVICE_EXTENSIONS:
diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp
index 3b96b03fde81083e0d04..fddbbecaa5927db6300a 100644
--- a/src/gallium/state_trackers/clover/api/platform.cpp
+++ b/src/gallium/state_trackers/clover/api/platform.cpp
@@ -62,11 +62,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
       static const std::string version_string =
             debug_get_option("CLOVER_PLATFORM_VERSION_OVERRIDE", "1.1");
 
-      buf.as_string() = "OpenCL " + version_string + " Mesa " PACKAGE_VERSION
-#ifdef MESA_GIT_SHA1
-                        " (" MESA_GIT_SHA1 ")"
-#endif
-                        ;
+      buf.as_string() = "OpenCL " + version_string + " Mesa " PACKAGE_VERSION MESA_GIT_SHA1;
       break;
    }
    case CL_PLATFORM_NAME:
diff --git a/src/git_sha1.h.in b/src/git_sha1.h.in
index dc17f5e6614930d7d376..d814d253442b913a21c7 100644
--- a/src/git_sha1.h.in
+++ b/src/git_sha1.h.in
@@ -1 +1 @@
-#define MESA_GIT_SHA1 "git- at VCS_TAG@"
+#define MESA_GIT_SHA1 " (git- at VCS_TAG@)"
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 0ef8fe32a635e90d6ada..7eea60f12a00f81799d7 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -404,11 +404,7 @@ one_time_init( struct gl_context *ctx )
 
 #if defined(DEBUG)
       if (MESA_VERBOSE != 0) {
-         _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build"
-#ifdef MESA_GIT_SHA1
-                     " (" MESA_GIT_SHA1 ")"
-#endif
-                     "\n");
+         _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n");
       }
 #endif
    }
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 9df8c11c740ca02e4b77..77ff51b6d9e66ef43a6c 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -121,11 +121,7 @@ create_version_string(struct gl_context *ctx, const char *prefix)
    ctx->VersionString = malloc(max);
    if (ctx->VersionString) {
       _mesa_snprintf(ctx->VersionString, max,
-		     "%s%u.%u%s Mesa " PACKAGE_VERSION
-#ifdef MESA_GIT_SHA1
-		     " (" MESA_GIT_SHA1 ")"
-#endif
-		     ,
+		     "%s%u.%u%s Mesa " PACKAGE_VERSION MESA_GIT_SHA1,
 		     prefix,
 		     ctx->Version / 10, ctx->Version % 10,
 		     (ctx->API == API_OPENGL_CORE) ? " (Core Profile)" :
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list