summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_resource.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2013-08-29 17:24:33 -0400
committerRob Clark <[email protected]>2013-08-29 17:35:05 -0400
commite95b7d89b9cd7d82b6122f9ad9bbf2249a0a8802 (patch)
tree4c33ddecff90d44eca28938b6ddcaf730848fe7d /src/gallium/drivers/freedreno/freedreno_resource.c
parent0267f264cc5a492d29858f3a2f2fa69f4f73f82b (diff)
freedreno: updates for msm drm/kms driver
There where some small API tweaks in libdrm_freedreno to enable support for msm drm/kms driver. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_resource.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 1b1eaa52512..3e051ea9882 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -59,6 +59,9 @@ fd_resource_transfer_unmap(struct pipe_context *pctx,
struct pipe_transfer *ptrans)
{
struct fd_context *ctx = fd_context(pctx);
+ struct fd_resource *rsc = fd_resource(ptrans->resource);
+ if (!(ptrans->usage & PIPE_TRANSFER_UNSYNCHRONIZED))
+ fd_bo_cpu_fini(rsc->bo);
pipe_resource_reference(&ptrans->resource, NULL);
util_slab_free(&ctx->transfer_pool, ptrans);
}
@@ -74,12 +77,13 @@ fd_resource_transfer_map(struct pipe_context *pctx,
struct fd_resource *rsc = fd_resource(prsc);
struct pipe_transfer *ptrans = util_slab_alloc(&ctx->transfer_pool);
enum pipe_format format = prsc->format;
+ uint32_t op = 0;
char *buf;
if (!ptrans)
return NULL;
- /* util_slap_alloc() doesn't zero: */
+ /* util_slab_alloc() doesn't zero: */
memset(ptrans, 0, sizeof(*ptrans));
pipe_resource_reference(&ptrans->resource, prsc);
@@ -90,7 +94,8 @@ fd_resource_transfer_map(struct pipe_context *pctx,
ptrans->layer_stride = ptrans->stride;
/* some state trackers (at least XA) don't do this.. */
- fd_resource_transfer_flush_region(pctx, ptrans, box);
+ if (!(usage & PIPE_TRANSFER_FLUSH_EXPLICIT))
+ fd_resource_transfer_flush_region(pctx, ptrans, box);
buf = fd_bo_map(rsc->bo);
if (!buf) {
@@ -98,6 +103,15 @@ fd_resource_transfer_map(struct pipe_context *pctx,
return NULL;
}
+ if (usage & PIPE_TRANSFER_READ)
+ op |= DRM_FREEDRENO_PREP_READ;
+
+ if (usage & PIPE_TRANSFER_WRITE)
+ op |= DRM_FREEDRENO_PREP_WRITE;
+
+ if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED))
+ fd_bo_cpu_prep(rsc->bo, ctx->screen->pipe, op);
+
*pptrans = ptrans;
return buf +