Module: Mesa
Branch: main
Commit: 4873b13aec71826df5e16bb39bc2181720b82836
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4873b13aec71826df5e16bb39bc2181720b82836

Author: Adam Jackson <[email protected]>
Date:   Fri May  6 14:11:04 2022 -0400

dri: move driQueryRendererIntegerCommon near its one caller

Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Mike Blumenkrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16377>

---

 src/gallium/frontends/dri/dri_query_renderer.c | 72 ++++++++++++++++++++++++++
 src/gallium/frontends/dri/utils.c              | 71 -------------------------
 src/gallium/frontends/dri/utils.h              |  3 --
 3 files changed, 72 insertions(+), 74 deletions(-)

diff --git a/src/gallium/frontends/dri/dri_query_renderer.c 
b/src/gallium/frontends/dri/dri_query_renderer.c
index eeebdb76572..3290c855f9e 100644
--- a/src/gallium/frontends/dri/dri_query_renderer.c
+++ b/src/gallium/frontends/dri/dri_query_renderer.c
@@ -8,6 +8,78 @@
 #include "dri_query_renderer.h"
 #include "pipe-loader/pipe_loader.h"
 
+/**
+ * Implement queries for values that are common across all Mesa drivers
+ *
+ * Currently only the following queries are supported by this function:
+ *
+ *     - \c __DRI2_RENDERER_VERSION
+ *     - \c __DRI2_RENDERER_PREFERRED_PROFILE
+ *     - \c __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION
+ *     - \c __DRI2_RENDERER_OPENGL_COMPATIBLITY_PROFILE_VERSION
+ *     - \c __DRI2_RENDERER_ES_PROFILE_VERSION
+ *     - \c __DRI2_RENDERER_ES2_PROFILE_VERSION
+ *     - \c __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT
+ *
+ * \returns
+ * Zero if a recognized value of \c param is supplied, -1 otherwise.
+ */
+static int
+driQueryRendererIntegerCommon(__DRIscreen *psp, int param, unsigned int *value)
+{
+   switch (param) {
+   case __DRI2_RENDERER_VERSION: {
+      static const char *const ver = PACKAGE_VERSION;
+      char *endptr;
+      int v[3];
+
+      v[0] = strtol(ver, &endptr, 10);
+      assert(endptr[0] == '.');
+      if (endptr[0] != '.')
+         return -1;
+
+      v[1] = strtol(endptr + 1, &endptr, 10);
+      assert(endptr[0] == '.');
+      if (endptr[0] != '.')
+         return -1;
+
+      v[2] = strtol(endptr + 1, &endptr, 10);
+
+      value[0] = v[0];
+      value[1] = v[1];
+      value[2] = v[2];
+      return 0;
+   }
+   case __DRI2_RENDERER_PREFERRED_PROFILE:
+      value[0] = (psp->max_gl_core_version != 0)
+         ? (1U << __DRI_API_OPENGL_CORE) : (1U << __DRI_API_OPENGL);
+      return 0;
+   case __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION:
+      value[0] = psp->max_gl_core_version / 10;
+      value[1] = psp->max_gl_core_version % 10;
+      return 0;
+   case __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION:
+      value[0] = psp->max_gl_compat_version / 10;
+      value[1] = psp->max_gl_compat_version % 10;
+      return 0;
+   case __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION:
+      value[0] = psp->max_gl_es1_version / 10;
+      value[1] = psp->max_gl_es1_version % 10;
+      return 0;
+   case __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION:
+      value[0] = psp->max_gl_es2_version / 10;
+      value[1] = psp->max_gl_es2_version % 10;
+      return 0;
+   case __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT:
+      value[0] = GL_TRUE;
+      return 0;
+   default:
+      break;
+   }
+
+   return -1;
+}
+
 static int
 dri2_query_renderer_integer(__DRIscreen *_screen, int param,
                             unsigned int *value)
diff --git a/src/gallium/frontends/dri/utils.c 
b/src/gallium/frontends/dri/utils.c
index 9fb940cf12f..db14d2c5e41 100644
--- a/src/gallium/frontends/dri/utils.c
+++ b/src/gallium/frontends/dri/utils.c
@@ -491,74 +491,3 @@ driIndexConfigAttrib(const __DRIconfig *config, int index,
     return GL_FALSE;
 }
 
-/**
- * Implement queries for values that are common across all Mesa drivers
- *
- * Currently only the following queries are supported by this function:
- *
- *     - \c __DRI2_RENDERER_VERSION
- *     - \c __DRI2_RENDERER_PREFERRED_PROFILE
- *     - \c __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION
- *     - \c __DRI2_RENDERER_OPENGL_COMPATIBLITY_PROFILE_VERSION
- *     - \c __DRI2_RENDERER_ES_PROFILE_VERSION
- *     - \c __DRI2_RENDERER_ES2_PROFILE_VERSION
- *     - \c __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT
- *
- * \returns
- * Zero if a recognized value of \c param is supplied, -1 otherwise.
- */
-int
-driQueryRendererIntegerCommon(__DRIscreen *psp, int param, unsigned int *value)
-{
-   switch (param) {
-   case __DRI2_RENDERER_VERSION: {
-      static const char *const ver = PACKAGE_VERSION;
-      char *endptr;
-      int v[3];
-
-      v[0] = strtol(ver, &endptr, 10);
-      assert(endptr[0] == '.');
-      if (endptr[0] != '.')
-         return -1;
-
-      v[1] = strtol(endptr + 1, &endptr, 10);
-      assert(endptr[0] == '.');
-      if (endptr[0] != '.')
-         return -1;
-
-      v[2] = strtol(endptr + 1, &endptr, 10);
-
-      value[0] = v[0];
-      value[1] = v[1];
-      value[2] = v[2];
-      return 0;
-   }
-   case __DRI2_RENDERER_PREFERRED_PROFILE:
-      value[0] = (psp->max_gl_core_version != 0)
-         ? (1U << __DRI_API_OPENGL_CORE) : (1U << __DRI_API_OPENGL);
-      return 0;
-   case __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION:
-      value[0] = psp->max_gl_core_version / 10;
-      value[1] = psp->max_gl_core_version % 10;
-      return 0;
-   case __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION:
-      value[0] = psp->max_gl_compat_version / 10;
-      value[1] = psp->max_gl_compat_version % 10;
-      return 0;
-   case __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION:
-      value[0] = psp->max_gl_es1_version / 10;
-      value[1] = psp->max_gl_es1_version % 10;
-      return 0;
-   case __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION:
-      value[0] = psp->max_gl_es2_version / 10;
-      value[1] = psp->max_gl_es2_version % 10;
-      return 0;
-   case __DRI2_RENDERER_HAS_NO_ERROR_CONTEXT:
-      value[0] = GL_TRUE;
-      return 0;
-   default:
-      break;
-   }
-
-   return -1;
-}
diff --git a/src/gallium/frontends/dri/utils.h 
b/src/gallium/frontends/dri/utils.h
index c30c8faab54..41b4eee4376 100644
--- a/src/gallium/frontends/dri/utils.h
+++ b/src/gallium/frontends/dri/utils.h
@@ -55,7 +55,4 @@ int
 driIndexConfigAttrib(const __DRIconfig *config, int index,
                     unsigned int *attrib, unsigned int *value);
 
-int
-driQueryRendererIntegerCommon(__DRIscreen *psp, int param, unsigned int 
*value);
-
 #endif /* DRI_DEBUG_H */

Reply via email to