summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.c4
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.h1
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c24
3 files changed, 27 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index ca9e1307db9..340404e6aa4 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -137,7 +137,9 @@ dri_create_buffer(__DRIscreen * sPriv,
drawable->screen = screen;
drawable->sPriv = sPriv;
drawable->dPriv = dPriv;
- drawable->desired_fences = 2;
+ drawable->desired_fences = screen->default_throttle_frames;
+ if (drawable->desired_fences > DRI_SWAP_FENCES_MAX)
+ drawable->desired_fences = DRI_SWAP_FENCES_MAX;
dPriv->driverPrivate = (void *)drawable;
p_atomic_set(&drawable->base.stamp, 1);
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h
index 8cb0a102c8d..4e865b9c551 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -54,6 +54,7 @@ struct dri_screen
/* dri */
__DRIscreen *sPriv;
+ int default_throttle_frames;
/**
* Configuration cache with default values for all contexts
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);