summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/drm
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2011-10-12 11:00:12 +0200
committerThomas Hellstrom <[email protected]>2011-10-14 09:53:11 +0200
commitbde2fc5a7123829dc87d3761934627555be4446f (patch)
tree88c4102c436b29f53d081859bdcb403783d199bf /src/gallium/state_trackers/dri/drm
parentec7d5b8c021f655d49df4ba1ed2038ee423f9d5e (diff)
st/dri: Hook up throttling based on the drm driver_descriptor configuration
Hooks up throttling if there is a configuration function present and it indicates that throttling is desired. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri/drm')
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 2b6919ddd0b..f3c9e1053cb 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -623,6 +623,19 @@ static const __DRIextension *dri_screen_extensions[] = {
NULL
};
+static const __DRIextension *dri_screen_extensions_throttle[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driMediaStreamCounterExtension.base,
+ &driTexBufferExtension.base,
+ &dri2FlushExtension.base,
+ &dri2ImageExtension.base,
+ &dri2ConfigQueryExtension.base,
+ &dri2ThrottleExtension.base,
+ NULL
+};
+
/**
* This is the driver specific part of the createNewScreen entry point.
*
@@ -634,6 +647,7 @@ dri2_init_screen(__DRIscreen * sPriv)
const __DRIconfig **configs;
struct dri_screen *screen;
struct pipe_screen *pscreen;
+ const struct drm_conf_ret *throttle_ret = NULL;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -643,9 +657,17 @@ dri2_init_screen(__DRIscreen * sPriv)
screen->fd = sPriv->fd;
sPriv->private = (void *)screen;
- sPriv->extensions = dri_screen_extensions;
pscreen = driver_descriptor.create_screen(screen->fd);
+ if (driver_descriptor.configuration)
+ throttle_ret = driver_descriptor.configuration(DRM_CONF_THROTTLE);
+
+ if (throttle_ret && throttle_ret->val.val_int != -1) {
+ sPriv->extensions = dri_screen_extensions_throttle;
+ screen->default_throttle_frames = throttle_ret->val.val_int;
+ } else
+ sPriv->extensions = dri_screen_extensions;
+
/* dri_init_screen_helper checks pscreen for us */
configs = dri_init_screen_helper(screen, pscreen, 32);