summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/identity
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/identity')
-rw-r--r--src/gallium/drivers/identity/id_context.c52
-rw-r--r--src/gallium/drivers/identity/id_objects.c10
-rw-r--r--src/gallium/drivers/identity/id_objects.h2
3 files changed, 22 insertions, 42 deletions
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index cf0a3f9aa40..fb2f78764a4 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -776,53 +776,34 @@ identity_context_surface_destroy(struct pipe_context *_pipe,
identity_surface(_surf));
}
-static struct pipe_transfer *
-identity_context_get_transfer(struct pipe_context *_context,
+static void *
+identity_context_transfer_map(struct pipe_context *_context,
struct pipe_resource *_resource,
unsigned level,
unsigned usage,
- const struct pipe_box *box)
+ const struct pipe_box *box,
+ struct pipe_transfer **transfer)
{
struct identity_context *id_context = identity_context(_context);
struct identity_resource *id_resource = identity_resource(_resource);
struct pipe_context *context = id_context->pipe;
struct pipe_resource *resource = id_resource->resource;
struct pipe_transfer *result;
+ void *map;
- result = context->get_transfer(context,
- resource,
- level,
- usage,
- box);
-
- if (result)
- return identity_transfer_create(id_context, id_resource, result);
- return NULL;
-}
+ map = context->transfer_map(context,
+ resource,
+ level,
+ usage,
+ box, &result);
-static void
-identity_context_transfer_destroy(struct pipe_context *_pipe,
- struct pipe_transfer *_transfer)
-{
- identity_transfer_destroy(identity_context(_pipe),
- identity_transfer(_transfer));
-}
-
-static void *
-identity_context_transfer_map(struct pipe_context *_context,
- struct pipe_transfer *_transfer)
-{
- struct identity_context *id_context = identity_context(_context);
- struct identity_transfer *id_transfer = identity_transfer(_transfer);
- struct pipe_context *context = id_context->pipe;
- struct pipe_transfer *transfer = id_transfer->transfer;
+ if (!map)
+ return NULL;
- return context->transfer_map(context,
- transfer);
+ *transfer = identity_transfer_map(id_context, id_resource, result);
+ return *transfer ? map : NULL;
}
-
-
static void
identity_context_transfer_flush_region(struct pipe_context *_context,
struct pipe_transfer *_transfer,
@@ -850,6 +831,9 @@ identity_context_transfer_unmap(struct pipe_context *_context,
context->transfer_unmap(context,
transfer);
+
+ identity_transfer_destroy(identity_context(_context),
+ identity_transfer(_transfer));
}
@@ -945,8 +929,6 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.surface_destroy = identity_context_surface_destroy;
id_pipe->base.create_sampler_view = identity_context_create_sampler_view;
id_pipe->base.sampler_view_destroy = identity_context_sampler_view_destroy;
- id_pipe->base.get_transfer = identity_context_get_transfer;
- id_pipe->base.transfer_destroy = identity_context_transfer_destroy;
id_pipe->base.transfer_map = identity_context_transfer_map;
id_pipe->base.transfer_unmap = identity_context_transfer_unmap;
id_pipe->base.transfer_flush_region = identity_context_transfer_flush_region;
diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c
index 63454410525..a26d9874870 100644
--- a/src/gallium/drivers/identity/id_objects.c
+++ b/src/gallium/drivers/identity/id_objects.c
@@ -149,9 +149,9 @@ identity_sampler_view_destroy(struct identity_context *id_context,
struct pipe_transfer *
-identity_transfer_create(struct identity_context *id_context,
- struct identity_resource *id_resource,
- struct pipe_transfer *transfer)
+identity_transfer_map(struct identity_context *id_context,
+ struct identity_resource *id_resource,
+ struct pipe_transfer *transfer)
{
struct identity_transfer *id_transfer;
@@ -175,7 +175,7 @@ identity_transfer_create(struct identity_context *id_context,
return &id_transfer->base;
error:
- id_context->pipe->transfer_destroy(id_context->pipe, transfer);
+ id_context->pipe->transfer_unmap(id_context->pipe, transfer);
return NULL;
}
@@ -184,8 +184,6 @@ identity_transfer_destroy(struct identity_context *id_context,
struct identity_transfer *id_transfer)
{
pipe_resource_reference(&id_transfer->base.resource, NULL);
- id_context->pipe->transfer_destroy(id_context->pipe,
- id_transfer->transfer);
FREE(id_transfer);
}
diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h
index 181f2d6623e..67049436247 100644
--- a/src/gallium/drivers/identity/id_objects.h
+++ b/src/gallium/drivers/identity/id_objects.h
@@ -165,7 +165,7 @@ identity_sampler_view_destroy(struct identity_context *id_context,
struct identity_sampler_view *id_sampler_view);
struct pipe_transfer *
-identity_transfer_create(struct identity_context *id_context,
+identity_transfer_map(struct identity_context *id_context,
struct identity_resource *id_resource,
struct pipe_transfer *transfer);