diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-02-13 19:06:33 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-02-13 19:10:09 -0500 |
commit | 0f234f5fdca1e31c7a6333c3633edc653cf3e598 (patch) | |
tree | 7fe79d1387c8db942042f967279745ec0162591a /drivers/gpu | |
parent | 4eace7fdfa1f8ac2f0a833e12bd07eeb453ec9ef (diff) |
drm/radeon/kms: evergreen/ni big endian fixes (v2)
Based on 6xx/7xx endian fixes from Cédric Cano.
v2: fix typo in shader
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen_blit_kms.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen_blit_shaders.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/evergreend.h | 1 |
4 files changed, 40 insertions, 10 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index ffdc8332b76e..d270b3ff896b 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1192,7 +1192,11 @@ void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | |||
1192 | radeon_ring_write(rdev, 1); | 1192 | radeon_ring_write(rdev, 1); |
1193 | /* FIXME: implement */ | 1193 | /* FIXME: implement */ |
1194 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | 1194 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
1195 | radeon_ring_write(rdev, ib->gpu_addr & 0xFFFFFFFC); | 1195 | radeon_ring_write(rdev, |
1196 | #ifdef __BIG_ENDIAN | ||
1197 | (2 << 0) | | ||
1198 | #endif | ||
1199 | (ib->gpu_addr & 0xFFFFFFFC)); | ||
1196 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); | 1200 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); |
1197 | radeon_ring_write(rdev, ib->length_dw); | 1201 | radeon_ring_write(rdev, ib->length_dw); |
1198 | } | 1202 | } |
@@ -1207,7 +1211,11 @@ static int evergreen_cp_load_microcode(struct radeon_device *rdev) | |||
1207 | return -EINVAL; | 1211 | return -EINVAL; |
1208 | 1212 | ||
1209 | r700_cp_stop(rdev); | 1213 | r700_cp_stop(rdev); |
1210 | WREG32(CP_RB_CNTL, RB_NO_UPDATE | (15 << 8) | (3 << 0)); | 1214 | WREG32(CP_RB_CNTL, |
1215 | #ifdef __BIG_ENDIAN | ||
1216 | BUF_SWAP_32BIT | | ||
1217 | #endif | ||
1218 | RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3)); | ||
1211 | 1219 | ||
1212 | fw_data = (const __be32 *)rdev->pfp_fw->data; | 1220 | fw_data = (const __be32 *)rdev->pfp_fw->data; |
1213 | WREG32(CP_PFP_UCODE_ADDR, 0); | 1221 | WREG32(CP_PFP_UCODE_ADDR, 0); |
@@ -1326,7 +1334,11 @@ int evergreen_cp_resume(struct radeon_device *rdev) | |||
1326 | WREG32(CP_RB_WPTR, 0); | 1334 | WREG32(CP_RB_WPTR, 0); |
1327 | 1335 | ||
1328 | /* set the wb address wether it's enabled or not */ | 1336 | /* set the wb address wether it's enabled or not */ |
1329 | WREG32(CP_RB_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC); | 1337 | WREG32(CP_RB_RPTR_ADDR, |
1338 | #ifdef __BIG_ENDIAN | ||
1339 | RB_RPTR_SWAP(2) | | ||
1340 | #endif | ||
1341 | ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC)); | ||
1330 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); | 1342 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); |
1331 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); | 1343 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); |
1332 | 1344 | ||
@@ -2627,8 +2639,8 @@ restart_ih: | |||
2627 | while (rptr != wptr) { | 2639 | while (rptr != wptr) { |
2628 | /* wptr/rptr are in bytes! */ | 2640 | /* wptr/rptr are in bytes! */ |
2629 | ring_index = rptr / 4; | 2641 | ring_index = rptr / 4; |
2630 | src_id = rdev->ih.ring[ring_index] & 0xff; | 2642 | src_id = le32_to_cpu(rdev->ih.ring[ring_index]) & 0xff; |
2631 | src_data = rdev->ih.ring[ring_index + 1] & 0xfffffff; | 2643 | src_data = le32_to_cpu(rdev->ih.ring[ring_index + 1]) & 0xfffffff; |
2632 | 2644 | ||
2633 | switch (src_id) { | 2645 | switch (src_id) { |
2634 | case 1: /* D1 vblank/vline */ | 2646 | case 1: /* D1 vblank/vline */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index a1ba4b3053d0..a7b7a33eaf3a 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
@@ -133,6 +133,9 @@ set_vtx_resource(struct radeon_device *rdev, u64 gpu_addr) | |||
133 | 133 | ||
134 | /* high addr, stride */ | 134 | /* high addr, stride */ |
135 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8)); | 135 | sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8)); |
136 | #ifdef __BIG_ENDIAN | ||
137 | sq_vtx_constant_word2 |= (2 << 30); | ||
138 | #endif | ||
136 | /* xyzw swizzles */ | 139 | /* xyzw swizzles */ |
137 | sq_vtx_constant_word3 = (0 << 3) | (1 << 6) | (2 << 9) | (3 << 12); | 140 | sq_vtx_constant_word3 = (0 << 3) | (1 << 6) | (2 << 9) | (3 << 12); |
138 | 141 | ||
@@ -221,7 +224,11 @@ draw_auto(struct radeon_device *rdev) | |||
221 | radeon_ring_write(rdev, DI_PT_RECTLIST); | 224 | radeon_ring_write(rdev, DI_PT_RECTLIST); |
222 | 225 | ||
223 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); | 226 | radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0)); |
224 | radeon_ring_write(rdev, DI_INDEX_SIZE_16_BIT); | 227 | radeon_ring_write(rdev, |
228 | #ifdef __BIG_ENDIAN | ||
229 | (2 << 2) | | ||
230 | #endif | ||
231 | DI_INDEX_SIZE_16_BIT); | ||
225 | 232 | ||
226 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); | 233 | radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0)); |
227 | radeon_ring_write(rdev, 1); | 234 | radeon_ring_write(rdev, 1); |
@@ -541,7 +548,7 @@ static inline uint32_t i2f(uint32_t input) | |||
541 | int evergreen_blit_init(struct radeon_device *rdev) | 548 | int evergreen_blit_init(struct radeon_device *rdev) |
542 | { | 549 | { |
543 | u32 obj_size; | 550 | u32 obj_size; |
544 | int r, dwords; | 551 | int i, r, dwords; |
545 | void *ptr; | 552 | void *ptr; |
546 | u32 packet2s[16]; | 553 | u32 packet2s[16]; |
547 | int num_packet2s = 0; | 554 | int num_packet2s = 0; |
@@ -557,7 +564,7 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
557 | 564 | ||
558 | dwords = rdev->r600_blit.state_len; | 565 | dwords = rdev->r600_blit.state_len; |
559 | while (dwords & 0xf) { | 566 | while (dwords & 0xf) { |
560 | packet2s[num_packet2s++] = PACKET2(0); | 567 | packet2s[num_packet2s++] = cpu_to_le32(PACKET2(0)); |
561 | dwords++; | 568 | dwords++; |
562 | } | 569 | } |
563 | 570 | ||
@@ -598,8 +605,10 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
598 | if (num_packet2s) | 605 | if (num_packet2s) |
599 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | 606 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), |
600 | packet2s, num_packet2s * 4); | 607 | packet2s, num_packet2s * 4); |
601 | memcpy(ptr + rdev->r600_blit.vs_offset, evergreen_vs, evergreen_vs_size * 4); | 608 | for (i = 0; i < evergreen_vs_size; i++) |
602 | memcpy(ptr + rdev->r600_blit.ps_offset, evergreen_ps, evergreen_ps_size * 4); | 609 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]); |
610 | for (i = 0; i < evergreen_ps_size; i++) | ||
611 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]); | ||
603 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 612 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
604 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 613 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
605 | 614 | ||
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_shaders.c b/drivers/gpu/drm/radeon/evergreen_blit_shaders.c index ef1d28c07fbf..3a10399e0066 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_shaders.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_shaders.c | |||
@@ -311,11 +311,19 @@ const u32 evergreen_vs[] = | |||
311 | 0x00000000, | 311 | 0x00000000, |
312 | 0x3c000000, | 312 | 0x3c000000, |
313 | 0x67961001, | 313 | 0x67961001, |
314 | #ifdef __BIG_ENDIAN | ||
315 | 0x000a0000, | ||
316 | #else | ||
314 | 0x00080000, | 317 | 0x00080000, |
318 | #endif | ||
315 | 0x00000000, | 319 | 0x00000000, |
316 | 0x1c000000, | 320 | 0x1c000000, |
317 | 0x67961000, | 321 | 0x67961000, |
322 | #ifdef __BIG_ENDIAN | ||
323 | 0x00020008, | ||
324 | #else | ||
318 | 0x00000008, | 325 | 0x00000008, |
326 | #endif | ||
319 | 0x00000000, | 327 | 0x00000000, |
320 | }; | 328 | }; |
321 | 329 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index afec1aca2a73..eb4acf4528ff 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -98,6 +98,7 @@ | |||
98 | #define BUF_SWAP_32BIT (2 << 16) | 98 | #define BUF_SWAP_32BIT (2 << 16) |
99 | #define CP_RB_RPTR 0x8700 | 99 | #define CP_RB_RPTR 0x8700 |
100 | #define CP_RB_RPTR_ADDR 0xC10C | 100 | #define CP_RB_RPTR_ADDR 0xC10C |
101 | #define RB_RPTR_SWAP(x) ((x) << 0) | ||
101 | #define CP_RB_RPTR_ADDR_HI 0xC110 | 102 | #define CP_RB_RPTR_ADDR_HI 0xC110 |
102 | #define CP_RB_RPTR_WR 0xC108 | 103 | #define CP_RB_RPTR_WR 0xC108 |
103 | #define CP_RB_WPTR 0xC114 | 104 | #define CP_RB_WPTR 0xC114 |