From 948e6c522827b64cfd9b02eb3ab34e7d1f145017 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Mon, 17 Nov 2014 16:58:28 +0100 Subject: 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 Signed-off-by: David Heidelberg Signed-off-by: Axel Davy --- src/gallium/targets/d3dadapter9/drm.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/gallium/targets/d3dadapter9/drm.c') 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 #include #include @@ -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); -- cgit v1.2.3