summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-13 22:39:58 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-13 23:37:40 +0900
commit36dd89c8a7f2a911e8f7f18d1edcaf982a75a438 (patch)
treedf767b61d9f62041a494378e00507568d512d46c /src
parent17af66fc1a141920969ddf404bd7ffb52a94fb31 (diff)
util: Eliminate pipe from the arguments to pipe_get/put_tile_xxx functions.
You don't need a pipe_context * for this, and all other necessary info is already inside pipe_surface.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/p_tile.c42
-rw-r--r--src/gallium/auxiliary/util/p_tile.h19
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c16
-rw-r--r--src/mesa/drivers/x11/xm_surface.c4
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c12
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c8
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c10
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c8
8 files changed, 51 insertions, 68 deletions
diff --git a/src/gallium/auxiliary/util/p_tile.c b/src/gallium/auxiliary/util/p_tile.c
index 93abef9879..1a1a2d96cc 100644
--- a/src/gallium/auxiliary/util/p_tile.c
+++ b/src/gallium/auxiliary/util/p_tile.c
@@ -45,12 +45,10 @@
* This should be usable by any hw driver that has mappable surfaces.
*/
void
-pipe_get_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
void *dst, int dst_stride)
{
- struct pipe_screen *screen = pipe->screen;
const void *src;
if (pipe_clip_tile(x, y, &w, &h, ps))
@@ -59,14 +57,14 @@ pipe_get_tile_raw(struct pipe_context *pipe,
if (dst_stride == 0)
dst_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
- src = screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_READ);
+ src = pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_READ);
assert(src);
if(!src)
return;
pipe_copy_rect(dst, &ps->block, dst_stride, 0, 0, w, h, src, ps->stride, x, y);
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
@@ -75,12 +73,10 @@ pipe_get_tile_raw(struct pipe_context *pipe,
* This should be usable by any hw driver that has mappable surfaces.
*/
void
-pipe_put_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const void *src, int src_stride)
{
- struct pipe_screen *screen = pipe->screen;
void *dst;
if (pipe_clip_tile(x, y, &w, &h, ps))
@@ -89,14 +85,14 @@ pipe_put_tile_raw(struct pipe_context *pipe,
if (src_stride == 0)
src_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
- dst = screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_WRITE);
+ dst = pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_WRITE);
assert(dst);
if(!dst)
return;
pipe_copy_rect(dst, &ps->block, ps->stride, x, y, w, h, src, src_stride, 0, 0);
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
@@ -686,8 +682,7 @@ ycbcr_get_tile_rgba(ushort *src,
void
-pipe_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
float *p)
{
@@ -702,7 +697,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
if (!packed)
return;
- pipe_get_tile_raw(pipe, ps, x, y, w, h, packed, 0);
+ pipe_get_tile_raw(ps, x, y, w, h, packed, 0);
switch (ps->format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
@@ -768,8 +763,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
void
-pipe_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const float *p)
{
@@ -838,7 +832,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
assert(0);
}
- pipe_put_tile_raw(pipe, ps, x, y, w, h, packed, 0);
+ pipe_put_tile_raw(ps, x, y, w, h, packed, 0);
FREE(packed);
}
@@ -848,12 +842,10 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
* Get a block of Z values, converted to 32-bit range.
*/
void
-pipe_get_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
uint *z)
{
- struct pipe_screen *screen = pipe->screen;
const uint dstStride = w;
ubyte *map;
uint *pDest = z;
@@ -862,7 +854,7 @@ pipe_get_tile_z(struct pipe_context *pipe,
if (pipe_clip_tile(x, y, &w, &h, ps))
return;
- map = (ubyte *)screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_READ);
+ map = (ubyte *)pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_READ);
if (!map) {
assert(0);
return;
@@ -913,17 +905,15 @@ pipe_get_tile_z(struct pipe_context *pipe,
assert(0);
}
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
void
-pipe_put_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const uint *zSrc)
{
- struct pipe_screen *screen = pipe->screen;
const uint srcStride = w;
const uint *pSrc = zSrc;
ubyte *map;
@@ -932,7 +922,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
if (pipe_clip_tile(x, y, &w, &h, ps))
return;
- map = (ubyte *)screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_WRITE);
+ map = (ubyte *)pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_WRITE);
if (!map) {
assert(0);
return;
@@ -980,7 +970,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
assert(0);
}
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
diff --git a/src/gallium/auxiliary/util/p_tile.h b/src/gallium/auxiliary/util/p_tile.h
index fdc80a13b3..adfec8bcee 100644
--- a/src/gallium/auxiliary/util/p_tile.h
+++ b/src/gallium/auxiliary/util/p_tile.h
@@ -30,7 +30,6 @@
#include "pipe/p_compiler.h"
-struct pipe_context;
struct pipe_surface;
@@ -57,40 +56,34 @@ extern "C" {
#endif
void
-pipe_get_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
void *p, int dst_stride);
void
-pipe_put_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const void *p, int src_stride);
void
-pipe_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
float *p);
void
-pipe_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const float *p);
void
-pipe_get_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
uint *z);
void
-pipe_put_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const uint *z);
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 2d5d2b50f5..bfdaaa6b8f 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -339,7 +339,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
for (y = 0; y < h; y += TILE_SIZE) {
for (x = 0; x < w; x += TILE_SIZE) {
if (is_clear_flag_set(tc->clear_flags, x, y)) {
- pipe_put_tile_raw(pipe, ps,
+ pipe_put_tile_raw(ps,
x, y, TILE_SIZE, TILE_SIZE,
tc->tile.data.color32, 0/*STRIDE*/);
@@ -374,12 +374,12 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
struct softpipe_cached_tile *tile = tc->entries + pos;
if (tile->x >= 0) {
if (tc->depth_stencil) {
- pipe_put_tile_raw(pipe, ps,
+ pipe_put_tile_raw(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_put_tile_rgba(pipe, ps,
+ pipe_put_tile_rgba(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
}
@@ -431,12 +431,12 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
if (tile->x != -1) {
/* put dirty tile back in framebuffer */
if (tc->depth_stencil) {
- pipe_put_tile_raw(pipe, ps,
+ pipe_put_tile_raw(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_put_tile_rgba(pipe, ps,
+ pipe_put_tile_rgba(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
}
@@ -458,12 +458,12 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
else {
/* get new tile data from surface */
if (tc->depth_stencil) {
- pipe_get_tile_raw(pipe, ps,
+ pipe_get_tile_raw(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_get_tile_rgba(pipe, ps,
+ pipe_get_tile_rgba(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
}
@@ -544,7 +544,7 @@ sp_get_cached_tile_tex(struct pipe_context *pipe,
}
/* get tile from the surface (view into texture) */
- pipe_get_tile_rgba(pipe, tc->tex_surf,
+ pipe_get_tile_rgba(tc->tex_surf,
tile_x, tile_y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
tile->x = tile_x;
diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c
index 81616b92d9..a3f2fe7d68 100644
--- a/src/mesa/drivers/x11/xm_surface.c
+++ b/src/mesa/drivers/x11/xm_surface.c
@@ -106,7 +106,7 @@ xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
}
else {
/* other softpipe surface */
- softpipe_get_tile_rgba(pipe, ps, x, y, w, h, p);
+ softpipe_get_tile_rgba(ps, x, y, w, h, p);
}
}
@@ -142,7 +142,7 @@ xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
}
else {
/* other softpipe surface */
- softpipe_put_tile_rgba(pipe, ps, x, y, w, h, p);
+ softpipe_put_tile_rgba(ps, x, y, w, h, p);
}
}
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 2283905662..c0e8c6bf33 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -73,7 +73,7 @@ acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
acc_ps->block.width = 1;
acc_ps->block.height = 1;
- pipe_get_tile_rgba(pipe, acc_ps, x, y, w, h, p);
+ pipe_get_tile_rgba(acc_ps, x, y, w, h, p);
acc_ps->format = f;
acc_ps->block = b;
@@ -97,7 +97,7 @@ acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
acc_ps->block.width = 1;
acc_ps->block.height = 1;
- pipe_put_tile_rgba(pipe, acc_ps, x, y, w, h, p);
+ pipe_put_tile_rgba(acc_ps, x, y, w, h, p);
acc_ps->format = f;
acc_ps->block = b;
@@ -208,7 +208,7 @@ accum_accum(struct pipe_context *pipe, GLfloat value,
colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_surf, xpos, ypos, width, height, colorBuf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf);
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
for (i = 0; i < 4 * width * height; i++) {
@@ -243,7 +243,7 @@ accum_load(struct pipe_context *pipe, GLfloat value,
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_surf, xpos, ypos, width, height, buf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf);
for (i = 0; i < 4 * width * height; i++) {
buf[i] = buf[i] * value;
@@ -283,7 +283,7 @@ accum_return(GLcontext *ctx, GLfloat value,
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_surf, xpos, ypos, width, height, cbuf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf);
}
for (i = 0; i < width * height; i++) {
@@ -298,7 +298,7 @@ accum_return(GLcontext *ctx, GLfloat value,
}
}
- pipe_put_tile_rgba(pipe, color_surf, xpos, ypos, width, height, abuf);
+ pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf);
free(abuf);
if (cbuf)
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index a7781f3ab2..6b0137dcf8 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1049,16 +1049,16 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* alternate path using get/put_tile() */
GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, psRead, srcx, srcy, width, height, buf);
- pipe_put_tile_rgba(pipe, psTex, 0, 0, width, height, buf);
+ pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf);
+ pipe_put_tile_rgba(psTex, 0, 0, width, height, buf);
free(buf);
}
else {
/* GL_DEPTH */
GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
- pipe_get_tile_z(pipe, psRead, srcx, srcy, width, height, buf);
- pipe_put_tile_z(pipe, psTex, 0, 0, width, height, buf);
+ pipe_get_tile_z(psRead, srcx, srcy, width, height, buf);
+ pipe_put_tile_z(psTex, 0, 0, width, height, buf);
free(buf);
}
pipe_surface_reference(&psRead, NULL);
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 09d9c29e44..eb71779cc9 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -262,7 +262,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / ((1 << 24) - 1);
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff));
@@ -276,7 +276,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* untested, but simple: */
assert(format == GL_DEPTH_STENCIL_EXT);
for (i = 0; i < height; i++) {
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, dst, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, dst, 0);
y += yStep;
dst += dstStride;
}
@@ -287,7 +287,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLushort ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffff;
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ztemp[j]);
@@ -302,7 +302,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffffffff;
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ztemp[j]);
@@ -316,7 +316,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* RGBA format */
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
- pipe_get_tile_rgba(pipe, surf, x, y, width, 1, df);
+ pipe_get_tile_rgba(surf, x, y, width, 1, df);
y += yStep;
df += dfStride;
if (!dfStride) {
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b9aa513d72..73f8b8f788 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1100,25 +1100,25 @@ fallback_copy_texsubimage(GLcontext *ctx,
for (row = 0; row < height; row++, srcY++, destY += yStep) {
uint data[MAX_WIDTH];
- pipe_get_tile_z(pipe, src_surf, srcX, srcY, width, 1, data);
+ pipe_get_tile_z(src_surf, srcX, srcY, width, 1, data);
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- pipe_put_tile_z(pipe, dest_surf, destX, destY, width, 1, data);
+ pipe_put_tile_z(dest_surf, destX, destY, width, 1, data);
}
}
else {
/* RGBA format */
for (row = 0; row < height; row++, srcY++, destY += yStep) {
float data[4 * MAX_WIDTH];
- pipe_get_tile_rgba(pipe, src_surf, srcX, srcY, width, 1, data);
+ pipe_get_tile_rgba(src_surf, srcX, srcY, width, 1, data);
/* XXX we're ignoring convolution for now */
if (ctx->_ImageTransferState) {
_mesa_apply_rgba_transfer_ops(ctx,
ctx->_ImageTransferState & ~IMAGE_CONVOLUTION_BIT,
width, (GLfloat (*)[4]) data);
}
- pipe_put_tile_rgba(pipe, dest_surf, destX, destY, width, 1, data);
+ pipe_put_tile_rgba(dest_surf, destX, destY, width, 1, data);
}
}