X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Ftargets%2Fd3dadapter9%2Fdrm.c;h=819aa59468cd2b86223e63b557792fd29a7dd186;hb=04dc6074cf7f651b720868e0ba24362b585d1b31;hp=e0c2e26c02f6b567c6e7f9d9eafaa989d6f6d4a7;hpb=59048e75489e6a8d1a75ed6b9c869bd96886f75c;p=mesa.git diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c index e0c2e26c02f..819aa59468c 100644 --- a/src/gallium/targets/d3dadapter9/drm.c +++ b/src/gallium/targets/d3dadapter9/drm.c @@ -37,10 +37,10 @@ #include "d3dadapter/d3dadapter9.h" #include "d3dadapter/drm.h" -#include "xmlconfig.h" -#include "xmlpool.h" +#include "util/xmlconfig.h" +#include "util/xmlpool.h" -#include +#include "drm-uapi/drm.h" #include #include #include @@ -58,6 +58,9 @@ DRI_CONF_BEGIN DRI_CONF_NINE_THREADSUBMIT("false") DRI_CONF_NINE_ALLOWDISCARDDELAYEDRELEASE("true") DRI_CONF_NINE_TEARFREEDISCARD("false") + DRI_CONF_NINE_CSMT(-1) + DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND("false") + DRI_CONF_NINE_SHADERINLINECONSTANTS("false") DRI_CONF_SECTION_END DRI_CONF_END; @@ -148,8 +151,8 @@ read_descriptor( struct d3dadapter9_context *ctx, &drvid->SubSysId, &drvid->Revision); snprintf(drvid->DeviceName, sizeof(drvid->DeviceName), "Gallium 0.4 with %s", ctx->hal->get_vendor(ctx->hal)); - strncpy(drvid->Description, ctx->hal->get_name(ctx->hal), - sizeof(drvid->Description)); + snprintf(drvid->Description, sizeof(drvid->Description), + "%s", ctx->hal->get_name(ctx->hal)); if (override_vendorid > 0) { found = FALSE; @@ -162,8 +165,8 @@ read_descriptor( struct d3dadapter9_context *ctx, fallback_cards[i].device_id); drvid->VendorId = fallback_cards[i].vendor_id; drvid->DeviceId = fallback_cards[i].device_id; - strncpy(drvid->Description, fallback_cards[i].name, - sizeof(drvid->Description)); + snprintf(drvid->Description, sizeof(drvid->Description), + "%s", fallback_cards[i].name); found = TRUE; break; } @@ -203,9 +206,7 @@ drm_create_adapter( int fd, { struct d3dadapter9drm_context *ctx = CALLOC_STRUCT(d3dadapter9drm_context); HRESULT hr; - int different_device; - const struct drm_conf_ret *throttle_ret = NULL; - const struct drm_conf_ret *dmabuf_ret = NULL; + bool different_device; driOptionCache defaultInitOptions; driOptionCache userInitOptions; int throttling_value_user = -2; @@ -219,7 +220,7 @@ drm_create_adapter( int fd, * takes ownership of it. */ fd = loader_get_user_preferred_fd(fd, &different_device); ctx->fd = fd; - ctx->base.linear_framebuffer = !!different_device; + ctx->base.linear_framebuffer = different_device; if (!pipe_loader_drm_probe_fd(&ctx->dev, fd)) { ERR("Failed to probe drm fd %d.\n", fd); @@ -235,23 +236,22 @@ drm_create_adapter( int fd, 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) { + if (!ctx->base.hal->get_param(ctx->base.hal, PIPE_CAP_DMABUF)) { 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; + /* Previously was set to PIPE_CAP_MAX_FRAMES_IN_FLIGHT, + * but the change of value of this cap to 1 seems to cause + * regressions. */ + ctx->base.throttling_value = 2; + ctx->base.throttling = ctx->base.throttling_value > 0; driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine); - driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "nine"); + driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, + "nine", NULL, NULL, 0); if (driCheckOption(&userInitOptions, "throttle_value", DRI_INT)) { throttling_value_user = driQueryOptioni(&userInitOptions, "throttle_value"); if (throttling_value_user == -1) @@ -270,17 +270,7 @@ drm_create_adapter( int fd, if (driCheckOption(&userInitOptions, "thread_submit", DRI_BOOL)) ctx->base.thread_submit = driQueryOptionb(&userInitOptions, "thread_submit"); else - ctx->base.thread_submit = !!different_device; - - if (ctx->base.thread_submit && (throttling_value_user == -2 || throttling_value_user == 0)) { - ctx->base.throttling_value = 0; - } else if (ctx->base.thread_submit) { - DBG("You have set a non standard throttling value in combination with thread_submit." - "We advise to use a throttling value of -2/0"); - } - if (ctx->base.thread_submit && !different_device) - DBG("You have set thread_submit but do not use a different device than the server." - "You should not expect any benefit."); + ctx->base.thread_submit = different_device; if (driCheckOption(&userInitOptions, "override_vendorid", DRI_INT)) { override_vendorid = driQueryOptioni(&userInitOptions, "override_vendorid"); @@ -301,6 +291,21 @@ drm_create_adapter( int fd, ctx->base.tearfree_discard = FALSE; } + if (driCheckOption(&userInitOptions, "csmt_force", DRI_INT)) + ctx->base.csmt_force = driQueryOptioni(&userInitOptions, "csmt_force"); + else + ctx->base.csmt_force = -1; + + if (driCheckOption(&userInitOptions, "dynamic_texture_workaround", DRI_BOOL)) + ctx->base.dynamic_texture_workaround = driQueryOptionb(&userInitOptions, "dynamic_texture_workaround"); + else + ctx->base.dynamic_texture_workaround = FALSE; + + if (driCheckOption(&userInitOptions, "shader_inline_constants", DRI_BOOL)) + ctx->base.shader_inline_constants = driQueryOptionb(&userInitOptions, "shader_inline_constants"); + else + ctx->base.shader_inline_constants = FALSE; + driDestroyOptionCache(&userInitOptions); driDestroyOptionInfo(&defaultInitOptions);