mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
freedreno: Add support for upload transfers
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18258>
This commit is contained in:
parent
4703efd23f
commit
9da5b2c1f5
2 changed files with 12 additions and 1 deletions
|
|
@ -710,7 +710,10 @@ fd_resource_transfer_unmap(struct pipe_context *pctx,
|
|||
pipe_resource_reference(&trans->staging_prsc, NULL);
|
||||
}
|
||||
|
||||
if (!(ptrans->usage & PIPE_MAP_UNSYNCHRONIZED)) {
|
||||
if (trans->upload_ptr) {
|
||||
fd_bo_upload(rsc->bo, trans->upload_ptr, ptrans->box.x, ptrans->box.width);
|
||||
free(trans->upload_ptr);
|
||||
} else if (!(ptrans->usage & PIPE_MAP_UNSYNCHRONIZED)) {
|
||||
fd_bo_cpu_fini(rsc->bo);
|
||||
}
|
||||
|
||||
|
|
@ -789,6 +792,13 @@ resource_transfer_map_unsync(struct pipe_context *pctx,
|
|||
uint32_t offset;
|
||||
char *buf;
|
||||
|
||||
if ((prsc->target == PIPE_BUFFER) &&
|
||||
!(usage & (PIPE_MAP_READ | PIPE_MAP_DIRECTLY | PIPE_MAP_PERSISTENT)) &&
|
||||
fd_bo_prefer_upload(rsc->bo, box->width)) {
|
||||
trans->upload_ptr = malloc(box->width);
|
||||
return trans->upload_ptr;
|
||||
}
|
||||
|
||||
buf = fd_bo_map(rsc->bo);
|
||||
|
||||
/* With imported bo's allocated by something outside of mesa, when
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ struct fd_transfer {
|
|||
struct threaded_transfer b;
|
||||
struct pipe_resource *staging_prsc;
|
||||
struct pipe_box staging_box;
|
||||
void *upload_ptr;
|
||||
};
|
||||
|
||||
static inline struct fd_transfer *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue