summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/target-helpers/drm_helper.h7
-rw-r--r--src/gallium/auxiliary/util/u_screen.c1
-rw-r--r--src/gallium/docs/source/screen.rst3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c3
-rw-r--r--src/gallium/drivers/i915/i915_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.c3
-rw-r--r--src/gallium/drivers/r300/r300_screen.c3
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c3
-rw-r--r--src/gallium/drivers/radeonsi/si_get.c3
-rw-r--r--src/gallium/drivers/svga/svga_screen.c2
-rw-r--r--src/gallium/include/pipe/p_defines.h1
-rw-r--r--src/gallium/include/state_tracker/drm_driver.h4
-rw-r--r--src/gallium/state_trackers/dri/dri2.c8
-rw-r--r--src/gallium/targets/d3dadapter9/drm.c10
-rw-r--r--src/gallium/targets/pipe-loader/pipe_i915.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_msm.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_nouveau.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_r300.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_r600.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_radeonsi.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_vmwgfx.c7
23 files changed, 37 insertions, 72 deletions
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h
index b98e17c3d9a..a89c47e4861 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper.h
@@ -7,11 +7,6 @@
#include "state_tracker/drm_driver.h"
#include "util/xmlpool.h"
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -21,8 +16,6 @@ const struct drm_conf_ret *
pipe_default_configuration_query(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default:
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index cbafcaa3e5f..46aae302520 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -352,6 +352,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
return 0;
case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
return 0;
default:
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index fcb16aebe2d..60184116312 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -516,6 +516,9 @@ The integer capabilities:
A driver might rely on the input mapping that was defined with the original
GLSL code.
* ``PIPE_CAP_IMAGE_LOAD_FORMATTED``: True if a format for image loads does not need to be specified in the shader IR
+* ``PIPE_CAP_MAX_FRAMES_IN_FLIGHT``: Maximum number of frames that state
+ trackers should allow to be in flight before throttling pipe_context
+ execution. 0 = throttling is disabled.
.. _pipe_capf:
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index fdf26390718..38a459e73aa 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -380,6 +380,9 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
/* only a4xx, requires new enough kernel so we know max_freq: */
return (screen->max_freq > 0) && (is_a4xx(screen) || is_a5xx(screen) || is_a6xx(screen));
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_VENDOR_ID:
return 0x5143;
case PIPE_CAP_DEVICE_ID:
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 78707c66e62..62ff5f89198 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -341,6 +341,9 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
return 0;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_MAX_GS_INVOCATIONS:
return 32;
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index b5dc033bd2d..e6e7fac2a44 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -249,6 +249,9 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_IMAGE_LOAD_FORMATTED:
return 0;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_MAX_GS_INVOCATIONS:
return 32;
case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 423b6af3b64..c439f507c1d 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -321,6 +321,9 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_IMAGE_LOAD_FORMATTED:
return 0;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_VENDOR_ID:
return 0x10de;
case PIPE_CAP_DEVICE_ID: {
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 79224ac99a7..930da324794 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -355,6 +355,9 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_IMAGE_LOAD_FORMATTED:
return 0;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_VENDOR_ID:
return 0x10de;
case PIPE_CAP_DEVICE_ID: {
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index be0b475e5ef..6b77d188433 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -307,6 +307,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_VARYINGS:
return 10;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_VENDOR_ID:
return 0x1002;
case PIPE_CAP_DEVICE_ID:
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 41a878ab9d2..9cef7c79cbd 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -398,6 +398,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
return 8;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
/* Unsupported features. */
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
index eddb383c270..a6d558a735f 100644
--- a/src/gallium/drivers/radeonsi/si_get.c
+++ b/src/gallium/drivers/radeonsi/si_get.c
@@ -306,6 +306,9 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
+
case PIPE_CAP_VENDOR_ID:
return ATI_VENDOR_ID;
case PIPE_CAP_DEVICE_ID:
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 6cb5a14f5b0..ceaf388c7db 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -479,6 +479,8 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_PACKED_UNIFORMS:
case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
return 0;
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
+ return 2;
case PIPE_CAP_MAX_GS_INVOCATIONS:
return 32;
case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 304c3dcb2bb..1760fc2f101 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -880,6 +880,7 @@ enum pipe_cap
PIPE_CAP_COMPUTE_SHADER_DERIVATIVES,
PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS,
PIPE_CAP_IMAGE_LOAD_FORMATTED,
+ PIPE_CAP_MAX_FRAMES_IN_FLIGHT,
};
/**
diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h
index 19cd19f26e1..8094734b672 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -15,8 +15,6 @@ struct pipe_resource;
* Configuration queries.
*/
enum drm_conf {
- /* How many frames to allow before throttling. Or -1 to indicate any number */
- DRM_CONF_THROTTLE, /* DRM_CONF_INT. */
/* Can this driver, running on this kernel, import and export dma-buf fds? */
DRM_CONF_SHARE_FD, /* DRM_CONF_BOOL. */
/* XML string describing the available config options. */
@@ -28,7 +26,6 @@ enum drm_conf {
* Type of configuration answer
*/
enum drm_conf_type {
- DRM_CONF_INT,
DRM_CONF_BOOL,
DRM_CONF_FLOAT,
DRM_CONF_POINTER
@@ -40,7 +37,6 @@ enum drm_conf_type {
struct drm_conf_ret {
enum drm_conf_type type;
union {
- int val_int;
bool val_bool;
float val_float;
void *val_pointer;
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 7edef415505..2a4a6ac6dad 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1908,7 +1908,6 @@ dri2_init_screen(__DRIscreen * sPriv)
const __DRIconfig **configs;
struct dri_screen *screen;
struct pipe_screen *pscreen = NULL;
- const struct drm_conf_ret *throttle_ret;
const struct drm_conf_ret *dmabuf_ret;
screen = CALLOC_STRUCT(dri_screen);
@@ -1930,11 +1929,10 @@ dri2_init_screen(__DRIscreen * sPriv)
if (!pscreen)
goto release_pipe;
- throttle_ret = pipe_loader_configuration(screen->dev, DRM_CONF_THROTTLE);
- dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
+ screen->default_throttle_frames =
+ pscreen->get_param(pscreen, PIPE_CAP_MAX_FRAMES_IN_FLIGHT);
- if (throttle_ret && throttle_ret->val.val_int > 0)
- screen->default_throttle_frames = throttle_ret->val.val_int;
+ dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
if (pscreen->resource_create_with_modifiers)
dri2ImageExtension.createImageWithModifiers =
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index 1d01d4a067c..1c8460f7f03 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -205,7 +205,6 @@ drm_create_adapter( int fd,
struct d3dadapter9drm_context *ctx = CALLOC_STRUCT(d3dadapter9drm_context);
HRESULT hr;
bool different_device;
- const struct drm_conf_ret *throttle_ret = NULL;
const struct drm_conf_ret *dmabuf_ret = NULL;
driOptionCache defaultInitOptions;
driOptionCache userInitOptions;
@@ -237,7 +236,6 @@ drm_create_adapter( int fd,
}
dmabuf_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_SHARE_FD);
- throttle_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_THROTTLE);
if (!dmabuf_ret || !dmabuf_ret->val.val_bool) {
ERR("The driver is not capable of dma-buf sharing."
"Abandon to load nine state tracker\n");
@@ -245,11 +243,9 @@ drm_create_adapter( int fd,
return D3DERR_DRIVERINTERNALERROR;
}
- if (throttle_ret && throttle_ret->val.val_int != -1) {
- ctx->base.throttling = TRUE;
- ctx->base.throttling_value = throttle_ret->val.val_int;
- } else
- ctx->base.throttling = FALSE;
+ ctx->base.throttling_value =
+ ctx->base.hal->get_param(ctx->base.hal, PIPE_CAP_MAX_FRAMES_IN_FLIGHT);
+ ctx->base.throttling = ctx->base.throttling_value > 0;
driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine);
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "nine", NULL);
diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c b/src/gallium/targets/pipe-loader/pipe_i915.c
index 8524a1dc58f..841990e0e23 100644
--- a/src/gallium/targets/pipe-loader/pipe_i915.c
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -23,11 +23,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -36,8 +31,6 @@ static const struct drm_conf_ret share_fd_ret = {
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default:
diff --git a/src/gallium/targets/pipe-loader/pipe_msm.c b/src/gallium/targets/pipe-loader/pipe_msm.c
index 683332579fe..eb38be586ac 100644
--- a/src/gallium/targets/pipe-loader/pipe_msm.c
+++ b/src/gallium/targets/pipe-loader/pipe_msm.c
@@ -17,11 +17,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -30,8 +25,6 @@ static const struct drm_conf_ret share_fd_ret = {
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default:
diff --git a/src/gallium/targets/pipe-loader/pipe_nouveau.c b/src/gallium/targets/pipe-loader/pipe_nouveau.c
index d95aeda529b..ead5a182738 100644
--- a/src/gallium/targets/pipe-loader/pipe_nouveau.c
+++ b/src/gallium/targets/pipe-loader/pipe_nouveau.c
@@ -17,11 +17,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -30,8 +25,6 @@ static const struct drm_conf_ret share_fd_ret = {
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default:
diff --git a/src/gallium/targets/pipe-loader/pipe_r300.c b/src/gallium/targets/pipe-loader/pipe_r300.c
index 8aa1ba8735c..2a03580223d 100644
--- a/src/gallium/targets/pipe-loader/pipe_r300.c
+++ b/src/gallium/targets/pipe-loader/pipe_r300.c
@@ -13,11 +13,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return sws ? debug_screen_wrap(sws->screen) : NULL;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -26,8 +21,6 @@ static const struct drm_conf_ret share_fd_ret = {
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default:
diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c b/src/gallium/targets/pipe-loader/pipe_r600.c
index a6051aa2258..a35e0a6179f 100644
--- a/src/gallium/targets/pipe-loader/pipe_r600.c
+++ b/src/gallium/targets/pipe-loader/pipe_r600.c
@@ -13,11 +13,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return rw ? debug_screen_wrap(rw->screen) : NULL;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -26,8 +21,6 @@ static const struct drm_conf_ret share_fd_ret = {
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default:
diff --git a/src/gallium/targets/pipe-loader/pipe_radeonsi.c b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
index 2defc521b24..947c9e1990e 100644
--- a/src/gallium/targets/pipe-loader/pipe_radeonsi.c
+++ b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
@@ -20,11 +20,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return rw ? debug_screen_wrap(rw->screen) : NULL;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -39,8 +34,6 @@ static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
};
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
case DRM_CONF_XML_OPTIONS:
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
index 68bf92ce82e..3b8c748594c 100644
--- a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -23,11 +23,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret throttle_ret = {
- .type = DRM_CONF_INT,
- .val.val_int = 2,
-};
-
static const struct drm_conf_ret share_fd_ret = {
.type = DRM_CONF_BOOL,
.val.val_bool = true,
@@ -36,8 +31,6 @@ static const struct drm_conf_ret share_fd_ret = {
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
default: