summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c14
-rw-r--r--src/gallium/auxiliary/util/u_debug.c44
-rw-r--r--src/gallium/auxiliary/util/u_debug.h14
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c50
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h12
-rw-r--r--src/gallium/auxiliary/util/u_rect.c26
-rw-r--r--src/gallium/auxiliary/util/u_tile.c24
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c10
-rw-r--r--src/gallium/drivers/i915/i915_context.c1
-rw-r--r--src/gallium/drivers/i915/i915_context.h6
-rw-r--r--src/gallium/drivers/i915/i915_texture.c23
-rw-r--r--src/gallium/drivers/i965/brw_screen.h5
-rw-r--r--src/gallium/drivers/i965/brw_screen_texture.c25
-rw-r--r--src/gallium/drivers/identity/id_context.c72
-rw-r--r--src/gallium/drivers/identity/id_objects.c10
-rw-r--r--src/gallium/drivers/identity/id_objects.h4
-rw-r--r--src/gallium/drivers/identity/id_screen.c69
-rw-r--r--src/gallium/drivers/llvmpipe/Makefile6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c20
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c25
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.h2
-rw-r--r--src/gallium/drivers/nouveau/nv04_surface_2d.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h1
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.h3
-rw-r--r--src/gallium/drivers/nv30/nv30_transfer.c19
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h1
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c1
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.h3
-rw-r--r--src/gallium/drivers/nv40/nv40_transfer.c19
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_transfer.c17
-rw-r--r--src/gallium/drivers/r300/r300_context.c3
-rw-r--r--src/gallium/drivers/r300/r300_context.h1
-rw-r--r--src/gallium/drivers/r300/r300_screen.c4
-rw-r--r--src/gallium/drivers/r300/r300_transfer.c39
-rw-r--r--src/gallium/drivers/r300/r300_transfer.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c10
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.c30
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c27
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.h3
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c26
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.h4
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.c45
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.h3
-rw-r--r--src/gallium/drivers/trace/tr_context.c136
-rw-r--r--src/gallium/drivers/trace/tr_rbug.c16
-rw-r--r--src/gallium/drivers/trace/tr_screen.c136
-rw-r--r--src/gallium/drivers/trace/tr_screen.h1
-rw-r--r--src/gallium/drivers/trace/tr_texture.c13
-rw-r--r--src/gallium/drivers/trace/tr_texture.h6
-rw-r--r--src/gallium/include/pipe/p_context.h26
-rw-r--r--src/gallium/include/pipe/p_screen.h17
-rw-r--r--src/gallium/include/pipe/p_state.h2
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c14
-rw-r--r--src/gallium/state_trackers/vega/api_images.c5
-rw-r--r--src/gallium/state_trackers/vega/image.c13
-rw-r--r--src/gallium/state_trackers/vega/paint.c6
-rw-r--r--src/gallium/state_trackers/vega/st_inlines.h9
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c7
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c9
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c23
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c30
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c20
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c19
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c13
-rw-r--r--src/mesa/state_tracker/st_inlines.h10
-rw-r--r--src/mesa/state_tracker/st_texture.c17
76 files changed, 690 insertions, 610 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 8f6ca15dfa..2cb76b25ae 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -422,9 +422,9 @@ aaline_create_texture(struct aaline_stage *aaline)
/* This texture is new, no need to flush.
*/
- transfer = screen->get_tex_transfer(screen, aaline->texture, 0, level, 0,
+ transfer = pipe->get_tex_transfer(pipe, aaline->texture, 0, level, 0,
PIPE_TRANSFER_WRITE, 0, 0, size, size);
- data = screen->transfer_map(screen, transfer);
+ data = pipe->transfer_map(pipe, transfer);
if (data == NULL)
return FALSE;
@@ -448,8 +448,8 @@ aaline_create_texture(struct aaline_stage *aaline)
}
/* unmap */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
}
return TRUE;
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index d0d99aa331..479777e807 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -374,19 +374,21 @@ pstip_update_texture(struct pstip_stage *pstip)
{
static const uint bit31 = 1 << 31;
struct pipe_context *pipe = pstip->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *transfer;
const uint *stipple = pstip->state.stipple->stipple;
uint i, j;
ubyte *data;
/* XXX: want to avoid flushing just because we use stipple:
+ *
+ * Flush should no longer be necessary if driver is properly
+ * interleaving drawing and transfers on a given context:
*/
pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL );
- transfer = screen->get_tex_transfer(screen, pstip->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
- data = screen->transfer_map(screen, transfer);
+ transfer = pipe->get_tex_transfer(pipe, pstip->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
+ data = pipe->transfer_map(pipe, transfer);
/*
* Load alpha texture.
@@ -408,8 +410,8 @@ pstip_update_texture(struct pstip_stage *pstip)
}
/* unmap */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
}
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 94be682c4b..de775a2dbc 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -421,26 +421,31 @@ void debug_dump_image(const char *prefix,
#endif
}
-void debug_dump_surface(const char *prefix,
+void debug_dump_surface(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_surface *surface)
{
struct pipe_texture *texture;
- struct pipe_screen *screen;
struct pipe_transfer *transfer;
void *data;
if (!surface)
return;
+ /* XXX: this doesn't necessarily work, as the driver may be using
+ * temporary storage for the surface which hasn't been propagated
+ * back into the texture. Need to nail down the semantics of views
+ * and transfers a bit better before we can say if extra work needs
+ * to be done here:
+ */
texture = surface->texture;
- screen = texture->screen;
- transfer = screen->get_tex_transfer(screen, texture, surface->face,
- surface->level, surface->zslice,
- PIPE_TRANSFER_READ, 0, 0, surface->width,
- surface->height);
+ transfer = pipe->get_tex_transfer(pipe, texture, surface->face,
+ surface->level, surface->zslice,
+ PIPE_TRANSFER_READ, 0, 0, surface->width,
+ surface->height);
- data = screen->transfer_map(screen, transfer);
+ data = pipe->transfer_map(pipe, transfer);
if(!data)
goto error;
@@ -452,13 +457,14 @@ void debug_dump_surface(const char *prefix,
transfer->stride,
data);
- screen->transfer_unmap(screen, transfer);
+ pipe->transfer_unmap(pipe, transfer);
error:
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(transfer);
}
-void debug_dump_texture(const char *prefix,
+void debug_dump_texture(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_texture *texture)
{
struct pipe_surface *surface;
@@ -473,7 +479,7 @@ void debug_dump_texture(const char *prefix,
surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
PIPE_TEXTURE_USAGE_SAMPLER);
if (surface) {
- debug_dump_surface(prefix, surface);
+ debug_dump_surface(pipe, prefix, surface);
screen->tex_surface_destroy(surface);
}
}
@@ -511,22 +517,22 @@ struct bmp_rgb_quad {
};
void
-debug_dump_surface_bmp(const char *filename,
+debug_dump_surface_bmp(struct pipe_context *pipe,
+ const char *filename,
struct pipe_surface *surface)
{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
struct pipe_transfer *transfer;
struct pipe_texture *texture = surface->texture;
- struct pipe_screen *screen = texture->screen;
- transfer = screen->get_tex_transfer(screen, texture, surface->face,
- surface->level, surface->zslice,
- PIPE_TRANSFER_READ, 0, 0, surface->width,
- surface->height);
+ transfer = pipe->get_tex_transfer(pipe, texture, surface->face,
+ surface->level, surface->zslice,
+ PIPE_TRANSFER_READ, 0, 0, surface->width,
+ surface->height);
debug_dump_transfer_bmp(filename, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(transfer);
#endif
}
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 0f4768f344..a383837743 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -312,6 +312,7 @@ debug_memory_end(unsigned long beginning);
#ifdef DEBUG
+struct pipe_context;
struct pipe_surface;
struct pipe_transfer;
struct pipe_texture;
@@ -321,11 +322,14 @@ void debug_dump_image(const char *prefix,
unsigned width, unsigned height,
unsigned stride,
const void *data);
-void debug_dump_surface(const char *prefix,
+void debug_dump_surface(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_surface *surface);
-void debug_dump_texture(const char *prefix,
+void debug_dump_texture(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_texture *texture);
-void debug_dump_surface_bmp(const char *filename,
+void debug_dump_surface_bmp(struct pipe_context *pipe,
+ const char *filename,
struct pipe_surface *surface);
void debug_dump_transfer_bmp(const char *filename,
struct pipe_transfer *transfer);
@@ -334,8 +338,8 @@ void debug_dump_float_rgba_bmp(const char *filename,
float *rgba, unsigned stride);
#else
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
-#define debug_dump_surface(prefix, surface) ((void)0)
-#define debug_dump_surface_bmp(filename, surface) ((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_float_rgba_bmp(filename, width, height, rgba, stride) ((void)0)
#endif
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index d421bee8ef..46fbde3f4a 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1119,7 +1119,6 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
uint face, uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
const uint zslice = 0;
uint dstLevel;
@@ -1128,27 +1127,27 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
void *srcMap, *dstMap;
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+ srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
u_minify(pt->width0, srcLevel),
u_minify(pt->height0, srcLevel));
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+ dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
reduce_1d(pt->format,
srcTrans->width, srcMap,
dstTrans->width, dstMap);
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(srcTrans);
+ pipe->tex_transfer_destroy(dstTrans);
}
}
@@ -1159,7 +1158,6 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
uint face, uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
const uint zslice = 0;
uint dstLevel;
@@ -1171,17 +1169,17 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
ubyte *srcMap, *dstMap;
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+ srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
u_minify(pt->width0, srcLevel),
u_minify(pt->height0, srcLevel));
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+ dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
reduce_2d(pt->format,
srcTrans->width, srcTrans->height,
@@ -1189,11 +1187,11 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
dstTrans->width, dstTrans->height,
dstTrans->stride, dstMap);
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(srcTrans);
+ pipe->tex_transfer_destroy(dstTrans);
}
}
@@ -1216,17 +1214,17 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
ubyte *srcMap, *dstMap;
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+ srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
u_minify(pt->width0, srcLevel),
u_minify(pt->height0, srcLevel));
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+ dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
reduce_3d(pt->format,
srcTrans->width, srcTrans->height,
@@ -1234,11 +1232,11 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
dstTrans->width, dstTrans->height,
dstTrans->stride, dstMap);
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(srcTrans);
+ pipe->tex_transfer_destroy(dstTrans);
}
#else
(void) reduce_3d;
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 0cb3432c6e..ada31b8182 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -266,22 +266,22 @@ pipe_buffer_read(struct pipe_screen *screen,
static INLINE void *
pipe_transfer_map( struct pipe_transfer *transf )
{
- struct pipe_screen *screen = transf->texture->screen;
- return screen->transfer_map(screen, transf);
+ struct pipe_context *context = transf->pipe;
+ return context->transfer_map(context, transf);
}
static INLINE void
pipe_transfer_unmap( struct pipe_transfer *transf )
{
- struct pipe_screen *screen = transf->texture->screen;
- screen->transfer_unmap(screen, transf);
+ struct pipe_context *context = transf->pipe;
+ context->transfer_unmap(context, transf);
}
static INLINE void
pipe_transfer_destroy( struct pipe_transfer *transf )
{
- struct pipe_screen *screen = transf->texture->screen;
- screen->tex_transfer_destroy(transf);
+ struct pipe_context *context = transf->pipe;
+ context->tex_transfer_destroy(transf);
}
static INLINE unsigned
diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c
index 8479161c74..0b8405d01f 100644
--- a/src/gallium/auxiliary/util/u_rect.c
+++ b/src/gallium/auxiliary/util/u_rect.c
@@ -169,7 +169,6 @@ util_surface_copy(struct pipe_context *pipe,
unsigned src_x, unsigned src_y,
unsigned w, unsigned h)
{
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *src_trans, *dst_trans;
void *dst_map;
const void *src_map;
@@ -182,7 +181,7 @@ util_surface_copy(struct pipe_context *pipe,
src_format = src->texture->format;
dst_format = dst->texture->format;
- src_trans = screen->get_tex_transfer(screen,
+ src_trans = pipe->get_tex_transfer(pipe,
src->texture,
src->face,
src->level,
@@ -190,7 +189,7 @@ util_surface_copy(struct pipe_context *pipe,
PIPE_TRANSFER_READ,
src_x, src_y, w, h);
- dst_trans = screen->get_tex_transfer(screen,
+ dst_trans = pipe->get_tex_transfer(pipe,
dst->texture,
dst->face,
dst->level,
@@ -202,8 +201,8 @@ util_surface_copy(struct pipe_context *pipe,
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->screen->transfer_map(screen, src_trans);
- dst_map = pipe->screen->transfer_map(screen, dst_trans);
+ src_map = pipe->transfer_map(pipe, src_trans);
+ dst_map = pipe->transfer_map(pipe, dst_trans);
assert(src_map);
assert(dst_map);
@@ -221,11 +220,11 @@ util_surface_copy(struct pipe_context *pipe,
do_flip ? h - 1 : 0);
}
- pipe->screen->transfer_unmap(pipe->screen, src_trans);
- pipe->screen->transfer_unmap(pipe->screen, dst_trans);
+ pipe->transfer_unmap(pipe, src_trans);
+ pipe->transfer_unmap(pipe, dst_trans);
- screen->tex_transfer_destroy(src_trans);
- screen->tex_transfer_destroy(dst_trans);
+ pipe->tex_transfer_destroy(src_trans);
+ pipe->tex_transfer_destroy(dst_trans);
}
@@ -243,14 +242,13 @@ util_surface_fill(struct pipe_context *pipe,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height, unsigned value)
{
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *dst_trans;
void *dst_map;
assert(dst->texture);
if (!dst->texture)
return;
- dst_trans = screen->get_tex_transfer(screen,
+ dst_trans = pipe->get_tex_transfer(pipe,
dst->texture,
dst->face,
dst->level,
@@ -258,7 +256,7 @@ util_surface_fill(struct pipe_context *pipe,
PIPE_TRANSFER_WRITE,
dstx, dsty, width, height);
- dst_map = pipe->screen->transfer_map(screen, dst_trans);
+ dst_map = pipe->transfer_map(pipe, dst_trans);
assert(dst_map);
@@ -302,6 +300,6 @@ util_surface_fill(struct pipe_context *pipe,
}
}
- pipe->screen->transfer_unmap(pipe->screen, dst_trans);
- screen->tex_transfer_destroy(dst_trans);
+ pipe->transfer_unmap(pipe, dst_trans);
+ pipe->tex_transfer_destroy(dst_trans);
}
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 79481b710b..70a6d97385 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -49,7 +49,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
void *dst, int dst_stride)
{
- struct pipe_screen *screen = pt->texture->screen;
+ struct pipe_context *pipe = pt->pipe;
const void *src;
if (dst_stride == 0)
@@ -58,14 +58,14 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- src = screen->transfer_map(screen, pt);
+ src = pipe->transfer_map(pipe, pt);
assert(src);
if(!src)
return;
util_copy_rect(dst, pt->texture->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y);
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
@@ -77,7 +77,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const void *src, int src_stride)
{
- struct pipe_screen *screen = pt->texture->screen;
+ struct pipe_context *pipe = pt->pipe;
void *dst;
enum pipe_format format = pt->texture->format;
@@ -87,14 +87,14 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- dst = screen->transfer_map(screen, pt);
+ 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);
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
@@ -1377,7 +1377,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
uint *z)
{
- struct pipe_screen *screen = pt->texture->screen;
+ struct pipe_context *pipe = pt->pipe;
const uint dstStride = w;
ubyte *map;
uint *pDest = z;
@@ -1387,7 +1387,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- map = (ubyte *)screen->transfer_map(screen, pt);
+ map = (ubyte *)pipe->transfer_map(pipe, pt);
if (!map) {
assert(0);
return;
@@ -1453,7 +1453,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
assert(0);
}
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
@@ -1462,7 +1462,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const uint *zSrc)
{
- struct pipe_screen *screen = pt->texture->screen;
+ struct pipe_context *pipe = pt->pipe;
const uint srcStride = w;
const uint *ptrc = zSrc;
ubyte *map;
@@ -1472,7 +1472,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- map = (ubyte *)screen->transfer_map(screen, pt);
+ map = (ubyte *)pipe->transfer_map(pipe, pt);
if (!map) {
assert(0);
return;
@@ -1560,7 +1560,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
assert(0);
}
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 0763b5bb0e..dcc0014479 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -680,14 +680,14 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r)
assert(r);
for (i = 0; i < 3; ++i) {
- r->tex_transfer[i] = r->pipe->screen->get_tex_transfer
+ r->tex_transfer[i] = r->pipe->get_tex_transfer
(
- r->pipe->screen, r->textures.all[i],
+ r->pipe, r->textures.all[i],
0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0,
r->textures.all[i]->width0, r->textures.all[i]->height0
);
- r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]);
+ r->texels[i] = r->pipe->transfer_map(r->pipe, r->tex_transfer[i]);
}
}
@@ -699,8 +699,8 @@ xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r)
assert(r);
for (i = 0; i < 3; ++i) {
- r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]);
- r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]);
+ r->pipe->transfer_unmap(r->pipe, r->tex_transfer[i]);
+ r->pipe->tex_transfer_destroy(r->tex_transfer[i]);
}
}
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 3d45a22b7e..130519ffa5 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -221,6 +221,7 @@ i915_create_context(struct pipe_screen *screen, void *priv)
i915_init_surface_functions(i915);
i915_init_state_functions(i915);
i915_init_flush_functions(i915);
+ i915_init_texture_functions(i915);
draw_install_aaline_stage(i915->draw, &i915->base);
draw_install_aapoint_stage(i915->draw, &i915->base);
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 4994537683..039165b63f 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -350,6 +350,12 @@ struct pipe_context *i915_create_context(struct pipe_screen *screen,
/***********************************************************************
+ * i915_texture.c
+ */
+void i915_init_texture_functions(struct i915_context *i915 );
+
+
+/***********************************************************************
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index 3ce52cdcdb..3435f7797f 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -795,12 +795,12 @@ i915_tex_surface_destroy(struct pipe_surface *surf)
/*
- * Screen transfer functions
+ * Texture transfer functions
*/
-static struct pipe_transfer*
-i915_get_tex_transfer(struct pipe_screen *screen,
+static struct pipe_transfer *
+i915_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
@@ -825,6 +825,7 @@ i915_get_tex_transfer(struct pipe_screen *screen,
trans = CALLOC_STRUCT(i915_transfer);
if (trans) {
pipe_texture_reference(&trans->base.texture, texture);
+ trans->base.pipe = pipe;
trans->base.x = x;
trans->base.y = y;
trans->base.width = w;
@@ -837,7 +838,7 @@ i915_get_tex_transfer(struct pipe_screen *screen,
}
static void *
-i915_transfer_map(struct pipe_screen *screen,
+i915_transfer_map(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct i915_texture *tex = (struct i915_texture *)transfer->texture;
@@ -859,7 +860,7 @@ i915_transfer_map(struct pipe_screen *screen,
}
static void
-i915_transfer_unmap(struct pipe_screen *screen,
+i915_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct i915_texture *tex = (struct i915_texture *)transfer->texture;
@@ -879,6 +880,14 @@ i915_tex_transfer_destroy(struct pipe_transfer *trans)
* Other texture functions
*/
+void
+i915_init_texture_functions(struct i915_context *i915 )
+{
+ i915->base.get_tex_transfer = i915_get_tex_transfer;
+ i915->base.transfer_map = i915_transfer_map;
+ i915->base.transfer_unmap = i915_transfer_unmap;
+ i915->base.tex_transfer_destroy = i915_tex_transfer_destroy;
+}
void
i915_init_screen_texture_functions(struct i915_screen *is)
@@ -889,8 +898,4 @@ i915_init_screen_texture_functions(struct i915_screen *is)
is->base.texture_destroy = i915_texture_destroy;
is->base.get_tex_surface = i915_get_tex_surface;
is->base.tex_surface_destroy = i915_tex_surface_destroy;
- is->base.get_tex_transfer = i915_get_tex_transfer;
- is->base.transfer_map = i915_transfer_map;
- is->base.transfer_unmap = i915_transfer_unmap;
- is->base.tex_transfer_destroy = i915_tex_transfer_destroy;
}
diff --git a/src/gallium/drivers/i965/brw_screen.h b/src/gallium/drivers/i965/brw_screen.h
index e0f3cd2a9f..23e052d0b9 100644
--- a/src/gallium/drivers/i965/brw_screen.h
+++ b/src/gallium/drivers/i965/brw_screen.h
@@ -181,6 +181,10 @@ void brw_update_texture( struct brw_screen *brw_screen,
struct brw_texture *tex );
+/* brw_screen_texture.h
+ */
+struct brw_context;
+void brw_tex_init( struct brw_context *brw );
void brw_screen_tex_init( struct brw_screen *brw_screen );
void brw_screen_tex_surface_init( struct brw_screen *brw_screen );
@@ -198,5 +202,4 @@ boolean brw_is_buffer_referenced_by_bo( struct brw_screen *brw_screen,
struct brw_winsys_buffer *bo );
-
#endif /* BRW_SCREEN_H */
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c
index cc79bfc771..52bf9b3c1c 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -37,6 +37,8 @@
#include "brw_defines.h"
#include "brw_structs.h"
#include "brw_winsys.h"
+#include "brw_context.h"
+
@@ -479,7 +481,7 @@ boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen,
*/
static struct pipe_transfer*
-brw_get_tex_transfer(struct pipe_screen *screen,
+brw_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
@@ -502,6 +504,7 @@ brw_get_tex_transfer(struct pipe_screen *screen,
trans = CALLOC_STRUCT(brw_transfer);
if (trans) {
pipe_texture_reference(&trans->base.texture, texture);
+ trans->base.pipe = pipe;
trans->base.x = x;
trans->base.y = y;
trans->base.width = w;
@@ -514,11 +517,11 @@ brw_get_tex_transfer(struct pipe_screen *screen,
}
static void *
-brw_transfer_map(struct pipe_screen *screen,
+brw_transfer_map(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct brw_texture *tex = brw_texture(transfer->texture);
- struct brw_winsys_screen *sws = brw_screen(screen)->sws;
+ struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws;
char *map;
unsigned usage = transfer->usage;
@@ -541,11 +544,11 @@ brw_transfer_map(struct pipe_screen *screen,
}
static void
-brw_transfer_unmap(struct pipe_screen *screen,
+brw_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct brw_texture *tex = brw_texture(transfer->texture);
- struct brw_winsys_screen *sws = brw_screen(screen)->sws;
+ struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws;
sws->bo_unmap(tex->bo);
}
@@ -558,6 +561,14 @@ brw_tex_transfer_destroy(struct pipe_transfer *trans)
}
+void brw_tex_init( struct brw_context *brw )
+{
+ brw->base.get_tex_transfer = brw_get_tex_transfer;
+ brw->base.transfer_map = brw_transfer_map;
+ brw->base.transfer_unmap = brw_transfer_unmap;
+ brw->base.tex_transfer_destroy = brw_tex_transfer_destroy;
+}
+
void brw_screen_tex_init( struct brw_screen *brw_screen )
{
brw_screen->base.is_format_supported = brw_is_format_supported;
@@ -565,8 +576,4 @@ void brw_screen_tex_init( struct brw_screen *brw_screen )
brw_screen->base.texture_from_handle = brw_texture_from_handle;
brw_screen->base.texture_get_handle = brw_texture_get_handle;
brw_screen->base.texture_destroy = brw_texture_destroy;
- brw_screen->base.get_tex_transfer = brw_get_tex_transfer;
- brw_screen->base.transfer_map = brw_transfer_map;
- brw_screen->base.transfer_unmap = brw_transfer_unmap;
- brw_screen->base.tex_transfer_destroy = brw_tex_transfer_destroy;
}
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index baf0ae4401..5e371c47c8 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -711,6 +711,74 @@ identity_is_buffer_referenced(struct pipe_context *_pipe,
buffer);
}
+
+
+static struct pipe_transfer *
+identity_context_get_tex_transfer(struct pipe_context *_context,
+ struct pipe_texture *_texture,
+ unsigned face,
+ unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x,
+ unsigned y,
+ unsigned w,
+ unsigned h)
+{
+ struct identity_context *id_context = identity_context(_context);
+ struct identity_texture *id_texture = identity_texture(_texture);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_texture *texture = id_texture->texture;
+ struct pipe_transfer *result;
+
+ result = context->get_tex_transfer(context,
+ texture,
+ face,
+ level,
+ zslice,
+ usage,
+ x,
+ y,
+ w,
+ h);
+
+ if (result)
+ return identity_transfer_create(id_context, id_texture, result);
+ return NULL;
+}
+
+static void
+identity_context_tex_transfer_destroy(struct pipe_transfer *_transfer)
+{
+ identity_transfer_destroy(identity_transfer(_transfer));
+}
+
+static void *
+identity_context_transfer_map(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct identity_context *id_context = identity_context(_context);
+ struct identity_transfer *id_transfer = identity_transfer(_transfer);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_transfer *transfer = id_transfer->transfer;
+
+ return context->transfer_map(context,
+ transfer);
+}
+
+static void
+identity_context_transfer_unmap(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct identity_context *id_context = identity_context(_context);
+ struct identity_transfer *id_transfer = identity_transfer(_transfer);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_transfer *transfer = id_transfer->transfer;
+
+ context->transfer_unmap(context,
+ transfer);
+}
+
struct pipe_context *
identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
{
@@ -775,6 +843,10 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.flush = identity_flush;
id_pipe->base.is_texture_referenced = identity_is_texture_referenced;
id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced;
+ id_pipe->base.get_tex_transfer = identity_context_get_tex_transfer;
+ id_pipe->base.tex_transfer_destroy = identity_context_tex_transfer_destroy;
+ id_pipe->base.transfer_map = identity_context_transfer_map;
+ id_pipe->base.transfer_unmap = identity_context_transfer_unmap;
id_pipe->pipe = pipe;
diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c
index 2b1a60c1bf..91831404b8 100644
--- a/src/gallium/drivers/identity/id_objects.c
+++ b/src/gallium/drivers/identity/id_objects.c
@@ -142,7 +142,8 @@ identity_surface_destroy(struct identity_surface *id_surface)
struct pipe_transfer *
-identity_transfer_create(struct identity_texture *id_texture,
+identity_transfer_create(struct identity_context *id_context,
+ struct identity_texture *id_texture,
struct pipe_transfer *transfer)
{
struct identity_transfer *id_transfer;
@@ -166,18 +167,15 @@ identity_transfer_create(struct identity_texture *id_texture,
return &id_transfer->base;
error:
- transfer->texture->screen->tex_transfer_destroy(transfer);
+ transfer->pipe->tex_transfer_destroy(transfer);
return NULL;
}
void
identity_transfer_destroy(struct identity_transfer *id_transfer)
{
- struct identity_screen *id_screen = identity_screen(id_transfer->base.texture->screen);
- struct pipe_screen *screen = id_screen->screen;
-
pipe_texture_reference(&id_transfer->base.texture, NULL);
- screen->tex_transfer_destroy(id_transfer->transfer);
+ id_transfer->transfer->pipe->tex_transfer_destroy(id_transfer->transfer);
FREE(id_transfer);
}
diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h
index 77cc719079..3c4e6d3f8c 100644
--- a/src/gallium/drivers/identity/id_objects.h
+++ b/src/gallium/drivers/identity/id_objects.h
@@ -35,6 +35,7 @@
#include "id_screen.h"
+struct identity_context;
struct identity_buffer
{
@@ -177,7 +178,8 @@ void
identity_surface_destroy(struct identity_surface *id_surface);
struct pipe_transfer *
-identity_transfer_create(struct identity_texture *id_texture,
+identity_transfer_create(struct identity_context *id_context,
+ struct identity_texture *id_texture,
struct pipe_transfer *transfer);
void
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index b9d0f003d7..419b146578 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -207,71 +207,6 @@ identity_screen_tex_surface_destroy(struct pipe_surface *_surface)
identity_surface_destroy(identity_surface(_surface));
}
-static struct pipe_transfer *
-identity_screen_get_tex_transfer(struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned face,
- unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x,
- unsigned y,
- unsigned w,
- unsigned h)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_texture *id_texture = identity_texture(_texture);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *texture = id_texture->texture;
- struct pipe_transfer *result;
-
- result = screen->get_tex_transfer(screen,
- texture,
- face,
- level,
- zslice,
- usage,
- x,
- y,
- w,
- h);
-
- if (result)
- return identity_transfer_create(id_texture, result);
- return NULL;
-}
-
-static void
-identity_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
-{
- identity_transfer_destroy(identity_transfer(_transfer));
-}
-
-static void *
-identity_screen_transfer_map(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_transfer *id_transfer = identity_transfer(_transfer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_transfer *transfer = id_transfer->transfer;
-
- return screen->transfer_map(screen,
- transfer);
-}
-
-static void
-identity_screen_transfer_unmap(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_transfer *id_transfer = identity_transfer(_transfer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_transfer *transfer = id_transfer->transfer;
-
- screen->transfer_unmap(screen,
- transfer);
-}
static struct pipe_buffer *
identity_screen_buffer_create(struct pipe_screen *_screen,
@@ -488,10 +423,6 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.texture_destroy = identity_screen_texture_destroy;
id_screen->base.get_tex_surface = identity_screen_get_tex_surface;
id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy;
- id_screen->base.get_tex_transfer = identity_screen_get_tex_transfer;
- id_screen->base.tex_transfer_destroy = identity_screen_tex_transfer_destroy;
- id_screen->base.transfer_map = identity_screen_transfer_map;
- id_screen->base.transfer_unmap = identity_screen_transfer_unmap;
id_screen->base.buffer_create = identity_screen_buffer_create;
id_screen->base.user_buffer_create = identity_screen_user_buffer_create;
if (screen->buffer_map)
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index 41ac1cee72..89c06ea3ad 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -55,7 +55,7 @@ testprogs := lp_test_format \
LIBS += $(GL_LIB_DEPS) -L. -lllvmpipe -L../../auxiliary/ -lgallium
-$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a
- $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group
+#$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a
+# $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group
-default: $(testprogs)
+#default: $(testprogs)
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index d94efec16a..945e3e0558 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -173,6 +173,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
llvmpipe->pipe.is_buffer_referenced = llvmpipe_is_buffer_referenced;
llvmpipe_init_query_funcs( llvmpipe );
+ llvmpipe_init_context_texture_funcs( &llvmpipe->pipe );
/*
* Create drawing context and plug our rendering stage into it.
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index bf832433be..1b4e889935 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -79,12 +79,12 @@ llvmpipe_flush( struct pipe_context *pipe,
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no);
- debug_dump_surface(filename, llvmpipe->framebuffer.cbufs[i]);
+ debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[0]);
}
if (0) {
util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no);
- debug_dump_surface(filename, llvmpipe->framebuffer.zsbuf);
+ debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf);
}
++frame_no;
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 72492c0f0c..bfe53d4106 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -397,7 +397,7 @@ end:
static boolean
lp_scene_map_buffers( struct lp_scene *scene )
{
- struct pipe_screen *screen = scene->pipe->screen;
+ struct pipe_context *pipe = scene->pipe;
struct pipe_surface *cbuf, *zsbuf;
int i;
@@ -409,7 +409,7 @@ lp_scene_map_buffers( struct lp_scene *scene )
for (i = 0; i < scene->fb.nr_cbufs; i++) {
cbuf = scene->fb.cbufs[i];
if (cbuf) {
- scene->cbuf_transfer[i] = screen->get_tex_transfer(screen,
+ scene->cbuf_transfer[i] = pipe->get_tex_transfer(pipe,
cbuf->texture,
cbuf->face,
cbuf->level,
@@ -421,7 +421,7 @@ lp_scene_map_buffers( struct lp_scene *scene )
if (!scene->cbuf_transfer[i])
goto fail;
- scene->cbuf_map[i] = screen->transfer_map(screen,
+ scene->cbuf_map[i] = pipe->transfer_map(pipe,
scene->cbuf_transfer[i]);
if (!scene->cbuf_map[i])
goto fail;
@@ -432,7 +432,7 @@ lp_scene_map_buffers( struct lp_scene *scene )
*/
zsbuf = scene->fb.zsbuf;
if (zsbuf) {
- scene->zsbuf_transfer = screen->get_tex_transfer(screen,
+ scene->zsbuf_transfer = pipe->get_tex_transfer(pipe,
zsbuf->texture,
zsbuf->face,
zsbuf->level,
@@ -444,7 +444,7 @@ lp_scene_map_buffers( struct lp_scene *scene )
if (!scene->zsbuf_transfer)
goto fail;
- scene->zsbuf_map = screen->transfer_map(screen,
+ scene->zsbuf_map = pipe->transfer_map(pipe,
scene->zsbuf_transfer);
if (!scene->zsbuf_map)
goto fail;
@@ -469,25 +469,25 @@ fail:
static void
lp_scene_unmap_buffers( struct lp_scene *scene )
{
- struct pipe_screen *screen = scene->pipe->screen;
+ struct pipe_context *pipe = scene->pipe;
unsigned i;
for (i = 0; i < scene->fb.nr_cbufs; i++) {
if (scene->cbuf_map[i])
- screen->transfer_unmap(screen, scene->cbuf_transfer[i]);
+ pipe->transfer_unmap(pipe, scene->cbuf_transfer[i]);
if (scene->cbuf_transfer[i])
- screen->tex_transfer_destroy(scene->cbuf_transfer[i]);
+ pipe->tex_transfer_destroy(scene->cbuf_transfer[i]);
scene->cbuf_transfer[i] = NULL;
scene->cbuf_map[i] = NULL;
}
if (scene->zsbuf_map)
- screen->transfer_unmap(screen, scene->zsbuf_transfer);
+ pipe->transfer_unmap(pipe, scene->zsbuf_transfer);
if (scene->zsbuf_transfer)
- screen->tex_transfer_destroy(scene->zsbuf_transfer);
+ pipe->tex_transfer_destroy(scene->zsbuf_transfer);
scene->zsbuf_transfer = NULL;
scene->zsbuf_map = NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 74b7b4ec5e..65f7994e0e 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -243,7 +243,7 @@ llvmpipe_tex_surface_destroy(struct pipe_surface *surf)
static struct pipe_transfer *
-llvmpipe_get_tex_transfer(struct pipe_screen *screen,
+llvmpipe_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
@@ -307,10 +307,10 @@ llvmpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
static void *
-llvmpipe_transfer_map( struct pipe_screen *_screen,
+llvmpipe_transfer_map( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
- struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
+ struct llvmpipe_screen *screen = llvmpipe_screen(pipe->screen);
ubyte *map, *xfer_map;
struct llvmpipe_texture *lpt;
enum pipe_format format;
@@ -351,10 +351,10 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
static void
-llvmpipe_transfer_unmap(struct pipe_screen *screen,
- struct pipe_transfer *transfer)
+llvmpipe_transfer_unmap(struct pipe_context *pipe,
+ struct pipe_transfer *transfer)
{
- struct llvmpipe_screen *lp_screen = llvmpipe_screen(screen);
+ struct llvmpipe_screen *lp_screen = llvmpipe_screen(pipe->screen);
struct llvmpipe_texture *lpt;
assert(transfer->texture);
@@ -376,9 +376,14 @@ llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen)
screen->get_tex_surface = llvmpipe_get_tex_surface;
screen->tex_surface_destroy = llvmpipe_tex_surface_destroy;
+}
+
- screen->get_tex_transfer = llvmpipe_get_tex_transfer;
- screen->tex_transfer_destroy = llvmpipe_tex_transfer_destroy;
- screen->transfer_map = llvmpipe_transfer_map;
- screen->transfer_unmap = llvmpipe_transfer_unmap;
+void
+llvmpipe_init_context_texture_funcs(struct pipe_context *pipe)
+{
+ pipe->get_tex_transfer = llvmpipe_get_tex_transfer;
+ pipe->tex_transfer_destroy = llvmpipe_tex_transfer_destroy;
+ pipe->transfer_map = llvmpipe_transfer_map;
+ pipe->transfer_unmap = llvmpipe_transfer_unmap;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index b23f929b16..94b667abf3 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -98,5 +98,7 @@ llvmpipe_transfer(struct pipe_transfer *pt)
extern void
llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen);
+extern void
+llvmpipe_init_context_texture_funcs(struct pipe_context *pipe);
#endif /* LP_TEXTURE_H */
diff --git a/src/gallium/drivers/nouveau/nv04_surface_2d.c b/src/gallium/drivers/nouveau/nv04_surface_2d.c
index b074547c4d..93114465d5 100644
--- a/src/gallium/drivers/nouveau/nv04_surface_2d.c
+++ b/src/gallium/drivers/nouveau/nv04_surface_2d.c
@@ -518,7 +518,6 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d
ns->base.usage = PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER | PIPE_BUFFER_USAGE_GPU_READ;
}
- struct nv40_screen* screen = (struct nv40_screen*)pscreen;
ns->base.usage = PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE;
struct pipe_texture templ;
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index 279b74445c..825c167b01 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -74,6 +74,7 @@ nv30_create(struct pipe_screen *pscreen, void *priv)
nv30_init_query_functions(nv30);
nv30_init_surface_functions(nv30);
nv30_init_state_functions(nv30);
+ nv30_init_transfer_functions(nv30);
/* Create, configure, and install fallback swtnl path */
nv30->draw = draw_create();
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index 1786460aec..4a164f3b1f 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -167,6 +167,7 @@ struct nv30_state_entry {
extern void nv30_init_state_functions(struct nv30_context *nv30);
extern void nv30_init_surface_functions(struct nv30_context *nv30);
extern void nv30_init_query_functions(struct nv30_context *nv30);
+extern void nv30_init_transfer_functions(struct nv30_context *nv30);
extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen);
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 85433d2095..db24335b7c 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -214,7 +214,6 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->context_create = nv30_create;
nv30_screen_init_miptree_functions(pscreen);
- nv30_screen_init_transfer_functions(pscreen);
/* 3D object */
switch (dev->chipset & 0xf0) {
diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h
index 8591cd31ca..b7856cdf00 100644
--- a/src/gallium/drivers/nv30/nv30_screen.h
+++ b/src/gallium/drivers/nv30/nv30_screen.h
@@ -35,7 +35,4 @@ nv30_screen(struct pipe_screen *screen)
return (struct nv30_screen *)screen;
}
-void
-nv30_screen_init_transfer_functions(struct pipe_screen *pscreen);
-
#endif
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c
index 3aeda51ea1..1318c60ae4 100644
--- a/src/gallium/drivers/nv30/nv30_transfer.c
+++ b/src/gallium/drivers/nv30/nv30_transfer.c
@@ -33,11 +33,12 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h
}
static struct pipe_transfer *
-nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv30_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nv30_miptree *mt = (struct nv30_miptree *)pt;
struct nv30_transfer *tx;
struct pipe_texture tx_tex_template, *tx_tex;
@@ -145,8 +146,9 @@ nv30_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv30_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
@@ -160,8 +162,9 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
static void
-nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv30_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
@@ -169,10 +172,10 @@ nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
void
-nv30_screen_init_transfer_functions(struct pipe_screen *pscreen)
+nv30_init_transfer_functions(struct nv30_context *nv30)
{
- pscreen->get_tex_transfer = nv30_transfer_new;
- pscreen->tex_transfer_destroy = nv30_transfer_del;
- pscreen->transfer_map = nv30_transfer_map;
- pscreen->transfer_unmap = nv30_transfer_unmap;
+ nv30->pipe.get_tex_transfer = nv30_transfer_new;
+ nv30->pipe.tex_transfer_destroy = nv30_transfer_del;
+ nv30->pipe.transfer_map = nv30_transfer_map;
+ nv30->pipe.transfer_unmap = nv30_transfer_unmap;
}
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index 65dc73e88b..e828f17643 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -74,6 +74,7 @@ nv40_create(struct pipe_screen *pscreen, void *priv)
nv40_init_query_functions(nv40);
nv40_init_surface_functions(nv40);
nv40_init_state_functions(nv40);
+ nv40_init_transfer_functions(nv40);
/* Create, configure, and install fallback swtnl path */
nv40->draw = draw_create();
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index 2550ec654b..cb5d9e2d9d 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -183,6 +183,7 @@ struct nv40_state_entry {
extern void nv40_init_state_functions(struct nv40_context *nv40);
extern void nv40_init_surface_functions(struct nv40_context *nv40);
extern void nv40_init_query_functions(struct nv40_context *nv40);
+extern void nv40_init_transfer_functions(struct nv40_context *nv40);
extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen);
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index b216c5e38c..dbcc33d8d9 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -201,7 +201,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->context_create = nv40_create;
nv40_screen_init_miptree_functions(pscreen);
- nv40_screen_init_transfer_functions(pscreen);
/* 3D object */
switch (dev->chipset & 0xf0) {
diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h
index 9437aa050d..2765ab764a 100644
--- a/src/gallium/drivers/nv40/nv40_screen.h
+++ b/src/gallium/drivers/nv40/nv40_screen.h
@@ -34,7 +34,4 @@ nv40_screen(struct pipe_screen *screen)
return (struct nv40_screen *)screen;
}
-void
-nv40_screen_init_transfer_functions(struct pipe_screen *pscreen);
-
#endif
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c
index 0462a042c3..2ca9b94388 100644
--- a/src/gallium/drivers/nv40/nv40_transfer.c
+++ b/src/gallium/drivers/nv40/nv40_transfer.c
@@ -33,11 +33,12 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h
}
static struct pipe_transfer *
-nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv40_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nv40_miptree *mt = (struct nv40_miptree *)pt;
struct nv40_transfer *tx;
struct pipe_texture tx_tex_template, *tx_tex;
@@ -145,8 +146,9 @@ nv40_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv40_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
@@ -160,8 +162,9 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
static void
-nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv40_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
@@ -169,10 +172,10 @@ nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
void
-nv40_screen_init_transfer_functions(struct pipe_screen *pscreen)
+nv40_init_transfer_functions(struct nv40_context *nv40)
{
- pscreen->get_tex_transfer = nv40_transfer_new;
- pscreen->tex_transfer_destroy = nv40_transfer_del;
- pscreen->transfer_map = nv40_transfer_map;
- pscreen->transfer_unmap = nv40_transfer_unmap;
+ nv40->pipe.get_tex_transfer = nv40_transfer_new;
+ nv40->pipe.tex_transfer_destroy = nv40_transfer_del;
+ nv40->pipe.transfer_map = nv40_transfer_map;
+ nv40->pipe.transfer_unmap = nv40_transfer_unmap;
}
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index 0eb42f323f..aa14e17872 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -97,6 +97,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
nv50_init_surface_functions(nv50);
nv50_init_state_functions(nv50);
nv50_init_query_functions(nv50);
+ nv50_init_transfer_functions(nv50);
nv50->draw = draw_create();
assert(nv50->draw);
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 8793c2aac5..1743f6fb39 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -175,6 +175,7 @@ nv50_context(struct pipe_context *pipe)
extern void nv50_init_surface_functions(struct nv50_context *nv50);
extern void nv50_init_state_functions(struct nv50_context *nv50);
extern void nv50_init_query_functions(struct nv50_context *nv50);
+extern void nv50_init_transfer_functions(struct nv50_context *nv50);
extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen);
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c
index 7c360e9e73..b7f2ac1b1c 100644
--- a/src/gallium/drivers/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nv50/nv50_transfer.c
@@ -121,11 +121,12 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
}
static struct pipe_transfer *
-nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv50_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
struct nv50_miptree *mt = nv50_miptree(pt);
struct nv50_miptree_level *lvl = &mt->level[level];
@@ -218,7 +219,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
unsigned flags = 0;
@@ -236,7 +237,7 @@ nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
static void
-nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
@@ -244,12 +245,12 @@ nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
void
-nv50_transfer_init_screen_functions(struct pipe_screen *pscreen)
+nv50_init_transfer_functions(struct nv50_context *nv50)
{
- pscreen->get_tex_transfer = nv50_transfer_new;
- pscreen->tex_transfer_destroy = nv50_transfer_del;
- pscreen->transfer_map = nv50_transfer_map;
- pscreen->transfer_unmap = nv50_transfer_unmap;
+ nv50->pipe.get_tex_transfer = nv50_transfer_new;
+ nv50->pipe.tex_transfer_destroy = nv50_transfer_del;
+ nv50->pipe.transfer_map = nv50_transfer_map;
+ nv50->pipe.transfer_unmap = nv50_transfer_unmap;
}
void
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 923e1e541f..8606c0004e 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -34,6 +34,7 @@
#include "r300_screen.h"
#include "r300_state_invariant.h"
#include "r300_texture.h"
+#include "r300_transfer.h"
#include "radeon_winsys.h"
@@ -209,6 +210,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300_init_query_functions(r300);
+ r300_init_transfer_functions(r300);
+
/* r300_init_surface_functions(r300); */
r300_init_state_functions(r300);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 985e339112..03b09603c7 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -404,6 +404,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_surface_functions(struct r300_context* r300);
+void r300_init_tex_functions( struct pipe_context *pipe );
static INLINE boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
{
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 5880eecd5f..69c0ab496c 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -27,7 +27,6 @@
#include "r300_context.h"
#include "r300_texture.h"
-#include "r300_transfer.h"
#include "radeon_winsys.h"
#include "r300_winsys.h"
@@ -252,6 +251,8 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
return retval == usage;
}
+
+
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
struct r300_screen* r300screen = r300_screen(pscreen);
@@ -290,7 +291,6 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
r300screen->screen.context_create = r300_create_context;
r300_init_screen_texture_functions(&r300screen->screen);
- r300_init_screen_transfer_functions(&r300screen->screen);
u_simple_screen_init(&r300screen->screen);
return &r300screen->screen;
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
index ec89681a3c..7dd707ff8e 100644
--- a/src/gallium/drivers/r300/r300_transfer.c
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -118,15 +118,15 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
}
static struct pipe_transfer*
-r300_get_tex_transfer(struct pipe_screen *screen,
+r300_get_tex_transfer(struct pipe_context *ctx,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
unsigned w, unsigned h)
{
struct r300_texture *tex = (struct r300_texture *)texture;
+ struct r300_screen *r300screen = r300_screen(ctx->screen);
struct r300_transfer *trans;
- struct r300_screen *r300screen = r300_screen(screen);
struct pipe_texture template;
trans = CALLOC_STRUCT(r300_transfer);
@@ -136,7 +136,7 @@ r300_get_tex_transfer(struct pipe_screen *screen,
trans->transfer.usage = usage;
trans->transfer.width = w;
trans->transfer.height = h;
- trans->ctx = r300screen->ctx;
+ trans->ctx = ctx;
trans->x = x;
trans->y = y;
trans->level = level;
@@ -174,8 +174,10 @@ r300_get_tex_transfer(struct pipe_screen *screen,
}
/* Create the temporary texture. */
- trans->detiled_texture =
- (struct r300_texture*)screen->texture_create(screen, &template);
+ trans->detiled_texture = (struct r300_texture*)
+ ctx->screen->texture_create(ctx->screen,
+ &template);
+
assert(!trans->detiled_texture->microtile &&
!trans->detiled_texture->macrotile);
@@ -187,7 +189,7 @@ r300_get_tex_transfer(struct pipe_screen *screen,
if (usage & PIPE_TRANSFER_READ) {
/* We cannot map a tiled texture directly because the data is
* in a different order, therefore we do detiling using a blit. */
- r300_copy_from_tiled_texture(r300screen->ctx, trans);
+ r300_copy_from_tiled_texture(ctx, trans);
}
} else {
trans->transfer.x = x;
@@ -219,7 +221,7 @@ static void r300_tex_transfer_destroy(struct pipe_transfer *trans)
FREE(trans);
}
-static void* r300_transfer_map(struct pipe_screen *screen,
+static void* r300_transfer_map(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
struct r300_transfer *r300transfer = r300_transfer(transfer);
@@ -230,12 +232,12 @@ static void* r300_transfer_map(struct pipe_screen *screen,
if (r300transfer->detiled_texture) {
/* The detiled texture is of the same size as the region being mapped
* (no offset needed). */
- return pipe_buffer_map(screen,
+ return pipe_buffer_map(ctx->screen,
r300transfer->detiled_texture->buffer,
pipe_transfer_buffer_flags(transfer));
} else {
/* Tiling is disabled. */
- map = pipe_buffer_map(screen, tex->buffer,
+ map = pipe_buffer_map(ctx->screen, tex->buffer,
pipe_transfer_buffer_flags(transfer));
if (!map) {
@@ -248,23 +250,26 @@ static void* r300_transfer_map(struct pipe_screen *screen,
}
}
-static void r300_transfer_unmap(struct pipe_screen *screen,
+static void r300_transfer_unmap(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_texture *tex = (struct r300_texture*)transfer->texture;
if (r300transfer->detiled_texture) {
- pipe_buffer_unmap(screen, r300transfer->detiled_texture->buffer);
+ pipe_buffer_unmap(ctx->screen, r300transfer->detiled_texture->buffer);
} else {
- pipe_buffer_unmap(screen, tex->buffer);
+ pipe_buffer_unmap(ctx->screen, tex->buffer);
}
}
-void r300_init_screen_transfer_functions(struct pipe_screen *screen)
+
+void r300_init_transfer_functions( struct r300_context *r300ctx )
{
- screen->get_tex_transfer = r300_get_tex_transfer;
- screen->tex_transfer_destroy = r300_tex_transfer_destroy;
- screen->transfer_map = r300_transfer_map;
- screen->transfer_unmap = r300_transfer_unmap;
+ struct pipe_context *ctx = &r300ctx->context;
+
+ ctx->get_tex_transfer = r300_get_tex_transfer;
+ ctx->tex_transfer_destroy = r300_tex_transfer_destroy;
+ ctx->transfer_map = r300_transfer_map;
+ ctx->transfer_unmap = r300_transfer_unmap;
}
diff --git a/src/gallium/drivers/r300/r300_transfer.h b/src/gallium/drivers/r300/r300_transfer.h
index 60d1d3dc85..79baf6d048 100644
--- a/src/gallium/drivers/r300/r300_transfer.h
+++ b/src/gallium/drivers/r300/r300_transfer.h
@@ -26,6 +26,8 @@
#include "pipe/p_screen.h"
-void r300_init_screen_transfer_functions(struct pipe_screen *screen);
+struct r300_context;
+
+void r300_init_transfer_functions(struct r300_context *r300ctx);
#endif
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 30494719f7..de92a0cd2c 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -44,6 +44,7 @@
#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "sp_tex_tile_cache.h"
+#include "sp_texture.h"
#include "sp_query.h"
@@ -275,6 +276,7 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.is_buffer_referenced = softpipe_is_buffer_referenced;
softpipe_init_query_funcs( softpipe );
+ softpipe_init_texture_funcs( &softpipe->pipe );
softpipe->pipe.render_condition = softpipe_render_condition;
@@ -283,13 +285,13 @@ softpipe_create_context( struct pipe_screen *screen,
* Must be before quad stage setup!
*/
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
- softpipe->cbuf_cache[i] = sp_create_tile_cache( screen );
- softpipe->zsbuf_cache = sp_create_tile_cache( screen );
+ softpipe->cbuf_cache[i] = sp_create_tile_cache( &softpipe->pipe );
+ softpipe->zsbuf_cache = sp_create_tile_cache( &softpipe->pipe );
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
- softpipe->tex_cache[i] = sp_create_tex_tile_cache( screen );
+ softpipe->tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe );
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache(screen);
+ softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe );
}
/* setup quad rendering stages */
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index e8952bf4fb..3d76af4d8c 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -93,9 +93,9 @@ softpipe_flush( struct pipe_context *pipe,
static unsigned frame_no = 1;
static char filename[256];
util_snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no);
- debug_dump_surface_bmp(filename, softpipe->framebuffer.cbufs[0]);
+ debug_dump_surface_bmp(softpipe, filename, softpipe->framebuffer.cbufs[0]);
util_snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no);
- debug_dump_surface_bmp(filename, softpipe->framebuffer.zsbuf);
+ debug_dump_surface_bmp(softpipe, filename, softpipe->framebuffer.zsbuf);
++frame_no;
}
#endif
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index a0b95c8884..a9f5b51a41 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -43,14 +43,14 @@
struct softpipe_tex_tile_cache *
-sp_create_tex_tile_cache( struct pipe_screen *screen )
+sp_create_tex_tile_cache( struct pipe_context *pipe )
{
struct softpipe_tex_tile_cache *tc;
uint pos;
tc = CALLOC_STRUCT( softpipe_tex_tile_cache );
if (tc) {
- tc->screen = screen;
+ tc->pipe = pipe;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
tc->entries[pos].addr.bits.invalid = 1;
}
@@ -63,19 +63,16 @@ sp_create_tex_tile_cache( struct pipe_screen *screen )
void
sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc)
{
- struct pipe_screen *screen;
uint pos;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
/*assert(tc->entries[pos].x < 0);*/
}
if (tc->transfer) {
- screen = tc->transfer->texture->screen;
- screen->tex_transfer_destroy(tc->transfer);
+ tc->pipe->tex_transfer_destroy(tc->transfer);
}
if (tc->tex_trans) {
- screen = tc->tex_trans->texture->screen;
- screen->tex_transfer_destroy(tc->tex_trans);
+ tc->pipe->tex_transfer_destroy(tc->tex_trans);
}
FREE( tc );
@@ -88,7 +85,7 @@ void
sp_tex_tile_cache_map_transfers(struct softpipe_tex_tile_cache *tc)
{
if (tc->tex_trans && !tc->tex_trans_map)
- tc->tex_trans_map = tc->screen->transfer_map(tc->screen, tc->tex_trans);
+ tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans);
}
@@ -96,7 +93,7 @@ void
sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc)
{
if (tc->tex_trans_map) {
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+ tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans_map = NULL;
}
}
@@ -133,14 +130,12 @@ sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc,
pipe_texture_reference(&tc->texture, texture);
if (tc->tex_trans) {
- struct pipe_screen *screen = tc->tex_trans->texture->screen;
-
if (tc->tex_trans_map) {
- screen->transfer_unmap(screen, tc->tex_trans);
+ tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans_map = NULL;
}
- screen->tex_transfer_destroy(tc->tex_trans);
+ tc->pipe->tex_transfer_destroy(tc->tex_trans);
tc->tex_trans = NULL;
}
@@ -204,7 +199,6 @@ const struct softpipe_tex_cached_tile *
sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
union tex_tile_address addr )
{
- struct pipe_screen *screen = tc->screen;
struct softpipe_tex_cached_tile *tile;
tile = tc->entries + tex_cache_pos( addr );
@@ -232,16 +226,16 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
if (tc->tex_trans) {
if (tc->tex_trans_map) {
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+ tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans_map = NULL;
}
- screen->tex_transfer_destroy(tc->tex_trans);
+ tc->pipe->tex_transfer_destroy(tc->tex_trans);
tc->tex_trans = NULL;
}
tc->tex_trans =
- screen->get_tex_transfer(screen, tc->texture,
+ tc->pipe->get_tex_transfer(tc->pipe, tc->texture,
addr.bits.face,
addr.bits.level,
addr.bits.z,
@@ -249,7 +243,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
u_minify(tc->texture->width0, addr.bits.level),
u_minify(tc->texture->height0, addr.bits.level));
- tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
+ tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans);
tc->tex_face = addr.bits.face;
tc->tex_level = addr.bits.level;
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
index ac6886a3df..b116397258 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
@@ -70,7 +70,7 @@ struct softpipe_tex_cached_tile
struct softpipe_tex_tile_cache
{
- struct pipe_screen *screen;
+ struct pipe_context *pipe;
struct pipe_transfer *transfer;
void *transfer_map;
@@ -88,7 +88,7 @@ struct softpipe_tex_tile_cache
extern struct softpipe_tex_tile_cache *
-sp_create_tex_tile_cache( struct pipe_screen *screen );
+sp_create_tex_tile_cache( struct pipe_context *pipe );
extern void
sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc);
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 11d184effb..adae48c474 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -256,7 +256,7 @@ softpipe_tex_surface_destroy(struct pipe_surface *surf)
* \param height height of region to read/write
*/
static struct pipe_transfer *
-softpipe_get_tex_transfer(struct pipe_screen *screen,
+softpipe_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
@@ -277,6 +277,7 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
struct pipe_transfer *pt = &spt->base;
int nblocksy = util_format_get_nblocksy(texture->format, u_minify(texture->height0, level));
pipe_texture_reference(&pt->texture, texture);
+ pt->pipe = pipe;
pt->x = x;
pt->y = y;
pt->width = w;
@@ -326,7 +327,7 @@ softpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
* Create memory mapping for given pipe_transfer object.
*/
static void *
-softpipe_transfer_map( struct pipe_screen *screen,
+softpipe_transfer_map( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
ubyte *map, *xfer_map;
@@ -339,7 +340,7 @@ softpipe_transfer_map( struct pipe_screen *screen,
if (spt->dt) {
/* display target */
- struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
+ struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys;
map = winsys->displaytarget_map(winsys, spt->dt,
pipe_transfer_buffer_flags(transfer));
@@ -359,7 +360,7 @@ softpipe_transfer_map( struct pipe_screen *screen,
/* Do something to notify sharing contexts of a texture change.
* In softpipe, that would mean flushing the texture cache.
*/
- softpipe_screen(screen)->timestamp++;
+ softpipe_screen(pipe->screen)->timestamp++;
}
xfer_map = map + softpipe_transfer(transfer)->offset +
@@ -374,7 +375,7 @@ softpipe_transfer_map( struct pipe_screen *screen,
* Unmap memory mapping for given pipe_transfer object.
*/
static void
-softpipe_transfer_unmap(struct pipe_screen *screen,
+softpipe_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct softpipe_texture *spt;
@@ -384,7 +385,7 @@ softpipe_transfer_unmap(struct pipe_screen *screen,
if (spt->dt) {
/* display target */
- struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
+ struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys;
winsys->displaytarget_unmap(winsys, spt->dt);
}
@@ -448,6 +449,15 @@ softpipe_video_surface_destroy(struct pipe_video_surface *vsfc)
void
+softpipe_init_texture_funcs(struct pipe_context *pipe)
+{
+ pipe->get_tex_transfer = softpipe_get_tex_transfer;
+ pipe->tex_transfer_destroy = softpipe_tex_transfer_destroy;
+ pipe->transfer_map = softpipe_transfer_map;
+ pipe->transfer_unmap = softpipe_transfer_unmap;
+}
+
+void
softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->texture_create = softpipe_texture_create;
@@ -456,11 +466,6 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
screen->get_tex_surface = softpipe_get_tex_surface;
screen->tex_surface_destroy = softpipe_tex_surface_destroy;
- screen->get_tex_transfer = softpipe_get_tex_transfer;
- screen->tex_transfer_destroy = softpipe_tex_transfer_destroy;
- screen->transfer_map = softpipe_transfer_map;
- screen->transfer_unmap = softpipe_transfer_unmap;
-
screen->video_surface_create = softpipe_video_surface_create;
screen->video_surface_destroy = softpipe_video_surface_destroy;
}
diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h
index 1c8636d1d5..c0e6ba8a86 100644
--- a/src/gallium/drivers/softpipe/sp_texture.h
+++ b/src/gallium/drivers/softpipe/sp_texture.h
@@ -107,5 +107,8 @@ softpipe_video_surface(struct pipe_video_surface *pvs)
extern void
softpipe_init_screen_texture_funcs(struct pipe_screen *screen);
+void
+softpipe_init_texture_funcs(struct pipe_context *pipe);
+
#endif /* SP_TEXTURE */
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index aedfdf1b46..d779816790 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -79,20 +79,20 @@ clear_clear_flag(uint *bitvec, union tile_address addr)
struct softpipe_tile_cache *
-sp_create_tile_cache( struct pipe_screen *screen )
+sp_create_tile_cache( struct pipe_context *pipe )
{
struct softpipe_tile_cache *tc;
uint pos;
int maxLevels, maxTexSize;
/* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */
- maxLevels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ maxLevels = pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
maxTexSize = 1 << (maxLevels - 1);
assert(MAX_WIDTH >= maxTexSize);
tc = CALLOC_STRUCT( softpipe_tile_cache );
if (tc) {
- tc->screen = screen;
+ tc->pipe = pipe;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
tc->entries[pos].addr.bits.invalid = 1;
}
@@ -115,15 +115,13 @@ sp_create_tile_cache( struct pipe_screen *screen )
void
sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
{
- struct pipe_screen *screen;
uint pos;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
/*assert(tc->entries[pos].x < 0);*/
}
if (tc->transfer) {
- screen = tc->transfer->texture->screen;
- screen->tex_transfer_destroy(tc->transfer);
+ tc->pipe->tex_transfer_destroy(tc->transfer);
}
FREE( tc );
@@ -137,27 +135,25 @@ void
sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
struct pipe_surface *ps)
{
- if (tc->transfer) {
- struct pipe_screen *screen = tc->transfer->texture->screen;
+ struct pipe_context *pipe = tc->pipe;
+ if (tc->transfer) {
if (ps == tc->surface)
return;
if (tc->transfer_map) {
- screen->transfer_unmap(screen, tc->transfer);
+ pipe->transfer_unmap(pipe, tc->transfer);
tc->transfer_map = NULL;
}
- screen->tex_transfer_destroy(tc->transfer);
+ pipe->tex_transfer_destroy(tc->transfer);
tc->transfer = NULL;
}
tc->surface = ps;
if (ps) {
- struct pipe_screen *screen = ps->texture->screen;
-
- tc->transfer = screen->get_tex_transfer(screen, ps->texture, ps->face,
+ tc->transfer = pipe->get_tex_transfer(pipe, ps->texture, ps->face,
ps->level, ps->zslice,
PIPE_TRANSFER_READ_WRITE,
0, 0, ps->width, ps->height);
@@ -187,7 +183,7 @@ void
sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc)
{
if (tc->transfer && !tc->transfer_map)
- tc->transfer_map = tc->screen->transfer_map(tc->screen, tc->transfer);
+ tc->transfer_map = tc->pipe->transfer_map(tc->pipe, tc->transfer);
}
@@ -195,7 +191,7 @@ void
sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc)
{
if (tc->transfer_map) {
- tc->screen->transfer_unmap(tc->screen, tc->transfer);
+ tc->pipe->transfer_unmap(tc->pipe, tc->transfer);
tc->transfer_map = NULL;
}
}
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h
index a12092702a..753d8c0daa 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.h
@@ -80,7 +80,7 @@ struct softpipe_cached_tile
struct softpipe_tile_cache
{
- struct pipe_screen *screen;
+ struct pipe_context *pipe;
struct pipe_surface *surface; /**< the surface we're caching */
struct pipe_transfer *transfer;
void *transfer_map;
@@ -98,7 +98,7 @@ struct softpipe_tile_cache
extern struct softpipe_tile_cache *
-sp_create_tile_cache( struct pipe_screen *screen );
+sp_create_tile_cache( struct pipe_context *pipe );
extern void
sp_destroy_tile_cache(struct softpipe_tile_cache *tc);
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
index 5b581debfc..065b8748a3 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.c
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -783,15 +783,17 @@ svga_surface_needs_propagation(struct pipe_surface *surf)
return s->dirty && s->handle != tex->handle;
}
-
+/* XXX: Still implementing this as if it was a screen function, but
+ * can now modify it to queue transfers on the context.
+ */
static struct pipe_transfer *
-svga_get_tex_transfer(struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned face, unsigned level, unsigned zslice,
- enum pipe_transfer_usage usage, unsigned x, unsigned y,
- unsigned w, unsigned h)
+svga_get_tex_transfer(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage, unsigned x, unsigned y,
+ unsigned w, unsigned h)
{
- struct svga_screen *ss = svga_screen(screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st;
unsigned nblocksx = util_format_get_nblocksx(texture->format, w);
@@ -859,11 +861,14 @@ no_hwbuf:
}
+/* XXX: Still implementing this as if it was a screen function, but
+ * can now modify it to queue transfers on the context.
+ */
static void *
-svga_transfer_map( struct pipe_screen *screen,
+svga_transfer_map( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
- struct svga_screen *ss = svga_screen(screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st = svga_transfer(transfer);
@@ -877,11 +882,14 @@ svga_transfer_map( struct pipe_screen *screen,
}
+/* XXX: Still implementing this as if it was a screen function, but
+ * can now modify it to queue transfers on the context.
+ */
static void
-svga_transfer_unmap(struct pipe_screen *screen,
+svga_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
- struct svga_screen *ss = svga_screen(screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st = svga_transfer(transfer);
@@ -911,6 +919,17 @@ svga_tex_transfer_destroy(struct pipe_transfer *transfer)
FREE(st);
}
+
+void
+svga_init_texture_functions(struct pipe_context *pipe)
+{
+ pipe->get_tex_transfer = svga_get_tex_transfer;
+ pipe->transfer_map = svga_transfer_map;
+ pipe->transfer_unmap = svga_transfer_unmap;
+ pipe->tex_transfer_destroy = svga_tex_transfer_destroy;
+}
+
+
void
svga_screen_init_texture_functions(struct pipe_screen *screen)
{
@@ -920,10 +939,6 @@ svga_screen_init_texture_functions(struct pipe_screen *screen)
screen->texture_destroy = svga_texture_destroy;
screen->get_tex_surface = svga_get_tex_surface;
screen->tex_surface_destroy = svga_tex_surface_destroy;
- screen->get_tex_transfer = svga_get_tex_transfer;
- screen->transfer_map = svga_transfer_map;
- screen->transfer_unmap = svga_transfer_unmap;
- screen->tex_transfer_destroy = svga_tex_transfer_destroy;
}
/***********************************************************************
diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h
index ca6602b436..96d035b12d 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.h
+++ b/src/gallium/drivers/svga/svga_screen_texture.h
@@ -186,6 +186,9 @@ svga_surface_needs_propagation(struct pipe_surface *surf);
extern void
svga_screen_init_texture_functions(struct pipe_screen *screen);
+void
+svga_init_texture_functions(struct pipe_context *pipe);
+
enum SVGA3dSurfaceFormat
svga_translate_format(enum pipe_format format);
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index 133521f45e..4a0e9ac17d 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -27,7 +27,9 @@
#include "util/u_memory.h"
#include "util/u_simple_list.h"
+#include "util/u_format.h"
+#include "pipe/p_format.h"
#include "pipe/p_screen.h"
#include "tr_dump.h"
@@ -1283,6 +1285,135 @@ trace_is_buffer_referenced( struct pipe_context *_pipe,
return referenced;
}
+
+/********************************************************************
+ * transfer
+ */
+
+
+static struct pipe_transfer *
+trace_context_get_tex_transfer(struct pipe_context *_context,
+ struct pipe_texture *_texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_texture *tr_tex = trace_texture(_texture);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_texture *texture = tr_tex->texture;
+ struct pipe_transfer *result = NULL;
+
+ assert(texture->screen == context->screen);
+
+ trace_dump_call_begin("pipe_context", "get_tex_transfer");
+
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, texture);
+ trace_dump_arg(uint, face);
+ trace_dump_arg(uint, level);
+ trace_dump_arg(uint, zslice);
+ trace_dump_arg(uint, usage);
+
+ trace_dump_arg(uint, x);
+ trace_dump_arg(uint, y);
+ trace_dump_arg(uint, w);
+ trace_dump_arg(uint, h);
+
+ result = context->get_tex_transfer(context, texture, face, level, zslice, usage,
+ x, y, w, h);
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ if (result)
+ result = trace_transfer_create(tr_context, tr_tex, result);
+
+ return result;
+}
+
+
+static void
+trace_context_tex_transfer_destroy(struct pipe_transfer *_transfer)
+{
+ struct trace_context *tr_ctx = trace_context(_transfer->pipe);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
+ struct pipe_context *context = tr_ctx->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
+
+ trace_dump_call_begin("pipe_context", "tex_transfer_destroy");
+
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, transfer);
+
+ trace_dump_call_end();
+
+ trace_transfer_destroy(tr_trans);
+}
+
+
+static void *
+trace_context_transfer_map(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
+ void *map;
+
+ map = context->transfer_map(context, transfer);
+ if(map) {
+ if(transfer->usage & PIPE_TRANSFER_WRITE) {
+ assert(!tr_trans->map);
+ tr_trans->map = map;
+ }
+ }
+
+ return map;
+}
+
+
+static void
+trace_context_transfer_unmap(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct trace_context *tr_ctx = trace_context(_context);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
+ struct pipe_context *context = tr_ctx->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
+
+ if(tr_trans->map) {
+ size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->height) * transfer->stride;
+
+ trace_dump_call_begin("pipe_context", "transfer_write");
+
+ trace_dump_arg(ptr, context);
+
+ trace_dump_arg(ptr, transfer);
+
+ trace_dump_arg_begin("stride");
+ trace_dump_uint(transfer->stride);
+ trace_dump_arg_end();
+
+ trace_dump_arg_begin("data");
+ trace_dump_bytes(tr_trans->map, size);
+ trace_dump_arg_end();
+
+ trace_dump_arg_begin("size");
+ trace_dump_uint(size);
+ trace_dump_arg_end();
+
+ trace_dump_call_end();
+
+ tr_trans->map = NULL;
+ }
+
+ context->transfer_unmap(context, transfer);
+}
+
static const struct debug_named_value rbug_blocker_flags[] = {
{"before", 1},
{"after", 2},
@@ -1367,6 +1498,11 @@ trace_context_create(struct trace_screen *tr_scr,
tr_ctx->base.is_texture_referenced = trace_is_texture_referenced;
tr_ctx->base.is_buffer_referenced = trace_is_buffer_referenced;
+ tr_ctx->base.get_tex_transfer = trace_context_get_tex_transfer;
+ tr_ctx->base.tex_transfer_destroy = trace_context_tex_transfer_destroy;
+ tr_ctx->base.transfer_map = trace_context_transfer_map;
+ tr_ctx->base.transfer_unmap = trace_context_transfer_unmap;
+
tr_ctx->pipe = pipe;
trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index a43adac694..b36865400d 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -219,7 +219,7 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
struct trace_texture *tr_tex = NULL;
struct tr_list *ptr;
- struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_context *context = tr_scr->private_context;
struct pipe_texture *tex;
struct pipe_transfer *t;
@@ -239,12 +239,12 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
}
tex = tr_tex->texture;
- t = screen->get_tex_transfer(tr_scr->screen, tex,
- gptr->face, gptr->level, gptr->zslice,
- PIPE_TRANSFER_READ,
- gptr->x, gptr->y, gptr->w, gptr->h);
+ t = context->get_tex_transfer(context, tex,
+ gptr->face, gptr->level, gptr->zslice,
+ PIPE_TRANSFER_READ,
+ gptr->x, gptr->y, gptr->w, gptr->h);
- map = screen->transfer_map(screen, t);
+ map = context->transfer_map(context, t);
rbug_send_texture_read_reply(tr_rbug->con, serial,
t->texture->format,
@@ -256,8 +256,8 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
t->stride,
NULL);
- screen->transfer_unmap(screen, t);
- screen->tex_transfer_destroy(t);
+ context->transfer_unmap(context, t);
+ context->tex_transfer_destroy(t);
pipe_mutex_unlock(tr_scr->list_mutex);
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 86ddb99540..25990bdac7 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -353,133 +353,7 @@ trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
}
-/********************************************************************
- * transfer
- */
-
-
-static struct pipe_transfer *
-trace_screen_get_tex_transfer(struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned face, unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(_texture);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_texture *texture = tr_tex->texture;
- struct pipe_transfer *result = NULL;
-
- assert(texture->screen == screen);
-
- trace_dump_call_begin("pipe_screen", "get_tex_transfer");
-
- trace_dump_arg(ptr, screen);
- trace_dump_arg(ptr, texture);
- trace_dump_arg(uint, face);
- trace_dump_arg(uint, level);
- trace_dump_arg(uint, zslice);
- trace_dump_arg(uint, usage);
-
- trace_dump_arg(uint, x);
- trace_dump_arg(uint, y);
- trace_dump_arg(uint, w);
- trace_dump_arg(uint, h);
-
- result = screen->get_tex_transfer(screen, texture, face, level, zslice, usage,
- x, y, w, h);
-
- trace_dump_ret(ptr, result);
-
- trace_dump_call_end();
-
- if (result)
- result = trace_transfer_create(tr_tex, result);
-
- return result;
-}
-
-
-static void
-trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
-{
- struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
- struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_trans->transfer;
-
- trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
-
- trace_dump_arg(ptr, screen);
- trace_dump_arg(ptr, transfer);
-
- trace_dump_call_end();
-
- trace_transfer_destroy(tr_trans);
-}
-
-
-static void *
-trace_screen_transfer_map(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_trans->transfer;
- void *map;
-
- map = screen->transfer_map(screen, transfer);
- if(map) {
- if(transfer->usage & PIPE_TRANSFER_WRITE) {
- assert(!tr_trans->map);
- tr_trans->map = map;
- }
- }
-
- return map;
-}
-
-
-static void
-trace_screen_transfer_unmap(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_trans->transfer;
-
- if(tr_trans->map) {
- size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->height) * transfer->stride;
-
- trace_dump_call_begin("pipe_screen", "transfer_write");
-
- trace_dump_arg(ptr, screen);
-
- trace_dump_arg(ptr, transfer);
-
- trace_dump_arg_begin("stride");
- trace_dump_uint(transfer->stride);
- trace_dump_arg_end();
-
- trace_dump_arg_begin("data");
- trace_dump_bytes(tr_trans->map, size);
- trace_dump_arg_end();
- trace_dump_arg_begin("size");
- trace_dump_uint(size);
- trace_dump_arg_end();
-
- trace_dump_call_end();
-
- tr_trans->map = NULL;
- }
-
- screen->transfer_unmap(screen, transfer);
-}
/********************************************************************
@@ -901,10 +775,6 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.texture_destroy = trace_screen_texture_destroy;
tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
tr_scr->base.tex_surface_destroy = trace_screen_tex_surface_destroy;
- tr_scr->base.get_tex_transfer = trace_screen_get_tex_transfer;
- tr_scr->base.tex_transfer_destroy = trace_screen_tex_transfer_destroy;
- tr_scr->base.transfer_map = trace_screen_transfer_map;
- tr_scr->base.transfer_unmap = trace_screen_transfer_unmap;
tr_scr->base.buffer_create = trace_screen_buffer_create;
tr_scr->base.user_buffer_create = trace_screen_user_buffer_create;
if (screen->buffer_map)
@@ -920,7 +790,11 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.fence_signalled = trace_screen_fence_signalled;
tr_scr->base.fence_finish = trace_screen_fence_finish;
tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
+
tr_scr->screen = screen;
+ tr_scr->private_context = screen->context_create(screen, NULL);
+ if (tr_scr->private_context == NULL)
+ goto error3;
trace_dump_ret(ptr, screen);
trace_dump_call_end();
@@ -930,10 +804,8 @@ trace_screen_create(struct pipe_screen *screen)
return &tr_scr->base;
-#if 0
error3:
FREE(tr_scr);
-#endif
error2:
trace_dump_ret(ptr, screen);
trace_dump_call_end();
diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h
index 597e2fc265..9bfbe72e2c 100644
--- a/src/gallium/drivers/trace/tr_screen.h
+++ b/src/gallium/drivers/trace/tr_screen.h
@@ -56,6 +56,7 @@ struct trace_screen
struct pipe_screen base;
struct pipe_screen *screen;
+ struct pipe_context *private_context;
/* remote debugger */
struct trace_rbug *rbug;
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 5321d68ec0..b70ccb9ce8 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -31,6 +31,7 @@
#include "util/u_simple_list.h"
#include "tr_screen.h"
+#include "tr_context.h"
#include "tr_texture.h"
@@ -124,8 +125,9 @@ trace_surface_destroy(struct trace_surface *tr_surf)
struct pipe_transfer *
-trace_transfer_create(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer)
+trace_transfer_create(struct trace_context *tr_ctx,
+ struct trace_texture *tr_tex,
+ struct pipe_transfer *transfer)
{
struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
struct trace_transfer *tr_trans;
@@ -141,6 +143,7 @@ trace_transfer_create(struct trace_texture *tr_tex,
memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer));
+ tr_trans->base.pipe = &tr_ctx->base;
tr_trans->base.texture = NULL;
pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base);
tr_trans->transfer = transfer;
@@ -151,7 +154,7 @@ trace_transfer_create(struct trace_texture *tr_tex,
return &tr_trans->base;
error:
- transfer->texture->screen->tex_transfer_destroy(transfer);
+ tr_ctx->pipe->tex_transfer_destroy(transfer);
return NULL;
}
@@ -160,12 +163,12 @@ void
trace_transfer_destroy(struct trace_transfer *tr_trans)
{
struct trace_screen *tr_scr = trace_screen(tr_trans->base.texture->screen);
- struct pipe_screen *screen = tr_trans->transfer->texture->screen;
+ struct pipe_context *context = tr_trans->transfer->pipe;
trace_screen_remove_from_list(tr_scr, transfers, tr_trans);
pipe_texture_reference(&tr_trans->base.texture, NULL);
- screen->tex_transfer_destroy(tr_trans->transfer);
+ context->tex_transfer_destroy(tr_trans->transfer);
FREE(tr_trans);
}
diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h
index 395e523e73..ab284eeef3 100644
--- a/src/gallium/drivers/trace/tr_texture.h
+++ b/src/gallium/drivers/trace/tr_texture.h
@@ -34,6 +34,7 @@
#include "tr_screen.h"
+struct trace_context;
struct trace_texture
{
@@ -112,8 +113,9 @@ void
trace_surface_destroy(struct trace_surface *tr_surf);
struct pipe_transfer *
-trace_transfer_create(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer);
+trace_transfer_create(struct trace_context *tr_ctx,
+ struct trace_texture *tr_tex,
+ struct pipe_transfer *transfer);
void
trace_transfer_destroy(struct trace_transfer *tr_trans);
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 376b01aa69..494b53e912 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -306,6 +306,32 @@ struct pipe_context {
*/
unsigned int (*is_buffer_referenced)(struct pipe_context *pipe,
struct pipe_buffer *buf);
+
+
+
+ /**
+ * Get a transfer object for transferring data to/from a texture.
+ *
+ * Transfers are (by default) context-private and allow uploads to be
+ * interleaved with
+ */
+ struct pipe_transfer *(*get_tex_transfer)(struct pipe_context *,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y,
+ unsigned w, unsigned h);
+
+ void (*tex_transfer_destroy)(struct pipe_transfer *);
+
+ void *(*transfer_map)( struct pipe_context *,
+ struct pipe_transfer *transfer );
+
+ void (*transfer_unmap)( struct pipe_context *,
+ struct pipe_transfer *transfer );
+
+
};
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b771bfe85e..b7cb83abbe 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -142,23 +142,6 @@ struct pipe_screen {
void (*tex_surface_destroy)(struct pipe_surface *);
- /** Get a transfer object for transferring data to/from a texture */
- struct pipe_transfer *(*get_tex_transfer)(struct pipe_screen *,
- struct pipe_texture *texture,
- unsigned face, unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y,
- unsigned w, unsigned h);
-
- void (*tex_transfer_destroy)(struct pipe_transfer *);
-
- void *(*transfer_map)( struct pipe_screen *,
- struct pipe_transfer *transfer );
-
- void (*transfer_unmap)( struct pipe_screen *,
- struct pipe_transfer *transfer );
-
/**
* Create a new buffer.
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 3a97d888ce..2af933207d 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -304,6 +304,8 @@ struct pipe_surface
*/
struct pipe_transfer
{
+ struct pipe_context *pipe;
+
unsigned x; /**< x offset from start of texture image */
unsigned y; /**< y offset from start of texture image */
unsigned width; /**< logical width in pixels */
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index 02248ad433..6e79dd370f 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -78,14 +78,14 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
{ /* upload color_data */
struct pipe_transfer *transfer =
- screen->get_tex_transfer(screen, tex,
- 0, 0, 0,
- PIPE_TRANSFER_READ_WRITE ,
- 0, 0, tex->width0, tex->height0);
- void *map = screen->transfer_map(screen, transfer);
+ pipe->get_tex_transfer(pipe, tex,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ_WRITE ,
+ 0, 0, tex->width0, tex->height0);
+ void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, color_data, sizeof(VGint)*color_data_len);
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
}
return tex;
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index 015241498e..432ba68139 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -397,7 +397,6 @@ void vgReadPixels(void * data, VGint dataStride,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *strb = stfb->strb;
@@ -442,7 +441,7 @@ void vgReadPixels(void * data, VGint dataStride,
{
struct pipe_transfer *transfer;
- transfer = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
+ transfer = pipe->get_tex_transfer(pipe, strb->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
0, 0, width, height);
@@ -458,7 +457,7 @@ void vgReadPixels(void * data, VGint dataStride,
dst += dataStride;
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(transfer);
}
}
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index 41c979bfec..604a86aeb8 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -378,7 +378,7 @@ void image_sub_data(struct vg_image *image,
VGfloat *df = (VGfloat*)temp;
VGint i;
struct vg_context *ctx = vg_current_context();
- struct pipe_screen *screen = ctx->pipe->screen;
+ struct pipe_context *pipe = ctx->pipe;
struct pipe_texture *texture = image_texture(image);
VGint xoffset = 0, yoffset = 0;
@@ -412,8 +412,8 @@ void image_sub_data(struct vg_image *image,
}
{ /* upload color_data */
- struct pipe_transfer *transfer = screen->get_tex_transfer(
- screen, texture, 0, 0, 0,
+ struct pipe_transfer *transfer = pipe->get_tex_transfer(
+ pipe, texture, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
src += (dataStride * yoffset);
for (i = 0; i < height; i++) {
@@ -422,7 +422,7 @@ void image_sub_data(struct vg_image *image,
y += yStep;
src += dataStride;
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(transfer);
}
}
@@ -435,7 +435,6 @@ void image_get_sub_data(struct vg_image * image,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4];
VGfloat *df = (VGfloat*)temp;
VGint y = 0, yStep = 1;
@@ -444,7 +443,7 @@ void image_get_sub_data(struct vg_image * image,
{
struct pipe_transfer *transfer =
- screen->get_tex_transfer(screen,
+ pipe->get_tex_transfer(pipe,
image->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
0, 0,
@@ -461,7 +460,7 @@ void image_get_sub_data(struct vg_image * image,
dst += dataStride;
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(transfer);
}
}
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index cdb87d3bf6..47a7710d3e 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -164,10 +164,10 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
struct pipe_transfer *transfer =
st_no_flush_get_tex_transfer(p->base.ctx, tex, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
- void *map = screen->transfer_map(screen, transfer);
+ void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, p->gradient.color_data, sizeof(VGint)*1024);
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
}
return tex;
diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h
index 419151c3ae..4d12a4efdd 100644
--- a/src/gallium/state_trackers/vega/st_inlines.h
+++ b/src/gallium/state_trackers/vega/st_inlines.h
@@ -51,7 +51,6 @@ st_cond_flush_get_tex_transfer(struct vg_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
struct pipe_context *pipe = st->pipe;
unsigned referenced =
pipe->is_texture_referenced(pipe, pt, face, level);
@@ -60,7 +59,7 @@ st_cond_flush_get_tex_transfer(struct vg_context *st,
(usage & PIPE_TRANSFER_WRITE)))
vgFlush();
- return screen->get_tex_transfer(screen, pt, face, level, zslice, usage,
+ return pipe->get_tex_transfer(pipe, pt, face, level, zslice, usage,
x, y, w, h);
}
@@ -74,10 +73,10 @@ st_no_flush_get_tex_transfer(struct vg_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *pipe = st->pipe;
- return screen->get_tex_transfer(screen, pt, face, level,
- zslice, usage, x, y, w, h);
+ return pipe->get_tex_transfer(pipe, pt, face, level,
+ zslice, usage, x, y, w, h);
}
static INLINE void *
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 0b2e3f5381..b066f5c94b 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -138,7 +138,6 @@ static void
load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *transfer;
const GLuint rSize = ctx->PixelMaps.RtoR.Size;
const GLuint gSize = ctx->PixelMaps.GtoG.Size;
@@ -151,7 +150,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
transfer = st_cond_flush_get_tex_transfer(st_context(ctx),
pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
0, 0, texSize, texSize);
- dest = (uint *) screen->transfer_map(screen, transfer);
+ dest = (uint *) pipe->transfer_map(pipe, transfer);
/* Pack four 1D maps into a 2D texture:
* R map is placed horizontally, indexed by S, in channel 0
@@ -172,8 +171,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
}
}
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
}
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 33e43ddcc4..69a96e5d10 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -129,7 +129,6 @@ accum_accum(struct st_context *st, GLfloat value,
struct st_renderbuffer *color_strb)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *color_trans;
size_t stride = acc_strb->stride;
GLubyte *data = acc_strb->data;
@@ -166,7 +165,7 @@ accum_accum(struct st_context *st, GLfloat value,
}
free(buf);
- screen->tex_transfer_destroy(color_trans);
+ pipe->tex_transfer_destroy(color_trans);
}
@@ -177,7 +176,6 @@ accum_load(struct st_context *st, GLfloat value,
struct st_renderbuffer *color_strb)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *color_trans;
size_t stride = acc_strb->stride;
GLubyte *data = acc_strb->data;
@@ -215,7 +213,7 @@ accum_load(struct st_context *st, GLfloat value,
}
free(buf);
- screen->tex_transfer_destroy(color_trans);
+ pipe->tex_transfer_destroy(color_trans);
}
@@ -226,7 +224,6 @@ accum_return(GLcontext *ctx, GLfloat value,
struct st_renderbuffer *color_strb)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
const GLubyte *colormask = ctx->Color.ColorMask[0];
enum pipe_transfer_usage usage;
struct pipe_transfer *color_trans;
@@ -283,7 +280,7 @@ accum_return(GLcontext *ctx, GLfloat value,
pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf);
free(buf);
- screen->tex_transfer_destroy(color_trans);
+ pipe->tex_transfer_destroy(color_trans);
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index f326601c3b..723c5f180b 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -259,7 +259,6 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
const GLubyte *bitmap)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *transfer;
ubyte *dest;
struct pipe_texture *pt;
@@ -285,7 +284,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
PIPE_TRANSFER_WRITE,
0, 0, width, height);
- dest = screen->transfer_map(screen, transfer);
+ dest = pipe->transfer_map(pipe, transfer);
/* Put image into texture transfer */
memset(dest, 0xff, height * transfer->stride);
@@ -295,8 +294,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
_mesa_unmap_pbo_source(ctx, unpack);
/* Release transfer */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
return pt;
}
@@ -520,7 +519,6 @@ static void
reset_cache(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
/*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/
@@ -532,7 +530,7 @@ reset_cache(struct st_context *st)
cache->ymax = -1000000;
if (cache->trans) {
- screen->tex_transfer_destroy(cache->trans);
+ pipe->tex_transfer_destroy(cache->trans);
cache->trans = NULL;
}
@@ -570,7 +568,6 @@ static void
create_cache_trans(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
if (cache->trans)
@@ -583,7 +580,7 @@ create_cache_trans(struct st_context *st)
PIPE_TRANSFER_WRITE, 0, 0,
BITMAP_CACHE_WIDTH,
BITMAP_CACHE_HEIGHT);
- cache->buffer = screen->transfer_map(screen, cache->trans);
+ cache->buffer = pipe->transfer_map(pipe, cache->trans);
/* init image to all 0xff */
memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT);
@@ -601,7 +598,6 @@ st_flush_bitmap_cache(struct st_context *st)
if (st->ctx->DrawBuffer) {
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
assert(cache->xmin <= cache->xmax);
@@ -617,10 +613,10 @@ st_flush_bitmap_cache(struct st_context *st)
if (cache->trans) {
if (0)
print_cache(cache);
- screen->transfer_unmap(screen, cache->trans);
+ pipe->transfer_unmap(pipe, cache->trans);
cache->buffer = NULL;
- screen->tex_transfer_destroy(cache->trans);
+ pipe->tex_transfer_destroy(cache->trans);
cache->trans = NULL;
}
@@ -823,7 +819,6 @@ void
st_destroy_bitmap(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
@@ -840,8 +835,8 @@ st_destroy_bitmap(struct st_context *st)
if (cache) {
if (cache->trans) {
- screen->transfer_unmap(screen, cache->trans);
- screen->tex_transfer_destroy(cache->trans);
+ pipe->transfer_unmap(pipe, cache->trans);
+ pipe->tex_transfer_destroy(cache->trans);
}
pipe_texture_reference(&st->bitmap.cache->texture, NULL);
free(st->bitmap.cache);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 8eb76f4131..3fa6d12f1c 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -349,7 +349,6 @@ make_texture(struct st_context *st,
{
GLcontext *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
gl_format mformat;
struct pipe_texture *pt;
enum pipe_format pipeFormat;
@@ -391,7 +390,7 @@ make_texture(struct st_context *st,
width, height);
/* map texture transfer */
- dest = screen->transfer_map(screen, transfer);
+ dest = pipe->transfer_map(pipe, transfer);
/* Put image into texture transfer.
@@ -411,8 +410,8 @@ make_texture(struct st_context *st,
unpack);
/* unmap */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(transfer);
assert(success);
@@ -658,7 +657,6 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct st_renderbuffer *strb;
enum pipe_transfer_usage usage;
struct pipe_transfer *pt;
@@ -692,7 +690,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
usage, x, y,
width, height);
- stmap = screen->transfer_map(screen, pt);
+ stmap = pipe->transfer_map(pipe, pt);
pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels);
assert(pixels);
@@ -792,8 +790,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
_mesa_unmap_pbo_source(ctx, &clippedUnpack);
/* unmap the stencil buffer */
- screen->transfer_unmap(screen, pt);
- screen->tex_transfer_destroy(pt);
+ pipe->transfer_unmap(pipe, pt);
+ pipe->tex_transfer_destroy(pt);
}
@@ -856,7 +854,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint dstx, GLint dsty)
{
struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer);
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
enum pipe_transfer_usage usage;
struct pipe_transfer *ptDraw;
ubyte *drawMap;
@@ -892,7 +890,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
assert(util_format_get_blockheight(ptDraw->texture->format) == 1);
/* map the stencil buffer */
- drawMap = screen->transfer_map(screen, ptDraw);
+ drawMap = pipe->transfer_map(pipe, ptDraw);
/* draw */
/* XXX PixelZoom not handled yet */
@@ -945,8 +943,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
free(buffer);
/* unmap the stencil buffer */
- screen->transfer_unmap(screen, ptDraw);
- screen->tex_transfer_destroy(ptDraw);
+ pipe->transfer_unmap(pipe, ptDraw);
+ pipe->tex_transfer_destroy(ptDraw);
}
@@ -1084,8 +1082,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (0) {
/* debug */
- debug_dump_surface("copypixsrcsurf", psRead);
- debug_dump_surface("copypixtemptex", psTex);
+ debug_dump_surface(pipe, "copypixsrcsurf", psRead);
+ debug_dump_surface(pipe, "copypixtemptex", psTex);
}
pipe_surface_reference(&psRead, NULL);
@@ -1128,8 +1126,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
free(buf);
}
- screen->tex_transfer_destroy(ptRead);
- screen->tex_transfer_destroy(ptTex);
+ pipe->tex_transfer_destroy(ptRead);
+ pipe->tex_transfer_destroy(ptTex);
}
/* draw textured quad */
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 8cc9cfac76..98ccda821c 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -63,7 +63,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
GLvoid *pixels)
{
struct gl_framebuffer *fb = ctx->ReadBuffer;
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer);
struct pipe_transfer *pt;
ubyte *stmap;
@@ -81,7 +81,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
width, height);
/* map the stencil buffer */
- stmap = screen->transfer_map(screen, pt);
+ stmap = pipe->transfer_map(pipe, pt);
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
@@ -161,8 +161,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
/* unmap the stencil buffer */
- screen->transfer_unmap(screen, pt);
- screen->tex_transfer_destroy(pt);
+ pipe->transfer_unmap(pipe, pt);
+ pipe->tex_transfer_destroy(pt);
}
@@ -234,7 +234,6 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *trans;
const GLubyte *map;
GLubyte *dst;
@@ -253,9 +252,9 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
return GL_FALSE;
}
- map = screen->transfer_map(screen, trans);
+ map = pipe->transfer_map(pipe, trans);
if (!map) {
- screen->tex_transfer_destroy(trans);
+ pipe->tex_transfer_destroy(trans);
return GL_FALSE;
}
@@ -317,8 +316,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
; /* nothing */
}
- screen->transfer_unmap(screen, trans);
- screen->tex_transfer_destroy(trans);
+ pipe->transfer_unmap(pipe, trans);
+ pipe->tex_transfer_destroy(trans);
}
return GL_TRUE;
@@ -337,7 +336,6 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLvoid *dest)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
GLfloat temp[MAX_WIDTH][4];
const GLbitfield transferOps = ctx->_ImageTransferState;
GLsizei i, j;
@@ -541,7 +539,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- screen->tex_transfer_destroy(trans);
+ pipe->tex_transfer_destroy(trans);
_mesa_unmap_pbo_dest(ctx, &clippedPacking);
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index c849132e74..1b20b615d0 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -371,7 +371,8 @@ compress_with_blit(GLcontext * ctx,
{
const GLuint dstImageOffsets[1] = {0};
struct st_texture_image *stImage = st_texture_image(texImage);
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
gl_format mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
@@ -421,7 +422,7 @@ compress_with_blit(GLcontext * ctx,
0, 0, 0, /* face, level are zero */
PIPE_TRANSFER_WRITE,
0, 0, width, height); /* x, y, w, h */
- map = screen->transfer_map(screen, tex_xfer);
+ map = pipe->transfer_map(pipe, tex_xfer);
_mesa_texstore(ctx, 2, GL_RGBA, mesa_format,
map, /* dest ptr */
@@ -433,8 +434,8 @@ compress_with_blit(GLcontext * ctx,
pixels, /* source data */
unpack); /* source data packing */
- screen->transfer_unmap(screen, tex_xfer);
- screen->tex_transfer_destroy(tex_xfer);
+ pipe->transfer_unmap(pipe, tex_xfer);
+ pipe->tex_transfer_destroy(tex_xfer);
/* copy / compress image */
util_blit_pixels_tex(ctx->st->blit,
@@ -809,7 +810,8 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
struct st_texture_image *stImage = st_texture_image(texImage);
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
@@ -848,7 +850,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
if (st_equal_formats(stImage->pt->format, format, type)) {
/* memcpy */
const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
- ubyte *map = screen->transfer_map(screen, tex_xfer);
+ ubyte *map = pipe->transfer_map(pipe, tex_xfer);
GLuint row;
for (row = 0; row < height; row++) {
GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
@@ -856,7 +858,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
memcpy(dest, map, bytesPerRow);
map += tex_xfer->stride;
}
- screen->transfer_unmap(screen, tex_xfer);
+ pipe->transfer_unmap(pipe, tex_xfer);
}
else {
/* format translation via floats */
@@ -1256,7 +1258,6 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
GLsizei width, GLsizei height)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *src_trans;
GLvoid *texDest;
enum pipe_transfer_usage transfer_usage;
@@ -1363,7 +1364,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
}
st_texture_image_unmap(ctx->st, stImage);
- screen->tex_transfer_destroy(src_trans);
+ pipe->tex_transfer_destroy(src_trans);
}
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index f67d7b4cb5..a73b8ed8fe 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -106,7 +106,6 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_texture *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
const uint lastLevel = pt->last_level;
@@ -142,8 +141,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcData = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstData = (ubyte *) pipe->transfer_map(pipe, dstTrans);
srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->texture->format);
dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->texture->format);
@@ -161,11 +160,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
dstData,
dstStride); /* stride in texels */
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(srcTrans);
+ pipe->tex_transfer_destroy(dstTrans);
}
}
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index e105870bc7..7fcde7b1a9 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -53,11 +53,11 @@ st_cond_flush_get_tex_transfer(struct st_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *context = st->pipe;
st_teximage_flush_before_map(st, pt, face, level, usage);
- return screen->get_tex_transfer(screen, pt, face, level, zslice, usage,
- x, y, w, h);
+ return context->get_tex_transfer(context, pt, face, level, zslice, usage,
+ x, y, w, h);
}
static INLINE struct pipe_transfer *
@@ -70,9 +70,9 @@ st_no_flush_get_tex_transfer(struct st_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *context = st->pipe;
- return screen->get_tex_transfer(screen, pt, face, level,
+ return context->get_tex_transfer(context, pt, face, level,
zslice, usage, x, y, w, h);
}
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 5a45c4358a..f1eef768eb 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -192,7 +192,6 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
GLuint x, GLuint y, GLuint w, GLuint h)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_texture *pt = stImage->pt;
DBG("%s \n", __FUNCTION__);
@@ -202,7 +201,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
usage, x, y, w, h);
if (stImage->transfer)
- return screen->transfer_map(screen, stImage->transfer);
+ return pipe->transfer_map(pipe, stImage->transfer);
else
return NULL;
}
@@ -212,13 +211,13 @@ void
st_texture_image_unmap(struct st_context *st,
struct st_texture_image *stImage)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *pipe = st->pipe;
DBG("%s\n", __FUNCTION__);
- screen->transfer_unmap(screen, stImage->transfer);
+ pipe->transfer_unmap(pipe, stImage->transfer);
- screen->tex_transfer_destroy(stImage->transfer);
+ pipe->tex_transfer_destroy(stImage->transfer);
}
@@ -238,8 +237,7 @@ st_surface_data(struct pipe_context *pipe,
const void *src, unsigned src_stride,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
- struct pipe_screen *screen = pipe->screen;
- void *map = screen->transfer_map(screen, dst);
+ void *map = pipe->transfer_map(pipe, dst);
assert(dst->texture);
util_copy_rect(map,
@@ -250,7 +248,7 @@ st_surface_data(struct pipe_context *pipe,
src, src_stride,
srcx, srcy);
- screen->transfer_unmap(screen, dst);
+ pipe->transfer_unmap(pipe, dst);
}
@@ -265,7 +263,6 @@ st_texture_image_data(struct st_context *st,
GLuint src_row_stride, GLuint src_image_stride)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
GLuint depth = u_minify(dst->depth0, level);
GLuint i;
const GLubyte *srcUB = src;
@@ -287,7 +284,7 @@ st_texture_image_data(struct st_context *st,
u_minify(dst->width0, level),
u_minify(dst->height0, level)); /* width, height */
- screen->tex_transfer_destroy(dst_transfer);
+ pipe->tex_transfer_destroy(dst_transfer);
srcUB += src_image_stride;
}