aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/evergreen.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-10-21 13:31:38 -0400
committerDave Airlie <airlied@redhat.com>2010-10-26 00:42:39 -0400
commit2281a378e1830d7ab78d3067f228e4e55d368b0d (patch)
tree8fce4594a1d1b8854d219f5297ccb5ecfc263b10 /drivers/gpu/drm/radeon/evergreen.c
parentc3cceeddf0b5f97b0d2352b98ef0f025e31a9ae3 (diff)
drm/radeon/kms/evergreen: set the clear state to the blit state
The hw stores a default clear state for registers in the context range that can be initialized when the CP is set up. Set the blit state as the default clear state and use the CLEAR_STATE packet to load the blit state rather than loading it from an IB. This reduces overhead when doing bo moves using the 3D engine. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/evergreen.c')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 17b2fe925ce0..f12a5b3ec050 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -32,6 +32,7 @@
32#include "atom.h" 32#include "atom.h"
33#include "avivod.h" 33#include "avivod.h"
34#include "evergreen_reg.h" 34#include "evergreen_reg.h"
35#include "evergreen_blit_shaders.h"
35 36
36#define EVERGREEN_PFP_UCODE_SIZE 1120 37#define EVERGREEN_PFP_UCODE_SIZE 1120
37#define EVERGREEN_PM4_UCODE_SIZE 1376 38#define EVERGREEN_PM4_UCODE_SIZE 1376
@@ -1112,7 +1113,7 @@ static int evergreen_cp_load_microcode(struct radeon_device *rdev)
1112 1113
1113static int evergreen_cp_start(struct radeon_device *rdev) 1114static int evergreen_cp_start(struct radeon_device *rdev)
1114{ 1115{
1115 int r; 1116 int r, i;
1116 uint32_t cp_me; 1117 uint32_t cp_me;
1117 1118
1118 r = radeon_ring_lock(rdev, 7); 1119 r = radeon_ring_lock(rdev, 7);
@@ -1132,16 +1133,39 @@ static int evergreen_cp_start(struct radeon_device *rdev)
1132 cp_me = 0xff; 1133 cp_me = 0xff;
1133 WREG32(CP_ME_CNTL, cp_me); 1134 WREG32(CP_ME_CNTL, cp_me);
1134 1135
1135 r = radeon_ring_lock(rdev, 4); 1136 r = radeon_ring_lock(rdev, evergreen_default_size + 15);
1136 if (r) { 1137 if (r) {
1137 DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); 1138 DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r);
1138 return r; 1139 return r;
1139 } 1140 }
1140 /* init some VGT regs */ 1141
1141 radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); 1142 /* setup clear context state */
1142 radeon_ring_write(rdev, (VGT_VERTEX_REUSE_BLOCK_CNTL - PACKET3_SET_CONTEXT_REG_START) >> 2); 1143 radeon_ring_write(rdev, PACKET3(PACKET3_PREAMBLE_CNTL, 0));
1143 radeon_ring_write(rdev, 0xe); 1144 radeon_ring_write(rdev, PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
1144 radeon_ring_write(rdev, 0x10); 1145
1146 for (i = 0; i < evergreen_default_size; i++)
1147 radeon_ring_write(rdev, evergreen_default_state[i]);
1148
1149 radeon_ring_write(rdev, PACKET3(PACKET3_PREAMBLE_CNTL, 0));
1150 radeon_ring_write(rdev, PACKET3_PREAMBLE_END_CLEAR_STATE);
1151
1152 /* set clear context state */
1153 radeon_ring_write(rdev, PACKET3(PACKET3_CLEAR_STATE, 0));
1154 radeon_ring_write(rdev, 0);
1155
1156 /* SQ_VTX_BASE_VTX_LOC */
1157 radeon_ring_write(rdev, 0xc0026f00);
1158 radeon_ring_write(rdev, 0x00000000);
1159 radeon_ring_write(rdev, 0x00000000);
1160 radeon_ring_write(rdev, 0x00000000);
1161
1162 /* Clear consts */
1163 radeon_ring_write(rdev, 0xc0036f00);
1164 radeon_ring_write(rdev, 0x00000bc4);
1165 radeon_ring_write(rdev, 0xffffffff);
1166 radeon_ring_write(rdev, 0xffffffff);
1167 radeon_ring_write(rdev, 0xffffffff);
1168
1145 radeon_ring_unlock_commit(rdev); 1169 radeon_ring_unlock_commit(rdev);
1146 1170
1147 return 0; 1171 return 0;