aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/galahad
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/galahad')
-rw-r--r--src/gallium/drivers/galahad/glhd_context.c65
-rw-r--r--src/gallium/drivers/galahad/glhd_objects.c4
2 files changed, 22 insertions, 47 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
index 354f20a3ad7..92ca4a63da9 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -877,58 +877,35 @@ galahad_context_surface_destroy(struct pipe_context *_pipe,
}
-
-static struct pipe_transfer *
-galahad_context_get_transfer(struct pipe_context *_context,
- struct pipe_resource *_resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box)
+static void *
+galahad_context_transfer_map(struct pipe_context *_context,
+ struct pipe_resource *_resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ struct pipe_transfer **transfer)
{
struct galahad_context *glhd_context = galahad_context(_context);
struct galahad_resource *glhd_resource = galahad_resource(_resource);
struct pipe_context *context = glhd_context->pipe;
struct pipe_resource *resource = glhd_resource->resource;
struct pipe_transfer *result;
-
- result = context->get_transfer(context,
- resource,
- level,
- usage,
- box);
-
- if (result)
- return galahad_transfer_create(glhd_context, glhd_resource, result);
- return NULL;
-}
-
-static void
-galahad_context_transfer_destroy(struct pipe_context *_pipe,
- struct pipe_transfer *_transfer)
-{
- galahad_transfer_destroy(galahad_context(_pipe),
- galahad_transfer(_transfer));
-}
-
-static void *
-galahad_context_transfer_map(struct pipe_context *_context,
- struct pipe_transfer *_transfer)
-{
- struct galahad_context *glhd_context = galahad_context(_context);
- struct galahad_transfer *glhd_transfer = galahad_transfer(_transfer);
- struct pipe_context *context = glhd_context->pipe;
- struct pipe_transfer *transfer = glhd_transfer->transfer;
-
- struct galahad_resource *glhd_resource = galahad_resource(_transfer->resource);
+ void *map;
+
+ map = context->transfer_map(context,
+ resource,
+ level,
+ usage,
+ box, &result);
+ if (!map)
+ return NULL;
glhd_resource->map_count++;
- return context->transfer_map(context,
- transfer);
+ *transfer = galahad_transfer_create(glhd_context, glhd_resource, result);
+ return *transfer ? map : NULL;
}
-
-
static void
galahad_context_transfer_flush_region(struct pipe_context *_context,
struct pipe_transfer *_transfer,
@@ -944,7 +921,6 @@ galahad_context_transfer_flush_region(struct pipe_context *_context,
box);
}
-
static void
galahad_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *_transfer)
@@ -964,6 +940,9 @@ galahad_context_transfer_unmap(struct pipe_context *_context,
context->transfer_unmap(context,
transfer);
+
+ galahad_transfer_destroy(galahad_context(_context),
+ galahad_transfer(_transfer));
}
@@ -1088,8 +1067,6 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
GLHD_PIPE_INIT(sampler_view_destroy);
GLHD_PIPE_INIT(create_surface);
GLHD_PIPE_INIT(surface_destroy);
- GLHD_PIPE_INIT(get_transfer);
- GLHD_PIPE_INIT(transfer_destroy);
GLHD_PIPE_INIT(transfer_map);
GLHD_PIPE_INIT(transfer_flush_region);
GLHD_PIPE_INIT(transfer_unmap);
diff --git a/src/gallium/drivers/galahad/glhd_objects.c b/src/gallium/drivers/galahad/glhd_objects.c
index b44adff20c7..e4a8f28f352 100644
--- a/src/gallium/drivers/galahad/glhd_objects.c
+++ b/src/gallium/drivers/galahad/glhd_objects.c
@@ -173,7 +173,7 @@ galahad_transfer_create(struct galahad_context *glhd_context,
return &glhd_transfer->base;
error:
- glhd_context->pipe->transfer_destroy(glhd_context->pipe, transfer);
+ glhd_context->pipe->transfer_unmap(glhd_context->pipe, transfer);
return NULL;
}
@@ -182,7 +182,5 @@ galahad_transfer_destroy(struct galahad_context *glhd_context,
struct galahad_transfer *glhd_transfer)
{
pipe_resource_reference(&glhd_transfer->base.resource, NULL);
- glhd_context->pipe->transfer_destroy(glhd_context->pipe,
- glhd_transfer->transfer);
FREE(glhd_transfer);
}