summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2014-11-17 16:58:28 +0100
committerEmil Velikov <[email protected]>2014-11-18 02:30:18 +0000
commitdf63e76c2c07afc7948fddd100f893853d9a3d4d (patch)
treeca54bbcb91545c5953d716b990cca3a7b58722c8 /src
parentb46e80ae6004b7dfcbd8bc4e32ff51af36defadf (diff)
nine: Add drirc options (v2)
Implements vblank_mode and throttling, which allows us change default ratio between framerate and input lag. Acked-by: Jose Fonseca <[email protected]> Signed-off-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> (cherry picked from commit 948e6c522827b64cfd9b02eb3ab34e7d1f145017)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/nine/adapter9.h1
-rw-r--r--src/gallium/state_trackers/nine/swapchain9.c5
-rw-r--r--src/gallium/targets/d3dadapter9/drm.c35
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/t_options.h13
4 files changed, 54 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/adapter9.h b/src/gallium/state_trackers/nine/adapter9.h
index c743347b6af..4db4f3cfd53 100644
--- a/src/gallium/state_trackers/nine/adapter9.h
+++ b/src/gallium/state_trackers/nine/adapter9.h
@@ -37,6 +37,7 @@ struct d3dadapter9_context
BOOL linear_framebuffer;
BOOL throttling;
int throttling_value;
+ int vblank_mode;
void (*destroy)( struct d3dadapter9_context *ctx );
};
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index b6e81257aba..ce92a3a8966 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -164,6 +164,11 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
if (This->desired_fences > DRI_SWAP_FENCES_MAX)
This->desired_fences = DRI_SWAP_FENCES_MAX;
+ if (This->actx->vblank_mode == 0)
+ pParams->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
+ else if (This->actx->vblank_mode == 3)
+ pParams->PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+
if (mode && This->mode) {
*(This->mode) = *mode;
} else if (mode) {
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index d0b72e07bc2..a58e16715c0 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -36,6 +36,9 @@
#include "d3dadapter/d3dadapter9.h"
#include "d3dadapter/drm.h"
+#include "xmlconfig.h"
+#include "xmlpool.h"
+
#include <libdrm/drm.h>
#include <sys/ioctl.h>
#include <fcntl.h>
@@ -49,6 +52,16 @@
(DWORD)((lo) & 0xFFFF) \
))
+const char __driConfigOptionsNine[] =
+DRI_CONF_BEGIN
+ DRI_CONF_SECTION_PERFORMANCE
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_1)
+ DRI_CONF_SECTION_END
+ DRI_CONF_SECTION_NINE
+ DRI_CONF_NINE_THROTTLE(-2)
+ DRI_CONF_SECTION_END
+DRI_CONF_END;
+
/* Regarding os versions, we should not define our own as that would simply be
* weird. Defaulting to Win2k/XP seems sane considering the origin of D3D9. The
* driver also defaults to being a generic D3D9 driver, which of course only
@@ -229,6 +242,9 @@ drm_create_adapter( int fd,
int i, 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;
#if !GALLIUM_STATIC_TARGETS
const char *paths[] = {
@@ -289,6 +305,25 @@ drm_create_adapter( int fd,
} else
ctx->base.throttling = FALSE;
+ driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine);
+ driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "nine");
+ 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;
+ }
+ }
+
+ if (driCheckOption(&userInitOptions, "vblank_mode", DRI_ENUM))
+ ctx->base.vblank_mode = driQueryOptioni(&userInitOptions, "vblank_mode");
+ else
+ ctx->base.vblank_mode = 1;
+
+ driDestroyOptionCache(&userInitOptions);
+ driDestroyOptionInfo(&defaultInitOptions);
#if GALLIUM_STATIC_TARGETS
ctx->base.ref = ninesw_create_screen(ctx->base.hal);
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index b73a6620ce8..e4f6937d455 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -340,3 +340,16 @@ DRI_CONF_SECTION_BEGIN \
DRI_CONF_OPT_BEGIN(device_id, string, def) \
DRI_CONF_DESC(en,gettext("Define the graphic device to use if possible")) \
DRI_CONF_OPT_END
+
+/**
+ * \brief Gallium-Nine specific configuration options
+ */
+
+#define DRI_CONF_SECTION_NINE \
+DRI_CONF_SECTION_BEGIN \
+ DRI_CONF_DESC(en,gettext("Gallium Nine"))
+
+#define DRI_CONF_NINE_THROTTLE(def) \
+DRI_CONF_OPT_BEGIN(throttle_value, int, def) \
+ DRI_CONF_DESC(en,gettext("Define the throttling value. -1 for no throttling, -2 for default (usually 2), 0 for glfinish behaviour")) \
+DRI_CONF_OPT_END