[Mesa-dev] [PATCH 11/23] target-helpers: introduce dd_configuration()
Emil Velikov
emil.l.velikov at gmail.com
Sun May 18 00:07:33 PDT 2014
Some drivers do not provide any configuration parameters
those are left as is. A handful of targets provide share_fd
(dmabuf) bug lack throttle. This patch provides the latter
in the cases where it was left out - ilo, nouveau and r300.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
.../auxiliary/target-helpers/inline_drm_helper.h | 75 ++++++++++++++++++++++
src/gallium/include/state_tracker/drm_driver.h | 2 +
2 files changed, 77 insertions(+)
diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
index bfcf9fe..624e0f9 100644
--- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
@@ -215,4 +215,79 @@ dd_create_screen(int fd)
return NULL;
}
+#if NEED_DRIVER_DESCRIPTOR_EXTRA
+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;
+}
+
+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 /* NEED_DRIVER_DESCRIPTOR_EXTRA */
+
#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..7eaf375 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -119,4 +119,6 @@ struct drm_driver_descriptor driver_descriptor = { \
extern struct pipe_screen *dd_create_screen(int fd);
+extern const struct drm_conf_ret *dd_configuration(enum drm_conf conf);
+
#endif
--
1.9.2
More information about the mesa-dev
mailing list