574
574
struct r300_query *query)
576
576
struct r300_capabilities* caps = &r300->screen->caps;
577
uint32_t gb_pipes = r300->screen->info.r300_num_gb_pipes;
579
assert(caps->num_frag_pipes);
581
BEGIN_CS(6 * caps->num_frag_pipes + 2);
582
BEGIN_CS(6 * gb_pipes + 2);
582
583
/* I'm not so sure I like this switch, but it's hard to be elegant
583
584
* when there's so many special cases...
587
588
* 4-byte offset for each pipe. RV380 and older are special; they have
588
589
* only two pipes, and the second pipe's enable is on bit 3, not bit 1,
589
590
* so there's a chipset cap for that. */
590
switch (caps->num_frag_pipes) {
592
593
/* pipe 3 only */
593
594
OUT_CS_REG(R300_SU_REG_DEST, 1 << 3);
665
666
if (caps->family == CHIP_FAMILY_RV530) {
666
if (caps->num_z_pipes == 2)
667
if (r300->screen->info.r300_num_z_pipes == 2)
667
668
rv530_emit_query_end_double_z(r300, query);
669
670
rv530_emit_query_end_single_z(r300, query);
674
675
query->num_results += query->num_pipes;
676
677
/* XXX grab all the results and reset the counter. */
677
if (query->num_results >= query->buffer_size / 4 - 4) {
678
query->num_results = (query->buffer_size / 4) / 2;
678
if (query->num_results >= query->buf->size / 4 - 4) {
679
query->num_results = (query->buf->size / 4) / 2;
679
680
fprintf(stderr, "r300: Rewinding OQBO...\n");
822
823
void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
823
824
boolean indexed, int instance_id)
825
struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->vertex_buffer;
826
struct pipe_resource **valid_vbuf = r300->vbuf_mgr->real_vertex_buffer;
826
struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer;
827
827
struct pipe_vertex_element *velem = r300->velems->velem;
828
828
struct r300_resource *buf;
1189
1189
for (i = 0; i < fb->nr_cbufs; i++) {
1190
1190
tex = r300_resource(fb->cbufs[i]->texture);
1191
1191
assert(tex && tex->buf && "cbuf is marked, but NULL!");
1192
r300->rws->cs_add_reloc(r300->cs, tex->cs_buf, 0,
1192
r300->rws->cs_add_reloc(r300->cs, tex->cs_buf,
1193
RADEON_USAGE_READWRITE,
1193
1194
r300_surface(fb->cbufs[i])->domain);
1195
1196
/* ...depth buffer... */
1196
1197
if (fb->zsbuf) {
1197
1198
tex = r300_resource(fb->zsbuf->texture);
1198
1199
assert(tex && tex->buf && "zsbuf is marked, but NULL!");
1199
r300->rws->cs_add_reloc(r300->cs, tex->cs_buf, 0,
1200
r300->rws->cs_add_reloc(r300->cs, tex->cs_buf,
1201
RADEON_USAGE_READWRITE,
1200
1202
r300_surface(fb->zsbuf)->domain);
1210
1212
tex = r300_resource(texstate->sampler_views[i]->base.texture);
1211
r300->rws->cs_add_reloc(r300->cs, tex->cs_buf, tex->domain, 0);
1213
r300->rws->cs_add_reloc(r300->cs, tex->cs_buf, RADEON_USAGE_READ,
1214
1217
/* ...occlusion query buffer... */
1215
1218
if (r300->query_current)
1216
1219
r300->rws->cs_add_reloc(r300->cs, r300->query_current->cs_buf,
1217
0, r300->query_current->domain);
1220
RADEON_USAGE_WRITE, RADEON_DOMAIN_GTT);
1218
1221
/* ...vertex buffer for SWTCL path... */
1220
1223
r300->rws->cs_add_reloc(r300->cs, r300_resource(r300->vbo)->cs_buf,
1221
r300_resource(r300->vbo)->domain, 0);
1225
r300_resource(r300->vbo)->domain);
1222
1226
/* ...vertex buffers for HWTCL path... */
1223
1227
if (do_validate_vertex_buffers && r300->vertex_arrays_dirty) {
1224
struct pipe_resource **buf = r300->vbuf_mgr->real_vertex_buffer;
1225
struct pipe_resource **last = r300->vbuf_mgr->real_vertex_buffer +
1228
struct pipe_vertex_buffer *vbuf = r300->vbuf_mgr->real_vertex_buffer;
1229
struct pipe_vertex_buffer *last = r300->vbuf_mgr->real_vertex_buffer +
1226
1230
r300->vbuf_mgr->nr_real_vertex_buffers;
1227
for (; buf != last; buf++) {
1231
struct pipe_resource *buf;
1232
for (; vbuf != last; vbuf++) {
1231
r300->rws->cs_add_reloc(r300->cs, r300_resource(*buf)->cs_buf,
1232
r300_resource(*buf)->domain, 0);
1237
r300->rws->cs_add_reloc(r300->cs, r300_resource(buf)->cs_buf,
1239
r300_resource(buf)->domain);
1235
1242
/* ...and index buffer for HWTCL path. */
1236
1243
if (index_buffer)
1237
1244
r300->rws->cs_add_reloc(r300->cs, r300_resource(index_buffer)->cs_buf,
1238
r300_resource(index_buffer)->domain, 0);
1246
r300_resource(index_buffer)->domain);
1240
/* Now do the validation. */
1248
/* Now do the validation (flush is called inside cs_validate on failure). */
1241
1249
if (!r300->rws->cs_validate(r300->cs)) {
1242
1250
/* Ooops, an infinite loop, give up. */
1246
r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
1247
1254
flushed = TRUE;