32 #define DI_PT_RECTLIST 0x11
33 #define DI_INDEX_SIZE_16_BIT 0x0
34 #define DI_SRC_SEL_AUTO_INDEX 0x2
38 #define FMT_8_8_8_8 0x1a
40 #define COLOR_5_6_5 0x8
41 #define COLOR_8_8_8_8 0x1a
55 cb_color_info = ((format << 2) | (1 << 27));
57 slice = ((w *
h) / 64) - 1;
76 OUT_RING((pitch << 0) | (slice << 10));
109 if (size == 0xffffffff)
110 cp_coher_size = 0xffffffff;
112 cp_coher_size = ((size + 255) >> 8);
135 vs = (
u32 *) ((
char *)dev->agp_buffer_map->handle + dev_priv->
blit_vb->offset);
136 ps = (
u32 *) ((
char *)dev->agp_buffer_map->handle + dev_priv->
blit_vb->offset + 256);
148 sq_pgm_resources = (1 << 0);
171 OUT_RING(sq_pgm_resources | (1 << 28));
182 cp_set_surface_sync(dev_priv,
193 sq_vtx_constant_word2 = (((gpu_addr >> 32) & 0xff) | (16 << 8));
195 sq_vtx_constant_word2 |= (2 << 30);
215 cp_set_surface_sync(dev_priv,
218 cp_set_surface_sync(dev_priv,
226 uint32_t sq_tex_resource_word0, sq_tex_resource_word1, sq_tex_resource_word4;
233 sq_tex_resource_word0 = (1 << 0);
234 sq_tex_resource_word0 |= ((((pitch >> 3) - 1) << 8) |
237 sq_tex_resource_word1 = (format << 26);
238 sq_tex_resource_word1 |= ((h - 1) << 0);
240 sq_tex_resource_word4 = ((1 << 14) |
274 OUT_RING((x1 << 0) | (y1 << 16) | (1 << 31));
279 OUT_RING((x1 << 0) | (y1 << 16) | (1 << 31));
317 u32 sq_config, sq_gpr_resource_mgmt_1, sq_gpr_resource_mgmt_2;
318 u32 sq_thread_resource_mgmt, sq_stack_resource_mgmt_1, sq_stack_resource_mgmt_2;
319 int num_ps_gprs, num_vs_gprs, num_temp_gprs, num_gs_gprs, num_es_gprs;
320 int num_ps_threads, num_vs_threads, num_gs_threads, num_es_threads;
321 int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries;
331 num_ps_threads = 136;
335 num_ps_stack_entries = 128;
336 num_vs_stack_entries = 128;
337 num_gs_stack_entries = 0;
338 num_es_stack_entries = 0;
347 num_ps_threads = 144;
351 num_ps_stack_entries = 40;
352 num_vs_stack_entries = 40;
353 num_gs_stack_entries = 32;
354 num_es_stack_entries = 16;
366 num_ps_threads = 136;
370 num_ps_stack_entries = 40;
371 num_vs_stack_entries = 40;
372 num_gs_stack_entries = 32;
373 num_es_stack_entries = 16;
381 num_ps_threads = 136;
385 num_ps_stack_entries = 40;
386 num_vs_stack_entries = 40;
387 num_gs_stack_entries = 32;
388 num_es_stack_entries = 16;
396 num_ps_threads = 188;
400 num_ps_stack_entries = 256;
401 num_vs_stack_entries = 256;
402 num_gs_stack_entries = 0;
403 num_es_stack_entries = 0;
412 num_ps_threads = 188;
416 num_ps_stack_entries = 128;
417 num_vs_stack_entries = 128;
418 num_gs_stack_entries = 0;
419 num_es_stack_entries = 0;
427 num_ps_threads = 144;
431 num_ps_stack_entries = 128;
432 num_vs_stack_entries = 128;
433 num_gs_stack_entries = 0;
434 num_es_stack_entries = 0;
492 #define I2F_FRAC_BITS 23
493 #define I2F_MASK ((1 << I2F_FRAC_BITS) - 1)
522 static int r600_nomm_get_vb(
struct drm_device *dev)
527 DRM_ERROR(
"Unable to allocate vertex buffer for blit\n");
533 static void r600_nomm_put_vb(
struct drm_device *dev)
541 static void *r600_nomm_get_vb_ptr(
struct drm_device *dev)
544 return (((
char *)dev->agp_buffer_map->handle +
555 ret = r600_nomm_get_vb(dev);
559 dev_priv->
blit_vb->file_priv = file_priv;
561 set_default_state(dev_priv);
586 r600_nomm_put_vb(dev);
599 vb = r600_nomm_get_vb_ptr(dev);
601 if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) {
605 int cur_size = size_bytes;
606 int src_x = src_gpu_addr & 255;
607 int dst_x = dst_gpu_addr & 255;
609 src_gpu_addr = src_gpu_addr & ~255;
610 dst_gpu_addr = dst_gpu_addr & ~255;
612 if (!src_x && !dst_x) {
621 if (cur_size > max_bytes)
623 if (cur_size > (max_bytes - dst_x))
624 cur_size = (max_bytes - dst_x);
625 if (cur_size > (max_bytes - src_x))
626 cur_size = (max_bytes - src_x);
631 r600_nomm_put_vb(dev);
632 r600_nomm_get_vb(dev);
636 vb = r600_nomm_get_vb_ptr(dev);
655 set_tex_resource(dev_priv,
FMT_8,
656 src_x + cur_size, h, src_x + cur_size,
659 cp_set_surface_sync(dev_priv,
663 set_render_target(dev_priv,
COLOR_8,
668 set_scissors(dev_priv, dst_x, 0, dst_x + cur_size, h);
674 set_vtx_resource(dev_priv, vb_addr);
679 cp_set_surface_sync(dev_priv,
681 cur_size * h, dst_gpu_addr);
684 dev_priv->
blit_vb->used += 12 * 4;
686 src_gpu_addr += cur_size *
h;
687 dst_gpu_addr += cur_size *
h;
688 size_bytes -= cur_size *
h;
691 max_bytes = 8192 * 4;
694 int cur_size = size_bytes;
695 int src_x = (src_gpu_addr & 255);
696 int dst_x = (dst_gpu_addr & 255);
698 src_gpu_addr = src_gpu_addr & ~255;
699 dst_gpu_addr = dst_gpu_addr & ~255;
701 if (!src_x && !dst_x) {
710 if (cur_size > max_bytes)
712 if (cur_size > (max_bytes - dst_x))
713 cur_size = (max_bytes - dst_x);
714 if (cur_size > (max_bytes - src_x))
715 cur_size = (max_bytes - src_x);
719 r600_nomm_put_vb(dev);
720 r600_nomm_get_vb(dev);
725 vb = r600_nomm_get_vb_ptr(dev);
738 vb[8] =
int2float((dst_x + cur_size) / 4);
740 vb[10] =
int2float((src_x + cur_size) / 4);
745 (src_x + cur_size) / 4,
746 h, (src_x + cur_size) / 4,
749 cp_set_surface_sync(dev_priv,
754 (dst_x + cur_size) / 4, h,
758 set_scissors(dev_priv, (dst_x / 4), 0, (dst_x + cur_size / 4), h);
764 set_vtx_resource(dev_priv, vb_addr);
769 cp_set_surface_sync(dev_priv,
771 cur_size * h, dst_gpu_addr);
774 dev_priv->
blit_vb->used += 12 * 4;
776 src_gpu_addr += cur_size *
h;
777 dst_gpu_addr += cur_size *
h;
778 size_bytes -= cur_size *
h;
786 int sx,
int sy,
int dx,
int dy,
787 int w,
int h,
int src_pitch,
int dst_pitch,
int cpp)
790 int cb_format, tex_format;
791 int sx2, sy2, dx2, dy2;
797 r600_nomm_put_vb(dev);
798 r600_nomm_get_vb(dev);
804 vb = r600_nomm_get_vb_ptr(dev);
842 set_tex_resource(dev_priv, tex_format,
844 sy2, src_pitch / cpp,
847 cp_set_surface_sync(dev_priv,
851 set_render_target(dev_priv, cb_format,
852 dst_pitch / cpp, dy2,
856 set_scissors(dev_priv, dx, dy, dx2, dy2);
862 set_vtx_resource(dev_priv, vb_addr);
867 cp_set_surface_sync(dev_priv,
869 dst_pitch * dy2, dst_gpu_addr);
871 dev_priv->
blit_vb->used += 12 * 4;