~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/gallium/drivers/r300/r300_emit.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
574
574
                                           struct r300_query *query)
575
575
{
576
576
    struct r300_capabilities* caps = &r300->screen->caps;
 
577
    uint32_t gb_pipes = r300->screen->info.r300_num_gb_pipes;
577
578
    CS_LOCALS(r300);
578
579
 
579
 
    assert(caps->num_frag_pipes);
 
580
    assert(gb_pipes);
580
581
 
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...
584
585
     *
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) {
 
591
    switch (gb_pipes) {
591
592
        case 4:
592
593
            /* pipe 3 only */
593
594
            OUT_CS_REG(R300_SU_REG_DEST, 1 << 3);
613
614
            break;
614
615
        default:
615
616
            fprintf(stderr, "r300: Implementation error: Chipset reports %d"
616
 
                    " pixel pipes!\n", caps->num_frag_pipes);
 
617
                    " pixel pipes!\n", gb_pipes);
617
618
            abort();
618
619
    }
619
620
 
663
664
        return;
664
665
 
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);
668
669
        else
669
670
            rv530_emit_query_end_single_z(r300, query);
674
675
    query->num_results += query->num_pipes;
675
676
 
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");
680
681
    }
681
682
}
822
823
void r300_emit_vertex_arrays(struct r300_context* r300, int offset,
823
824
                             boolean indexed, int instance_id)
824
825
{
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;
829
829
    int i;
861
861
        }
862
862
 
863
863
        for (i = 0; i < vertex_array_count; i++) {
864
 
            buf = r300_resource(valid_vbuf[velem[i].vertex_buffer_index]);
 
864
            buf = r300_resource(vbuf[velem[i].vertex_buffer_index].buffer);
865
865
            OUT_CS_RELOC(buf);
866
866
        }
867
867
    } else {
913
913
        }
914
914
 
915
915
        for (i = 0; i < vertex_array_count; i++) {
916
 
            buf = r300_resource(valid_vbuf[velem[i].vertex_buffer_index]);
 
916
            buf = r300_resource(vbuf[velem[i].vertex_buffer_index].buffer);
917
917
            OUT_CS_RELOC(buf);
918
918
        }
919
919
    }
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);
1194
1195
        }
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);
1201
1203
        }
1202
1204
    }
1208
1210
            }
1209
1211
 
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
                                    tex->domain);
1212
1215
        }
1213
1216
    }
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... */
1219
1222
    if (r300->vbo)
1220
1223
        r300->rws->cs_add_reloc(r300->cs, r300_resource(r300->vbo)->cs_buf,
1221
 
                                r300_resource(r300->vbo)->domain, 0);
 
1224
                                RADEON_USAGE_READ,
 
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++) {
1228
 
            if (!*buf)
 
1231
        struct pipe_resource *buf;
 
1232
        for (; vbuf != last; vbuf++) {
 
1233
            buf = vbuf->buffer;
 
1234
            if (!buf)
1229
1235
                continue;
1230
1236
 
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,
 
1238
                                    RADEON_USAGE_READ,
 
1239
                                    r300_resource(buf)->domain);
1233
1240
        }
1234
1241
    }
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);
 
1245
                                RADEON_USAGE_READ,
 
1246
                                r300_resource(index_buffer)->domain);
1239
1247
 
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. */
1243
1251
        if (flushed)
1244
1252
            return FALSE;
1245
1253
 
1246
 
        r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
1247
1254
        flushed = TRUE;
1248
1255
        goto validate;
1249
1256
    }