summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/x11/xm_surface.c43
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c7
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h1
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_depth_test.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stencil.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_state_surface.c46
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c75
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.h27
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.c12
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.h4
10 files changed, 47 insertions, 182 deletions
diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c
index 3655a55e4e..dbbf26e33f 100644
--- a/src/mesa/drivers/x11/xm_surface.c
+++ b/src/mesa/drivers/x11/xm_surface.c
@@ -27,7 +27,7 @@
* \file xm_surface.c
* Code to allow the softpipe code to write to X windows/buffers.
* This is a bit of a hack for now. We've basically got two different
- * abstractions for color buffers: gl_renderbuffer and softpipe_surface.
+ * abstractions for color buffers: gl_renderbuffer and pipe_surface.
* They'll need to get merged someday...
* For now, they're separate things that point to each other.
*/
@@ -62,13 +62,6 @@
static INLINE struct xmesa_surface *
-xmesa_surf(struct softpipe_surface *sps)
-{
- return (struct xmesa_surface *) sps;
-}
-
-
-static INLINE struct xmesa_surface *
xmesa_surface(struct pipe_surface *ps)
{
return (struct xmesa_surface *) ps;
@@ -76,9 +69,9 @@ xmesa_surface(struct pipe_surface *ps)
static INLINE struct xmesa_renderbuffer *
-xmesa_rb(struct softpipe_surface *sps)
+xmesa_rb(struct pipe_surface *ps)
{
- struct xmesa_surface *xms = xmesa_surf(sps);
+ struct xmesa_surface *xms = xmesa_surface(ps);
return xms->xrb;
}
@@ -170,24 +163,6 @@ xmesa_new_color_surface(struct pipe_context *pipe, GLuint pipeFormat)
xms->surface.format = pipeFormat;
xms->surface.refcount = 1;
-#if 0
- /* some of the functions plugged in by this call will get overridden */
- softpipe_init_surface_funcs(&xms->surface);
-#endif
-
-#if 0
- switch (pipeFormat) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- xms->surface.get_tile = get_tile;
- xms->surface.put_tile = put_tile;
- break;
- case PIPE_FORMAT_S8_Z24:
- break;
- default:
- abort();
- }
-#endif
-
/* Note, the region we allocate doesn't actually have any storage
* since we're drawing into an XImage or Pixmap.
* The region's size will get set in the xmesa_alloc_front/back_storage()
@@ -215,12 +190,7 @@ xmesa_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat)
xms->surface.format = pipeFormat;
xms->surface.refcount = 1;
-#if 0
- /*
- * This is really just a softpipe surface, not an XImage/Pixmap surface.
- */
- softpipe_init_surface_funcs(&xms->surface);
-#endif
+
return &xms->surface;
}
@@ -246,7 +216,7 @@ xmesa_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
void
xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value)
{
- struct xmesa_renderbuffer *xrb = xmesa_rb((struct softpipe_surface *) ps);
+ struct xmesa_renderbuffer *xrb = xmesa_rb(ps);
/* XXX actually, we should just discard any cached tiles from this
* surface since we don't want to accidentally re-use them after clearing.
@@ -255,8 +225,7 @@ xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value)
{
struct softpipe_context *sp = softpipe_context(pipe);
- struct softpipe_surface *sps = softpipe_surface(ps);
- if (sps == sp_tile_cache_get_surface(sp->cbuf_cache[0])) {
+ if (ps == sp_tile_cache_get_surface(sp->cbuf_cache[0])) {
float clear[4];
clear[0] = 0.2; /* XXX hack */
clear[1] = 0.2;
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index 08b87417aa..df0537be1d 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -47,7 +47,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct softpipe_surface *sps = softpipe_surface(ps);
unsigned x, y, w, h;
softpipe_update_derived(softpipe); /* not needed?? */
@@ -66,12 +65,12 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
assert(w <= ps->region->pitch);
assert(h <= ps->region->height);
- if (sps == sp_tile_cache_get_surface(softpipe->zbuf_cache)) {
+ if (ps == sp_tile_cache_get_surface(softpipe->zbuf_cache)) {
float clear[4];
clear[0] = 1.0; /* XXX hack */
sp_tile_cache_clear(softpipe->zbuf_cache, clear);
}
- else if (sps == sp_tile_cache_get_surface(softpipe->cbuf_cache[0])) {
+ else if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[0])) {
float clear[4];
clear[0] = 0.2; /* XXX hack */
clear[1] = 0.2; /* XXX hack */
@@ -84,6 +83,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
#if 0
- sp_clear_tile_cache(sps, clearValue);
+ sp_clear_tile_cache(ps, clearValue);
#endif
}
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 88a418d3c7..e51e81c7b8 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -40,7 +40,6 @@
#include "sp_quad.h"
-struct softpipe_surface;
struct softpipe_winsys;
struct draw_context;
struct draw_stage;
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
index 05dafeca7c..188509065b 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
@@ -50,8 +50,8 @@ void
sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- struct softpipe_surface *sps = softpipe_surface(softpipe->framebuffer.zbuf);
- const uint format = sps->surface.format;
+ struct pipe_surface *ps = softpipe->framebuffer.zbuf;
+ const uint format = ps->format;
unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */
unsigned zmask = 0;
@@ -59,7 +59,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
struct softpipe_cached_tile *tile
= sp_get_cached_tile(softpipe, softpipe->zbuf_cache, quad->x0, quad->y0);
- assert(sps); /* shouldn't get here if there's no zbuffer */
+ assert(ps); /* shouldn't get here if there's no zbuffer */
/*
* Convert quad's float depth values to int depth values (qzzzz).
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c
index 8475bf3b96..c4240f1f8b 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stencil.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c
@@ -201,7 +201,7 @@ static void
stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- struct softpipe_surface *sps = softpipe_surface(softpipe->framebuffer.sbuf);
+ struct pipe_surface *ps = softpipe->framebuffer.sbuf;
unsigned func, zFailOp, zPassOp, failOp;
ubyte ref, wrtMask, valMask;
ubyte stencilVals[QUAD_SIZE];
@@ -230,10 +230,10 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
valMask = softpipe->depth_stencil->stencil.value_mask[0];
}
- assert(sps); /* shouldn't get here if there's no stencil buffer */
+ assert(ps); /* shouldn't get here if there's no stencil buffer */
/* get stencil values from cached tile */
- switch (sps->surface.format) {
+ switch (ps->format) {
case PIPE_FORMAT_S8_Z24:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
@@ -290,7 +290,7 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
}
/* put new stencil values into cached tile */
- switch (sps->surface.format) {
+ switch (ps->format) {
case PIPE_FORMAT_S8_Z24:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/mesa/pipe/softpipe/sp_state_surface.c
index 0960fc45ab..d4e0bd1e15 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/mesa/pipe/softpipe/sp_state_surface.c
@@ -44,7 +44,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
const struct pipe_framebuffer_state *fb)
{
struct softpipe_context *sp = softpipe_context(pipe);
- struct softpipe_surface *sps;
+ struct pipe_surface *ps;
uint i;
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
@@ -53,18 +53,18 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
/* flush old */
sp_flush_tile_cache(sp, sp->cbuf_cache[i]);
/* unmap old */
- sps = softpipe_surface(sp->framebuffer.cbufs[i]);
- if (sps && sps->surface.region)
- pipe->region_unmap(pipe, sps->surface.region);
+ ps = sp->framebuffer.cbufs[i];
+ if (ps && ps->region)
+ pipe->region_unmap(pipe, ps->region);
/* map new */
- sps = softpipe_surface(fb->cbufs[i]);
- if (sps)
- pipe->region_map(pipe, sps->surface.region);
+ ps = fb->cbufs[i];
+ if (ps)
+ pipe->region_map(pipe, ps->region);
/* assign new */
sp->framebuffer.cbufs[i] = fb->cbufs[i];
/* update cache */
- sp_tile_cache_set_surface(sp->cbuf_cache[i], sps);
+ sp_tile_cache_set_surface(sp->cbuf_cache[i], ps);
}
}
@@ -75,22 +75,22 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
/* flush old */
sp_flush_tile_cache(sp, sp->zbuf_cache);
/* unmap old */
- sps = softpipe_surface(sp->framebuffer.zbuf);
- if (sps && sps->surface.region)
- pipe->region_unmap(pipe, sps->surface.region);
+ ps = sp->framebuffer.zbuf;
+ if (ps && ps->region)
+ pipe->region_unmap(pipe, ps->region);
if (sp->framebuffer.sbuf == sp->framebuffer.zbuf) {
/* combined z/stencil */
sp->framebuffer.sbuf = NULL;
}
/* map new */
- sps = softpipe_surface(fb->zbuf);
- if (sps)
- pipe->region_map(pipe, sps->surface.region);
+ ps = fb->zbuf;
+ if (ps)
+ pipe->region_map(pipe, ps->region);
/* assign new */
sp->framebuffer.zbuf = fb->zbuf;
/* update cache */
- sp_tile_cache_set_surface(sp->zbuf_cache, sps);
+ sp_tile_cache_set_surface(sp->zbuf_cache, ps);
}
/* XXX combined depth/stencil here */
@@ -100,13 +100,13 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
/* flush old */
sp_flush_tile_cache(sp, sp->sbuf_cache_sep);
/* unmap old */
- sps = softpipe_surface(sp->framebuffer.sbuf);
- if (sps && sps->surface.region)
- pipe->region_unmap(pipe, sps->surface.region);
+ ps = sp->framebuffer.sbuf;
+ if (ps && ps->region)
+ pipe->region_unmap(pipe, ps->region);
/* map new */
- sps = softpipe_surface(fb->sbuf);
- if (sps && fb->sbuf != fb->zbuf)
- pipe->region_map(pipe, sps->surface.region);
+ ps = fb->sbuf;
+ if (ps && fb->sbuf != fb->zbuf)
+ pipe->region_map(pipe, ps->region);
/* assign new */
sp->framebuffer.sbuf = fb->sbuf;
@@ -114,12 +114,12 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
if (fb->sbuf != fb->zbuf) {
/* separate stencil buf */
sp->sbuf_cache = sp->sbuf_cache_sep;
- sp_tile_cache_set_surface(sp->sbuf_cache, sps);
+ sp_tile_cache_set_surface(sp->sbuf_cache, ps);
}
else {
/* combined depth/stencil */
sp->sbuf_cache = sp->zbuf_cache;
- sp_tile_cache_set_surface(sp->sbuf_cache, sps);
+ sp_tile_cache_set_surface(sp->sbuf_cache, ps);
}
}
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index d1aa2aba97..bc343140ba 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -461,78 +461,6 @@ s8z24_get_tile(struct pipe_surface *ps,
/**
- * Initialize the quad_read/write and get/put_tile() methods.
- */
-void
-softpipe_init_surface_funcs(struct softpipe_surface *sps)
-{
- assert(sps->surface.format);
-#if 0
- switch (sps->surface.format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- sps->get_tile = a8r8g8b8_get_tile;
- sps->put_tile = a8r8g8b8_put_tile;
- break;
- case PIPE_FORMAT_U_A1_R5_G5_B5:
- sps->get_tile = a1r5g5b5_get_tile;
- break;
- case PIPE_FORMAT_U_L8:
- sps->get_tile = l8_get_tile;
- break;
- case PIPE_FORMAT_U_A8:
- sps->get_tile = a8_get_tile;
- break;
- case PIPE_FORMAT_U_I8:
- sps->get_tile = i8_get_tile;
- break;
- case PIPE_FORMAT_U_A8_L8:
- sps->get_tile = a8_l8_get_tile;
- break;
-
- case PIPE_FORMAT_S_R16_G16_B16_A16:
- sps->get_tile = r16g16b16a16_get_tile;
- sps->put_tile = r16g16b16a16_put_tile;
- break;
-
- case PIPE_FORMAT_U_Z16:
- sps->get_tile = z16_get_tile;
- break;
- case PIPE_FORMAT_U_Z32:
- sps->get_tile = z32_get_tile;
- break;
- case PIPE_FORMAT_S8_Z24:
- sps->get_tile = s8z24_get_tile;
- break;
- case PIPE_FORMAT_U_S8:
- break;
- default:
- assert(0);
- }
-#endif
-}
-
-
-static struct pipe_surface *
-softpipe_surface_alloc(struct pipe_context *pipe, unsigned pipeFormat)
-{
- struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface);
- if (!sps)
- return NULL;
-
- assert(pipeFormat < PIPE_FORMAT_COUNT);
-
- sps->surface.format = pipeFormat;
- sps->surface.refcount = 1;
- softpipe_init_surface_funcs(sps);
-
- return &sps->surface;
-}
-
-
-
-
-
-/**
* Called via pipe->get_tex_surface()
* XXX is this in the right place?
*/
@@ -730,9 +658,6 @@ softpipe_put_tile_rgba(struct pipe_context *pipe,
void
sp_init_surface_functions(struct softpipe_context *sp)
{
-#if 0
- sp->pipe.surface_alloc = softpipe_surface_alloc;
-#endif
sp->pipe.get_tile = softpipe_get_tile;
sp->pipe.put_tile = softpipe_put_tile;
diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/mesa/pipe/softpipe/sp_surface.h
index 359a438c86..7e08ce7a2b 100644
--- a/src/mesa/pipe/softpipe/sp_surface.h
+++ b/src/mesa/pipe/softpipe/sp_surface.h
@@ -35,26 +35,10 @@
#include "pipe/p_state.h"
struct pipe_context;
-struct softpipe_surface;
struct softpipe_context;
struct softpipe_tile_cache;
-/**
- * Softpipe surface is derived from pipe_surface.
- */
-struct softpipe_surface {
- struct pipe_surface surface;
-
-#if 0
- /* XXX these are temporary here */
- void (*get_tile)(struct pipe_surface *ps,
- uint x, uint y, uint w, uint h, float *p);
- void (*put_tile)(struct pipe_surface *ps,
- uint x, uint y, uint w, uint h, const float *p);
-#endif
-};
-
extern struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt,
@@ -73,17 +57,6 @@ softpipe_put_tile_rgba(struct pipe_context *pipe,
uint x, uint y, uint w, uint h,
const float *p);
-extern void
-softpipe_init_surface_funcs(struct softpipe_surface *sps);
-
-
-/** Cast wrapper */
-static INLINE struct softpipe_surface *
-softpipe_surface(struct pipe_surface *ps)
-{
- return (struct softpipe_surface *) ps;
-}
-
extern void
sp_init_surface_functions(struct softpipe_context *sp);
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/mesa/pipe/softpipe/sp_tile_cache.c
index 421d7bdb1a..1b600aadf1 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.c
+++ b/src/mesa/pipe/softpipe/sp_tile_cache.c
@@ -49,7 +49,7 @@
struct softpipe_tile_cache
{
- struct softpipe_surface *surface; /**< the surface we're caching */
+ struct pipe_surface *surface; /**< the surface we're caching */
struct pipe_mipmap_tree *texture; /**< if caching a texture */
struct softpipe_cached_tile entries[NUM_ENTRIES];
uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32];
@@ -123,13 +123,13 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
void
sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
- struct softpipe_surface *sps)
+ struct pipe_surface *ps)
{
- tc->surface = sps;
+ tc->surface = ps;
}
-struct softpipe_surface *
+struct pipe_surface *
sp_tile_cache_get_surface(struct softpipe_tile_cache *tc)
{
return tc->surface;
@@ -157,7 +157,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
struct softpipe_tile_cache *tc)
{
struct pipe_context *pipe = &softpipe->pipe;
- struct pipe_surface *ps = &tc->surface->surface;
+ struct pipe_surface *ps = tc->surface;
boolean is_depth_stencil;
int inuse = 0, pos;
@@ -199,7 +199,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
struct softpipe_tile_cache *tc, int x, int y)
{
struct pipe_context *pipe = &softpipe->pipe;
- struct pipe_surface *ps = &tc->surface->surface;
+ struct pipe_surface *ps = tc->surface;
boolean is_depth_stencil
= (ps->format == PIPE_FORMAT_S8_Z24 ||
ps->format == PIPE_FORMAT_U_Z16 ||
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.h b/src/mesa/pipe/softpipe/sp_tile_cache.h
index e122d70d13..e66fec2e20 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.h
+++ b/src/mesa/pipe/softpipe/sp_tile_cache.h
@@ -64,9 +64,9 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc);
extern void
sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
- struct softpipe_surface *sps);
+ struct pipe_surface *sps);
-extern struct softpipe_surface *
+extern struct pipe_surface *
sp_tile_cache_get_surface(struct softpipe_tile_cache *tc);
extern void