r600g: don't share u_upload_mgr with u_vbuf, create its own

This commit is contained in:
Marek Olšák 2012-04-11 16:00:09 +02:00
parent e54cc2c070
commit 428855eea3
4 changed files with 15 additions and 4 deletions

View file

@ -28,6 +28,7 @@
#include "util/u_blitter.h"
#include "util/u_format_s3tc.h"
#include "util/u_simple_shaders.h"
#include "util/u_upload_mgr.h"
#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
#include "os/os_time.h"
@ -194,6 +195,9 @@ static void r600_destroy_context(struct pipe_context *context)
if (rctx->vbuf_mgr) {
u_vbuf_destroy(rctx->vbuf_mgr);
}
if (rctx->uploader) {
u_upload_destroy(rctx->uploader);
}
util_slab_destroy(&rctx->pool_transfers);
r600_update_num_contexts(rctx->screen, -1);
@ -304,6 +308,12 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
if (!rctx->vbuf_mgr)
goto fail;
rctx->uploader = u_upload_create(&rctx->context, 1024 * 1024, 256,
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER);
if (!rctx->uploader)
goto fail;
rctx->blitter = util_blitter_create(&rctx->context);
if (rctx->blitter == NULL)
goto fail;

View file

@ -285,6 +285,7 @@ struct r600_context {
struct r600_textures_info ps_samplers;
struct u_vbuf *vbuf_mgr;
struct u_upload_mgr *uploader;
struct util_slab_mempool pool_transfers;
boolean have_depth_texture, have_depth_fb;

View file

@ -574,10 +574,10 @@ void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
tmpPtr[i] = bswap_32(((uint32_t *)ptr)[i]);
}
u_upload_data(rctx->vbuf_mgr->uploader, 0, size, tmpPtr, &cb->buffer_offset, &cb->buffer);
u_upload_data(rctx->uploader, 0, size, tmpPtr, &cb->buffer_offset, &cb->buffer);
free(tmpPtr);
} else {
u_upload_data(rctx->vbuf_mgr->uploader, 0, buffer->width0, ptr, &cb->buffer_offset, &cb->buffer);
u_upload_data(rctx->uploader, 0, buffer->width0, ptr, &cb->buffer_offset, &cb->buffer);
}
} else {
/* Setup the hw buffer. */
@ -780,7 +780,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo)
ptr = ib.buffer->user_ptr;
if (ptr) {
u_upload_data(rctx->vbuf_mgr->uploader, 0, info.count * ib.index_size,
u_upload_data(rctx->uploader, 0, info.count * ib.index_size,
ptr, &ib.offset, &ib.buffer);
}
} else {

View file

@ -38,7 +38,7 @@ void r600_translate_index_buffer(struct r600_context *r600,
switch (ib->index_size) {
case 1:
u_upload_alloc(r600->vbuf_mgr->uploader, 0, count * 2,
u_upload_alloc(r600->uploader, 0, count * 2,
&out_offset, &out_buffer, &ptr);
util_shorten_ubyte_elts_to_userptr(