summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/r600_blit.c12
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c33
-rw-r--r--src/gallium/drivers/r600/r600_query.c4
-rw-r--r--src/gallium/drivers/r600/r600_resource.h1
-rw-r--r--src/gallium/drivers/r600/r600_screen.c1
-rw-r--r--src/gallium/drivers/r600/r600_shader.c4
-rw-r--r--src/gallium/drivers/r600/r600_texture.c6
-rw-r--r--src/gallium/drivers/r600/radeon.h7
8 files changed, 23 insertions, 45 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 0e061c25f77..54fbc50bbc4 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -179,11 +179,11 @@ static int r600_blit_state_vs_resources(struct r600_screen *rscreen, struct r600
};
/* simple shader */
- bo = radeon_ws_bo(rscreen->rw, 128, 4096);
+ bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0);
if (bo == NULL) {
return -ENOMEM;
}
- data = radeon_ws_bo_map(rscreen->rw, bo);
+ data = radeon_ws_bo_map(rscreen->rw, bo, 0, NULL);
if (!data) {
radeon_ws_bo_reference(rscreen->rw, &bo, NULL);
return -ENOMEM;
@@ -274,11 +274,11 @@ static void r600_blit_state_vs_shader(struct r600_screen *rscreen, struct radeon
};
/* simple shader */
- bo = radeon_ws_bo(rscreen->rw, 128, 4096);
+ bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0);
if (bo == NULL) {
return;
}
- data = radeon_ws_bo_map(rscreen->rw, bo);
+ data = radeon_ws_bo_map(rscreen->rw, bo, 0, NULL);
if (!data) {
radeon_ws_bo_reference(rscreen->rw, &bo, NULL);
return;
@@ -338,11 +338,11 @@ static void r600_blit_state_ps_shader(struct r600_screen *rscreen, struct radeon
};
/* simple shader */
- bo = radeon_ws_bo(rscreen->rw, 128, 4096);
+ bo = radeon_ws_bo(rscreen->rw, 128, 4096, 0);
if (bo == NULL) {
return;
}
- data = radeon_ws_bo_map(rscreen->rw, bo);
+ data = radeon_ws_bo_map(rscreen->rw, bo, 0, NULL);
if (!data) {
radeon_ws_bo_reference(rscreen->rw, &bo, NULL);
return;
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 37abf42d34f..a38c013e167 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -69,7 +69,6 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
struct r600_screen *rscreen = r600_screen(screen);
struct r600_resource *rbuffer;
struct radeon_ws_bo *bo;
- struct pb_desc desc;
/* XXX We probably want a different alignment for buffers and textures. */
unsigned alignment = 4096;
@@ -82,19 +81,8 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
rbuffer->base.b.screen = screen;
rbuffer->base.vtbl = &r600_buffer_vtbl;
rbuffer->size = rbuffer->base.b.width0;
- if ((rscreen->use_mem_constant == FALSE) && (rbuffer->base.b.bind & PIPE_BIND_CONSTANT_BUFFER)) {
- desc.alignment = alignment;
- desc.usage = rbuffer->base.b.bind;
- rbuffer->pb = pb_malloc_buffer_create(rbuffer->base.b.width0,
- &desc);
- if (rbuffer->pb == NULL) {
- free(rbuffer);
- return NULL;
- }
- return &rbuffer->base.b;
- }
rbuffer->domain = r600_domain_from_usage(rbuffer->base.b.bind);
- bo = radeon_ws_bo(rscreen->rw, rbuffer->base.b.width0, alignment);
+ bo = radeon_ws_bo(rscreen->rw, rbuffer->base.b.width0, alignment, rbuffer->base.b.bind);
if (bo == NULL) {
FREE(rbuffer);
return NULL;
@@ -125,7 +113,7 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
if (rbuffer == NULL) {
return NULL;
}
- data = radeon_ws_bo_map(rscreen->rw, rbuffer->bo);
+ data = radeon_ws_bo_map(rscreen->rw, rbuffer->bo, 0, NULL);
memcpy(data, ptr, bytes);
radeon_ws_bo_unmap(rscreen->rw, rbuffer->bo);
return &rbuffer->base.b;
@@ -137,15 +125,9 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
struct r600_resource *rbuffer = (struct r600_resource*)buf;
struct r600_screen *rscreen = r600_screen(screen);
- if (rbuffer->pb) {
- pipe_reference_init(&rbuffer->pb->base.reference, 0);
- pb_destroy(rbuffer->pb);
- rbuffer->pb = NULL;
- }
if (rbuffer->bo) {
radeon_ws_bo_reference(rscreen->rw, &rbuffer->bo, NULL);
}
- memset(rbuffer, 0, sizeof(struct r600_resource));
FREE(rbuffer);
}
@@ -157,16 +139,13 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
int write = 0;
uint8_t *data;
- if (rbuffer->pb) {
- return (uint8_t*)pb_map(rbuffer->pb, transfer->usage, NULL) + transfer->box.x;
- }
if (transfer->usage & PIPE_TRANSFER_DONTBLOCK) {
/* FIXME */
}
if (transfer->usage & PIPE_TRANSFER_WRITE) {
write = 1;
}
- data = radeon_ws_bo_map(rscreen->rw, rbuffer->bo);
+ data = radeon_ws_bo_map(rscreen->rw, rbuffer->bo, transfer->usage, r600_context(pipe));
if (!data)
return NULL;
@@ -179,11 +158,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe,
struct r600_resource *rbuffer = (struct r600_resource*)transfer->resource;
struct r600_screen *rscreen = r600_screen(pipe->screen);
- if (rbuffer->pb) {
- pb_unmap(rbuffer->pb);
- } else {
- radeon_ws_bo_unmap(rscreen->rw, rbuffer->bo);
- }
+ radeon_ws_bo_unmap(rscreen->rw, rbuffer->bo);
}
static void r600_buffer_transfer_flush_region(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 922d7ace130..12900cce114 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -79,7 +79,7 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
q->type = query_type;
q->buffer_size = 4096;
- q->buffer = radeon_ws_bo(rscreen->rw, q->buffer_size, 1);
+ q->buffer = radeon_ws_bo(rscreen->rw, q->buffer_size, 1, 0);
if (!q->buffer) {
FREE(q);
return NULL;
@@ -109,7 +109,7 @@ static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquer
int i;
radeon_ws_bo_wait(rscreen->rw, rquery->buffer);
- results = radeon_ws_bo_map(rscreen->rw, rquery->buffer);
+ results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, r600_context(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_resource.h b/src/gallium/drivers/r600/r600_resource.h
index 8a110b1b72a..ff05afbc302 100644
--- a/src/gallium/drivers/r600/r600_resource.h
+++ b/src/gallium/drivers/r600/r600_resource.h
@@ -37,7 +37,6 @@ struct r600_resource {
struct radeon_ws_bo *bo;
u32 domain;
u32 flink;
- struct pb_buffer *pb;
u32 size;
};
diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c
index 19d1005e771..1d8612c21d4 100644
--- a/src/gallium/drivers/r600/r600_screen.c
+++ b/src/gallium/drivers/r600/r600_screen.c
@@ -277,6 +277,7 @@ struct pipe_screen *r600_screen_create(struct radeon *rw)
FREE(rscreen);
return NULL;
}
+ radeon_set_mem_constant(rw, rscreen->use_mem_constant);
rscreen->rw = rw;
rscreen->screen.winsys = (struct pipe_winsys*)rw;
rscreen->screen.destroy = r600_destroy_screen;
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 10f6d016a38..4da6850b0a9 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -163,11 +163,11 @@ static int r600_pipe_shader(struct pipe_context *ctx, struct r600_context_state
radeon_ws_bo_reference(rscreen->rw, &rpshader->bo, NULL);
rpshader->bo = NULL;
rpshader->bo = radeon_ws_bo(rscreen->rw, rshader->bc.ndw * 4,
- 4096);
+ 4096, 0);
if (rpshader->bo == NULL) {
return -ENOMEM;
}
- data = radeon_ws_bo_map(rscreen->rw, rpshader->bo);
+ data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, rctx);
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_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 4fa8cf47099..efc5f820659 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -121,7 +121,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
/* FIXME alignment 4096 enought ? too much ? */
resource->domain = r600_domain_from_usage(resource->base.b.bind);
resource->size = rtex->size;
- resource->bo = radeon_ws_bo(radeon, rtex->size, 4096);
+ resource->bo = radeon_ws_bo(radeon, rtex->size, 4096, 0);
if (resource->bo == NULL) {
FREE(rtex);
return NULL;
@@ -344,7 +344,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);
+ map = radeon_ws_bo_map(radeon, bo, 0, r600_context(ctx));
if (!map) {
return NULL;
}
@@ -655,7 +655,7 @@ int r600_texture_from_depth(struct pipe_context *ctx, struct r600_resource_textu
/* allocate uncompressed texture */
if (rtexture->uncompressed == NULL) {
- rtexture->uncompressed = radeon_ws_bo(rscreen->rw, rtexture->size, 4096);
+ rtexture->uncompressed = radeon_ws_bo(rscreen->rw, rtexture->size, 4096, 0);
if (rtexture->uncompressed == NULL) {
return -ENOMEM;
}
diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h
index be28ad19ff6..36bfb747b51 100644
--- a/src/gallium/drivers/r600/radeon.h
+++ b/src/gallium/drivers/r600/radeon.h
@@ -21,6 +21,8 @@
#include <stdint.h>
+#include <pipe/p_compiler.h>
+
typedef uint64_t u64;
typedef uint32_t u32;
typedef uint16_t u16;
@@ -86,14 +88,15 @@ enum {
};
enum radeon_family radeon_get_family(struct radeon *rw);
+void radeon_set_mem_constant(struct radeon *radeon, boolean state);
/* lowlevel WS bo */
struct radeon_ws_bo;
struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
- unsigned size, unsigned alignment);
+ unsigned size, unsigned alignment, unsigned usage);
struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon,
unsigned handle);
-void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo);
+void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx);
void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo);
void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
struct radeon_ws_bo *src);