37 int w,
int h,
u64 gpu_addr)
51 slice = ((w *
h) / 64) - 1;
96 if (size == 0xffffffff)
97 cp_coher_size = 0xffffffff;
99 cp_coher_size = ((size + 255) >> 8);
114 u32 sq_pgm_resources;
117 sq_pgm_resources = (1 << 0);
160 u32 sq_vtx_constant_word2;
183 cp_set_surface_sync(rdev,
186 cp_set_surface_sync(rdev,
193 int format,
int w,
int h,
int pitch,
197 uint32_t sq_tex_resource_word0, sq_tex_resource_word1, sq_tex_resource_word4;
216 cp_set_surface_sync(rdev,
282 u32 sq_config, sq_gpr_resource_mgmt_1, sq_gpr_resource_mgmt_2;
283 u32 sq_thread_resource_mgmt, sq_stack_resource_mgmt_1, sq_stack_resource_mgmt_2;
284 int num_ps_gprs, num_vs_gprs, num_temp_gprs, num_gs_gprs, num_es_gprs;
285 int num_ps_threads, num_vs_threads, num_gs_threads, num_es_threads;
286 int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries;
297 num_ps_threads = 136;
301 num_ps_stack_entries = 128;
302 num_vs_stack_entries = 128;
303 num_gs_stack_entries = 0;
304 num_es_stack_entries = 0;
313 num_ps_threads = 144;
317 num_ps_stack_entries = 40;
318 num_vs_stack_entries = 40;
319 num_gs_stack_entries = 32;
320 num_es_stack_entries = 16;
332 num_ps_threads = 136;
336 num_ps_stack_entries = 40;
337 num_vs_stack_entries = 40;
338 num_gs_stack_entries = 32;
339 num_es_stack_entries = 16;
347 num_ps_threads = 136;
351 num_ps_stack_entries = 40;
352 num_vs_stack_entries = 40;
353 num_gs_stack_entries = 32;
354 num_es_stack_entries = 16;
362 num_ps_threads = 188;
366 num_ps_stack_entries = 256;
367 num_vs_stack_entries = 256;
368 num_gs_stack_entries = 0;
369 num_es_stack_entries = 0;
378 num_ps_threads = 188;
382 num_ps_stack_entries = 128;
383 num_vs_stack_entries = 128;
384 num_gs_stack_entries = 0;
385 num_es_stack_entries = 0;
393 num_ps_threads = 144;
397 num_ps_stack_entries = 128;
398 num_vs_stack_entries = 128;
399 num_gs_stack_entries = 0;
400 num_es_stack_entries = 0;
420 sq_gpr_resource_mgmt_1 = (
NUM_PS_GPRS(num_ps_gprs) |
423 sq_gpr_resource_mgmt_2 = (
NUM_GS_GPRS(num_gs_gprs) |
442 (gpu_addr & 0xFFFFFFFC));
463 int num_packet2s = 0;
465 rdev->
r600_blit.primitives.set_render_target = set_render_target;
466 rdev->
r600_blit.primitives.cp_set_surface_sync = cp_set_surface_sync;
467 rdev->
r600_blit.primitives.set_shaders = set_shaders;
468 rdev->
r600_blit.primitives.set_vtx_resource = set_vtx_resource;
469 rdev->
r600_blit.primitives.set_tex_resource = set_tex_resource;
470 rdev->
r600_blit.primitives.set_scissors = set_scissors;
471 rdev->
r600_blit.primitives.draw_auto = draw_auto;
472 rdev->
r600_blit.primitives.set_default_state = set_default_state;
494 while (dwords & 0xf) {
499 obj_size = dwords * 4;
500 obj_size =
ALIGN(obj_size, 256);
504 obj_size =
ALIGN(obj_size, 256);
508 obj_size =
ALIGN(obj_size, 256);
516 DRM_ERROR(
"r600 failed to allocate shader\n");
525 radeon_bo_unreserve(rdev->
r600_blit.shader_obj);
527 dev_err(rdev->
dev,
"(%d) pin blit object failed\n", r);
532 DRM_DEBUG(
"r6xx blit allocated bo %08x vs %08x ps %08x\n",
541 DRM_ERROR(
"failed to map blit object %d\n", r);
552 packet2s, num_packet2s * 4);
558 radeon_bo_unreserve(rdev->
r600_blit.shader_obj);
577 radeon_bo_unreserve(rdev->
r600_blit.shader_obj);
582 static unsigned r600_blit_create_rect(
unsigned num_gpu_pages,
586 unsigned pages = num_gpu_pages;
589 if (num_gpu_pages == 0) {
598 while (num_gpu_pages / rect_order) {
607 if (pages > max_pages)
616 DRM_DEBUG(
"blit_rectangle: h=%d, w=%d, pages=%d\n", h, w, pages);
636 int dwords_per_loop = rdev->
r600_blit.ring_size_per_loop;
639 while (num_gpu_pages) {
641 r600_blit_create_rect(num_gpu_pages,
NULL,
NULL,
648 (num_loops*48)+256, 256,
true);
660 ring_size = num_loops * dwords_per_loop;
661 ring_size += rdev->
r600_blit.ring_size_common;
677 rdev->
r600_blit.primitives.set_default_state(rdev);
678 rdev->
r600_blit.primitives.set_shaders(rdev);
700 u64 src_gpu_addr,
u64 dst_gpu_addr,
701 unsigned num_gpu_pages,
707 DRM_DEBUG(
"emitting copy %16llx %16llx %d\n",
708 src_gpu_addr, dst_gpu_addr, num_gpu_pages);
709 vb_cpu_addr = (
u32 *)radeon_sa_bo_cpu_addr(vb);
710 vb_gpu_addr = radeon_sa_bo_gpu_addr(vb);
712 while (num_gpu_pages) {
714 unsigned size_in_bytes;
715 unsigned pages_per_loop =
716 r600_blit_create_rect(num_gpu_pages, &w, &h,
720 DRM_DEBUG(
"rectangle w=%d h=%d\n", w, h);
738 w, h, w, src_gpu_addr, size_in_bytes);
741 rdev->
r600_blit.primitives.set_scissors(rdev, 0, 0, w, h);
742 rdev->
r600_blit.primitives.set_vtx_resource(rdev, vb_gpu_addr);
743 rdev->
r600_blit.primitives.draw_auto(rdev);
744 rdev->
r600_blit.primitives.cp_set_surface_sync(rdev,
746 size_in_bytes, dst_gpu_addr);
750 src_gpu_addr += size_in_bytes;
751 dst_gpu_addr += size_in_bytes;
752 num_gpu_pages -= pages_per_loop;