drm_driver: Add a configuration function to the driver descriptor.
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 12 Oct 2011 08:29:24 +0000 (10:29 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Fri, 14 Oct 2011 07:53:05 +0000 (09:53 +0200)
Adds a possibility for the state tracker manager to query the
target for a specific configuration.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
27 files changed:
src/gallium/include/state_tracker/drm_driver.h
src/gallium/targets/dri-i915/target.c
src/gallium/targets/dri-i965/target.c
src/gallium/targets/dri-nouveau/target.c
src/gallium/targets/dri-r300/target.c
src/gallium/targets/dri-r600/target.c
src/gallium/targets/dri-vmwgfx/target.c
src/gallium/targets/gbm/pipe_i915.c
src/gallium/targets/gbm/pipe_i965.c
src/gallium/targets/gbm/pipe_nouveau.c
src/gallium/targets/gbm/pipe_r300.c
src/gallium/targets/gbm/pipe_r600.c
src/gallium/targets/gbm/pipe_swrast.c
src/gallium/targets/gbm/pipe_vmwgfx.c
src/gallium/targets/va-r300/target.c
src/gallium/targets/va-r600/target.c
src/gallium/targets/vdpau-r300/target.c
src/gallium/targets/vdpau-r600/target.c
src/gallium/targets/xa-vmwgfx/vmw_target.c
src/gallium/targets/xorg-i915/intel_target.c
src/gallium/targets/xorg-i965/intel_target.c
src/gallium/targets/xorg-nouveau/nouveau_target.c
src/gallium/targets/xorg-r300/target.c
src/gallium/targets/xorg-r600/target.c
src/gallium/targets/xvmc-nouveau/target.c
src/gallium/targets/xvmc-r300/target.c
src/gallium/targets/xvmc-r600/target.c

index d94c1e6a7cf2eff9e95d5ac84851e98d36e30a6e..2df28599fe8b263b13c0f1bd32fad2657799ae6d 100644 (file)
@@ -35,6 +35,40 @@ struct winsys_handle
    unsigned stride;
 };
 
+
+
+/**
+ * Configuration queries.
+ */
+enum drm_conf {
+   /* How many frames to allow before throttling. Or -1 to indicate any number */
+   DRM_CONF_THROTTLE, /* DRM_CONF_INT. */
+   DRM_CONF_MAX
+};
+
+/**
+ * Type of configuration answer
+ */
+enum drm_conf_type {
+   DRM_CONF_INT,
+   DRM_CONF_BOOL,
+   DRM_CONF_FLOAT,
+   DRM_CONF_POINTER
+};
+
+/**
+ * Return value from the configuration function.
+ */
+struct drm_conf_ret {
+   enum drm_conf_type type;
+   union {
+      int val_int;
+      bool val_bool;
+      float val_float;
+      void *val_pointer;
+   } val;
+};
+
 struct drm_driver_descriptor
 {
    /**
@@ -54,6 +88,16 @@ struct drm_driver_descriptor
     * For example wrapping trace or rbug debugging drivers around it.
     */
    struct pipe_screen* (*create_screen)(int drm_fd);
+
+
+   /**
+    * Return a configuration value.
+    *
+    * If this function is NULL, or if it returns NULL
+    * the state tracker- or state
+    * tracker manager should provide a reasonable default value.
+    */
+   const struct drm_conf_ret *(*configuration) (enum drm_conf conf);
 };
 
 extern struct drm_driver_descriptor driver_descriptor;
@@ -61,11 +105,12 @@ extern struct drm_driver_descriptor driver_descriptor;
 /**
  * Instantiate a drm_driver_descriptor struct.
  */
-#define DRM_DRIVER_DESCRIPTOR(name_str, driver_name_str, func) \
+#define DRM_DRIVER_DESCRIPTOR(name_str, driver_name_str, func, conf) \
 struct drm_driver_descriptor driver_descriptor = {             \
    .name = name_str,                                           \
    .driver_name = driver_name_str,                             \
    .create_screen = func,                                      \
+   .configuration = (conf),                                   \
 };
 
 #endif
index a27b7bd6d810010767426dfa0e960c443b837a35..935eb0ebdd7143871927eb1017275795ebd12b65 100644 (file)
@@ -26,4 +26,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
index 0632b97beaacaa8282b6f151ad8067f9e189e05a..0434063f20f3973a8f78f942b88148ab0989e291 100644 (file)
@@ -26,4 +26,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen)
+DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen, NULL)
index e725a4d9b7a427229ff0119f14608a2a110dd8e4..c0d7f92e33f0bb571a7a1c4e1025027b289c6cfa 100644 (file)
@@ -17,4 +17,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL)
index 9b6d816fb62abfe8be11fcc0ab90235bb8d0a536..07b07051cc949ba0e1386da3f18130899b7dbde9 100644 (file)
@@ -22,4 +22,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
index 1b8b6816ec150fd43eeff64c4cc71db9c57a218a..3b7795b35076025d1f661952129f3f514b8f794b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)
index da50b8b8bda69d6d7c14818a06f0c82fec6dae1a..fe3f8fd05b2ad67d77a6d4cdb1aa33d798bd51fe 100644 (file)
@@ -27,4 +27,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)
+DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen, NULL)
index cd74044d8c1b532baf434424025b365853331608..85662cb85b589a648c736c73bfe07c0b9a929996 100644 (file)
@@ -24,4 +24,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
index f810ecffb0a5715606ea01f378b30e73f64ca4a8..1eece9ce4b49104af94a170e21e10c9ba93706bb 100644 (file)
@@ -27,4 +27,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("i965", "i965", create_screen)
+DRM_DRIVER_DESCRIPTOR("i965", "i965", create_screen, NULL)
index 0c9081bc71306fd155b52b5b1cd4521e6c4fcbc3..65425e8d45694797d671df1d46df9b6eebb57c9c 100644 (file)
@@ -18,4 +18,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL)
index 09940f0a194f3ece2c0735fd71e74b5f14992292..055685996e6ff802a05eda4f24e56cec8d7e30d9 100644 (file)
@@ -24,4 +24,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
index 9f61a51404a8962534b54436cb1034884e7b1d68..5d89aca6ec37351b0edae10573ffd52dd689f4e3 100644 (file)
@@ -23,4 +23,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)
index b2e3289c5d38e94e2cd47cac95d3617ed66ea45b..092abf07a522a89647badc3955b0b7d796ea392d 100644 (file)
@@ -7,7 +7,7 @@ PUBLIC struct pipe_screen *
 swrast_create_screen(struct sw_winsys *ws);
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL)
+DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL, NULL)
 
 struct pipe_screen *
 swrast_create_screen(struct sw_winsys *ws)
index 22a28fa858ae2cbfec19b4769a5633e98c0ca55a..bfe665be6eb703869825f15c1749d8fc80dbc843 100644 (file)
@@ -24,4 +24,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)
+DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen, NULL)
index 9f673bf17e6b121cae3a5c55cf606954083bcac2..2fd7c2f6102f06d43d465990c3eddac5e46be05b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
index 1b8b6816ec150fd43eeff64c4cc71db9c57a218a..3b7795b35076025d1f661952129f3f514b8f794b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)
index 9f673bf17e6b121cae3a5c55cf606954083bcac2..2fd7c2f6102f06d43d465990c3eddac5e46be05b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
index 1b8b6816ec150fd43eeff64c4cc71db9c57a218a..3b7795b35076025d1f661952129f3f514b8f794b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)
index 15089d6db264a20126697f4aeb6ee36e2c627e97..1087801ef78c17b21b8a66a99a5f37fecac68958 100644 (file)
@@ -23,4 +23,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)
+DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen, NULL)
index 8c8ef7e02b4c4a9bde2c34adf43778c97c00c42f..50efa21b1f795c95d918ea92c3dd1e8646d67b7f 100644 (file)
@@ -23,4 +23,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
+DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
index 0632b97beaacaa8282b6f151ad8067f9e189e05a..0434063f20f3973a8f78f942b88148ab0989e291 100644 (file)
@@ -26,4 +26,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen)
+DRM_DRIVER_DESCRIPTOR("i915", "i965", create_screen, NULL)
index e725a4d9b7a427229ff0119f14608a2a110dd8e4..c0d7f92e33f0bb571a7a1c4e1025027b289c6cfa 100644 (file)
@@ -17,4 +17,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL)
index b48bcad3710bb39cb6866e148a1ab65e1980abe4..a8f8e6e1bd1d2fffb6a4b189a72b8639033dddf5 100644 (file)
@@ -23,4 +23,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
index 60424359a7b86f7a08d5964d774523a652c938fb..75785da6e9ba86e2f0f240f6ea36870dc54fb5bf 100644 (file)
@@ -23,4 +23,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)
index 9b61b036d26e228b283a9d5f7c8ef1e60c409334..d580b10442145c5fa6e17eb9c16cdfc020e10df9 100644 (file)
@@ -15,4 +15,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL)
index 9f673bf17e6b121cae3a5c55cf606954083bcac2..2fd7c2f6102f06d43d465990c3eddac5e46be05b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
index 1b8b6816ec150fd43eeff64c4cc71db9c57a218a..3b7795b35076025d1f661952129f3f514b8f794b 100644 (file)
@@ -21,4 +21,4 @@ static struct pipe_screen *create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL)