mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 05:58:05 +02:00
Remove remnants of softpipe_surface.
This is the last of the clean-up following the change which moved surface allocation to the winsys layer.
This commit is contained in:
parent
4f24568dc7
commit
f6a73c3f28
10 changed files with 47 additions and 182 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
@ -61,13 +61,6 @@
|
|||
} while(0)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
#include "sp_quad.h"
|
||||
|
||||
|
||||
struct softpipe_surface;
|
||||
struct softpipe_winsys;
|
||||
struct draw_context;
|
||||
struct draw_stage;
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -460,78 +460,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue