pipe-loader: move configuration_query into drm_helper
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 29 Jun 2017 15:48:28 +0000 (17:48 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 2 Aug 2017 07:50:58 +0000 (09:50 +0200)
Having it inline is pointless anyway, since it's only called via a
function pointer.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
src/gallium/auxiliary/target-helpers/drm_helper.h
src/gallium/auxiliary/target-helpers/drm_helper_public.h

index 5c8c7509e085af6a0facf2891d07c4f3da04c4c7..d8d3878bcd580629cc3a590e095db9ced2e4bbc8 100644 (file)
@@ -64,95 +64,71 @@ struct pipe_loader_drm_device {
 static const struct pipe_loader_ops pipe_loader_drm_ops;
 
 #ifdef GALLIUM_STATIC_TARGETS
-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_bool = true,
-};
-
-static inline 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;
-}
-
 static const struct drm_driver_descriptor driver_descriptors[] = {
     {
         .driver_name = "i915",
         .create_screen = pipe_i915_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "nouveau",
         .create_screen = pipe_nouveau_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "r300",
         .create_screen = pipe_r300_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "r600",
         .create_screen = pipe_r600_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "radeonsi",
         .create_screen = pipe_radeonsi_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "vmwgfx",
         .create_screen = pipe_vmwgfx_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "kgsl",
         .create_screen = pipe_freedreno_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "msm",
         .create_screen = pipe_freedreno_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
        .driver_name = "pl111",
         .create_screen = pipe_pl111_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "virtio_gpu",
         .create_screen = pipe_virgl_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "vc4",
         .create_screen = pipe_vc4_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "etnaviv",
         .create_screen = pipe_etna_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     },
     {
         .driver_name = "imx-drm",
         .create_screen = pipe_imx_drm_create_screen,
-        .configuration = configuration_query,
+        .configuration = pipe_default_configuration_query,
     }
 };
 #endif
index 2a2f57d20db875d83497c68d8f1f85323b8296d2..a4fcde385f273c73bfc4b4ef02e70646d8395d70 100644 (file)
@@ -4,6 +4,31 @@
 #include <stdio.h>
 #include "target-helpers/inline_debug_helper.h"
 #include "target-helpers/drm_helper_public.h"
+#include "state_tracker/drm_driver.h"
+
+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_bool = true,
+};
+
+const struct drm_conf_ret *
+pipe_default_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;
+}
 
 #ifdef GALLIUM_I915
 #include "i915/drm/i915_drm_public.h"
index 5746e08554b58c8a4b28d6982c837a178dd7e92c..c540d7c58a607c3dd69fbad21bf51f61ccc689d5 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _DRM_HELPER_PUBLIC_H
 #define _DRM_HELPER_PUBLIC_H
 
+enum drm_conf;
+struct drm_conf_ret;
 
 struct pipe_screen;
 struct pipe_screen_config;
@@ -44,4 +46,7 @@ pipe_etna_create_screen(int fd, const struct pipe_screen_config *config);
 struct pipe_screen *
 pipe_imx_drm_create_screen(int fd, const struct pipe_screen_config *config);
 
+const struct drm_conf_ret *
+pipe_default_configuration_query(enum drm_conf conf);
+
 #endif /* _DRM_HELPER_PUBLIC_H */