From ec7d5b8c021f655d49df4ba1ed2038ee423f9d5e Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 12 Oct 2011 10:29:24 +0200 Subject: [PATCH] drm_driver: Add a configuration function to the driver descriptor. Adds a possibility for the state tracker manager to query the target for a specific configuration. Signed-off-by: Thomas Hellstrom Reviewed-by: Jakob Bornecrantz --- .../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 +- .../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 d94c1e6a7cf..2df28599fe8 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 a27b7bd6d81..935eb0ebdd7 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 0632b97beaa..0434063f20f 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 e725a4d9b7a..c0d7f92e33f 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 9b6d816fb62..07b07051cc9 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 1b8b6816ec1..3b7795b3507 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 da50b8b8bda..fe3f8fd05b2 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 cd74044d8c1..85662cb85b5 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 f810ecffb0a..1eece9ce4b4 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 0c9081bc713..65425e8d456 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 09940f0a194..055685996e6 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 9f61a51404a..5d89aca6ec3 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 b2e3289c5d3..092abf07a52 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 22a28fa858a..bfe665be6eb 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 9f673bf17e6..2fd7c2f6102 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 1b8b6816ec1..3b7795b3507 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 9f673bf17e6..2fd7c2f6102 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 1b8b6816ec1..3b7795b3507 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 15089d6db26..1087801ef78 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 8c8ef7e02b4..50efa21b1f7 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 0632b97beaa..0434063f20f 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 e725a4d9b7a..c0d7f92e33f 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 b48bcad3710..a8f8e6e1bd1 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 60424359a7b..75785da6e9b 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 9b61b036d26..d580b104421 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 9f673bf17e6..2fd7c2f6102 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 1b8b6816ec1..3b7795b3507 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) -- 2.30.2