summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_texture.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-16 20:22:09 +1000
committerDave Airlie <airlied@redhat.com>2010-09-17 10:57:49 +1000
commitf70f79f6f6027bdf2f7de09bb39e12a24420f338 (patch)
tree8ee84c9ddd557fddc10ee11837108eb23768235d /src/gallium/drivers/r600/r600_texture.c
parentec9d838aa56d2c4bc5649d7c26ac61abb6c4b9bb (diff)
r600g: attempt to abstract kernel bos from pipe driver.
introduce an abstraction layer between kernel bos and the winsys BOs. this is to allow plugging in pb manager with minimal disruption to pipe driver.
Diffstat (limited to 'src/gallium/drivers/r600/r600_texture.c')
-rw-r--r--src/gallium/drivers/r600/r600_texture.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 80cfa36ac0..4fa8cf4709 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -120,7 +120,8 @@ 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->bo = radeon_bo(radeon, 0, rtex->size, 4096, NULL);
+ resource->size = rtex->size;
+ resource->bo = radeon_ws_bo(radeon, rtex->size, 4096);
if (resource->bo == NULL) {
FREE(rtex);
return NULL;
@@ -149,10 +150,10 @@ static void r600_texture_destroy(struct pipe_screen *screen,
struct radeon *radeon = (struct radeon *)screen->winsys;
if (resource->bo) {
- radeon_bo_decref(radeon, resource->bo);
+ radeon_ws_bo_reference(radeon, &resource->bo, NULL);
}
if (rtex->uncompressed) {
- radeon_bo_decref(radeon, rtex->uncompressed);
+ radeon_ws_bo_reference(radeon, &rtex->uncompressed, NULL);
}
r600_texture_destroy_state(ptex);
FREE(rtex);
@@ -197,7 +198,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
struct radeon *rw = (struct radeon*)screen->winsys;
struct r600_resource_texture *rtex;
struct r600_resource *resource;
- struct radeon_bo *bo = NULL;
+ struct radeon_ws_bo *bo = NULL;
/* Support only 2D textures without mipmaps */
if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT) ||
@@ -208,7 +209,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
if (rtex == NULL)
return NULL;
- bo = radeon_bo(rw, whandle->handle, 0, 0, NULL);
+ bo = radeon_ws_bo_handle(rw, whandle->handle);
if (bo == NULL) {
FREE(rtex);
return NULL;
@@ -316,7 +317,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
{
struct r600_screen *rscreen = r600_screen(ctx->screen);
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
- struct radeon_bo *bo;
+ struct radeon_ws_bo *bo;
enum pipe_format format = transfer->resource->format;
struct radeon *radeon = (struct radeon *)ctx->screen->winsys;
struct r600_resource_texture *rtex;
@@ -343,12 +344,12 @@ 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);
}
- if (radeon_bo_map(radeon, bo)) {
+ map = radeon_ws_bo_map(radeon, bo);
+ if (!map) {
return NULL;
}
- radeon_bo_wait(radeon, bo);
+ radeon_ws_bo_wait(radeon, bo);
- map = bo->data;
return map + offset;
}
@@ -358,7 +359,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
struct radeon *radeon = (struct radeon *)ctx->screen->winsys;
struct r600_resource_texture *rtex;
- struct radeon_bo *bo;
+ struct radeon_ws_bo *bo;
if (rtransfer->linear_texture) {
bo = ((struct r600_resource *)rtransfer->linear_texture)->bo;
@@ -370,7 +371,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,
bo = ((struct r600_resource *)transfer->resource)->bo;
}
}
- radeon_bo_unmap(radeon, bo);
+ radeon_ws_bo_unmap(radeon, bo);
}
struct u_resource_vtbl r600_texture_vtbl =
@@ -654,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_bo(rscreen->rw, 0, rtexture->size, 4096, NULL);
+ rtexture->uncompressed = radeon_ws_bo(rscreen->rw, rtexture->size, 4096);
if (rtexture->uncompressed == NULL) {
return -ENOMEM;
}