From: Marek Olšák Date: Mon, 5 Mar 2012 12:45:00 +0000 (+0100) Subject: Revert "gallium: add flag PIPE_TRANSFER_MAP_PERMANENTLY" X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62f44f670bb0162e89fd4786af877f8da9ff607c;p=mesa.git Revert "gallium: add flag PIPE_TRANSFER_MAP_PERMANENTLY" This reverts commit 0950086376b1c8b7fb89eda81ed7f2f06dee58bc. It was decided to refactor the transfer API instead of adding workarounds to address the performance issues. --- diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index c54e481698e..77c03450b3a 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -68,13 +68,8 @@ i915_get_transfer(struct pipe_context *pipe, const struct pipe_box *box) { struct i915_context *i915 = i915_context(pipe); - struct pipe_transfer *transfer; + struct pipe_transfer *transfer = util_slab_alloc(&i915->transfer_pool); - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } - - transfer = util_slab_alloc(&i915->transfer_pool); if (transfer == NULL) return NULL; diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index 64d071c9d53..8ff733a7be5 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -720,14 +720,9 @@ i915_texture_get_transfer(struct pipe_context *pipe, { struct i915_context *i915 = i915_context(pipe); struct i915_texture *tex = i915_texture(resource); - struct i915_transfer *transfer; + struct i915_transfer *transfer = util_slab_alloc(&i915->texture_transfer_pool); boolean use_staging_texture = FALSE; - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } - - transfer = util_slab_alloc(&i915->texture_transfer_pool); if (transfer == NULL) return NULL; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index e895485e947..28e5aa9a806 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -601,10 +601,6 @@ llvmpipe_get_transfer(struct pipe_context *pipe, assert(resource); assert(level <= resource->last_level); - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } - /* * Transfers, like other pipe operations, must happen in order, so flush the * context if necessary. diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index 02186ba3739..f822625af90 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -172,13 +172,7 @@ nouveau_buffer_transfer_get(struct pipe_context *pipe, { struct nv04_resource *buf = nv04_resource(resource); struct nouveau_context *nv = nouveau_context(pipe); - struct nouveau_transfer *xfr; - - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } - - xfr = CALLOC_STRUCT(nouveau_transfer); + struct nouveau_transfer *xfr = CALLOC_STRUCT(nouveau_transfer); if (!xfr) return NULL; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 8ddebeb7451..6f860e73348 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -243,7 +243,7 @@ nv50_miptree_transfer_new(struct pipe_context *pctx, uint32_t size; int ret; - if (usage & (PIPE_TRANSFER_MAP_DIRECTLY | PIPE_TRANSFER_MAP_PERMANENTLY)) + if (usage & PIPE_TRANSFER_MAP_DIRECTLY) return NULL; tx = CALLOC_STRUCT(nv50_transfer); diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.c b/src/gallium/drivers/nvc0/nvc0_transfer.c index c04f41f6ea3..f16863733b7 100644 --- a/src/gallium/drivers/nvc0/nvc0_transfer.c +++ b/src/gallium/drivers/nvc0/nvc0_transfer.c @@ -243,7 +243,7 @@ nvc0_miptree_transfer_new(struct pipe_context *pctx, uint32_t size; int ret; - if (usage & (PIPE_TRANSFER_MAP_DIRECTLY | PIPE_TRANSFER_MAP_PERMANENTLY)) + if (usage & PIPE_TRANSFER_MAP_DIRECTLY) return NULL; tx = CALLOC_STRUCT(nvc0_transfer); diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c index 605af8efa8e..7a218b18c64 100644 --- a/src/gallium/drivers/nvfx/nvfx_transfer.c +++ b/src/gallium/drivers/nvfx/nvfx_transfer.c @@ -26,9 +26,6 @@ nvfx_transfer_new(struct pipe_context *pipe, unsigned usage, const struct pipe_box *box) { - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } if((usage & (PIPE_TRANSFER_UNSYNCHRONIZED | PIPE_TRANSFER_DONTBLOCK)) == PIPE_TRANSFER_DONTBLOCK) { struct nouveau_bo* bo = ((struct nvfx_resource*)pt)->bo; diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index ada094bcb59..5e99cc467a8 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -89,10 +89,6 @@ r300_texture_get_transfer(struct pipe_context *ctx, struct pipe_resource base; boolean referenced_cs, referenced_hw; - if (usage & (PIPE_TRANSFER_MAP_DIRECTLY | PIPE_TRANSFER_MAP_PERMANENTLY)) { - return NULL; - } - referenced_cs = r300->rws->cs_is_buffer_referenced(r300->cs, tex->cs_buf); if (referenced_cs) { diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 2b69fcd92f7..a5a94d4aee6 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -790,10 +790,6 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, int r; boolean use_staging_texture = FALSE; - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } - /* We cannot map a tiled texture directly because the data is * in a different order, therefore we do detiling using a blit. * diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index 57ec752bf9b..fa713ee88ad 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -74,10 +74,6 @@ svga_buffer_get_transfer(struct pipe_context *pipe, struct svga_buffer *sbuf = svga_buffer(resource); struct pipe_transfer *transfer; - if (usage & PIPE_TRANSFER_MAP_PERMANENTLY) { - return NULL; - } - transfer = CALLOC_STRUCT(pipe_transfer); if (transfer == NULL) { return NULL; diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index c5b830660f5..9830e79d106 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -251,7 +251,7 @@ svga_texture_get_transfer(struct pipe_context *pipe, unsigned nblocksy = util_format_get_nblocksy(texture->format, box->height); /* We can't map texture storage directly */ - if (usage & (PIPE_TRANSFER_MAP_DIRECTLY | PIPE_TRANSFER_MAP_PERMANENTLY)) + if (usage & PIPE_TRANSFER_MAP_DIRECTLY) return NULL; assert(box->depth == 1); diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index ff6c07dddd0..889fc9961f4 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -225,22 +225,6 @@ enum pipe_transfer_usage { */ PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2), - /** - * The transfer should map the resource storage directly and the GPU should - * be able to see what the CPU has written. Such a storage may stay mapped - * while issuing draw commands which use it. The only allowed usage is - * non-overlapping writes which are suballocated out of a big buffer. - * The minimum allowed alignment of suballocations is 256 bytes (this is - * a subject to change). - * The flag is intended to be used to avoid mapping and unmapping - * resources repeatedly when doing uploads and draws intermixed. - * - * The driver may return NULL if that isn't possible, and the state - * tracker needs to cope with that and use an alternative path - * without this flag. - */ - PIPE_TRANSFER_MAP_PERMANENTLY = (1 << 3), - /** * Discards the memory within the mapped region. *