[Mesa-dev] [PATCH 1/2] Unify OpenGL and OpenCL version string suffix
Giuseppe Bilotta
giuseppe.bilotta at gmail.com
Mon May 23 07:21:50 UTC 2016
Refactor the "Mesa " PACKAGE_VERSION [optional git SHA1] string into a
separate version_string.h header, and use it from both Mesa and clover
to report the Mesa version in both the OpenGL (resp. OpenCL)
implementation-specific version string suffix.
This changes the reported OpenCL version string suffix from MESA to
Mesa, and adds the previously missing git SHA1.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
---
src/gallium/state_trackers/clover/api/device.cpp | 3 +-
src/gallium/state_trackers/clover/api/platform.cpp | 3 +-
src/mesa/main/version.c | 8 ++---
src/mesa/main/version_string.h | 34 ++++++++++++++++++++++
4 files changed, 40 insertions(+), 8 deletions(-)
create mode 100644 src/mesa/main/version_string.h
diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index bc93f91..1c0ee76 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -23,6 +23,7 @@
#include "api/util.hpp"
#include "core/platform.hpp"
#include "core/device.hpp"
+#include "mesa/main/version_string.h"
using namespace clover;
@@ -300,7 +301,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
break;
case CL_DEVICE_VERSION:
- buf.as_string() = "OpenCL 1.1 MESA " PACKAGE_VERSION;
+ buf.as_string() = "OpenCL 1.1" MESA_VERSION_SUFFIX;
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 cf71593..7265bd4 100644
--- a/src/gallium/state_trackers/clover/api/platform.cpp
+++ b/src/gallium/state_trackers/clover/api/platform.cpp
@@ -22,6 +22,7 @@
#include "api/util.hpp"
#include "core/platform.hpp"
+#include "mesa/main/version_string.h"
using namespace clover;
@@ -57,7 +58,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
break;
case CL_PLATFORM_VERSION:
- buf.as_string() = "OpenCL 1.1 MESA " PACKAGE_VERSION;
+ buf.as_string() = "OpenCL 1.1" MESA_VERSION_SUFFIX;
break;
case CL_PLATFORM_NAME:
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 7138cf3..f6a561a 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -28,7 +28,7 @@
#include "imports.h"
#include "mtypes.h"
#include "version.h"
-#include "git_sha1.h"
+#include "version_string.h"
/**
* Scans 'string' to see if it ends with 'ending'.
@@ -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_VERSION_SUFFIX,
prefix,
ctx->Version / 10, ctx->Version % 10,
(ctx->API == API_OPENGL_CORE) ? " (Core Profile)" : ""
diff --git a/src/mesa/main/version_string.h b/src/mesa/main/version_string.h
new file mode 100644
index 0000000..970cc8b
--- /dev/null
+++ b/src/mesa/main/version_string.h
@@ -0,0 +1,34 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2010 VMware, Inc. 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, sublicense,
+ * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#include "git_sha1.h"
+
+#ifdef MESA_GIT_SHA1
+#define MESA_GIT_SHA1_SUFFIX " (" MESA_GIT_SHA1 ")"
+#else
+#define MESA_GIT_SHA1_SUFFIX ""
+#endif
+
+#define MESA_VERSION_SUFFIX " Mesa " PACKAGE_VERSION MESA_GIT_SHA1_SUFFIX
+
--
2.8.1.372.g9612035
More information about the mesa-dev
mailing list