r600g: condition evergreen dyn gpr resource management
authorDave Airlie <airlied@redhat.com>
Wed, 8 Jun 2011 04:45:31 +0000 (14:45 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 8 Jun 2011 04:50:58 +0000 (14:50 +1000)
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 <airlied@redhat.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/evergreend.h

index ef84db2877e3946681f6c192c29b99b83bb16cfd..1af9d5550d349cfc4d7d36384a4784ebb1fac986 100644 (file)
@@ -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);
index 0de54463bb87a76a104ef7bc101e9c78354f44a9..d795f5757ed170a805bd52e03fd24e3665bfa0a1 100644 (file)
 #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)