diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-09-10 02:53:50 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-09-10 04:44:16 -0400 |
commit | 119e20dc149581db3064661b2e659f308f97b663 (patch) | |
tree | 44971a17736e127ae503c608dd76874472103b10 /drivers/gpu | |
parent | a513c184d99fe10e7b20771ef86f5f807769318f (diff) |
drm/radeon/kms/r600: fix blit support
select the correct max number of bytes per blit based
on whether the size is multiple of 4 bytes. This
determines whether we can use 8 or 32 bit pixels for
the blit.
airlied: also merged the IB padding patch +
correcting the VS offset for context
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/r600_blit_kms.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 5755647e688a..bbb0d615ac1c 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -129,6 +129,7 @@ set_shaders(struct radeon_device *rdev) | |||
129 | radeon_ring_write(rdev, (SQ_PGM_CF_OFFSET_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); | 129 | radeon_ring_write(rdev, (SQ_PGM_CF_OFFSET_PS - PACKET3_SET_CONTEXT_REG_OFFSET) >> 2); |
130 | radeon_ring_write(rdev, 0); | 130 | radeon_ring_write(rdev, 0); |
131 | 131 | ||
132 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.vs_offset; | ||
132 | cp_set_surface_sync(rdev, PACKET3_SH_ACTION_ENA, 512, gpu_addr); | 133 | cp_set_surface_sync(rdev, PACKET3_SH_ACTION_ENA, 512, gpu_addr); |
133 | } | 134 | } |
134 | 135 | ||
@@ -248,6 +249,7 @@ set_default_state(struct radeon_device *rdev) | |||
248 | int num_ps_threads, num_vs_threads, num_gs_threads, num_es_threads; | 249 | int num_ps_threads, num_vs_threads, num_gs_threads, num_es_threads; |
249 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; | 250 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; |
250 | u64 gpu_addr; | 251 | u64 gpu_addr; |
252 | int dwords; | ||
251 | 253 | ||
252 | switch (rdev->family) { | 254 | switch (rdev->family) { |
253 | case CHIP_R600: | 255 | case CHIP_R600: |
@@ -394,11 +396,12 @@ set_default_state(struct radeon_device *rdev) | |||
394 | NUM_ES_STACK_ENTRIES(num_es_stack_entries)); | 396 | NUM_ES_STACK_ENTRIES(num_es_stack_entries)); |
395 | 397 | ||
396 | /* emit an IB pointing at default state */ | 398 | /* emit an IB pointing at default state */ |
399 | dwords = (rdev->r600_blit.state_len + 0xf) & ~0xf; | ||
397 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; | 400 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; |
398 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | 401 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); |
399 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); | 402 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); |
400 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); | 403 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); |
401 | radeon_ring_write(rdev, (rdev->r600_blit.state_len / 4)); | 404 | radeon_ring_write(rdev, dwords); |
402 | 405 | ||
403 | radeon_ring_write(rdev, PACKET3(PACKET3_EVENT_WRITE, 0)); | 406 | radeon_ring_write(rdev, PACKET3(PACKET3_EVENT_WRITE, 0)); |
404 | radeon_ring_write(rdev, CACHE_FLUSH_AND_INV_EVENT); | 407 | radeon_ring_write(rdev, CACHE_FLUSH_AND_INV_EVENT); |
@@ -441,17 +444,25 @@ static inline uint32_t i2f(uint32_t input) | |||
441 | int r600_blit_init(struct radeon_device *rdev) | 444 | int r600_blit_init(struct radeon_device *rdev) |
442 | { | 445 | { |
443 | u32 obj_size; | 446 | u32 obj_size; |
444 | int r; | 447 | int r, dwords; |
445 | void *ptr; | 448 | void *ptr; |
449 | u32 packet2s[16]; | ||
450 | int num_packet2s = 0; | ||
446 | 451 | ||
447 | rdev->r600_blit.state_offset = 0; | 452 | rdev->r600_blit.state_offset = 0; |
448 | 453 | ||
449 | if (rdev->family >= CHIP_RV770) | 454 | if (rdev->family >= CHIP_RV770) |
450 | rdev->r600_blit.state_len = r7xx_default_size * 4; | 455 | rdev->r600_blit.state_len = r7xx_default_size; |
451 | else | 456 | else |
452 | rdev->r600_blit.state_len = r6xx_default_size * 4; | 457 | rdev->r600_blit.state_len = r6xx_default_size; |
458 | |||
459 | dwords = rdev->r600_blit.state_len; | ||
460 | while (dwords & 0xf) { | ||
461 | packet2s[num_packet2s++] = PACKET2(0); | ||
462 | dwords++; | ||
463 | } | ||
453 | 464 | ||
454 | obj_size = rdev->r600_blit.state_len; | 465 | obj_size = dwords * 4; |
455 | obj_size = ALIGN(obj_size, 256); | 466 | obj_size = ALIGN(obj_size, 256); |
456 | 467 | ||
457 | rdev->r600_blit.vs_offset = obj_size; | 468 | rdev->r600_blit.vs_offset = obj_size; |
@@ -488,9 +499,15 @@ int r600_blit_init(struct radeon_device *rdev) | |||
488 | } | 499 | } |
489 | 500 | ||
490 | if (rdev->family >= CHIP_RV770) | 501 | if (rdev->family >= CHIP_RV770) |
491 | memcpy_toio(ptr + rdev->r600_blit.state_offset, r7xx_default_state, rdev->r600_blit.state_len); | 502 | memcpy_toio(ptr + rdev->r600_blit.state_offset, |
503 | r7xx_default_state, rdev->r600_blit.state_len * 4); | ||
492 | else | 504 | else |
493 | memcpy_toio(ptr + rdev->r600_blit.state_offset, r6xx_default_state, rdev->r600_blit.state_len); | 505 | memcpy_toio(ptr + rdev->r600_blit.state_offset, |
506 | r6xx_default_state, rdev->r600_blit.state_len * 4); | ||
507 | if (num_packet2s) | ||
508 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | ||
509 | packet2s, num_packet2s * 4); | ||
510 | |||
494 | 511 | ||
495 | memcpy(ptr + rdev->r600_blit.vs_offset, r6xx_vs, r6xx_vs_size * 4); | 512 | memcpy(ptr + rdev->r600_blit.vs_offset, r6xx_vs, r6xx_vs_size * 4); |
496 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); | 513 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); |
@@ -532,7 +549,13 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
532 | { | 549 | { |
533 | int r; | 550 | int r; |
534 | int ring_size; | 551 | int ring_size; |
535 | const int max_size = 8192*8192; | 552 | int max_size; |
553 | |||
554 | /* 8 bpp vs 32 bpp for xfer unit */ | ||
555 | if (size_bytes & 3) | ||
556 | max_size = 8192*8192; | ||
557 | else | ||
558 | max_size = 8192*8192*4; | ||
536 | 559 | ||
537 | r = r600_vb_ib_get(rdev); | 560 | r = r600_vb_ib_get(rdev); |
538 | WARN_ON(r); | 561 | WARN_ON(r); |