Adds a possibility for the state tracker manager to query the target for a specific configuration.
Signed-off-by: Thomas Hellstrom <thellst...@vmware.com> --- src/gallium/include/state_tracker/drm_driver.h | 47 ++++++++++++++++++++- src/gallium/targets/dri-i915/target.c | 2 +- src/gallium/targets/dri-i965/target.c | 2 +- src/gallium/targets/dri-nouveau/target.c | 2 +- src/gallium/targets/dri-r300/target.c | 2 +- src/gallium/targets/dri-r600/target.c | 2 +- src/gallium/targets/dri-vmwgfx/target.c | 2 +- src/gallium/targets/gbm/pipe_i915.c | 2 +- src/gallium/targets/gbm/pipe_i965.c | 2 +- src/gallium/targets/gbm/pipe_nouveau.c | 2 +- src/gallium/targets/gbm/pipe_r300.c | 2 +- src/gallium/targets/gbm/pipe_r600.c | 2 +- src/gallium/targets/gbm/pipe_swrast.c | 2 +- src/gallium/targets/gbm/pipe_vmwgfx.c | 2 +- src/gallium/targets/va-r300/target.c | 2 +- src/gallium/targets/va-r600/target.c | 2 +- src/gallium/targets/vdpau-r300/target.c | 2 +- src/gallium/targets/vdpau-r600/target.c | 2 +- src/gallium/targets/xa-vmwgfx/vmw_target.c | 2 +- src/gallium/targets/xorg-i915/intel_target.c | 2 +- src/gallium/targets/xorg-i965/intel_target.c | 2 +- src/gallium/targets/xorg-nouveau/nouveau_target.c | 2 +- src/gallium/targets/xorg-r300/target.c | 2 +- src/gallium/targets/xorg-r600/target.c | 2 +- src/gallium/targets/xvmc-nouveau/target.c | 2 +- src/gallium/targets/xvmc-r300/target.c | 2 +- src/gallium/targets/xvmc-r600/target.c | 2 +- 27 files changed, 72 insertions(+), 27 deletions(-) diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h index d94c1e6..2df2859 100644 --- a/src/gallium/include/state_tracker/drm_driver.h +++ b/src/gallium/include/state_tracker/drm_driver.h @@ -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 diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c index a27b7bd..935eb0e 100644 --- a/src/gallium/targets/dri-i915/target.c +++ b/src/gallium/targets/dri-i915/target.c @@ -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) diff --git a/src/gallium/targets/dri-i965/target.c b/src/gallium/targets/dri-i965/target.c index 0632b97..0434063 100644 --- a/src/gallium/targets/dri-i965/target.c +++ b/src/gallium/targets/dri-i965/target.c @@ -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) diff --git a/src/gallium/targets/dri-nouveau/target.c b/src/gallium/targets/dri-nouveau/target.c index e725a4d..c0d7f92 100644 --- a/src/gallium/targets/dri-nouveau/target.c +++ b/src/gallium/targets/dri-nouveau/target.c @@ -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) diff --git a/src/gallium/targets/dri-r300/target.c b/src/gallium/targets/dri-r300/target.c index 9b6d816..07b0705 100644 --- a/src/gallium/targets/dri-r300/target.c +++ b/src/gallium/targets/dri-r300/target.c @@ -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) diff --git a/src/gallium/targets/dri-r600/target.c b/src/gallium/targets/dri-r600/target.c index 1b8b681..3b7795b 100644 --- a/src/gallium/targets/dri-r600/target.c +++ b/src/gallium/targets/dri-r600/target.c @@ -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) diff --git a/src/gallium/targets/dri-vmwgfx/target.c b/src/gallium/targets/dri-vmwgfx/target.c index da50b8b..fe3f8fd 100644 --- a/src/gallium/targets/dri-vmwgfx/target.c +++ b/src/gallium/targets/dri-vmwgfx/target.c @@ -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) diff --git a/src/gallium/targets/gbm/pipe_i915.c b/src/gallium/targets/gbm/pipe_i915.c index cd74044..85662cb 100644 --- a/src/gallium/targets/gbm/pipe_i915.c +++ b/src/gallium/targets/gbm/pipe_i915.c @@ -24,4 +24,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen) +DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL) diff --git a/src/gallium/targets/gbm/pipe_i965.c b/src/gallium/targets/gbm/pipe_i965.c index f810ecf..1eece9c 100644 --- a/src/gallium/targets/gbm/pipe_i965.c +++ b/src/gallium/targets/gbm/pipe_i965.c @@ -27,4 +27,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("i965", "i965", create_screen) +DRM_DRIVER_DESCRIPTOR("i965", "i965", create_screen, NULL) diff --git a/src/gallium/targets/gbm/pipe_nouveau.c b/src/gallium/targets/gbm/pipe_nouveau.c index 0c9081b..65425e8 100644 --- a/src/gallium/targets/gbm/pipe_nouveau.c +++ b/src/gallium/targets/gbm/pipe_nouveau.c @@ -18,4 +18,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen) +DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, NULL) diff --git a/src/gallium/targets/gbm/pipe_r300.c b/src/gallium/targets/gbm/pipe_r300.c index 09940f0..0556859 100644 --- a/src/gallium/targets/gbm/pipe_r300.c +++ b/src/gallium/targets/gbm/pipe_r300.c @@ -24,4 +24,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen) +DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL) diff --git a/src/gallium/targets/gbm/pipe_r600.c b/src/gallium/targets/gbm/pipe_r600.c index 9f61a51..5d89aca 100644 --- a/src/gallium/targets/gbm/pipe_r600.c +++ b/src/gallium/targets/gbm/pipe_r600.c @@ -23,4 +23,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen) +DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen, NULL) diff --git a/src/gallium/targets/gbm/pipe_swrast.c b/src/gallium/targets/gbm/pipe_swrast.c index b2e3289..092abf0 100644 --- a/src/gallium/targets/gbm/pipe_swrast.c +++ b/src/gallium/targets/gbm/pipe_swrast.c @@ -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) diff --git a/src/gallium/targets/gbm/pipe_vmwgfx.c b/src/gallium/targets/gbm/pipe_vmwgfx.c index 22a28fa..bfe665b 100644 --- a/src/gallium/targets/gbm/pipe_vmwgfx.c +++ b/src/gallium/targets/gbm/pipe_vmwgfx.c @@ -24,4 +24,4 @@ create_screen(int fd) } PUBLIC -DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen) +DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen, NULL) diff --git a/src/gallium/targets/va-r300/target.c b/src/gallium/targets/va-r300/target.c index 9f673bf..2fd7c2f 100644 --- a/src/gallium/targets/va-r300/target.c +++ b/src/gallium/targets/va-r300/target.c @@ -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) diff --git a/src/gallium/targets/va-r600/target.c b/src/gallium/targets/va-r600/target.c index 1b8b681..3b7795b 100644 --- a/src/gallium/targets/va-r600/target.c +++ b/src/gallium/targets/va-r600/target.c @@ -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) diff --git a/src/gallium/targets/vdpau-r300/target.c b/src/gallium/targets/vdpau-r300/target.c index 9f673bf..2fd7c2f 100644 --- a/src/gallium/targets/vdpau-r300/target.c +++ b/src/gallium/targets/vdpau-r300/target.c @@ -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) diff --git a/src/gallium/targets/vdpau-r600/target.c b/src/gallium/targets/vdpau-r600/target.c index 1b8b681..3b7795b 100644 --- a/src/gallium/targets/vdpau-r600/target.c +++ b/src/gallium/targets/vdpau-r600/target.c @@ -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) diff --git a/src/gallium/targets/xa-vmwgfx/vmw_target.c b/src/gallium/targets/xa-vmwgfx/vmw_target.c index 15089d6..1087801 100644 --- a/src/gallium/targets/xa-vmwgfx/vmw_target.c +++ b/src/gallium/targets/xa-vmwgfx/vmw_target.c @@ -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) diff --git a/src/gallium/targets/xorg-i915/intel_target.c b/src/gallium/targets/xorg-i915/intel_target.c index 8c8ef7e..50efa21 100644 --- a/src/gallium/targets/xorg-i915/intel_target.c +++ b/src/gallium/targets/xorg-i915/intel_target.c @@ -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) diff --git a/src/gallium/targets/xorg-i965/intel_target.c b/src/gallium/targets/xorg-i965/intel_target.c index 0632b97..0434063 100644 --- a/src/gallium/targets/xorg-i965/intel_target.c +++ b/src/gallium/targets/xorg-i965/intel_target.c @@ -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) diff --git a/src/gallium/targets/xorg-nouveau/nouveau_target.c b/src/gallium/targets/xorg-nouveau/nouveau_target.c index e725a4d..c0d7f92 100644 --- a/src/gallium/targets/xorg-nouveau/nouveau_target.c +++ b/src/gallium/targets/xorg-nouveau/nouveau_target.c @@ -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) diff --git a/src/gallium/targets/xorg-r300/target.c b/src/gallium/targets/xorg-r300/target.c index b48bcad..a8f8e6e 100644 --- a/src/gallium/targets/xorg-r300/target.c +++ b/src/gallium/targets/xorg-r300/target.c @@ -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) diff --git a/src/gallium/targets/xorg-r600/target.c b/src/gallium/targets/xorg-r600/target.c index 6042435..75785da 100644 --- a/src/gallium/targets/xorg-r600/target.c +++ b/src/gallium/targets/xorg-r600/target.c @@ -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) diff --git a/src/gallium/targets/xvmc-nouveau/target.c b/src/gallium/targets/xvmc-nouveau/target.c index 9b61b03..d580b10 100644 --- a/src/gallium/targets/xvmc-nouveau/target.c +++ b/src/gallium/targets/xvmc-nouveau/target.c @@ -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) diff --git a/src/gallium/targets/xvmc-r300/target.c b/src/gallium/targets/xvmc-r300/target.c index 9f673bf..2fd7c2f 100644 --- a/src/gallium/targets/xvmc-r300/target.c +++ b/src/gallium/targets/xvmc-r300/target.c @@ -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) diff --git a/src/gallium/targets/xvmc-r600/target.c b/src/gallium/targets/xvmc-r600/target.c index 1b8b681..3b7795b 100644 --- a/src/gallium/targets/xvmc-r600/target.c +++ b/src/gallium/targets/xvmc-r600/target.c @@ -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) -- 1.7.4.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev