aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c5
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug.c29
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug.h4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_s3tc.c5
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c62
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h66
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_pstipple.c6
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_resource.c28
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_slab.h2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c74
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tile.c105
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tile.h52
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_transfer.c50
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_transfer.h44
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_upload_mgr.c4
-rw-r--r--mesalib/src/mesa/Android.gen.mk2
-rw-r--r--mesalib/src/mesa/drivers/dri/Android.mk3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c32
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c64
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c15
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c63
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c70
25 files changed, 282 insertions, 517 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 4ad7a6be4..1072a0e9a 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -1704,7 +1704,8 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
struct pipe_resource *src,
unsigned src_layer,
unsigned sample_mask,
- void *custom_blend)
+ void *custom_blend,
+ enum pipe_format format)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
@@ -1724,7 +1725,7 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
pipe->set_sample_mask(pipe, sample_mask);
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
- surf_tmpl.format = dst->format;
+ surf_tmpl.format = format;
surf_tmpl.u.tex.level = dst_level;
surf_tmpl.u.tex.first_layer = dst_layer;
surf_tmpl.u.tex.last_layer = dst_layer;
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h
index 40636c616..4f7146701 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.h
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h
@@ -344,7 +344,8 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
struct pipe_resource *src,
unsigned src_layer,
unsigned sampled_mask,
- void *custom_blend);
+ void *custom_blend,
+ enum pipe_format format);
/* The functions below should be used to save currently bound constant state
* objects inside a driver. The objects are automatically restored at the end
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.c b/mesalib/src/gallium/auxiliary/util/u_debug.c
index bf98f222e..c41585fdd 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug.c
+++ b/mesalib/src/gallium/auxiliary/util/u_debug.c
@@ -516,14 +516,12 @@ void debug_dump_surface(struct pipe_context *pipe,
*/
texture = surface->texture;
- transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
- surface->u.tex.first_layer,
- PIPE_TRANSFER_READ,
- 0, 0, surface->width, surface->height);
-
- data = pipe->transfer_map(pipe, transfer);
+ data = pipe_transfer_map(pipe, texture, surface->u.tex.level,
+ surface->u.tex.first_layer,
+ PIPE_TRANSFER_READ,
+ 0, 0, surface->width, surface->height, &transfer);
if(!data)
- goto error;
+ return;
debug_dump_image(prefix,
texture->format,
@@ -534,8 +532,6 @@ void debug_dump_surface(struct pipe_context *pipe,
data);
pipe->transfer_unmap(pipe, transfer);
-error:
- pipe->transfer_destroy(pipe, transfer);
}
@@ -597,20 +593,21 @@ debug_dump_surface_bmp(struct pipe_context *pipe,
{
struct pipe_transfer *transfer;
struct pipe_resource *texture = surface->texture;
+ void *ptr;
- transfer = pipe_get_transfer(pipe, texture, surface->u.tex.level,
- surface->u.tex.first_layer, PIPE_TRANSFER_READ,
- 0, 0, surface->width, surface->height);
+ ptr = pipe_transfer_map(pipe, texture, surface->u.tex.level,
+ surface->u.tex.first_layer, PIPE_TRANSFER_READ,
+ 0, 0, surface->width, surface->height, &transfer);
- debug_dump_transfer_bmp(pipe, filename, transfer);
+ debug_dump_transfer_bmp(pipe, filename, transfer, ptr);
- pipe->transfer_destroy(pipe, transfer);
+ pipe->transfer_unmap(pipe, transfer);
}
void
debug_dump_transfer_bmp(struct pipe_context *pipe,
const char *filename,
- struct pipe_transfer *transfer)
+ struct pipe_transfer *transfer, void *ptr)
{
float *rgba;
@@ -624,7 +621,7 @@ debug_dump_transfer_bmp(struct pipe_context *pipe,
if(!rgba)
goto error1;
- pipe_get_tile_rgba(pipe, transfer, 0, 0,
+ pipe_get_tile_rgba(transfer, ptr, 0, 0,
transfer->box.width, transfer->box.height,
rgba);
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug.h b/mesalib/src/gallium/auxiliary/util/u_debug.h
index 06470f66a..ec7d4a07a 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug.h
+++ b/mesalib/src/gallium/auxiliary/util/u_debug.h
@@ -433,7 +433,7 @@ void debug_dump_surface_bmp(struct pipe_context *pipe,
struct pipe_surface *surface);
void debug_dump_transfer_bmp(struct pipe_context *pipe,
const char *filename,
- struct pipe_transfer *transfer);
+ struct pipe_transfer *transfer, void *ptr);
void debug_dump_float_rgba_bmp(const char *filename,
unsigned width, unsigned height,
float *rgba, unsigned stride);
@@ -441,7 +441,7 @@ void debug_dump_float_rgba_bmp(const char *filename,
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
#define debug_dump_surface(pipe, prefix, surface) ((void)0)
#define debug_dump_surface_bmp(pipe, filename, surface) ((void)0)
-#define debug_dump_transfer_bmp(filename, transfer) ((void)0)
+#define debug_dump_transfer_bmp(filename, transfer, ptr) ((void)0)
#define debug_dump_float_rgba_bmp(filename, width, height, rgba, stride) ((void)0)
#endif
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c
index d8a7c0d45..4a9dc2237 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -109,6 +109,7 @@ util_format_s3tc_init(void)
util_dl_proc fetch_2d_texel_rgba_dxt3;
util_dl_proc fetch_2d_texel_rgba_dxt5;
util_dl_proc tx_compress_dxtn;
+ char *force_s3tc_enable;
if (!first_time)
return;
@@ -119,8 +120,8 @@ util_format_s3tc_init(void)
library = util_dl_open(DXTN_LIBNAME);
if (!library) {
- if (getenv("force_s3tc_enable") &&
- !strcmp(getenv("force_s3tc_enable"), "true")) {
+ if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
+ !strcmp(force_s3tc_enable, "true")) {
debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
"force_s3tc_enable=true environment variable\n");
util_format_s3tc_enabled = TRUE;
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index c82c52c84..4d8adb9f3 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1111,17 +1111,14 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
void *srcMap, *dstMap;
- srcTrans = pipe_get_transfer(pipe, pt, srcLevel, layer,
- PIPE_TRANSFER_READ, 0, 0,
- u_minify(pt->width0, srcLevel),
- u_minify(pt->height0, srcLevel));
- dstTrans = pipe_get_transfer(pipe, pt, dstLevel, layer,
- PIPE_TRANSFER_WRITE, 0, 0,
- u_minify(pt->width0, dstLevel),
- u_minify(pt->height0, dstLevel));
-
- srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
- dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
+ srcMap = pipe_transfer_map(pipe, pt, srcLevel, layer,
+ PIPE_TRANSFER_READ, 0, 0,
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel), &srcTrans);
+ dstMap = pipe_transfer_map(pipe, pt, dstLevel, layer,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel), &dstTrans);
reduce_1d(pt->format,
srcTrans->box.width, srcMap,
@@ -1129,9 +1126,6 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
pipe->transfer_unmap(pipe, srcTrans);
pipe->transfer_unmap(pipe, dstTrans);
-
- pipe->transfer_destroy(pipe, srcTrans);
- pipe->transfer_destroy(pipe, dstTrans);
}
}
@@ -1152,17 +1146,14 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
ubyte *srcMap, *dstMap;
- srcTrans = pipe_get_transfer(pipe, pt, srcLevel, layer,
- PIPE_TRANSFER_READ, 0, 0,
- u_minify(pt->width0, srcLevel),
- u_minify(pt->height0, srcLevel));
- dstTrans = pipe_get_transfer(pipe, pt, dstLevel, layer,
- PIPE_TRANSFER_WRITE, 0, 0,
- u_minify(pt->width0, dstLevel),
- u_minify(pt->height0, dstLevel));
-
- srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
- dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
+ srcMap = pipe_transfer_map(pipe, pt, srcLevel, layer,
+ PIPE_TRANSFER_READ, 0, 0,
+ u_minify(pt->width0, srcLevel),
+ u_minify(pt->height0, srcLevel), &srcTrans);
+ dstMap = pipe_transfer_map(pipe, pt, dstLevel, layer,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ u_minify(pt->width0, dstLevel),
+ u_minify(pt->height0, dstLevel), &dstTrans);
reduce_2d(pt->format,
srcTrans->box.width, srcTrans->box.height,
@@ -1172,9 +1163,6 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
pipe->transfer_unmap(pipe, srcTrans);
pipe->transfer_unmap(pipe, dstTrans);
-
- pipe->transfer_destroy(pipe, srcTrans);
- pipe->transfer_destroy(pipe, dstTrans);
}
}
@@ -1207,15 +1195,12 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
dst_box.height = u_minify(pt->height0, dstLevel);
dst_box.depth = u_minify(pt->depth0, dstLevel);
- srcTrans = pipe->get_transfer(pipe, pt, srcLevel,
- PIPE_TRANSFER_READ,
- &src_box);
- dstTrans = pipe->get_transfer(pipe, pt, dstLevel,
- PIPE_TRANSFER_WRITE,
- &dst_box);
-
- srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
- dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
+ srcMap = pipe->transfer_map(pipe, pt, srcLevel,
+ PIPE_TRANSFER_READ,
+ &src_box, &srcTrans);
+ dstMap = pipe->transfer_map(pipe, pt, dstLevel,
+ PIPE_TRANSFER_WRITE,
+ &dst_box, &dstTrans);
reduce_3d(pt->format,
srcTrans->box.width, srcTrans->box.height, srcTrans->box.depth,
@@ -1225,9 +1210,6 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
pipe->transfer_unmap(pipe, srcTrans);
pipe->transfer_unmap(pipe, dstTrans);
-
- pipe->transfer_destroy(pipe, srcTrans);
- pipe->transfer_destroy(pipe, dstTrans);
}
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index 033c100ed..5c6e7eb32 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -251,19 +251,8 @@ pipe_buffer_map_range(struct pipe_context *pipe,
u_box_1d(offset, length, &box);
- *transfer = pipe->get_transfer( pipe,
- buffer,
- 0,
- usage,
- &box);
-
- if (*transfer == NULL)
- return NULL;
-
- map = pipe->transfer_map( pipe, *transfer );
+ map = pipe->transfer_map(pipe, buffer, 0, usage, &box, transfer);
if (map == NULL) {
- pipe->transfer_destroy( pipe, *transfer );
- *transfer = NULL;
return NULL;
}
@@ -285,10 +274,7 @@ static INLINE void
pipe_buffer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
- if (transfer) {
- pipe->transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
- }
+ pipe->transfer_unmap(pipe, transfer);
}
static INLINE void
@@ -397,35 +383,29 @@ pipe_buffer_read(struct pipe_context *pipe,
offset, size,
PIPE_TRANSFER_READ,
&src_transfer);
+ if (!map)
+ return;
- if (map)
- memcpy(data, map, size);
-
+ memcpy(data, map, size);
pipe_buffer_unmap(pipe, src_transfer);
}
-static INLINE struct pipe_transfer *
-pipe_get_transfer( struct pipe_context *context,
- struct pipe_resource *resource,
- unsigned level, unsigned layer,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y,
- unsigned w, unsigned h)
-{
- struct pipe_box box;
- u_box_2d_zslice( x, y, layer, w, h, &box );
- return context->get_transfer( context,
- resource,
- level,
- usage,
- &box );
-}
-
static INLINE void *
-pipe_transfer_map( struct pipe_context *context,
- struct pipe_transfer *transfer )
+pipe_transfer_map(struct pipe_context *context,
+ struct pipe_resource *resource,
+ unsigned level, unsigned layer,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y,
+ unsigned w, unsigned h,
+ struct pipe_transfer **transfer)
{
- return context->transfer_map( context, transfer );
+ struct pipe_box box;
+ u_box_2d_zslice(x, y, layer, w, h, &box);
+ return context->transfer_map(context,
+ resource,
+ level,
+ usage,
+ &box, transfer);
}
static INLINE void
@@ -435,14 +415,6 @@ pipe_transfer_unmap( struct pipe_context *context,
context->transfer_unmap( context, transfer );
}
-
-static INLINE void
-pipe_transfer_destroy( struct pipe_context *context,
- struct pipe_transfer *transfer )
-{
- context->transfer_destroy(context, transfer);
-}
-
static INLINE void
pipe_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
struct pipe_resource *buf)
diff --git a/mesalib/src/gallium/auxiliary/util/u_pstipple.c b/mesalib/src/gallium/auxiliary/util/u_pstipple.c
index 3a91b1da1..68804ae98 100644
--- a/mesalib/src/gallium/auxiliary/util/u_pstipple.c
+++ b/mesalib/src/gallium/auxiliary/util/u_pstipple.c
@@ -69,9 +69,8 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe,
int i, j;
/* map texture memory */
- transfer = pipe_get_transfer(pipe, tex, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
- data = pipe->transfer_map(pipe, transfer);
+ data = pipe_transfer_map(pipe, tex, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0, 32, 32, &transfer);
/*
* Load alpha texture.
@@ -94,7 +93,6 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe,
/* unmap */
pipe->transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_resource.c b/mesalib/src/gallium/auxiliary/util/u_resource.c
index 50a7cd4d5..a32c4f6df 100644
--- a/mesalib/src/gallium/auxiliary/util/u_resource.c
+++ b/mesalib/src/gallium/auxiliary/util/u_resource.c
@@ -24,28 +24,16 @@ void u_resource_destroy_vtbl(struct pipe_screen *screen,
ur->vtbl->resource_destroy(screen, resource);
}
-struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box)
+void *u_transfer_map_vtbl(struct pipe_context *context,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ struct pipe_transfer **transfer)
{
struct u_resource *ur = u_resource(resource);
- return ur->vtbl->get_transfer(context, resource, level, usage, box);
-}
-
-void u_transfer_destroy_vtbl(struct pipe_context *pipe,
- struct pipe_transfer *transfer)
-{
- struct u_resource *ur = u_resource(transfer->resource);
- ur->vtbl->transfer_destroy(pipe, transfer);
-}
-
-void *u_transfer_map_vtbl( struct pipe_context *pipe,
- struct pipe_transfer *transfer )
-{
- struct u_resource *ur = u_resource(transfer->resource);
- return ur->vtbl->transfer_map(pipe, transfer);
+ return ur->vtbl->transfer_map(context, resource, level, usage, box,
+ transfer);
}
void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
diff --git a/mesalib/src/gallium/auxiliary/util/u_slab.h b/mesalib/src/gallium/auxiliary/util/u_slab.h
index 3ed8b12d3..29d0252ba 100644
--- a/mesalib/src/gallium/auxiliary/util/u_slab.h
+++ b/mesalib/src/gallium/auxiliary/util/u_slab.h
@@ -28,7 +28,7 @@
* Good for allocations which have very low lifetime and are allocated
* and freed very often. Use a profiler first to know if it's worth using it!
*
- * Candidates: get_transfer
+ * Candidates: transfer_map
*
* @author Marek Olšák
*/
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c
index 7fd6b3675..304da9070 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.c
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.c
@@ -145,27 +145,23 @@ util_resource_copy_region(struct pipe_context *pipe,
src_format = src->format;
dst_format = dst->format;
- src_trans = pipe_get_transfer(pipe,
- src,
- src_level,
- src_box->z,
- PIPE_TRANSFER_READ,
- src_box->x, src_box->y, w, h);
-
- dst_trans = pipe_get_transfer(pipe,
- dst,
- dst_level,
- dst_z,
- PIPE_TRANSFER_WRITE,
- dst_x, dst_y, w, h);
+ src_map = pipe_transfer_map(pipe,
+ src,
+ src_level,
+ src_box->z,
+ PIPE_TRANSFER_READ,
+ src_box->x, src_box->y, w, h, &src_trans);
+
+ dst_map = pipe_transfer_map(pipe,
+ dst,
+ dst_level,
+ dst_z,
+ PIPE_TRANSFER_WRITE,
+ dst_x, dst_y, w, h, &dst_trans);
assert(util_format_get_blocksize(dst_format) == util_format_get_blocksize(src_format));
assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format));
assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format));
-
- src_map = pipe->transfer_map(pipe, src_trans);
- dst_map = pipe->transfer_map(pipe, dst_trans);
-
assert(src_map);
assert(dst_map);
@@ -187,9 +183,6 @@ util_resource_copy_region(struct pipe_context *pipe,
pipe->transfer_unmap(pipe, src_trans);
pipe->transfer_unmap(pipe, dst_trans);
-
- pipe->transfer_destroy(pipe, src_trans);
- pipe->transfer_destroy(pipe, dst_trans);
}
@@ -219,14 +212,12 @@ util_clear_render_target(struct pipe_context *pipe,
if (!dst->texture)
return;
/* XXX: should handle multiple layers */
- dst_trans = pipe_get_transfer(pipe,
- dst->texture,
- dst->u.tex.level,
- dst->u.tex.first_layer,
- PIPE_TRANSFER_WRITE,
- dstx, dsty, width, height);
-
- dst_map = pipe->transfer_map(pipe, dst_trans);
+ dst_map = pipe_transfer_map(pipe,
+ dst->texture,
+ dst->u.tex.level,
+ dst->u.tex.first_layer,
+ PIPE_TRANSFER_WRITE,
+ dstx, dsty, width, height, &dst_trans);
assert(dst_map);
@@ -237,10 +228,9 @@ util_clear_render_target(struct pipe_context *pipe,
util_fill_rect(dst_map, dst->texture->format,
dst_trans->stride,
0, 0, width, height, &uc);
- }
- pipe->transfer_unmap(pipe, dst_trans);
- pipe->transfer_destroy(pipe, dst_trans);
+ pipe->transfer_unmap(pipe, dst_trans);
+ }
}
/**
@@ -270,16 +260,13 @@ util_clear_depth_stencil(struct pipe_context *pipe,
assert(dst->texture);
if (!dst->texture)
return;
- dst_trans = pipe_get_transfer(pipe,
- dst->texture,
- dst->u.tex.level,
- dst->u.tex.first_layer,
- (need_rmw ? PIPE_TRANSFER_READ_WRITE :
- PIPE_TRANSFER_WRITE),
- dstx, dsty, width, height);
-
- dst_map = pipe->transfer_map(pipe, dst_trans);
-
+ dst_map = pipe_transfer_map(pipe,
+ dst->texture,
+ dst->u.tex.level,
+ dst->u.tex.first_layer,
+ (need_rmw ? PIPE_TRANSFER_READ_WRITE :
+ PIPE_TRANSFER_WRITE),
+ dstx, dsty, width, height, &dst_trans);
assert(dst_map);
if (dst_map) {
@@ -376,8 +363,7 @@ util_clear_depth_stencil(struct pipe_context *pipe,
assert(0);
break;
}
- }
- pipe->transfer_unmap(pipe, dst_trans);
- pipe->transfer_destroy(pipe, dst_trans);
+ pipe->transfer_unmap(pipe, dst_trans);
+ }
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c
index 48e73c40b..f4b5cad0e 100644
--- a/mesalib/src/gallium/auxiliary/util/u_tile.c
+++ b/mesalib/src/gallium/auxiliary/util/u_tile.c
@@ -45,27 +45,18 @@
* Move raw block of pixels from transfer object to user memory.
*/
void
-pipe_get_tile_raw(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_raw(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
void *dst, int dst_stride)
{
- const void *src;
-
if (dst_stride == 0)
dst_stride = util_format_get_stride(pt->resource->format, w);
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;
- src = pipe->transfer_map(pipe, pt);
- assert(src);
- if(!src)
- return;
-
util_copy_rect(dst, pt->resource->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y);
-
- pipe->transfer_unmap(pipe, pt);
}
@@ -73,12 +64,11 @@ pipe_get_tile_raw(struct pipe_context *pipe,
* Move raw block of pixels from user memory to transfer object.
*/
void
-pipe_put_tile_raw(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_raw(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
const void *src, int src_stride)
{
- void *dst;
enum pipe_format format = pt->resource->format;
if (src_stride == 0)
@@ -87,14 +77,7 @@ pipe_put_tile_raw(struct pipe_context *pipe,
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;
- dst = pipe->transfer_map(pipe, pt);
- assert(dst);
- if(!dst)
- return;
-
util_copy_rect(dst, format, pt->stride, x, y, w, h, src, src_stride, 0, 0);
-
- pipe->transfer_unmap(pipe, pt);
}
@@ -372,7 +355,7 @@ x32_s8_get_tile_rgba(const unsigned *src,
void
pipe_tile_raw_to_rgba(enum pipe_format format,
- void *src,
+ const void *src,
uint w, uint h,
float *dst, unsigned dst_stride)
{
@@ -419,7 +402,7 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
void
pipe_tile_raw_to_unsigned(enum pipe_format format,
- void *src,
+ const void *src,
uint w, uint h,
unsigned *dst, unsigned dst_stride)
{
@@ -442,18 +425,18 @@ pipe_tile_raw_to_signed(enum pipe_format format,
}
void
-pipe_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_rgba(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
float *p)
{
- pipe_get_tile_rgba_format(pipe, pt, x, y, w, h, pt->resource->format, p);
+ pipe_get_tile_rgba_format(pt, src, x, y, w, h, pt->resource->format, p);
}
void
-pipe_get_tile_rgba_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_rgba_format(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
enum pipe_format format,
float *p)
@@ -474,7 +457,7 @@ pipe_get_tile_rgba_format(struct pipe_context *pipe,
assert((x & 1) == 0);
}
- pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+ pipe_get_tile_raw(pt, src, x, y, w, h, packed, 0);
pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride);
@@ -483,18 +466,18 @@ pipe_get_tile_rgba_format(struct pipe_context *pipe,
void
-pipe_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_rgba(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
const float *p)
{
- pipe_put_tile_rgba_format(pipe, pt, x, y, w, h, pt->resource->format, p);
+ pipe_put_tile_rgba_format(pt, dst, x, y, w, h, pt->resource->format, p);
}
void
-pipe_put_tile_rgba_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_rgba_format(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
enum pipe_format format,
const float *p)
@@ -538,14 +521,14 @@ pipe_put_tile_rgba_format(struct pipe_context *pipe,
0, 0, w, h);
}
- pipe_put_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+ pipe_put_tile_raw(pt, dst, x, y, w, h, packed, 0);
FREE(packed);
}
void
-pipe_put_tile_i_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_i_format(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
enum pipe_format format,
const int *p)
@@ -566,14 +549,14 @@ pipe_put_tile_i_format(struct pipe_context *pipe,
packed, util_format_get_stride(format, w),
0, 0, w, h);
- pipe_put_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+ pipe_put_tile_raw(pt, dst, x, y, w, h, packed, 0);
FREE(packed);
}
void
-pipe_put_tile_ui_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_ui_format(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
enum pipe_format format,
const unsigned int *p)
@@ -594,7 +577,7 @@ pipe_put_tile_ui_format(struct pipe_context *pipe,
packed, util_format_get_stride(format, w),
0, 0, w, h);
- pipe_put_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+ pipe_put_tile_raw(pt, dst, x, y, w, h, packed, 0);
FREE(packed);
}
@@ -603,13 +586,13 @@ pipe_put_tile_ui_format(struct pipe_context *pipe,
* Get a block of Z values, converted to 32-bit range.
*/
void
-pipe_get_tile_z(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_z(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
uint *z)
{
const uint dstStride = w;
- ubyte *map;
+ const ubyte *map = src;
uint *pDest = z;
uint i, j;
enum pipe_format format = pt->resource->format;
@@ -617,12 +600,6 @@ pipe_get_tile_z(struct pipe_context *pipe,
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;
- map = (ubyte *)pipe->transfer_map(pipe, pt);
- if (!map) {
- assert(0);
- return;
- }
-
switch (format) {
case PIPE_FORMAT_Z32_UNORM:
{
@@ -704,32 +681,24 @@ pipe_get_tile_z(struct pipe_context *pipe,
default:
assert(0);
}
-
- pipe->transfer_unmap(pipe, pt);
}
void
-pipe_put_tile_z(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_z(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
const uint *zSrc)
{
const uint srcStride = w;
const uint *ptrc = zSrc;
- ubyte *map;
+ ubyte *map = dst;
uint i, j;
enum pipe_format format = pt->resource->format;
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;
- map = (ubyte *)pipe->transfer_map(pipe, pt);
- if (!map) {
- assert(0);
- return;
- }
-
switch (format) {
case PIPE_FORMAT_Z32_UNORM:
{
@@ -825,14 +794,12 @@ pipe_put_tile_z(struct pipe_context *pipe,
default:
assert(0);
}
-
- pipe->transfer_unmap(pipe, pt);
}
void
-pipe_get_tile_ui_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_ui_format(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
enum pipe_format format,
unsigned int *p)
@@ -853,7 +820,7 @@ pipe_get_tile_ui_format(struct pipe_context *pipe,
assert((x & 1) == 0);
}
- pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+ pipe_get_tile_raw(pt, src, x, y, w, h, packed, 0);
pipe_tile_raw_to_unsigned(format, packed, w, h, p, dst_stride);
@@ -862,8 +829,8 @@ pipe_get_tile_ui_format(struct pipe_context *pipe,
void
-pipe_get_tile_i_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_i_format(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
enum pipe_format format,
int *p)
@@ -884,7 +851,7 @@ pipe_get_tile_i_format(struct pipe_context *pipe,
assert((x & 1) == 0);
}
- pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+ pipe_get_tile_raw(pt, src, x, y, w, h, packed, 0);
pipe_tile_raw_to_signed(format, packed, w, h, p, dst_stride);
diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.h b/mesalib/src/gallium/auxiliary/util/u_tile.h
index 926f1695f..abcd402c8 100644
--- a/mesalib/src/gallium/auxiliary/util/u_tile.h
+++ b/mesalib/src/gallium/auxiliary/util/u_tile.h
@@ -61,66 +61,66 @@ extern "C" {
#endif
void
-pipe_get_tile_raw(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_raw(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
void *p, int dst_stride);
void
-pipe_put_tile_raw(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_raw(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
const void *p, int src_stride);
void
-pipe_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_rgba(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
float *p);
void
-pipe_get_tile_rgba_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_rgba_format(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
enum pipe_format format,
float *p);
void
-pipe_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_rgba(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
const float *p);
void
-pipe_put_tile_rgba_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_rgba_format(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
enum pipe_format format,
const float *p);
void
-pipe_get_tile_z(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_z(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
uint *z);
void
-pipe_put_tile_z(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_z(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
const uint *z);
void
pipe_tile_raw_to_rgba(enum pipe_format format,
- void *src,
+ const void *src,
uint w, uint h,
float *dst, unsigned dst_stride);
void
pipe_tile_raw_to_unsigned(enum pipe_format format,
- void *src,
+ const void *src,
uint w, uint h,
unsigned *dst, unsigned dst_stride);
@@ -131,29 +131,29 @@ pipe_tile_raw_to_signed(enum pipe_format format,
int *dst, unsigned dst_stride);
void
-pipe_get_tile_ui_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_ui_format(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
enum pipe_format format,
unsigned int *p);
void
-pipe_get_tile_i_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_get_tile_i_format(struct pipe_transfer *pt,
+ const void *src,
uint x, uint y, uint w, uint h,
enum pipe_format format,
int *p);
void
-pipe_put_tile_ui_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_ui_format(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
enum pipe_format format,
const unsigned *p);
void
-pipe_put_tile_i_format(struct pipe_context *pipe,
- struct pipe_transfer *pt,
+pipe_put_tile_i_format(struct pipe_transfer *pt,
+ void *dst,
uint x, uint y, uint w, uint h,
enum pipe_format format,
const int *p);
diff --git a/mesalib/src/gallium/auxiliary/util/u_transfer.c b/mesalib/src/gallium/auxiliary/util/u_transfer.c
index 0b2679ffd..8b4c36592 100644
--- a/mesalib/src/gallium/auxiliary/util/u_transfer.c
+++ b/mesalib/src/gallium/auxiliary/util/u_transfer.c
@@ -31,17 +31,13 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
usage |= PIPE_TRANSFER_DISCARD_RANGE;
}
- transfer = pipe->get_transfer(pipe,
- resource,
- level,
- usage,
- box );
- if (transfer == NULL)
- goto out;
-
- map = pipe_transfer_map(pipe, transfer);
+ map = pipe->transfer_map(pipe,
+ resource,
+ level,
+ usage,
+ box, &transfer);
if (map == NULL)
- goto out;
+ return;
if (resource->target == PIPE_BUFFER) {
assert(box->height == 1);
@@ -68,12 +64,7 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
}
}
-out:
- if (map)
- pipe_transfer_unmap(pipe, transfer);
-
- if (transfer)
- pipe_transfer_destroy(pipe, transfer);
+ pipe_transfer_unmap(pipe, transfer);
}
@@ -94,34 +85,7 @@ void u_default_transfer_flush_region( struct pipe_context *pipe,
*/
}
-struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box)
-{
- struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
- if (transfer == NULL)
- return NULL;
-
- transfer->resource = resource;
- transfer->level = level;
- transfer->usage = usage;
- transfer->box = *box;
-
- /* Note strides are zero, this is ok for buffers, but not for
- * textures 2d & higher at least.
- */
- return transfer;
-}
-
void u_default_transfer_unmap( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
}
-
-void u_default_transfer_destroy(struct pipe_context *pipe,
- struct pipe_transfer *transfer)
-{
- FREE(transfer);
-}
diff --git a/mesalib/src/gallium/auxiliary/util/u_transfer.h b/mesalib/src/gallium/auxiliary/util/u_transfer.h
index f4fdf9a48..6c25ee0f0 100644
--- a/mesalib/src/gallium/auxiliary/util/u_transfer.h
+++ b/mesalib/src/gallium/auxiliary/util/u_transfer.h
@@ -27,18 +27,9 @@ void u_default_transfer_flush_region( struct pipe_context *pipe,
struct pipe_transfer *transfer,
const struct pipe_box *box);
-struct pipe_transfer * u_default_get_transfer(struct pipe_context *context,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box);
-
void u_default_transfer_unmap( struct pipe_context *pipe,
struct pipe_transfer *transfer );
-void u_default_transfer_destroy(struct pipe_context *pipe,
- struct pipe_transfer *transfer);
-
/* Useful helper to allow >1 implementation of resource functionality
@@ -53,24 +44,20 @@ struct u_resource_vtbl {
void (*resource_destroy)(struct pipe_screen *,
struct pipe_resource *pt);
- struct pipe_transfer *(*get_transfer)(struct pipe_context *,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *);
+ void *(*transfer_map)(struct pipe_context *,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *,
+ struct pipe_transfer **);
- void (*transfer_destroy)(struct pipe_context *,
- struct pipe_transfer *);
-
- void *(*transfer_map)( struct pipe_context *,
- struct pipe_transfer *transfer );
void (*transfer_flush_region)( struct pipe_context *,
struct pipe_transfer *transfer,
const struct pipe_box *);
void (*transfer_unmap)( struct pipe_context *,
- struct pipe_transfer *transfer );
+ struct pipe_transfer *transfer );
void (*transfer_inline_write)( struct pipe_context *pipe,
struct pipe_resource *resource,
@@ -96,17 +83,12 @@ boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
void u_resource_destroy_vtbl(struct pipe_screen *screen,
struct pipe_resource *resource);
-struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context,
- struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box);
-
-void u_transfer_destroy_vtbl(struct pipe_context *pipe,
- struct pipe_transfer *transfer);
-
-void *u_transfer_map_vtbl( struct pipe_context *pipe,
- struct pipe_transfer *transfer );
+void *u_transfer_map_vtbl(struct pipe_context *context,
+ struct pipe_resource *resource,
+ unsigned level,
+ unsigned usage,
+ const struct pipe_box *box,
+ struct pipe_transfer **transfer);
void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
struct pipe_transfer *transfer,
diff --git a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c
index b4b4c91f1..b62973de6 100644
--- a/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/mesalib/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -82,7 +82,6 @@ void u_upload_unmap( struct u_upload_mgr *upload )
box->x, upload->offset - box->x);
}
pipe_transfer_unmap(upload->pipe, upload->transfer);
- pipe_transfer_destroy(upload->pipe, upload->transfer);
upload->transfer = NULL;
upload->map = NULL;
}
@@ -142,13 +141,13 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
PIPE_TRANSFER_FLUSH_EXPLICIT,
&upload->transfer);
if (upload->map == NULL) {
+ upload->transfer = NULL;
upload->size = 0;
pipe_resource_reference(&upload->buffer, NULL);
return PIPE_ERROR_OUT_OF_MEMORY;
}
upload->size = size;
-
upload->offset = 0;
return PIPE_OK;
}
@@ -185,6 +184,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
if (!upload->map) {
pipe_resource_reference(outbuf, NULL);
*ptr = NULL;
+ upload->transfer = NULL;
return PIPE_ERROR_OUT_OF_MEMORY;
}
diff --git a/mesalib/src/mesa/Android.gen.mk b/mesalib/src/mesa/Android.gen.mk
index a8e4f3564..893fa4199 100644
--- a/mesalib/src/mesa/Android.gen.mk
+++ b/mesalib/src/mesa/Android.gen.mk
@@ -137,7 +137,7 @@ $(intermediates)/main/dispatch.h: $(es_hdr_deps)
$(call es-gen, $* -m remap_table)
$(intermediates)/main/remap_helper.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(glapi)/remap_helper.py
-$(intermediates)/main/remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_API.xml
+$(intermediates)/main/remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
$(intermediates)/main/remap_helper.h: $(es_hdr_deps)
$(call es-gen, $*)
diff --git a/mesalib/src/mesa/drivers/dri/Android.mk b/mesalib/src/mesa/drivers/dri/Android.mk
index 577f66408..d6196bb43 100644
--- a/mesalib/src/mesa/drivers/dri/Android.mk
+++ b/mesalib/src/mesa/drivers/dri/Android.mk
@@ -34,7 +34,8 @@ MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
MESA_DRI_CFLAGS := \
-DFEATURE_GL=1 \
-DFEATURE_ES1=1 \
- -DFEATURE_ES2=1
+ -DFEATURE_ES2=1 \
+ -DHAVE_ANDROID_PLATFORM
MESA_DRI_C_INCLUDES := \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 8d2317ea1..b612f7846 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -101,10 +101,9 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
uint *dest;
uint i, j;
- transfer = pipe_get_transfer(pipe,
- pt, 0, 0, PIPE_TRANSFER_WRITE,
- 0, 0, texSize, texSize);
- dest = (uint *) pipe_transfer_map(pipe, transfer);
+ dest = (uint *) pipe_transfer_map(pipe,
+ pt, 0, 0, PIPE_TRANSFER_WRITE,
+ 0, 0, texSize, texSize, &transfer);
/* Pack four 1D maps into a 2D texture:
* R map is placed horizontally, indexed by S, in channel 0
@@ -127,7 +126,6 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
}
pipe_transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index 62e571235..b024ef0db 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -306,11 +306,9 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
return NULL;
}
- transfer = pipe_get_transfer(st->pipe, pt, 0, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0, width, height);
-
- dest = pipe_transfer_map(pipe, transfer);
+ dest = pipe_transfer_map(st->pipe, pt, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, width, height, &transfer);
/* Put image into texture transfer */
memset(dest, 0xff, height * transfer->stride);
@@ -321,8 +319,6 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
/* Release transfer */
pipe_transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
-
return pt;
}
@@ -555,7 +551,6 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
static void
reset_cache(struct st_context *st)
{
- struct pipe_context *pipe = st->pipe;
struct bitmap_cache *cache = st->bitmap.cache;
/*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/
@@ -566,11 +561,6 @@ reset_cache(struct st_context *st)
cache->ymin = 1000000;
cache->ymax = -1000000;
- if (cache->trans) {
- pipe->transfer_destroy(pipe, cache->trans);
- cache->trans = NULL;
- }
-
assert(!cache->texture);
/* allocate a new texture */
@@ -617,11 +607,10 @@ create_cache_trans(struct st_context *st)
/* Map the texture transfer.
* Subsequent glBitmap calls will write into the texture image.
*/
- cache->trans = pipe_get_transfer(st->pipe, cache->texture, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
- BITMAP_CACHE_WIDTH,
- BITMAP_CACHE_HEIGHT);
- cache->buffer = pipe_transfer_map(pipe, cache->trans);
+ cache->buffer = pipe_transfer_map(pipe, cache->texture, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ BITMAP_CACHE_WIDTH,
+ BITMAP_CACHE_HEIGHT, &cache->trans);
/* init image to all 0xff */
memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT);
@@ -651,13 +640,11 @@ st_flush_bitmap_cache(struct st_context *st)
/* The texture transfer has been mapped until now.
* So unmap and release the texture transfer before drawing.
*/
- if (cache->trans) {
+ if (cache->trans && cache->buffer) {
if (0)
print_cache(cache);
pipe_transfer_unmap(pipe, cache->trans);
cache->buffer = NULL;
-
- pipe->transfer_destroy(pipe, cache->trans);
cache->trans = NULL;
}
@@ -873,9 +860,8 @@ st_destroy_bitmap(struct st_context *st)
}
if (cache) {
- if (cache->trans) {
+ if (cache->trans && cache->buffer) {
pipe_transfer_unmap(pipe, cache->trans);
- pipe->transfer_destroy(pipe, cache->trans);
}
pipe_resource_reference(&st->bitmap.cache->texture, NULL);
free(st->bitmap.cache);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index b47a2d87f..ac38128df 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -298,6 +298,9 @@ st_bufferobj_map_range(struct gl_context *ctx,
obj->Length = length;
obj->AccessFlags = access;
}
+ else {
+ st_obj->transfer = NULL;
+ }
return obj->Pointer;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index a8a01db96..4e2edd2e7 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -514,12 +514,10 @@ make_texture(struct st_context *st,
/* we'll do pixel transfer in a fragment shader */
ctx->_ImageTransferState = 0x0;
- transfer = pipe_get_transfer(st->pipe, pt, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
- width, height);
-
/* map texture transfer */
- dest = pipe_transfer_map(pipe, transfer);
+ dest = pipe_transfer_map(pipe, pt, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ width, height, &transfer);
/* Put image into texture transfer.
@@ -538,7 +536,6 @@ make_texture(struct st_context *st,
/* unmap */
pipe_transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
assert(success);
@@ -863,12 +860,10 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
usage = PIPE_TRANSFER_WRITE;
}
- pt = pipe_get_transfer(pipe, strb->texture,
- strb->rtt_level, strb->rtt_face + strb->rtt_slice,
- usage, x, y,
- width, height);
-
- stmap = pipe_transfer_map(pipe, pt);
+ stmap = pipe_transfer_map(pipe, strb->texture,
+ strb->rtt_level, strb->rtt_face + strb->rtt_slice,
+ usage, x, y,
+ width, height, &pt);
pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels);
assert(pixels);
@@ -996,7 +991,6 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
/* unmap the stencil buffer */
pipe_transfer_unmap(pipe, pt);
- pipe->transfer_destroy(pipe, pt);
}
@@ -1247,18 +1241,16 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
dsty = rbDraw->Base.Height - dsty - height;
}
- ptDraw = pipe_get_transfer(pipe,
- rbDraw->texture,
- rbDraw->rtt_level,
- rbDraw->rtt_face + rbDraw->rtt_slice,
- usage, dstx, dsty,
- width, height);
-
- assert(util_format_get_blockwidth(ptDraw->resource->format) == 1);
- assert(util_format_get_blockheight(ptDraw->resource->format) == 1);
+ assert(util_format_get_blockwidth(rbDraw->texture->format) == 1);
+ assert(util_format_get_blockheight(rbDraw->texture->format) == 1);
/* map the stencil buffer */
- drawMap = pipe_transfer_map(pipe, ptDraw);
+ drawMap = pipe_transfer_map(pipe,
+ rbDraw->texture,
+ rbDraw->rtt_level,
+ rbDraw->rtt_face + rbDraw->rtt_slice,
+ usage, dstx, dsty,
+ width, height, &ptDraw);
/* draw */
/* XXX PixelZoom not handled yet */
@@ -1283,7 +1275,6 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* unmap the stencil buffer */
pipe_transfer_unmap(pipe, ptDraw);
- pipe->transfer_destroy(pipe, ptDraw);
}
@@ -1573,13 +1564,15 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
}
else {
/* CPU-based fallback/conversion */
- struct pipe_transfer *ptRead =
- pipe_get_transfer(st->pipe, rbRead->texture,
+ struct pipe_transfer *ptRead;
+ void *mapRead =
+ pipe_transfer_map(st->pipe, rbRead->texture,
rbRead->rtt_level,
rbRead->rtt_face + rbRead->rtt_slice,
PIPE_TRANSFER_READ,
- readX, readY, readW, readH);
+ readX, readY, readW, readH, &ptRead);
struct pipe_transfer *ptTex;
+ void *mapTex;
enum pipe_transfer_usage transfer_usage;
if (ST_DEBUG & DEBUG_FALLBACK)
@@ -1590,8 +1583,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
else
transfer_usage = PIPE_TRANSFER_WRITE;
- ptTex = pipe_get_transfer(st->pipe, pt, 0, 0, transfer_usage,
- 0, 0, width, height);
+ mapTex = pipe_transfer_map(st->pipe, pt, 0, 0, transfer_usage,
+ 0, 0, width, height, &ptTex);
/* copy image from ptRead surface to ptTex surface */
if (type == GL_COLOR) {
@@ -1600,23 +1593,24 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
enum pipe_format readFormat, drawFormat;
readFormat = util_format_linear(rbRead->texture->format);
drawFormat = util_format_linear(pt->format);
- pipe_get_tile_rgba_format(pipe, ptRead, 0, 0, readW, readH,
+ pipe_get_tile_rgba_format(ptRead, mapRead, 0, 0, readW, readH,
readFormat, buf);
- pipe_put_tile_rgba_format(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
+ pipe_put_tile_rgba_format(ptTex, mapTex, pack.SkipPixels,
+ pack.SkipRows,
readW, readH, drawFormat, buf);
free(buf);
}
else {
/* GL_DEPTH */
GLuint *buf = malloc(width * height * sizeof(GLuint));
- pipe_get_tile_z(pipe, ptRead, 0, 0, readW, readH, buf);
- pipe_put_tile_z(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
+ pipe_get_tile_z(ptRead, mapRead, 0, 0, readW, readH, buf);
+ pipe_put_tile_z(ptTex, mapTex, pack.SkipPixels, pack.SkipRows,
readW, readH, buf);
free(buf);
}
- pipe->transfer_destroy(pipe, ptRead);
- pipe->transfer_destroy(pipe, ptTex);
+ pipe->transfer_unmap(pipe, ptRead);
+ pipe->transfer_unmap(pipe, ptTex);
}
/* OK, the texture 'pt' contains the src image/pixels. Now draw a
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index c523795b9..882fb372b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -708,6 +708,7 @@ st_MapRenderbuffer(struct gl_context *ctx,
const GLboolean invert = rb->Name == 0;
unsigned usage;
GLuint y2;
+ GLubyte *map;
if (strb->software) {
/* software-allocated renderbuffer (probably an accum buffer) */
@@ -742,13 +743,12 @@ st_MapRenderbuffer(struct gl_context *ctx,
else
y2 = y;
- strb->transfer = pipe_get_transfer(pipe,
- strb->texture,
- strb->rtt_level,
- strb->rtt_face + strb->rtt_slice,
- usage, x, y2, w, h);
- if (strb->transfer) {
- GLubyte *map = pipe_transfer_map(pipe, strb->transfer);
+ map = pipe_transfer_map(pipe,
+ strb->texture,
+ strb->rtt_level,
+ strb->rtt_face + strb->rtt_slice,
+ usage, x, y2, w, h, &strb->transfer);
+ if (map) {
if (invert) {
*rowStrideOut = -strb->transfer->stride;
map += (h - 1) * strb->transfer->stride;
@@ -782,7 +782,6 @@ st_UnmapRenderbuffer(struct gl_context *ctx,
}
pipe_transfer_unmap(pipe, strb->transfer);
- pipe->transfer_destroy(pipe, strb->transfer);
strb->transfer = NULL;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 473ff3a94..5bf3dc699 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -578,9 +578,10 @@ decompress_with_blit(struct gl_context * ctx,
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
struct pipe_resource *dst_texture;
- struct pipe_transfer *tex_xfer;
struct pipe_blit_info blit;
unsigned bind = (PIPE_BIND_RENDER_TARGET | PIPE_BIND_TRANSFER_READ);
+ struct pipe_transfer *tex_xfer;
+ ubyte *map;
/* create temp / dest surface */
if (!util_create_rgba_texture(pipe, width, height, bind,
@@ -610,21 +611,22 @@ decompress_with_blit(struct gl_context * ctx,
/* blit/render/decompress */
st->pipe->blit(st->pipe, &blit);
- /* map the dst_surface so we can read from it */
- tex_xfer = pipe_get_transfer(pipe,
- dst_texture, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, width, height);
-
pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels);
+ map = pipe_transfer_map(pipe, dst_texture, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0, width, height, &tex_xfer);
+ if (!map) {
+ goto end;
+ }
+
/* copy/pack data into user buffer */
if (_mesa_format_matches_format_and_type(stImage->base.TexFormat,
format, type,
ctx->Pack.SwapBytes)) {
/* memcpy */
const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
- ubyte *map = pipe_transfer_map(pipe, tex_xfer);
+ /* map the dst_surface so we can read from it */
GLuint row;
for (row = 0; row < height; row++) {
GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
@@ -655,7 +657,7 @@ decompress_with_blit(struct gl_context * ctx,
debug_printf("%s: fallback format translation\n", __FUNCTION__);
/* get float[4] rgba row from surface */
- pipe_get_tile_rgba_format(pipe, tex_xfer, 0, row, width, 1,
+ pipe_get_tile_rgba_format(tex_xfer, map, 0, row, width, 1,
pformat, rgba);
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format,
@@ -666,10 +668,10 @@ decompress_with_blit(struct gl_context * ctx,
}
end:
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
-
- pipe->transfer_destroy(pipe, tex_xfer);
+ if (map)
+ pipe_transfer_unmap(pipe, tex_xfer);
+ _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
pipe_resource_reference(&dst_texture, NULL);
}
@@ -720,6 +722,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
struct pipe_transfer *src_trans;
GLvoid *texDest;
enum pipe_transfer_usage transfer_usage;
+ void *map;
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -728,13 +731,13 @@ fallback_copy_texsubimage(struct gl_context *ctx,
srcY = strb->Base.Height - srcY - height;
}
- src_trans = pipe_get_transfer(pipe,
- strb->texture,
- strb->rtt_level,
- strb->rtt_face + strb->rtt_slice,
- PIPE_TRANSFER_READ,
- srcX, srcY,
- width, height);
+ map = pipe_transfer_map(pipe,
+ strb->texture,
+ strb->rtt_level,
+ strb->rtt_face + strb->rtt_slice,
+ PIPE_TRANSFER_READ,
+ srcX, srcY,
+ width, height, &src_trans);
if ((baseFormat == GL_DEPTH_COMPONENT ||
baseFormat == GL_DEPTH_STENCIL) &&
@@ -769,11 +772,12 @@ fallback_copy_texsubimage(struct gl_context *ctx,
if (data) {
/* To avoid a large temp memory allocation, do copy row by row */
for (row = 0; row < height; row++, srcY += yStep) {
- pipe_get_tile_z(pipe, src_trans, 0, srcY, width, 1, data);
+ pipe_get_tile_z(src_trans, map, 0, srcY, width, 1, data);
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- pipe_put_tile_z(pipe, stImage->transfer, 0, row, width, 1, data);
+ pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1,
+ data);
}
}
else {
@@ -801,7 +805,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
/* XXX this usually involves a lot of int/float conversion.
* try to avoid that someday.
*/
- pipe_get_tile_rgba_format(pipe, src_trans, 0, 0, width, height,
+ pipe_get_tile_rgba_format(src_trans, map, 0, 0, width, height,
util_format_linear(strb->texture->format),
tempSrc);
@@ -828,7 +832,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
}
st_texture_image_unmap(st, stImage);
- pipe->transfer_destroy(pipe, src_trans);
+ pipe->transfer_unmap(pipe, src_trans);
}
@@ -915,8 +919,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
{
struct st_texture_image *stImage = st_texture_image(texImage);
const GLenum texBaseFormat = texImage->_BaseFormat;
- struct gl_framebuffer *fb = ctx->ReadBuffer;
- struct st_renderbuffer *strb;
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
@@ -933,16 +936,6 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
*/
if (0) st_validate_state(st);
- /* determine if copying depth or color data */
- if (texBaseFormat == GL_DEPTH_COMPONENT ||
- texBaseFormat == GL_DEPTH_STENCIL) {
- strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer);
- }
- else {
- /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */
- strb = st_renderbuffer(fb->_ColorReadBuffer);
- }
-
if (!strb || !strb->surface || !stImage->pt) {
debug_printf("%s: null strb or stImage\n", __FUNCTION__);
return;
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index 3670683b5..d6dbf8d6c 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -230,7 +230,6 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
{
struct st_texture_object *stObj =
st_texture_object(stImage->base.TexObject);
- struct pipe_context *pipe = st->pipe;
GLuint level;
DBG("%s \n", __FUNCTION__);
@@ -243,14 +242,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
else
level = stImage->base.Level;
- stImage->transfer = pipe_get_transfer(st->pipe, stImage->pt, level,
- stImage->base.Face + zoffset,
- usage, x, y, w, h);
-
- if (stImage->transfer)
- return pipe_transfer_map(pipe, stImage->transfer);
- else
- return NULL;
+ return pipe_transfer_map(st->pipe, stImage->pt, level,
+ stImage->base.Face + zoffset,
+ usage, x, y, w, h, &stImage->transfer);
}
@@ -263,43 +257,10 @@ st_texture_image_unmap(struct st_context *st,
DBG("%s\n", __FUNCTION__);
pipe_transfer_unmap(pipe, stImage->transfer);
-
- pipe->transfer_destroy(pipe, stImage->transfer);
stImage->transfer = NULL;
}
-
-/**
- * Upload data to a rectangular sub-region. Lots of choices how to do this:
- *
- * - memcpy by span to current destination
- * - upload data as new buffer and blit
- *
- * Currently always memcpy.
- */
-static void
-st_surface_data(struct pipe_context *pipe,
- struct pipe_transfer *dst,
- unsigned dstx, unsigned dsty,
- const void *src, unsigned src_stride,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- void *map = pipe_transfer_map(pipe, dst);
-
- assert(dst->resource);
- util_copy_rect(map,
- dst->resource->format,
- dst->stride,
- dstx, dsty,
- width, height,
- src, src_stride,
- srcx, srcy);
-
- pipe_transfer_unmap(pipe, dst);
-}
-
-
/* Upload data for a particular image.
*/
void
@@ -313,7 +274,6 @@ st_texture_image_data(struct st_context *st,
struct pipe_context *pipe = st->pipe;
GLuint i;
const GLubyte *srcUB = src;
- struct pipe_transfer *dst_transfer;
GLuint layers;
if (dst->target == PIPE_TEXTURE_1D_ARRAY ||
@@ -325,20 +285,14 @@ st_texture_image_data(struct st_context *st,
DBG("%s\n", __FUNCTION__);
for (i = 0; i < layers; i++) {
- dst_transfer = pipe_get_transfer(st->pipe, dst, level, face + i,
- PIPE_TRANSFER_WRITE, 0, 0,
- u_minify(dst->width0, level),
- u_minify(dst->height0, level));
-
- st_surface_data(pipe, dst_transfer,
- 0, 0, /* dstx, dsty */
- srcUB,
- src_row_stride,
- 0, 0, /* source x, y */
- u_minify(dst->width0, level),
- u_minify(dst->height0, level)); /* width, height */
+ struct pipe_box box;
+ u_box_2d_zslice(0, 0, face + i,
+ u_minify(dst->width0, level),
+ u_minify(dst->height0, level),
+ &box);
- pipe->transfer_destroy(pipe, dst_transfer);
+ pipe->transfer_inline_write(pipe, dst, level, PIPE_TRANSFER_WRITE,
+ &box, srcUB, src_row_stride, 0);
srcUB += src_image_stride;
}
@@ -362,13 +316,11 @@ print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src)
region.height = 1;
region.depth = 1;
- xfer = pipe->get_transfer(pipe, src, 0, PIPE_TRANSFER_READ, &region);
- map = pipe->transfer_map(pipe, xfer);
+ map = pipe->transfer_map(pipe, src, 0, PIPE_TRANSFER_READ, &region, &xfer);
printf("center pixel: %d %d %d %d\n", map[0], map[1], map[2], map[3]);
pipe->transfer_unmap(pipe, xfer);
- pipe->transfer_destroy(pipe, xfer);
}