#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,
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:
return 0;
case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
return 0;
default:
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:
/* 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:
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_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:
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: {
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: {
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:
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:
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:
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:
PIPE_CAP_COMPUTE_SHADER_DERIVATIVES,
PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS,
PIPE_CAP_IMAGE_LOAD_FORMATTED,
+ PIPE_CAP_MAX_FRAMES_IN_FLIGHT,
};
/**
* 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. */
* Type of configuration answer
*/
enum drm_conf_type {
- DRM_CONF_INT,
DRM_CONF_BOOL,
DRM_CONF_FLOAT,
DRM_CONF_POINTER
struct drm_conf_ret {
enum drm_conf_type type;
union {
- int val_int;
bool val_bool;
float val_float;
void *val_pointer;
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);
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 =
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;
}
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");
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);
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,
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:
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,
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:
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,
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:
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,
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:
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,
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:
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,
};
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
case DRM_CONF_XML_OPTIONS:
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,
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: