diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-12-23 19:40:54 +1000 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2011-02-11 01:07:25 +0100 |
commit | 6ccab620a0e7364ab6c0d902b3ddf58ee988f7fa (patch) | |
tree | 6228427e261efd6187915ab651b78f99d3ff7dd1 /src/gallium/drivers/r300/r300_render.c | |
parent | c0beaf6e6d5764531a4cb21d0d0a9a1fd09affee (diff) | |
download | external_mesa3d-6ccab620a0e7364ab6c0d902b3ddf58ee988f7fa.zip external_mesa3d-6ccab620a0e7364ab6c0d902b3ddf58ee988f7fa.tar.gz external_mesa3d-6ccab620a0e7364ab6c0d902b3ddf58ee988f7fa.tar.bz2 |
r300g: import the last bits of libdrm and cleanup the whole thing
Based on Dave's branch.
The majority of this commit is a cleanup, mainly renaming things.
There wasn't much code to import, just ioctl calls.
Also done:
- implemented unsynchronized bo_map (important optimization!)
- radeon_bo_is_referenced_by_cs is no longer a refcount hack
- dropped the libdrm_radeon dependency
I'm surprised that this has resulted in less code in the end.
Diffstat (limited to 'src/gallium/drivers/r300/r300_render.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_render.c | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index eda5c48..ca55984 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -330,15 +330,10 @@ static boolean immd_is_good_idea(struct r300_context *r300, if (!checked[vbi]) { buf = r300->vbuf_mgr->real_vertex_buffer[vbi]; - if (!(r300_resource(buf)->domain & R300_DOMAIN_GTT)) { + if ((r300_resource(buf)->domain != R300_DOMAIN_GTT)) { return FALSE; } - if (r300_buffer_is_referenced(&r300->context, buf, - R300_REF_CS | R300_REF_HW)) { - /* It's a very bad idea to map it... */ - return FALSE; - } checked[vbi] = TRUE; } } @@ -395,7 +390,8 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300, if (!transfer[vbi]) { map[vbi] = (uint32_t*)pipe_buffer_map(&r300->context, r300->vbuf_mgr->real_vertex_buffer[vbi], - PIPE_TRANSFER_READ, + PIPE_TRANSFER_READ | + PIPE_TRANSFER_UNSYNCHRONIZED, &transfer[vbi]); map[vbi] += (vbuf->buffer_offset / 4) + stride[i] * start; } @@ -575,7 +571,9 @@ static void r300_draw_range_elements(struct pipe_context* pipe, struct pipe_resource *userbuf; uint16_t *ptr = pipe_buffer_map(pipe, indexBuffer, - PIPE_TRANSFER_READ, &transfer); + PIPE_TRANSFER_READ | + PIPE_TRANSFER_UNSYNCHRONIZED, + &transfer); if (mode == PIPE_PRIM_TRIANGLES) { memcpy(indices3, ptr + start, 6); @@ -771,7 +769,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, if (r300->vbuf_mgr->vertex_buffer[i].buffer) { void *buf = pipe_buffer_map(pipe, r300->vbuf_mgr->vertex_buffer[i].buffer, - PIPE_TRANSFER_READ, + PIPE_TRANSFER_READ | + PIPE_TRANSFER_UNSYNCHRONIZED, &vb_transfer[i]); draw_set_mapped_vertex_buffer(r300->draw, i, buf); } @@ -779,7 +778,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, if (indexed) { indices = pipe_buffer_map(pipe, r300->index_buffer.buffer, - PIPE_TRANSFER_READ, &ib_transfer); + PIPE_TRANSFER_READ | + PIPE_TRANSFER_UNSYNCHRONIZED, &ib_transfer); } draw_set_mapped_index_buffer(r300->draw, indices); @@ -876,7 +876,8 @@ static void* r300_render_map_vertices(struct vbuf_render* render) r300render->vbo_ptr = pipe_buffer_map(&r300render->r300->context, r300->vbo, - PIPE_TRANSFER_WRITE, + PIPE_TRANSFER_WRITE | + PIPE_TRANSFER_UNSYNCHRONIZED, &r300render->vbo_transfer); assert(r300render->vbo_ptr); @@ -952,23 +953,6 @@ static void r300_render_draw_arrays(struct vbuf_render* render, return; } - /* Uncomment to dump all VBOs rendered through this interface. - * Slow and noisy! - ptr = pipe_buffer_map(&r300render->r300->context, - r300render->vbo, PIPE_TRANSFER_READ, - &r300render->vbo_transfer); - - for (i = 0; i < count; i++) { - printf("r300: Vertex %d\n", i); - draw_dump_emitted_vertex(&r300->vertex_info, ptr); - ptr += r300->vertex_info.size * 4; - printf("\n"); - } - - pipe_buffer_unmap(&r300render->r300->context, r300render->vbo, - r300render->vbo_transfer); - */ - BEGIN_CS(dwords); OUT_CS_REG(R300_GA_COLOR_CONTROL, r300_provoking_vertex_fixes(r300, r300render->prim)); |