gallium: Remove some little-used fields from struct pipe_surface.

This commit is contained in:
Michel Dänzer
2009-03-26 10:53:47 +01:00
parent 6ce06f3fbc
commit d332f8b4ef
28 changed files with 1 additions and 131 deletions

View File

@@ -101,17 +101,4 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
clr->surface = surfIndex;
clr->value = clearValue;
}
/* Technically, the surface's contents are now known and cleared,
* so we could set the status to PIPE_SURFACE_STATUS_CLEAR. But
* it turns out it's quite painful to recognize when any particular
* surface goes from PIPE_SURFACE_STATUS_CLEAR to
* PIPE_SURFACE_STATUS_DEFINED (i.e. with known contents), because
* the drawing commands could be operating on numerous draw buffers,
* which we'd have to iterate through to set all their stati...
* For now, we cheat a bit and set the surface's status to DEFINED
* right here. Later we should revisit this and set the status to
* CLEAR here, and find a better place to set the status to DEFINED.
*/
ps->status = PIPE_SURFACE_STATUS_DEFINED;
}

View File

@@ -44,5 +44,4 @@ i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
ps->status = PIPE_SURFACE_STATUS_DEFINED;
}

View File

@@ -677,7 +677,6 @@ i915_get_tex_surface(struct pipe_screen *screen,
ps->height = pt->height[level];
ps->offset = offset;
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
}
return ps;
}
@@ -725,14 +724,6 @@ i915_init_texture_functions(struct i915_context *i915)
static void
i915_tex_surface_destroy(struct pipe_surface *surf)
{
/* This really should not be possible, but it's actually
* happening quite a bit... Will fix.
*/
if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
debug_printf("XXX destroying a surface with pending clears...\n");
assert(0);
}
pipe_texture_reference(&surf->texture, NULL);
FREE(surf);
}

View File

@@ -363,7 +363,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
ps->nblocksy = pt->nblocksy[level];
ps->stride = tex->stride;
ps->offset = offset;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
}
return ps;
}

View File

@@ -122,7 +122,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;

View File

@@ -136,7 +136,6 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;

View File

@@ -9,5 +9,4 @@ nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
ps->status = PIPE_SURFACE_STATUS_CLEAR;
}

View File

@@ -170,7 +170,6 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;

View File

@@ -9,5 +9,4 @@ nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
ps->status = PIPE_SURFACE_STATUS_CLEAR;
}

View File

@@ -177,7 +177,6 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;

View File

@@ -21,14 +21,6 @@ static void
nv30_state_do_validate(struct nv30_context *nv30,
struct nv30_state_entry **states)
{
const struct pipe_framebuffer_state *fb = &nv30->framebuffer;
unsigned i;
for (i = 0; i < fb->nr_cbufs; i++)
fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
if (fb->zsbuf)
fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
while (*states) {
struct nv30_state_entry *e = *states;

View File

@@ -9,5 +9,4 @@ nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
ps->status = PIPE_SURFACE_STATUS_CLEAR;
}

View File

@@ -176,7 +176,6 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ns->base.width = pt->width[level];
ns->base.height = pt->height[level];
ns->base.usage = flags;
ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ns->base.reference, 1);
ns->base.face = face;
ns->base.level = level;

View File

@@ -38,14 +38,6 @@ static void
nv40_state_do_validate(struct nv40_context *nv40,
struct nv40_state_entry **states)
{
const struct pipe_framebuffer_state *fb = &nv40->framebuffer;
unsigned i;
for (i = 0; i < fb->nr_cbufs; i++)
fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
if (fb->zsbuf)
fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
while (*states) {
struct nv40_state_entry *e = *states;

View File

@@ -86,7 +86,5 @@ nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
pipe->set_framebuffer_state(pipe, &s_fb);
pipe->set_scissor_state(pipe, &s_sc);
nv50->dirty |= dirty;
ps->status = PIPE_SURFACE_STATUS_CLEAR;
}

View File

@@ -163,7 +163,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->width = pt->width[level];
ps->height = pt->height[level];
ps->usage = flags;
ps->status = PIPE_SURFACE_STATUS_DEFINED;
pipe_reference_init(&ps->reference, 1);
ps->face = face;
ps->level = level;

View File

@@ -178,17 +178,10 @@ nv50_state_emit(struct nv50_context *nv50)
boolean
nv50_state_validate(struct nv50_context *nv50)
{
const struct pipe_framebuffer_state *fb = &nv50->framebuffer;
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nouveau_stateobj *so;
unsigned i;
for (i = 0; i < fb->nr_cbufs; i++)
fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
if (fb->zsbuf)
fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
if (nv50->dirty & NV50_NEW_FRAMEBUFFER)
nv50_state_validate_fb(nv50);

View File

@@ -29,5 +29,4 @@ void r300_clear(struct pipe_context* pipe,
unsigned color)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
ps->status = PIPE_SURFACE_STATUS_DEFINED;
}

View File

@@ -147,7 +147,6 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
surface->height = texture->height[level];
surface->offset = offset;
surface->usage = flags;
surface->status = PIPE_SURFACE_STATUS_DEFINED;
}
return surface;

View File

@@ -79,7 +79,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) {
sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue);
softpipe->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_CLEAR;
#if TILE_CLEAR_OPTIMIZATION
return;
#endif
@@ -96,7 +95,6 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
cv = clearValue;
}
sp_tile_cache_clear(softpipe->cbuf_cache[i], cv);
softpipe->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_CLEAR;
}
}

View File

@@ -1489,16 +1489,6 @@ void setup_prepare( struct setup_context *setup )
softpipe_update_derived(sp);
}
/* Mark surfaces as defined now */
for (i = 0; i < sp->framebuffer.nr_cbufs; i++){
if (sp->framebuffer.cbufs[i]) {
sp->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
}
}
if (sp->framebuffer.zsbuf) {
sp->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
}
/* Note: nr_attrs is only used for debugging (vertex printing) */
setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw);

View File

@@ -406,8 +406,6 @@ void trace_dump_surface(const struct pipe_surface *state)
trace_dump_reference(&state->reference);
trace_dump_member(format, state, format);
trace_dump_member(uint, state, status);
trace_dump_member(uint, state, clear_value);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);

View File

@@ -185,14 +185,6 @@ enum pipe_texture_target {
#define PIPE_SURFACE_LAYOUT_LINEAR 0
/**
* Surface status
*/
#define PIPE_SURFACE_STATUS_UNDEFINED 0
#define PIPE_SURFACE_STATUS_DEFINED 1
#define PIPE_SURFACE_STATUS_CLEAR 2
/**
* Transfer object usage flags
*/

View File

@@ -281,8 +281,6 @@ struct pipe_surface
{
struct pipe_reference reference;
enum pipe_format format; /**< PIPE_FORMAT_x */
unsigned status; /**< PIPE_SURFACE_STATUS_x */
unsigned clear_value; /**< XXX may be temporary */
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */

View File

@@ -406,8 +406,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
/* TODO stuff here */
}
st_notify_swapbuffers_complete(surf->stfb);
}
return EGL_TRUE;

View File

@@ -291,11 +291,6 @@ clear_with_quad(GLcontext *ctx,
static INLINE GLboolean
check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
{
const struct st_renderbuffer *strb = st_renderbuffer(rb);
if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
return FALSE;
if (ctx->Scissor.Enabled)
return TRUE;
@@ -312,14 +307,10 @@ check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
static INLINE GLboolean
check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
{
const struct st_renderbuffer *strb = st_renderbuffer(rb);
const GLuint stencilMax = (1 << rb->StencilBits) - 1;
GLboolean maskStencil
= (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
return FALSE;
if (ctx->Scissor.Enabled)
return TRUE;
@@ -339,14 +330,10 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
const struct st_renderbuffer *strb = st_renderbuffer(rb);
const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
return FALSE;
if (ctx->Scissor.Enabled)
return TRUE;
if (isDS &&
strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
ctx->DrawBuffer->Visual.stencilBits > 0)
return TRUE;
@@ -366,9 +353,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
const GLboolean maskStencil
= (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
return FALSE;
if (maskStencil)
return TRUE;
@@ -381,7 +365,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
* current state.
*/
if (isDS &&
strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
ctx->DrawBuffer->Visual.depthBits > 0)
return TRUE;

View File

@@ -293,32 +293,6 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
}
/**
* Quick hack - allows the winsys to inform the driver that surface
* states are now undefined after a glXSwapBuffers or similar.
*/
void
st_notify_swapbuffers_complete(struct st_framebuffer *stfb)
{
GET_CURRENT_CONTEXT(ctx);
if (ctx && ctx->DrawBuffer == &stfb->Base) {
struct st_renderbuffer *strb;
/* Mark back color buffers as undefined */
strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].
Renderbuffer);
if (strb && strb->surface)
strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_RIGHT].
Renderbuffer);
if (strb && strb->surface)
strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
}
}
void *st_framebuffer_private( struct st_framebuffer *stfb )
{
return stfb->Private;

View File

@@ -100,7 +100,6 @@ void st_flush( struct st_context *st, uint pipeFlushFlags,
void st_finish( struct st_context *st );
void st_notify_swapbuffers(struct st_framebuffer *stfb);
void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);
int st_set_teximage(struct pipe_texture *pt, int target);