summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-09-20 15:35:19 -0400
committerJerome Glisse <jglisse@redhat.com>2010-09-20 16:02:13 -0400
commit0f099f2906773690210661fb533e207626dc8e40 (patch)
tree02bbbc267829fa51a799fa117ed7062ba8f085c4 /src/gallium/drivers
parent021e68b2cdc9a675887dac33689d5ffe244d8f9a (diff)
r600g: use pipe context for flushing inside map
This allow to share code path btw old & new, also remove check on reference this might make things a little slower but new design doesn't use reference stuff. Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c2
-rw-r--r--src/gallium/drivers/r600/r600_context.c21
-rw-r--r--src/gallium/drivers/r600/r600_query.c2
-rw-r--r--src/gallium/drivers/r600/r600_shader.c2
-rw-r--r--src/gallium/drivers/r600/r600_state2.c3
-rw-r--r--src/gallium/drivers/r600/r600_texture.c2
-rw-r--r--src/gallium/drivers/r600/radeon.h1
7 files changed, 21 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index dc3fc812e1..ea370782fd 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -171,7 +171,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
if (transfer->usage & PIPE_TRANSFER_WRITE) {
write = 1;
}
- data = radeon_ws_bo_map(rscreen->rw, rbuffer->r.bo, transfer->usage, rctx);
+ data = radeon_ws_bo_map(rscreen->rw, rbuffer->r.bo, transfer->usage, pipe);
if (!data)
return NULL;
diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c
index 72aab91d04..7a63d966eb 100644
--- a/src/gallium/drivers/r600/r600_context.c
+++ b/src/gallium/drivers/r600/r600_context.c
@@ -69,6 +69,10 @@ void r600_flush(struct pipe_context *ctx, unsigned flags,
{
struct r600_context *rctx = r600_context(ctx);
struct r600_query *rquery = NULL;
+#if 0
+ static int dc = 0;
+ char dname[256];
+#endif
/* flush upload buffers */
u_upload_flush(rctx->upload_vb);
@@ -77,6 +81,16 @@ void r600_flush(struct pipe_context *ctx, unsigned flags,
/* suspend queries */
r600_queries_suspend(ctx);
+
+#if 0
+ sprintf(dname, "gallium-%08d.bof", dc);
+ if (dc < 2) {
+ radeon_ctx_dump_bof(rctx->ctx, dname);
+ R600_ERR("dumped %s\n", dname);
+ }
+ dc++;
+#endif
+
radeon_ctx_submit(rctx->ctx);
LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
@@ -88,13 +102,6 @@ void r600_flush(struct pipe_context *ctx, unsigned flags,
r600_queries_resume(ctx);
}
-void r600_flush_ctx(void *data)
-{
- struct r600_context *rctx = data;
-
- rctx->context.flush(&rctx->context, 0, NULL);
-}
-
struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
{
struct r600_context *rctx = CALLOC_STRUCT(r600_context);
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 023b09ef65..6e50701de6 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -108,7 +108,7 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer
u32 *results;
int i;
- results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, r600_context(ctx));
+ results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, ctx);
for (i = 0; i < rquery->num_results; i += 4) {
start = (u64)results[i] | (u64)results[i + 1] << 32;
end = (u64)results[i + 2] | (u64)results[i + 3] << 32;
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 1702475fa3..e1e2891b6e 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -167,7 +167,7 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_context_state
if (rpshader->bo == NULL) {
return -ENOMEM;
}
- data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, rctx);
+ data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, ctx);
memcpy(data, rshader->bc.bytecode, rshader->bc.ndw * 4);
radeon_ws_bo_unmap(rscreen->rw, rpshader->bo);
/* build state */
diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c
index ffb18ab7fb..5269e6db91 100644
--- a/src/gallium/drivers/r600/r600_state2.c
+++ b/src/gallium/drivers/r600/r600_state2.c
@@ -1600,6 +1600,9 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
/* unreference old buffer and reference new one */
rstate->id = R600_PIPE_STATE_FRAMEBUFFER;
for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
+ pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL);
+ }
+ for (int i = 0; i < state->nr_cbufs; i++) {
pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]);
}
pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf);
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 6633258090..abfe406402 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -346,7 +346,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
transfer->box.y / util_format_get_blockheight(format) * transfer->stride +
transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
}
- map = radeon_ws_bo_map(radeon, bo, 0, r600_context(ctx));
+ map = radeon_ws_bo_map(radeon, bo, 0, ctx);
if (!map) {
return NULL;
}
diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h
index e52dcb4a34..a7e7982c19 100644
--- a/src/gallium/drivers/r600/radeon.h
+++ b/src/gallium/drivers/r600/radeon.h
@@ -221,5 +221,4 @@ enum r600_stype {
#define R600_QUERY_SIZE 1
#define R600_QUERY_PM4 128
-void r600_flush_ctx(void *data);
#endif