summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv30')
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c59
-rw-r--r--src/gallium/drivers/nv30/nv30_resource.c2
2 files changed, 25 insertions, 36 deletions
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index 9700fa8cb4b..e89725feb2f 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -218,14 +218,16 @@ nv30_blit(struct pipe_context *pipe,
util_blitter_blit(nv30->blitter, &info);
}
-static struct pipe_transfer *
-nv30_miptree_transfer_new(struct pipe_context *pipe, struct pipe_resource *pt,
+static void *
+nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_resource *pt,
unsigned level, unsigned usage,
- const struct pipe_box *box)
+ const struct pipe_box *box,
+ struct pipe_transfer **ptransfer)
{
struct nv30_context *nv30 = nv30_context(pipe);
struct nouveau_device *dev = nv30->screen->base.device;
struct nv30_transfer *tx;
+ unsigned access = 0;
int ret;
tx = CALLOC_STRUCT(nv30_transfer);
@@ -270,42 +272,24 @@ nv30_miptree_transfer_new(struct pipe_context *pipe, struct pipe_resource *pt,
if (usage & PIPE_TRANSFER_READ)
nv30_transfer_rect(nv30, NEAREST, &tx->img, &tx->tmp);
- return &tx->base;
-}
-
-static void
-nv30_miptree_transfer_del(struct pipe_context *pipe, struct pipe_transfer *ptx)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_transfer *tx = nv30_transfer(ptx);
-
- if (ptx->usage & PIPE_TRANSFER_WRITE)
- nv30_transfer_rect(nv30, NEAREST, &tx->tmp, &tx->img);
-
- nouveau_bo_ref(NULL, &tx->tmp.bo);
- pipe_resource_reference(&ptx->resource, NULL);
- FREE(tx);
-}
-
-static void *
-nv30_miptree_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_transfer *tx = nv30_transfer(ptx);
- unsigned access = 0;
- int ret;
-
- if (tx->tmp.bo->map)
+ if (tx->tmp.bo->map) {
+ *ptransfer = &tx->base;
return tx->tmp.bo->map;
+ }
- if (ptx->usage & PIPE_TRANSFER_READ)
+ if (usage & PIPE_TRANSFER_READ)
access |= NOUVEAU_BO_RD;
- if (ptx->usage & PIPE_TRANSFER_WRITE)
+ if (usage & PIPE_TRANSFER_WRITE)
access |= NOUVEAU_BO_WR;
ret = nouveau_bo_map(tx->tmp.bo, access, nv30->base.client);
- if (ret)
+ if (ret) {
+ pipe_resource_reference(&tx->base.resource, NULL);
+ FREE(tx);
return NULL;
+ }
+
+ *ptransfer = &tx->base;
return tx->tmp.bo->map;
}
@@ -313,13 +297,20 @@ static void
nv30_miptree_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *ptx)
{
+ struct nv30_context *nv30 = nv30_context(pipe);
+ struct nv30_transfer *tx = nv30_transfer(ptx);
+
+ if (ptx->usage & PIPE_TRANSFER_WRITE)
+ nv30_transfer_rect(nv30, NEAREST, &tx->tmp, &tx->img);
+
+ nouveau_bo_ref(NULL, &tx->tmp.bo);
+ pipe_resource_reference(&ptx->resource, NULL);
+ FREE(tx);
}
const struct u_resource_vtbl nv30_miptree_vtbl = {
nv30_miptree_get_handle,
nv30_miptree_destroy,
- nv30_miptree_transfer_new,
- nv30_miptree_transfer_del,
nv30_miptree_transfer_map,
u_default_transfer_flush_region,
nv30_miptree_transfer_unmap,
diff --git a/src/gallium/drivers/nv30/nv30_resource.c b/src/gallium/drivers/nv30/nv30_resource.c
index 4d2a2284a75..f3bc8f1ee1b 100644
--- a/src/gallium/drivers/nv30/nv30_resource.c
+++ b/src/gallium/drivers/nv30/nv30_resource.c
@@ -66,11 +66,9 @@ nv30_resource_screen_init(struct pipe_screen *pscreen)
void
nv30_resource_init(struct pipe_context *pipe)
{
- pipe->get_transfer = u_get_transfer_vtbl;
pipe->transfer_map = u_transfer_map_vtbl;
pipe->transfer_flush_region = u_transfer_flush_region_vtbl;
pipe->transfer_unmap = u_transfer_unmap_vtbl;
- pipe->transfer_destroy = u_transfer_destroy_vtbl;
pipe->transfer_inline_write = u_transfer_inline_write_vtbl;
pipe->create_surface = nv30_miptree_surface_new;
pipe->surface_destroy = nv30_miptree_surface_del;