static void r300FireEB(r300ContextPtr rmesa, unsigned long addr, int vertex_count, int type, int elt_size) { int cmd_reserved = 0; int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; unsigned long t_addr; unsigned long magic_1, magic_2; assert(elt_size == 2 || elt_size == 4); if (addr & (elt_size - 1)) { WARN_ONCE("Badly aligned buffer\n"); return; } magic_1 = (addr % 32) / 4; t_addr = addr & ~0x1d; magic_2 = (vertex_count + 1 + (t_addr & 0x2)) / 2 + magic_1; start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, 0); if (elt_size == 4) { e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count << 16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); } else { e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count << 16) | type); } start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2); #ifdef OPTIMIZE_ELTS if (elt_size == 4) { e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2); e32(addr); } else { e32(R300_EB_UNK1 | (magic_1 << 16) | R300_EB_UNK2); e32(t_addr); } #else e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2); e32(addr); #endif if (elt_size == 4) { e32(vertex_count); } else { #ifdef OPTIMIZE_ELTS e32(magic_2); #else e32((vertex_count + 1) / 2); #endif } }
static void r300FireEB(r300ContextPtr rmesa, unsigned long addr, int vertex_count, int type) { int cmd_reserved = 0; int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; start_packet3(CP_PACKET3(R300_PACKET3_3D_DRAW_INDX_2, 0), 0); e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count << 16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); start_packet3(CP_PACKET3(R300_PACKET3_INDX_BUFFER, 2), 2); e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2); e32(addr); e32(vertex_count); }
static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) { int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; int i; int cmd_reserved = 0; int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; if (RADEON_DEBUG & DEBUG_VERTS) fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __FUNCTION__, nr, offset); start_packet3(CP_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, sz - 1), sz - 1); e32(nr); for (i = 0; i + 1 < nr; i += 2) { e32((rmesa->state.aos[i].aos_size << 0) | (rmesa->state.aos[i].aos_stride << 8) | (rmesa->state.aos[i + 1].aos_size << 16) | (rmesa->state.aos[i + 1].aos_stride << 24)); e32(rmesa->state.aos[i].aos_offset + offset * 4 * rmesa->state.aos[i].aos_stride); e32(rmesa->state.aos[i + 1].aos_offset + offset * 4 * rmesa->state.aos[i + 1].aos_stride); } if (nr & 1) { e32((rmesa->state.aos[nr - 1].aos_size << 0) | (rmesa->state.aos[nr - 1].aos_stride << 8)); e32(rmesa->state.aos[nr - 1].aos_offset + offset * 4 * rmesa->state.aos[nr - 1].aos_stride); } }
static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type) { int cmd_reserved = 0; int cmd_written = 0; drm_radeon_cmd_header_t *cmd = NULL; start_packet3(CP_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0), 0); e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count << 16) | type); }
static void inline fire_EB(PREFIX unsigned long addr, int vertex_count, int type, int elt_size) { LOCAL_VARS unsigned long addr_a; unsigned long t_addr; unsigned long magic_1, magic_2; GLcontext *ctx; ctx = rmesa->radeon.glCtx; assert(elt_size == 2 || elt_size == 4); if(addr & (elt_size-1)){ WARN_ONCE("Badly aligned buffer\n"); return ; } #ifdef OPTIMIZE_ELTS addr_a = 0; magic_1 = (addr % 32) / 4; t_addr = addr & (~0x1d); magic_2 = (vertex_count + 1 + (t_addr & 0x2)) / 2 + magic_1; check_space(6); start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, 0); if(elt_size == 4){ e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); } else { e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type); } start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2); if(elt_size == 4){ e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2); e32(addr /*& 0xffffffe3*/); } else { e32(R300_EB_UNK1 | (magic_1 << 16) | R300_EB_UNK2); e32(t_addr); } if(elt_size == 4){ e32(vertex_count /*+ addr_a/4*/); /* Total number of dwords needed? */ } else { e32(magic_2); /* Total number of dwords needed? */ } //cp_delay(PASS_PREFIX 1); #if 0 fprintf(stderr, "magic_1 %d\n", magic_1); fprintf(stderr, "t_addr %x\n", t_addr); fprintf(stderr, "magic_2 %d\n", magic_2); exit(1); #endif #else (void)magic_2, (void)magic_1, (void)t_addr; addr_a = 0; check_space(6); start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, 0); if(elt_size == 4){ e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); } else { e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type); } start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2); e32(R300_EB_UNK1 | (0 << 16) | R300_EB_UNK2); e32(addr /*& 0xffffffe3*/); if(elt_size == 4){ e32(vertex_count /*+ addr_a/4*/); /* Total number of dwords needed? */ } else { e32((vertex_count+1)/2 /*+ addr_a/4*/); /* Total number of dwords needed? */ } //cp_delay(PASS_PREFIX 1); #endif }