[Mesa-dev] [PATCH 3/5] gallium: replace DRM_CONF_THROTTLE with PIPE_CAP_MAX_FRAMES_IN_FLIGHT
Marek Olšák
maraeo at gmail.com
Tue Apr 23 01:29:44 UTC 2019
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/target-helpers/drm_helper.h | 7 -------
src/gallium/auxiliary/util/u_screen.c | 1 +
src/gallium/docs/source/screen.rst | 3 +++
src/gallium/drivers/freedreno/freedreno_screen.c | 3 +++
src/gallium/drivers/i915/i915_screen.c | 3 +++
src/gallium/drivers/nouveau/nv30/nv30_screen.c | 3 +++
src/gallium/drivers/nouveau/nv50/nv50_screen.c | 3 +++
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 3 +++
src/gallium/drivers/r300/r300_screen.c | 3 +++
src/gallium/drivers/r600/r600_pipe.c | 3 +++
src/gallium/drivers/radeonsi/si_get.c | 3 +++
src/gallium/drivers/svga/svga_screen.c | 2 ++
src/gallium/include/pipe/p_defines.h | 1 +
src/gallium/include/state_tracker/drm_driver.h | 4 ----
src/gallium/state_trackers/dri/dri2.c | 8 +++-----
src/gallium/targets/d3dadapter9/drm.c | 10 +++-------
src/gallium/targets/pipe-loader/pipe_i915.c | 7 -------
src/gallium/targets/pipe-loader/pipe_msm.c | 7 -------
src/gallium/targets/pipe-loader/pipe_nouveau.c | 7 -------
src/gallium/targets/pipe-loader/pipe_r300.c | 7 -------
src/gallium/targets/pipe-loader/pipe_r600.c | 7 -------
src/gallium/targets/pipe-loader/pipe_radeonsi.c | 7 -------
src/gallium/targets/pipe-loader/pipe_vmwgfx.c | 7 -------
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
@@ -1,35 +1,28 @@
#ifndef DRM_HELPER_H
#define DRM_HELPER_H
#include <stdio.h>
#include "target-helpers/inline_debug_helper.h"
#include "target-helpers/drm_helper_public.h"
#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,
};
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:
break;
}
return NULL;
}
#ifdef GALLIUM_I915
#include "i915/drm/i915_drm_public.h"
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index c5e264d2673..6864c76c355 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -345,16 +345,17 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_DEST_SURFACE_SRGB_CONTROL:
return 1;
case PIPE_CAP_MAX_VARYINGS:
return 8;
case PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK:
return 0;
case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:
+ case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
return 0;
default:
unreachable("bad PIPE_CAP_*");
}
}
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 41008816ee2..20ee9a29c34 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -509,20 +509,23 @@ The integer capabilities:
* ``PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK``: Whether pipe_grid_info::last_block
is implemented by the driver. See struct pipe_grid_info for more details.
* ``PIPE_CAP_COMPUTE_SHADER_DERIVATIVE``: True if the driver supports derivatives (and texture lookups with implicit derivatives) in compute shaders.
* ``PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS``: Whether the TGSI pass to shrink IO
arrays should be skipped and enforce keeping the declared array sizes instead.
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_PREFER_COMPUTE_BLIT_FOR_MULTIMEDIA``: Whether VDPAU, VAAPI, and
OpenMAX should use a compute-based blit instead of pipe_context::blit.
+* ``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:
PIPE_CAPF_*
^^^^^^^^^^^^^^^^
The floating-point capabilities are:
* ``PIPE_CAPF_MAX_LINE_WIDTH``: The maximum width of a regular line.
* ``PIPE_CAPF_MAX_LINE_WIDTH_AA``: The maximum width of a smoothed line.
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 40dc16f82cd..69264dbd741 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -371,20 +371,23 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return is_a3xx(screen) ? 1 : 0;
/* Queries. */
case PIPE_CAP_OCCLUSION_QUERY:
return is_a3xx(screen) || is_a4xx(screen) || is_a5xx(screen) || is_a6xx(screen);
case PIPE_CAP_QUERY_TIMESTAMP:
case PIPE_CAP_QUERY_TIME_ELAPSED:
/* 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:
return 0xFFFFFFFF;
case PIPE_CAP_ACCELERATED:
return 1;
case PIPE_CAP_VIDEO_MEMORY:
DBG("FINISHME: The value returned is incorrect\n");
return 10;
case PIPE_CAP_UMA:
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
@@ -334,20 +334,23 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
case PIPE_CAP_CONTEXT_PRIORITY_MASK:
case PIPE_CAP_FENCE_SIGNAL:
case PIPE_CAP_CONSTBUF0_FLAGS:
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:
return 1 << 27;
case PIPE_CAP_MAX_VIEWPORTS:
return 1;
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
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
@@ -242,20 +242,23 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES:
case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES:
case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES:
case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES:
case PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE:
case PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS:
case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
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:
return 1 << 27;
case PIPE_CAP_VENDOR_ID:
return 0x10de;
case PIPE_CAP_DEVICE_ID: {
uint64_t device_id;
if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) {
NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n");
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
@@ -314,20 +314,23 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_SURFACE_SAMPLE_COUNT:
case PIPE_CAP_TGSI_ATOMFADD:
case PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS:
case PIPE_CAP_NIR_COMPACT_ARRAYS:
case PIPE_CAP_COMPUTE:
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: {
uint64_t device_id;
if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) {
NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n");
return -1;
}
return 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
@@ -348,20 +348,23 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTERS:
case PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER_BUFFERS:
case PIPE_CAP_SURFACE_SAMPLE_COUNT:
case PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE:
case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
case PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS:
case PIPE_CAP_NIR_COMPACT_ARRAYS:
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: {
uint64_t device_id;
if (nouveau_getparam(dev, NOUVEAU_GETPARAM_PCI_DEVICE, &device_id)) {
NOUVEAU_ERR("NOUVEAU_GETPARAM_PCI_DEVICE failed.\n");
return -1;
}
return 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
@@ -300,20 +300,23 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_VIEWPORTS:
return 1;
case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
return 2048;
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:
return r300screen->info.pci_id;
case PIPE_CAP_ACCELERATED:
return 1;
case PIPE_CAP_VIDEO_MEMORY:
return r300screen->info.vram_size >> 20;
case PIPE_CAP_UMA:
return 0;
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
@@ -391,20 +391,23 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_GS_INVOCATIONS:
return 32;
/* shader buffer objects */
case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
return 1 << 27;
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_TGSI_CAN_COMPACT_CONSTANTS:
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
case PIPE_CAP_USER_VERTEX_BUFFERS:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_DEPTH_BOUNDS_TEST:
diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
index d96a11db003..37a7afeedf7 100644
--- a/src/gallium/drivers/radeonsi/si_get.c
+++ b/src/gallium/drivers/radeonsi/si_get.c
@@ -307,20 +307,23 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MIN_TEXEL_OFFSET:
return -32;
case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
case PIPE_CAP_MAX_TEXEL_OFFSET:
return 31;
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:
return sscreen->info.pci_id;
case PIPE_CAP_VIDEO_MEMORY:
return sscreen->info.vram_size >> 20;
case PIPE_CAP_PCI_GROUP:
return sscreen->info.pci_domain;
case PIPE_CAP_PCI_BUS:
return sscreen->info.pci_bus;
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
@@ -472,20 +472,22 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TILE_RASTER_ORDER:
case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
case PIPE_CAP_CONTEXT_PRIORITY_MASK:
case PIPE_CAP_FENCE_SIGNAL:
case PIPE_CAP_CONSTBUF0_FLAGS:
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:
return 1 << 27;
default:
return u_pipe_screen_get_param_defaults(screen, param);
}
}
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 72dc448aecc..e626193ccaf 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -873,20 +873,21 @@ enum pipe_cap
PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE,
PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND,
PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
PIPE_CAP_NIR_COMPACT_ARRAYS,
PIPE_CAP_MAX_VARYINGS,
PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK,
PIPE_CAP_COMPUTE_SHADER_DERIVATIVES,
PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS,
PIPE_CAP_IMAGE_LOAD_FORMATTED,
PIPE_CAP_PREFER_COMPUTE_BLIT_FOR_MULTIMEDIA,
+ PIPE_CAP_MAX_FRAMES_IN_FLIGHT,
};
/**
* Possible bits for PIPE_CAP_CONTEXT_PRIORITY_MASK param, which should
* return a bitmask of the supported priorities. If the driver does not
* support prioritized contexts, it can return 0.
*
* Note that these match __DRI2_RENDER_HAS_CONTEXT_PRIORITY_*
*/
#define PIPE_CONTEXT_PRIORITY_LOW (1 << 0)
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
@@ -8,46 +8,42 @@
struct pipe_screen;
struct pipe_screen_config;
struct pipe_context;
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. */
DRM_CONF_XML_OPTIONS, /* DRM_CONF_POINTER */
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
{
/**
* Identifying prefix/suffix of the binary, used by the pipe-loader.
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
@@ -1901,21 +1901,20 @@ static const __DRIextension *dri_robust_screen_extensions[] = {
* This is the driver specific part of the createNewScreen entry point.
*
* Returns the struct gl_config supported by this driver.
*/
static const __DRIconfig **
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);
if (!screen)
return NULL;
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
(void) mtx_init(&screen->opencl_func_mutex, mtx_plain);
@@ -1923,25 +1922,24 @@ dri2_init_screen(__DRIscreen * sPriv)
if (pipe_loader_drm_probe_fd(&screen->dev, screen->fd)) {
dri_init_options(screen);
pscreen = pipe_loader_create_screen(screen->dev);
}
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 =
dri2_create_image_with_modifiers;
if (dmabuf_ret && dmabuf_ret->val.val_bool) {
uint64_t cap;
if (drmGetCap(sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
(cap & DRM_PRIME_CAP_IMPORT)) {
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
@@ -198,21 +198,20 @@ read_descriptor( struct d3dadapter9_context *ctx,
drvid->DeviceIdentifier.Data4[7] = 0x81;
}
static HRESULT WINAPI
drm_create_adapter( int fd,
ID3DAdapter9 **ppAdapter )
{
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;
int throttling_value_user = -2;
int override_vendorid = -1;
if (!ctx) { return E_OUTOFMEMORY; }
ctx->base.destroy = drm_destroy;
@@ -230,33 +229,30 @@ drm_create_adapter( int fd,
}
ctx->base.hal = pipe_loader_create_screen(ctx->dev);
if (!ctx->base.hal) {
ERR("Unable to load requested driver.\n");
drm_destroy(&ctx->base);
return D3DERR_DRIVERINTERNALERROR;
}
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");
drm_destroy(&ctx->base);
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);
if (driCheckOption(&userInitOptions, "throttle_value", DRI_INT)) {
throttling_value_user = driQueryOptioni(&userInitOptions, "throttle_value");
if (throttling_value_user == -1)
ctx->base.throttling = FALSE;
else if (throttling_value_user >= 0) {
ctx->base.throttling = TRUE;
ctx->base.throttling_value = throttling_value_user;
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
@@ -16,35 +16,28 @@ create_screen(int fd, const struct pipe_screen_config *config)
screen = i915_screen_create(iws);
if (!screen)
return NULL;
screen = debug_screen_wrap(screen);
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:
break;
}
return NULL;
}
PUBLIC
DRM_DRIVER_DESCRIPTOR("i915", create_screen, drm_configuration)
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
@@ -10,35 +10,28 @@ create_screen(int fd, const struct pipe_screen_config *config)
screen = fd_drm_screen_create(fd, NULL);
if (!screen)
return NULL;
screen = debug_screen_wrap(screen);
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:
break;
}
return NULL;
}
PUBLIC
DRM_DRIVER_DESCRIPTOR("msm", create_screen, drm_configuration)
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
@@ -10,35 +10,28 @@ create_screen(int fd, const struct pipe_screen_config *config)
screen = nouveau_drm_screen_create(fd);
if (!screen)
return NULL;
screen = debug_screen_wrap(screen);
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:
break;
}
return NULL;
}
PUBLIC
DRM_DRIVER_DESCRIPTOR("nouveau", create_screen, drm_configuration)
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
@@ -6,35 +6,28 @@
static struct pipe_screen *
create_screen(int fd, const struct pipe_screen_config *config)
{
struct radeon_winsys *sws;
sws = radeon_drm_winsys_create(fd, config, r300_screen_create);
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:
break;
}
return NULL;
}
PUBLIC
DRM_DRIVER_DESCRIPTOR("r300", create_screen, drm_configuration)
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
@@ -6,35 +6,28 @@
static struct pipe_screen *
create_screen(int fd, const struct pipe_screen_config *config)
{
struct radeon_winsys *rw;
rw = radeon_drm_winsys_create(fd, config, r600_screen_create);
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:
break;
}
return NULL;
}
PUBLIC
DRM_DRIVER_DESCRIPTOR("r600", create_screen, drm_configuration)
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
@@ -13,41 +13,34 @@ create_screen(int fd, const struct pipe_screen_config *config)
/* First, try amdgpu. */
rw = amdgpu_winsys_create(fd, config, radeonsi_screen_create);
if (!rw)
rw = radeon_drm_winsys_create(fd, config, radeonsi_screen_create);
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)
{
static const struct drm_conf_ret xml_options_ret = {
.type = DRM_CONF_POINTER,
.val.val_pointer =
#include "radeonsi/si_driinfo.h"
};
switch (conf) {
- case DRM_CONF_THROTTLE:
- return &throttle_ret;
case DRM_CONF_SHARE_FD:
return &share_fd_ret;
case DRM_CONF_XML_OPTIONS:
return &xml_options_ret;
default:
break;
}
return NULL;
}
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
@@ -16,35 +16,28 @@ create_screen(int fd, const struct pipe_screen_config *config)
screen = svga_screen_create(sws);
if (!screen)
return NULL;
screen = debug_screen_wrap(screen);
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:
break;
}
return NULL;
}
PUBLIC
DRM_DRIVER_DESCRIPTOR("vmwgfx", create_screen, drm_configuration)
--
2.17.1
More information about the mesa-dev
mailing list