Rev 4358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4358 | Rev 4401 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | static void |
57 | static void |
58 | fd_resource_transfer_unmap(struct pipe_context *pctx, |
58 | fd_resource_transfer_unmap(struct pipe_context *pctx, |
59 | struct pipe_transfer *ptrans) |
59 | struct pipe_transfer *ptrans) |
60 | { |
60 | { |
61 | struct fd_context *ctx = fd_context(pctx); |
61 | struct fd_context *ctx = fd_context(pctx); |
- | 62 | struct fd_resource *rsc = fd_resource(ptrans->resource); |
|
- | 63 | if (!(ptrans->usage & PIPE_TRANSFER_UNSYNCHRONIZED)) |
|
- | 64 | fd_bo_cpu_fini(rsc->bo); |
|
62 | pipe_resource_reference(&ptrans->resource, NULL); |
65 | pipe_resource_reference(&ptrans->resource, NULL); |
63 | util_slab_free(&ctx->transfer_pool, ptrans); |
66 | util_slab_free(&ctx->transfer_pool, ptrans); |
64 | } |
67 | } |
Line 65... | Line 68... | ||
65 | 68 | ||
Line 72... | Line 75... | ||
72 | { |
75 | { |
73 | struct fd_context *ctx = fd_context(pctx); |
76 | struct fd_context *ctx = fd_context(pctx); |
74 | struct fd_resource *rsc = fd_resource(prsc); |
77 | struct fd_resource *rsc = fd_resource(prsc); |
75 | struct pipe_transfer *ptrans = util_slab_alloc(&ctx->transfer_pool); |
78 | struct pipe_transfer *ptrans = util_slab_alloc(&ctx->transfer_pool); |
76 | enum pipe_format format = prsc->format; |
79 | enum pipe_format format = prsc->format; |
- | 80 | uint32_t op = 0; |
|
77 | char *buf; |
81 | char *buf; |
Line 78... | Line 82... | ||
78 | 82 | ||
79 | if (!ptrans) |
83 | if (!ptrans) |
Line 80... | Line 84... | ||
80 | return NULL; |
84 | return NULL; |
81 | 85 | ||
Line 82... | Line 86... | ||
82 | /* util_slap_alloc() doesn't zero: */ |
86 | /* util_slab_alloc() doesn't zero: */ |
83 | memset(ptrans, 0, sizeof(*ptrans)); |
87 | memset(ptrans, 0, sizeof(*ptrans)); |
84 | 88 | ||
85 | pipe_resource_reference(&ptrans->resource, prsc); |
89 | pipe_resource_reference(&ptrans->resource, prsc); |
86 | ptrans->level = level; |
90 | ptrans->level = level; |
87 | ptrans->usage = usage; |
91 | ptrans->usage = usage; |
Line 88... | Line 92... | ||
88 | ptrans->box = *box; |
92 | ptrans->box = *box; |
- | 93 | ptrans->stride = rsc->pitch * rsc->cpp; |
|
89 | ptrans->stride = rsc->pitch * rsc->cpp; |
94 | ptrans->layer_stride = ptrans->stride; |
Line 90... | Line 95... | ||
90 | ptrans->layer_stride = ptrans->stride; |
95 | |
91 | 96 | /* some state trackers (at least XA) don't do this.. */ |
|
92 | /* some state trackers (at least XA) don't do this.. */ |
97 | if (!(usage & PIPE_TRANSFER_FLUSH_EXPLICIT)) |
93 | fd_resource_transfer_flush_region(pctx, ptrans, box); |
98 | fd_resource_transfer_flush_region(pctx, ptrans, box); |
94 | 99 | ||
Line -... | Line 100... | ||
- | 100 | buf = fd_bo_map(rsc->bo); |
|
- | 101 | if (!buf) { |
|
- | 102 | fd_resource_transfer_unmap(pctx, ptrans); |
|
- | 103 | return NULL; |
|
- | 104 | } |
|
- | 105 | ||
- | 106 | if (usage & PIPE_TRANSFER_READ) |
|
- | 107 | op |= DRM_FREEDRENO_PREP_READ; |
|
- | 108 | ||
95 | buf = fd_bo_map(rsc->bo); |
109 | if (usage & PIPE_TRANSFER_WRITE) |
Line 96... | Line 110... | ||
96 | if (!buf) { |
110 | op |= DRM_FREEDRENO_PREP_WRITE; |
97 | fd_resource_transfer_unmap(pctx, ptrans); |
111 | |
98 | return NULL; |
112 | if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) |