Mesa (master): target-helpers: add dd_configuration(), dd_driver_name()

Emil Velikov evelikov at kemper.freedesktop.org
Thu Jun 19 11:47:18 UTC 2014


Module: Mesa
Branch: master
Commit: 86c30c6c5b0d06b36b369c29a0a9264a2d1819d9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=86c30c6c5b0d06b36b369c29a0a9264a2d1819d9

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Sun May 18 00:20:47 2014 +0100

target-helpers: add dd_configuration(), dd_driver_name()

Add a couple of helpers to be used by the dri targets when
built with static pipe-drivers. Both functions provide
functionality required by the dri state-tracker.

With this patch ilo, nouveau and r300 gain support for
throttle dri configuration.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

---

 .../auxiliary/target-helpers/inline_drm_helper.h   |   78 ++++++++++++++++++++
 src/gallium/include/state_tracker/drm_driver.h     |    4 +
 2 files changed, 82 insertions(+)

diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
index e039a82..a03db3a 100644
--- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
@@ -203,4 +203,82 @@ dd_create_screen(int fd)
       return NULL;
 }
 
+inline const char *
+dd_driver_name(void)
+{
+   return driver_name;
+}
+
+static const struct drm_conf_ret throttle_ret = {
+   .type = DRM_CONF_INT,
+   .val.val_int = 2,
+};
+
+static const struct drm_conf_ret share_fd_ret = {
+   .type = DRM_CONF_BOOL,
+   .val.val_int = true,
+};
+
+static const struct drm_conf_ret *
+configuration_query(enum drm_conf conf)
+{
+   switch (conf) {
+   case DRM_CONF_THROTTLE:
+      return &throttle_ret;
+   case DRM_CONF_SHARE_FD:
+      return &share_fd_ret;
+   default:
+      break;
+   }
+   return NULL;
+}
+
+inline const struct drm_conf_ret *
+dd_configuration(enum drm_conf conf)
+{
+   if (!driver_name)
+      return NULL;
+
+#if defined(GALLIUM_I915)
+   if (strcmp(driver_name, "i915") == 0)
+      return NULL;
+   else
+#endif
+#if defined(GALLIUM_ILO)
+   if (strcmp(driver_name, "i965") == 0)
+      return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_NOUVEAU)
+   if (strcmp(driver_name, "nouveau") == 0)
+      return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_R300)
+   if (strcmp(driver_name, "r300") == 0)
+      return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_R600)
+   if (strcmp(driver_name, "r600") == 0)
+      return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_RADEONSI)
+   if (strcmp(driver_name, "radeonsi") == 0)
+      return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_VMWGFX)
+   if (strcmp(driver_name, "vmwgfx") == 0)
+      return configuration_query(conf);
+   else
+#endif
+#if defined(GALLIUM_FREEDRENO)
+   if ((strcmp(driver_name, "kgsl") == 0) || (strcmp(driver_name, "msm") == 0))
+      return NULL;
+   else
+#endif
+      return NULL;
+}
 #endif /* INLINE_DRM_HELPER_H */
diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h
index ea07685..740c4bb 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -119,4 +119,8 @@ struct drm_driver_descriptor driver_descriptor = {             \
 
 extern struct pipe_screen *dd_create_screen(int fd);
 
+extern const char *dd_driver_name(void);
+
+extern const struct drm_conf_ret *dd_configuration(enum drm_conf conf);
+
 #endif




More information about the mesa-commit mailing list