From 190bfea2deb9a3440aa35469f8651c0e8af377c7 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 8 Jun 2011 14:45:31 +1000 Subject: [PATCH] r600g: condition evergreen dyn gpr resource management So only with kernel version 2.7 can this work, thanks to Alex for pointing that out. Also add a workaround for a hw bug. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/evergreen_state.c | 29 ++++++++++++++++++++-- src/gallium/drivers/r600/evergreend.h | 6 +++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index ef84db2877e..1af9d5550d3 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1375,8 +1375,33 @@ void evergreen_init_config(struct r600_pipe_context *rctx) tmp |= S_008C00_ES_PRIO(es_prio); r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_008C10_SQ_GLOBAL_GPR_RESOURCE_MGMT_1, (4 << 28), 0xFFFFFFFF, NULL); - r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, (1 << 8), 0xFFFFFFFF, NULL); + /* enable dynamic GPR resource management */ + if (r600_get_minor_version(rctx->radeon) >= 7) { + r600_pipe_state_add_reg(rstate, R_008C10_SQ_GLOBAL_GPR_RESOURCE_MGMT_1, (4 << 28), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, (1 << 8), 0xFFFFFFFF, NULL); + r600_pipe_state_add_reg(rstate, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, + S_028838_PS_GPRS(0x1e) | + S_028838_VS_GPRS(0x1e) | + S_028838_GS_GPRS(0x1e) | + S_028838_ES_GPRS(0x1e) | + S_028838_HS_GPRS(0x1e) | + S_028838_LS_GPRS(0x1e), 0xFFFFFFFF, NULL); /* workaround for hw issues with dyn gpr - must set all limits to 240 instead of 0, 0x1e == 240 / 8*/ + } else { + tmp = 0; + tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); + tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); + tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs); + r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs); + tmp |= S_008C08_NUM_ES_GPRS(num_es_gprs); + r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL); + + tmp = 0; + tmp |= S_008C0C_NUM_HS_GPRS(num_hs_gprs); + tmp |= S_008C0C_NUM_HS_GPRS(num_ls_gprs); + } tmp = 0; tmp |= S_008C18_NUM_PS_THREADS(num_ps_threads); diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index 0de54463bb8..d795f5757ed 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -1641,6 +1641,12 @@ #define R_028818_PA_CL_VTE_CNTL 0x00028818 #define R_028820_PA_CL_NANINF_CNTL 0x00028820 #define R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1 0x00028838 +#define S_028838_PS_GPRS(x) (((x) & 0x1F) << 0) +#define S_028838_VS_GPRS(x) (((x) & 0x1F) << 5) +#define S_028838_GS_GPRS(x) (((x) & 0x1F) << 10) +#define S_028838_ES_GPRS(x) (((x) & 0x1F) << 15) +#define S_028838_HS_GPRS(x) (((x) & 0x1F) << 20) +#define S_028838_LS_GPRS(x) (((x) & 0x1F) << 25) #define R_028840_SQ_PGM_START_PS 0x00028840 #define R_02884C_SQ_PGM_EXPORTS_PS 0x0002884C #define S_02884C_EXPORT_COLORS(x) (((x) & 0xF) << 1) -- 2.30.2