gallium: remove flags from the flush function

The drivers have been changed so that they behave as if all of the flags
were set. This is already implicit in most hardware drivers and required
for multiple contexts.

Some state trackers were also abusing the PIPE_FLUSH_RENDER_CACHE flag
to decide whether flush_frontbuffer should be called.
New flag ST_FLUSH_FRONT has been added to st_api.h as a replacement.
This commit is contained in:
Marek Olšák
2011-03-08 00:57:48 +01:00
parent e968975cb5
commit 7e02303497
69 changed files with 167 additions and 213 deletions

View File

@@ -453,8 +453,8 @@ SetVertexPipelineOutput (D3D10.1+ only)
SetViewports
- Gallium lacks support for multiple geometry-shader-selectable viewports D3D11 has
ShaderResourceViewReadAfterWriteHazard -> flush(PIPE_FLUSH_RENDER_CACHE)
- Gallium does not support specifying this per-render-target/view
ShaderResourceViewReadAfterWriteHazard
- Gallium lacks support for this
SoSetTargets -> set_stream_output_buffers

View File

@@ -38,19 +38,16 @@
* Called via pipe->flush()
*/
void
cell_flush(struct pipe_context *pipe, unsigned flags,
cell_flush(struct pipe_context *pipe,
struct pipe_fence_handle **fence)
{
struct cell_context *cell = cell_context(pipe);
if (fence) {
*fence = NULL;
/* XXX: Implement real fencing */
flags |= CELL_FLUSH_WAIT;
}
if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_RENDER_CACHE))
flags |= CELL_FLUSH_WAIT;
flags |= CELL_FLUSH_WAIT;
draw_flush( cell->draw );
cell_flush_int(cell, flags);

View File

@@ -79,7 +79,7 @@ static void failover_draw_vbo( struct pipe_context *pipe,
if (failover->mode == FO_SW) {
if (failover->dirty) {
failover->hw->flush( failover->hw, ~0, NULL );
failover->hw->flush( failover->hw, NULL );
failover_state_emit( failover );
}
@@ -89,7 +89,7 @@ static void failover_draw_vbo( struct pipe_context *pipe,
* intervening flush. Unlikely to be much performance impact to
* this:
*/
failover->sw->flush( failover->sw, ~0, NULL );
failover->sw->flush( failover->sw, NULL );
}
}

View File

@@ -761,14 +761,12 @@ galahad_clear_depth_stencil(struct pipe_context *_pipe,
static void
galahad_flush(struct pipe_context *_pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
pipe->flush(pipe,
flags,
fence);
}

View File

@@ -39,7 +39,6 @@
static void i915_flush_pipe( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence )
{
struct i915_context *i915 = i915_context(pipe);
@@ -50,6 +49,7 @@ static void i915_flush_pipe( struct pipe_context *pipe,
/* Do we need to emit an MI_FLUSH command to flush the hardware
* caches?
*/
/* XXX These flags are now implicit. All of them. */
if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) {
unsigned flush = MI_FLUSH;

View File

@@ -38,7 +38,6 @@ void brw_context_flush( struct brw_context *brw )
static void
brw_flush( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence )
{
brw_context_flush( brw_context( pipe ) );

View File

@@ -668,14 +668,12 @@ identity_clear_depth_stencil(struct pipe_context *_pipe,
static void
identity_flush(struct pipe_context *_pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
pipe->flush(pipe,
flags,
fence);
}

View File

@@ -136,10 +136,9 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
static void
do_flush( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
llvmpipe_flush(pipe, flags, fence, __FUNCTION__);
llvmpipe_flush(pipe, fence, __FUNCTION__);
}

View File

@@ -40,12 +40,10 @@
/**
* \param flags bitmask of PIPE_FLUSH_x flags
* \param fence if non-null, returns pointer to a fence which can be waited on
*/
void
llvmpipe_flush( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence,
const char *reason)
{
@@ -54,7 +52,7 @@ llvmpipe_flush( struct pipe_context *pipe,
draw_flush(llvmpipe->draw);
/* ask the setup module to flush */
lp_setup_flush(llvmpipe->setup, flags, fence, reason);
lp_setup_flush(llvmpipe->setup, fence, reason);
if (llvmpipe_variant_count > 1000) {
@@ -65,23 +63,21 @@ llvmpipe_flush( struct pipe_context *pipe,
/* Enable to dump BMPs of the color/depth buffers each frame */
if (0) {
if (flags & PIPE_FLUSH_FRAME) {
static unsigned frame_no = 1;
char filename[256];
unsigned i;
static unsigned frame_no = 1;
char filename[256];
unsigned i;
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no);
debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[i]);
}
if (0) {
util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no);
debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf);
}
++frame_no;
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no);
debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[i]);
}
if (0) {
util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no);
debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf);
}
++frame_no;
}
}
@@ -90,7 +86,7 @@ llvmpipe_finish( struct pipe_context *pipe,
const char *reason )
{
struct pipe_fence_handle *fence = NULL;
llvmpipe_flush(pipe, 0, &fence, reason);
llvmpipe_flush(pipe, &fence, reason);
if (fence) {
pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE);
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
@@ -110,7 +106,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level,
int layer,
unsigned flush_flags,
boolean read_only,
boolean cpu_access,
boolean do_not_block,
@@ -136,7 +131,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
* Just flush.
*/
llvmpipe_flush(pipe, flush_flags, NULL, reason);
llvmpipe_flush(pipe, NULL, reason);
}
}

View File

@@ -36,7 +36,6 @@ struct pipe_resource;
void
llvmpipe_flush(struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence,
const char *reason);
@@ -49,7 +48,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level,
int layer,
unsigned flush_flags,
boolean read_only,
boolean cpu_access,
boolean do_not_block,

View File

@@ -69,7 +69,7 @@ llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
*/
if (pq->fence) {
if (!lp_fence_issued(pq->fence))
llvmpipe_flush(pipe, 0, NULL, __FUNCTION__);
llvmpipe_flush(pipe, NULL, __FUNCTION__);
if (!lp_fence_signalled(pq->fence))
lp_fence_wait(pq->fence);
@@ -99,7 +99,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
if (!lp_fence_signalled(pq->fence)) {
if (!lp_fence_issued(pq->fence))
llvmpipe_flush(pipe, 0, NULL, __FUNCTION__);
llvmpipe_flush(pipe, NULL, __FUNCTION__);
if (!wait)
return FALSE;

View File

@@ -333,12 +333,8 @@ fail:
}
/**
* \param flags bitmask of PIPE_FLUSH_x flags
*/
void
lp_setup_flush( struct lp_setup_context *setup,
unsigned flags,
struct pipe_fence_handle **fence,
const char *reason)
{
@@ -469,7 +465,7 @@ lp_setup_clear( struct lp_setup_context *setup,
unsigned flags )
{
if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) {
lp_setup_flush(setup, 0, NULL, __FUNCTION__);
lp_setup_flush(setup, NULL, __FUNCTION__);
if (!lp_setup_try_clear( setup, color, depth, stencil, flags ))
assert(0);
@@ -1114,7 +1110,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
if (!lp_scene_bin_everywhere(setup->scene,
LP_RAST_OP_END_QUERY,
dummy)) {
lp_setup_flush(setup, 0, NULL, __FUNCTION__);
lp_setup_flush(setup, NULL, __FUNCTION__);
}
}
else {

View File

@@ -64,7 +64,6 @@ lp_setup_clear(struct lp_setup_context *setup,
void
lp_setup_flush( struct lp_setup_context *setup,
unsigned flags,
struct pipe_fence_handle **fence,
const char *reason);

View File

@@ -69,7 +69,6 @@ lp_resource_copy(struct pipe_context *pipe,
llvmpipe_flush_resource(pipe,
dst, dst_level, dstz,
0, /* flush_flags */
FALSE, /* read_only */
TRUE, /* cpu_access */
FALSE, /* do_not_block */
@@ -77,7 +76,6 @@ lp_resource_copy(struct pipe_context *pipe,
llvmpipe_flush_resource(pipe,
src, src_level, src_box->z,
0, /* flush_flags */
TRUE, /* read_only */
TRUE, /* cpu_access */
FALSE, /* do_not_block */

View File

@@ -575,7 +575,6 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
if (!llvmpipe_flush_resource(pipe, resource,
level,
box->depth > 1 ? -1 : box->z,
0, /* flush_flags */
read_only,
TRUE, /* cpu_access */
do_not_block,

View File

@@ -260,7 +260,7 @@ static void noop_resource_copy_region(struct pipe_context *ctx,
/*
* context
*/
static void noop_flush(struct pipe_context *ctx, unsigned flags,
static void noop_flush(struct pipe_context *ctx,
struct pipe_fence_handle **fence)
{
}

View File

@@ -30,25 +30,25 @@
#include "nouveau/nouveau_reloc.h"
static void
nv50_flush(struct pipe_context *pipe, unsigned flags,
nv50_flush(struct pipe_context *pipe,
struct pipe_fence_handle **fence)
{
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->base.channel;
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
/* XXX This flag wasn't set by the state tracker anyway. */
/*if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
BEGIN_RING(chan, RING_3D_(NV50_GRAPH_WAIT_FOR_IDLE), 1);
OUT_RING (chan, 0);
BEGIN_RING(chan, RING_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 0x20);
}
}*/
if (fence)
nouveau_fence_ref(nv50->screen->base.fence.current,
(struct nouveau_fence **)fence);
if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME))
FIRE_RING(chan);
FIRE_RING(chan);
}
void

View File

@@ -30,29 +30,30 @@
#include "nouveau/nouveau_reloc.h"
static void
nvc0_flush(struct pipe_context *pipe, unsigned flags,
nvc0_flush(struct pipe_context *pipe,
struct pipe_fence_handle **fence)
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
struct nouveau_channel *chan = nvc0->screen->base.channel;
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
/* XXX This flag wasn't set by the state tracker anyway. */
/*if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
BEGIN_RING(chan, RING_3D(SERIALIZE), 1);
OUT_RING (chan, 0);
BEGIN_RING(chan, RING_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 0x00);
} else
if ((flags & PIPE_FLUSH_RENDER_CACHE) && !(flags & PIPE_FLUSH_FRAME)) {
} else*/
/* XXX FLUSH_FRAME is now implicit. */
/*if ((flags & PIPE_FLUSH_RENDER_CACHE) && !(flags & PIPE_FLUSH_FRAME)) {
BEGIN_RING(chan, RING_3D(SERIALIZE), 1);
OUT_RING (chan, 0);
}
}*/
if (fence)
nouveau_fence_ref(nvc0->screen->base.fence.current,
(struct nouveau_fence **)fence);
if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME))
FIRE_RING(chan);
FIRE_RING(chan);
}
static void

View File

@@ -7,7 +7,7 @@
#include "nvfx_resource.h"
static void
nvfx_flush(struct pipe_context *pipe, unsigned flags,
nvfx_flush(struct pipe_context *pipe,
struct pipe_fence_handle **fence)
{
struct nvfx_context *nvfx = nvfx_context(pipe);
@@ -16,12 +16,13 @@ nvfx_flush(struct pipe_context *pipe, unsigned flags,
struct nouveau_grobj *eng3d = screen->eng3d;
/* XXX: we need to actually be intelligent here */
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
/* XXX This flag wasn't set by the state tracker anyway. */
/*if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
BEGIN_RING(chan, eng3d, 0x1fd8, 1);
OUT_RING(chan, 2);
BEGIN_RING(chan, eng3d, 0x1fd8, 1);
OUT_RING(chan, 1);
}
}*/
FIRE_RING(chan);
if (fence)

View File

@@ -426,7 +426,7 @@ nvfx_state_validate_swtnl(struct nvfx_context *nvfx)
NOUVEAU_ERR("hw->swtnl 0x%08x\n", nvfx->fallback_swtnl);
warned = TRUE;
}
nvfx->pipe.flush(&nvfx->pipe, 0, NULL);
nvfx->pipe.flush(&nvfx->pipe, NULL);
nvfx->dirty |= (NVFX_NEW_VIEWPORT |
NVFX_NEW_VERTPROG |
NVFX_NEW_ARRAYS);

View File

@@ -94,10 +94,8 @@ void r300_flush(struct pipe_context *pipe,
}
static void r300_flush_wrapped(struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
/* don't use the flags param, it means something else */
r300_flush(pipe, 0, fence);
}

View File

@@ -73,7 +73,7 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
&r300transfer->linear_texture->b.b.b, 0, &src_box);
/* XXX remove this. */
ctx->flush(ctx, 0, NULL);
r300_flush(ctx, 0, NULL);
}
struct pipe_transfer*

View File

@@ -48,7 +48,7 @@
/*
* pipe_context
*/
static void r600_flush(struct pipe_context *ctx, unsigned flags,
static void r600_flush(struct pipe_context *ctx,
struct pipe_fence_handle **fence)
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;

View File

@@ -62,7 +62,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx,
struct r600_query *rquery = (struct r600_query *)query;
if (rquery->num_results) {
ctx->flush(ctx, 0, NULL);
ctx->flush(ctx, NULL);
}
return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult);
}

View File

@@ -68,7 +68,7 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600
rtransfer->staging_texture,
0, &sbox);
ctx->flush(ctx, 0, NULL);
ctx->flush(ctx, NULL);
}
unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
@@ -635,7 +635,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
if (usage & PIPE_TRANSFER_READ) {
r600_copy_to_staging_texture(ctx, trans);
/* Always referenced in the blit. */
ctx->flush(ctx, 0, NULL);
ctx->flush(ctx, NULL);
}
return &trans->transfer;
}

View File

@@ -801,14 +801,12 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe,
static void
rbug_flush(struct pipe_context *_pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct pipe_context *pipe = rb_pipe->pipe;
pipe->flush(pipe,
flags,
fence);
}

View File

@@ -498,7 +498,7 @@ rbug_context_flush(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32
/* protect the pipe context */
pipe_mutex_lock(rb_context->call_mutex);
rb_context->pipe->flush(rb_context->pipe, flush->flags, NULL);
rb_context->pipe->flush(rb_context->pipe, NULL);
pipe_mutex_unlock(rb_context->call_mutex);
pipe_mutex_unlock(rb_screen->list_mutex);

View File

@@ -255,7 +255,7 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.draw_stream_output = softpipe_draw_stream_output;
softpipe->pipe.clear = softpipe_clear;
softpipe->pipe.flush = softpipe_flush;
softpipe->pipe.flush = softpipe_flush_wrapped;
softpipe->pipe.render_condition = softpipe_render_condition;

View File

@@ -42,7 +42,7 @@
void
softpipe_flush( struct pipe_context *pipe,
unsigned flags,
unsigned flags,
struct pipe_fence_handle **fence )
{
struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -50,7 +50,7 @@ softpipe_flush( struct pipe_context *pipe,
draw_flush(softpipe->draw);
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
if (flags & SP_FLUSH_TEXTURE_CACHE) {
for (i = 0; i < softpipe->num_fragment_sampler_views; i++) {
sp_flush_tex_tile_cache(softpipe->fragment_tex_cache[i]);
}
@@ -62,34 +62,27 @@ softpipe_flush( struct pipe_context *pipe,
}
}
if (flags & PIPE_FLUSH_SWAPBUFFERS) {
/* If this is a swapbuffers, just flush color buffers.
*
* The zbuffer changes are not discarded, but held in the cache
* in the hope that a later clear will wipe them out.
*/
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++)
if (softpipe->cbuf_cache[i])
sp_flush_tile_cache(softpipe->cbuf_cache[i]);
/* If this is a swapbuffers, just flush color buffers.
*
* The zbuffer changes are not discarded, but held in the cache
* in the hope that a later clear will wipe them out.
*/
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++)
if (softpipe->cbuf_cache[i])
sp_flush_tile_cache(softpipe->cbuf_cache[i]);
/* Need this call for hardware buffers before swapbuffers.
*
* there should probably be another/different flush-type function
* that's called before swapbuffers because we don't always want
* to unmap surfaces when flushing.
*/
softpipe_unmap_transfers(softpipe);
}
else if (flags & PIPE_FLUSH_RENDER_CACHE) {
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++)
if (softpipe->cbuf_cache[i])
sp_flush_tile_cache(softpipe->cbuf_cache[i]);
if (softpipe->zsbuf_cache)
sp_flush_tile_cache(softpipe->zsbuf_cache);
if (softpipe->zsbuf_cache)
sp_flush_tile_cache(softpipe->zsbuf_cache);
softpipe->dirty_render_cache = FALSE;
softpipe->dirty_render_cache = FALSE;
}
/* Need this call for hardware buffers before swapbuffers.
*
* there should probably be another/different flush-type function
* that's called before swapbuffers because we don't always want
* to unmap surfaces when flushing.
*/
softpipe_unmap_transfers(softpipe);
/* Enable to dump BMPs of the color/depth buffers each frame */
#if 0
@@ -108,6 +101,13 @@ softpipe_flush( struct pipe_context *pipe,
*fence = NULL;
}
void
softpipe_flush_wrapped( struct pipe_context *pipe,
struct pipe_fence_handle **fence )
{
softpipe_flush(pipe, SP_FLUSH_TEXTURE_CACHE, fence);
}
/**
* Flush context if necessary.
@@ -139,11 +139,8 @@ softpipe_flush_resource(struct pipe_context *pipe,
* disappear and the pipe driver should just ensure that all visible
* side-effects happen when they need to happen.
*/
if (referenced & SP_REFERENCED_FOR_WRITE)
flush_flags |= PIPE_FLUSH_RENDER_CACHE;
if (referenced & SP_REFERENCED_FOR_READ)
flush_flags |= PIPE_FLUSH_TEXTURE_CACHE;
flush_flags |= SP_FLUSH_TEXTURE_CACHE;
if (cpu_access) {
/*
@@ -155,7 +152,7 @@ softpipe_flush_resource(struct pipe_context *pipe,
if (do_not_block)
return FALSE;
pipe->flush(pipe, flush_flags, &fence);
softpipe_flush(pipe, flush_flags, &fence);
if (fence) {
/*
@@ -171,7 +168,7 @@ softpipe_flush_resource(struct pipe_context *pipe,
* Just flush.
*/
pipe->flush(pipe, flush_flags, NULL);
softpipe_flush(pipe, flush_flags, NULL);
}
}

View File

@@ -33,10 +33,17 @@
struct pipe_context;
struct pipe_fence_handle;
#define SP_FLUSH_TEXTURE_CACHE 0x2
void
softpipe_flush(struct pipe_context *pipe, unsigned flags,
softpipe_flush(struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence);
void
softpipe_flush_wrapped( struct pipe_context *pipe,
struct pipe_fence_handle **fence );
boolean
softpipe_flush_resource(struct pipe_context *pipe,
struct pipe_resource *texture,

View File

@@ -161,7 +161,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
/* We're switching between SW and HW drawing. Do a flush to avoid
* mixing HW and SW rendering with the same vertex buffer.
*/
pipe->flush(pipe, ~0, NULL);
pipe->flush(pipe, NULL);
svga->prev_draw_swtnl = svga->state.sw.need_swtnl;
}

View File

@@ -32,7 +32,6 @@
static void svga_flush( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence )
{
struct svga_context *svga = svga_context(pipe);
@@ -45,29 +44,27 @@ static void svga_flush( struct pipe_context *pipe,
*/
svga_context_flush(svga, fence);
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s flags %x fence_ptr %p\n",
__FUNCTION__, flags, fence ? *fence : 0x0);
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n",
__FUNCTION__, fence ? *fence : 0x0);
/* Enable to dump BMPs of the color/depth buffers each frame */
if (0) {
if (flags & PIPE_FLUSH_FRAME) {
struct pipe_framebuffer_state *fb = &svga->curr.framebuffer;
static unsigned frame_no = 1;
char filename[256];
unsigned i;
struct pipe_framebuffer_state *fb = &svga->curr.framebuffer;
static unsigned frame_no = 1;
char filename[256];
unsigned i;
for (i = 0; i < fb->nr_cbufs; i++) {
util_snprintf(filename, sizeof(filename), "cbuf%u_%04u", i, frame_no);
debug_dump_surface_bmp(&svga->pipe, filename, fb->cbufs[i]);
}
if (0 && fb->zsbuf) {
util_snprintf(filename, sizeof(filename), "zsbuf_%04u", frame_no);
debug_dump_surface_bmp(&svga->pipe, filename, fb->zsbuf);
}
++frame_no;
for (i = 0; i < fb->nr_cbufs; i++) {
util_snprintf(filename, sizeof(filename), "cbuf%u_%04u", i, frame_no);
debug_dump_surface_bmp(&svga->pipe, filename, fb->cbufs[i]);
}
if (0 && fb->zsbuf) {
util_snprintf(filename, sizeof(filename), "zsbuf_%04u", frame_no);
debug_dump_surface_bmp(&svga->pipe, filename, fb->zsbuf);
}
++frame_no;
}
}

View File

@@ -1184,7 +1184,6 @@ trace_context_clear_depth_stencil(struct pipe_context *_pipe,
static INLINE void
trace_context_flush(struct pipe_context *_pipe,
unsigned flags,
struct pipe_fence_handle **fence)
{
struct trace_context *tr_ctx = trace_context(_pipe);
@@ -1193,9 +1192,8 @@ trace_context_flush(struct pipe_context *_pipe,
trace_dump_call_begin("pipe_context", "flush");
trace_dump_arg(ptr, pipe);
trace_dump_arg(uint, flags);
pipe->flush(pipe, flags, fence);
pipe->flush(pipe, fence);
if(fence)
trace_dump_ret(ptr, *fence);

View File

@@ -312,11 +312,9 @@ struct pipe_context {
unsigned dstx, unsigned dsty,
unsigned width, unsigned height);
/** Flush rendering
* \param flags bitmask of PIPE_FLUSH_x tokens)
/** Flush draw commands
*/
void (*flush)( struct pipe_context *pipe,
unsigned flags,
struct pipe_fence_handle **fence );
/**

View File

@@ -337,15 +337,6 @@ enum pipe_transfer_usage {
#define PIPE_USAGE_STAGING 5 /* supports data transfers from the GPU to the CPU */
/**
* Flush types:
*/
#define PIPE_FLUSH_RENDER_CACHE 0x1
#define PIPE_FLUSH_TEXTURE_CACHE 0x2
#define PIPE_FLUSH_SWAPBUFFERS 0x4
#define PIPE_FLUSH_FRAME 0x8 /**< Mark the end of a frame */
/**
* Shaders
*/

View File

@@ -120,6 +120,11 @@ enum st_context_resource_type {
ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE
};
/**
* Flush flags.
*/
#define ST_FLUSH_FRONT (1 << 0)
/**
* Value to st_manager->get_param function.
*/

View File

@@ -1234,7 +1234,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
if(dst_surface)
pipe->surface_destroy(pipe, dst_surface);
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 0);
pipe->flush(pipe, 0);
att = (db) ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT;
if(!surface->present(surface, att, FALSE, 0))

View File

@@ -1823,7 +1823,7 @@ changed:
virtual void STDMETHODCALLTYPE Flush(void)
{
SYNCHRONIZED;
pipe->flush(pipe, PIPE_FLUSH_FRAME, 0);
pipe->flush(pipe, 0);
}
/* In Direct3D 10, if the reference count of an object drops to 0, it is automatically

View File

@@ -149,7 +149,7 @@ dri_unbind_context(__DRIcontext * cPriv)
if (--ctx->bind_count == 0) {
if (ctx->st == ctx->stapi->get_current(ctx->stapi)) {
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
stapi->make_current(stapi, NULL, NULL, NULL);
draw->context = NULL;
read->context = NULL;
@@ -171,7 +171,7 @@ dri_make_current(__DRIcontext * cPriv,
struct st_context_iface *old_st = ctx->stapi->get_current(ctx->stapi);
if (old_st && old_st != ctx->st)
old_st->flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL);
old_st->flush(old_st, ST_FLUSH_FRONT, NULL);
++ctx->bind_count;

View File

@@ -139,7 +139,7 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
if (ptex) {
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
drisw_copy_to_front(dPriv, ptex);
}

View File

@@ -528,8 +528,7 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
old_gctx = egl_g3d_context(old_ctx);
if (old_gctx) {
/* flush old context */
old_gctx->stctxi->flush(old_gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
old_gctx->stctxi->flush(old_gctx->stctxi, ST_FLUSH_FRONT, NULL);
}
if (gctx) {
@@ -606,8 +605,7 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
/* flush if the surface is current */
if (gctx) {
gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL);
}
return gsurf->native->present(gsurf->native,
@@ -652,8 +650,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
/* flush if the surface is current */
if (ctx && ctx->DrawSurface == &gsurf->base) {
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL);
}
pipe = ndpy_get_copy_context(gdpy->native);
@@ -667,7 +664,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
u_box_origin_2d(ptex->width0, ptex->height0, &src_box);
pipe->resource_copy_region(pipe, ptex, 0, 0, 0, 0,
gsurf->render_texture, 0, &src_box);
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
pipe->flush(pipe, NULL);
nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
pipe_resource_reference(&ptex, NULL);
@@ -686,8 +683,7 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
struct pipe_screen *screen = gdpy->native->screen;
struct pipe_fence_handle *fence = NULL;
gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, &fence);
if (fence) {
screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE);
screen->fence_reference(screen, &fence, NULL);
@@ -758,8 +754,7 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
/* flush properly if the surface is bound */
if (gsurf->base.CurrentContext) {
gctx = egl_g3d_context(gsurf->base.CurrentContext);
gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL);
}
gctx = egl_g3d_context(es1);

View File

@@ -234,7 +234,7 @@ egl_g3d_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
if (gctx)
gctx->stctxi->flush(gctx->stctxi, PIPE_FLUSH_RENDER_CACHE , NULL);
gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL);
}
if (timeout) {

View File

@@ -352,7 +352,7 @@ resource_surface_flush(struct resource_surface *rsurf,
if (!pipe)
return FALSE;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, &fence);
pipe->flush(pipe, &fence);
if (fence == NULL)
return FALSE;

View File

@@ -1193,11 +1193,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
XMesaContext xmctx = XMesaGetCurrentContext();
if (xmctx && xmctx->xm_buffer == b) {
xmctx->st->flush( xmctx->st,
PIPE_FLUSH_RENDER_CACHE |
PIPE_FLUSH_SWAPBUFFERS |
PIPE_FLUSH_FRAME,
NULL);
xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL);
}
xmesa_swap_st_framebuffer(b->stfb);
@@ -1223,7 +1219,7 @@ void XMesaFlush( XMesaContext c )
XMesaDisplay xmdpy = xmesa_init_display(c->xm_visual->display);
struct pipe_fence_handle *fence = NULL;
c->st->flush(c->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
c->st->flush(c->st, ST_FLUSH_FRONT, &fence);
if (fence) {
xmdpy->screen->fence_finish(xmdpy->screen, fence,
PIPE_TIMEOUT_INFINITE);

View File

@@ -56,7 +56,7 @@ void vegaFlush(void)
return;
pipe = ctx->pipe;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
pipe->flush(pipe, NULL);
vg_manager_flush_frontbuffer(ctx);
}
@@ -72,7 +72,7 @@ void vegaFinish(void)
pipe = ctx->pipe;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
pipe->flush(pipe, &fence);
if (fence) {
pipe->screen->fence_finish(pipe->screen, fence,
PIPE_TIMEOUT_INFINITE);

View File

@@ -142,8 +142,8 @@ vg_context_flush(struct st_context_iface *stctxi, unsigned flags,
struct pipe_fence_handle **fence)
{
struct vg_context *ctx = (struct vg_context *) stctxi;
ctx->pipe->flush(ctx->pipe, flags, fence);
if (flags & PIPE_FLUSH_RENDER_CACHE)
ctx->pipe->flush(ctx->pipe, fence);
if (flags & ST_FLUSH_FRONT)
vg_manager_flush_frontbuffer(ctx);
}

View File

@@ -277,7 +277,7 @@ stw_make_current(
return TRUE;
}
} else {
curctx->st->flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
curctx->st->flush(curctx->st, ST_FLUSH_FRONT, NULL);
}
}
@@ -351,11 +351,7 @@ stw_flush_current_locked( struct stw_framebuffer *fb )
struct stw_context *ctx = stw_current_context();
if (ctx && ctx->current_framebuffer == fb) {
ctx->st->flush(ctx->st,
PIPE_FLUSH_RENDER_CACHE |
PIPE_FLUSH_SWAPBUFFERS |
PIPE_FLUSH_FRAME,
NULL);
ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
}
}

View File

@@ -336,7 +336,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
/* pixmap glXWaitX */
if (pSrcBuffer->attachment == DRI2BufferFrontLeft &&
pDestBuffer->attachment == DRI2BufferFakeFrontLeft) {
ms->ctx->flush(ms->ctx, PIPE_FLUSH_SWAPBUFFERS, NULL);
ms->ctx->flush(ms->ctx, NULL);
return;
}
/* pixmap glXWaitGL */
@@ -389,7 +389,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
FreeScratchGC(gc);
ms->ctx->flush(ms->ctx, PIPE_FLUSH_SWAPBUFFERS,
ms->ctx->flush(ms->ctx,
(pDestBuffer->attachment == DRI2BufferFrontLeft
&& ms->swapThrottling) ?
&dst_priv->fence : NULL);

View File

@@ -548,7 +548,7 @@ void xorg_flush(ScreenPtr pScreen)
if (ms->ctx) {
int j;
ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE,
ms->ctx->flush(ms->ctx,
ms->dirtyThrottling ?
&ms->fence[XORG_NR_FENCES-1] :
NULL);

View File

@@ -1072,17 +1072,17 @@ xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv)
}
void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
void xorg_exa_flush(struct exa_context *exa,
struct pipe_fence_handle **fence)
{
exa->pipe->flush(exa->pipe, pipeFlushFlags, fence);
exa->pipe->flush(exa->pipe, fence);
}
void xorg_exa_finish(struct exa_context *exa)
{
struct pipe_fence_handle *fence = NULL;
xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, &fence);
xorg_exa_flush(exa, &fence);
exa->pipe->screen->fence_finish(exa->pipe->screen, fence,
PIPE_TIMEOUT_INFINITE);

View File

@@ -74,7 +74,7 @@ do { \
struct pipe_surface *
xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv);
void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
void xorg_exa_flush(struct exa_context *exa,
struct pipe_fence_handle **fence);
void xorg_exa_finish(struct exa_context *exa);

View File

@@ -29,7 +29,7 @@ static void draw( void )
float clear_color[4] = {1,0,1,1};
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -276,7 +276,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -339,7 +339,7 @@ static void draw( void )
else
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -150,7 +150,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -147,7 +147,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -149,7 +149,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, 1);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
ctx->bind_fs_state(ctx, NULL);
ctx->delete_fs_state(ctx, fs);

View File

@@ -163,7 +163,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
screen->flush_frontbuffer(screen, tex, 0, 0, window);
}

View File

@@ -211,7 +211,7 @@ static void draw( void )
ctx->draw_vbo(ctx, &info);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -140,7 +140,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -227,7 +227,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, Elements(vertices));
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->flush(ctx, NULL);
graw_save_surface_to_file(ctx, surf, NULL);

View File

@@ -335,7 +335,7 @@ static void draw(struct program *p)
4, /* verts */
2); /* attribs/vert */
p->pipe->flush(p->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
p->pipe->flush(p->pipe, NULL);
debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]);
}

View File

@@ -264,7 +264,7 @@ static void draw(struct program *p)
3, /* verts */
2); /* attribs/vert */
p->pipe->flush(p->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
p->pipe->flush(p->pipe, NULL);
debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]);
}

View File

@@ -120,7 +120,7 @@ void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, voi
return NULL;
}
if (ctx) {
pctx->flush(pctx, 0, NULL);
pctx->flush(pctx, NULL);
}
}

View File

@@ -246,7 +246,7 @@ wsw_dt_unmap(struct sw_winsys *ws,
pipe->transfer_unmap(pipe, wdt->transfer);
pipe->transfer_destroy(pipe, wdt->transfer);
pipe->flush(pipe, 0, NULL);
pipe->flush(pipe, NULL);
wdt->transfer = NULL;
}

View File

@@ -76,7 +76,7 @@ display_front_buffer(struct st_context *st)
}
void st_flush( struct st_context *st, uint pipeFlushFlags,
void st_flush( struct st_context *st,
struct pipe_fence_handle **fence )
{
FLUSH_CURRENT(st->ctx, 0);
@@ -89,7 +89,7 @@ void st_flush( struct st_context *st, uint pipeFlushFlags,
util_blit_flush(st->blit);
util_gen_mipmap_flush(st->gen_mipmap);
st->pipe->flush( st->pipe, pipeFlushFlags, fence );
st->pipe->flush( st->pipe, fence );
}
@@ -100,7 +100,7 @@ void st_finish( struct st_context *st )
{
struct pipe_fence_handle *fence = NULL;
st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
st_flush(st, &fence);
if(fence) {
st->pipe->screen->fence_finish(st->pipe->screen, fence,
@@ -123,7 +123,7 @@ static void st_glFlush(struct gl_context *ctx)
* synchronization issues. Calling finish() here will just hide
* problems that need to be fixed elsewhere.
*/
st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
st_flush(st, NULL);
if (is_front_buffer_dirty(st)) {
display_front_buffer(st);

View File

@@ -40,7 +40,7 @@ extern void
st_init_flush_functions(struct dd_function_table *functions);
extern void
st_flush(struct st_context *st, uint pipeFlushFlags,
st_flush(struct st_context *st,
struct pipe_fence_handle **fence);
extern void

View File

@@ -72,7 +72,7 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
assert(so->fence == NULL);
pipe->flush(pipe, 0, &so->fence);
pipe->flush(pipe, &so->fence);
}
static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)

View File

@@ -502,8 +502,8 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
struct pipe_fence_handle **fence)
{
struct st_context *st = (struct st_context *) stctxi;
st_flush(st, flags, fence);
if (flags & PIPE_FLUSH_RENDER_CACHE)
st_flush(st, fence);
if (flags & ST_FLUSH_FRONT)
st_manager_flush_frontbuffer(st);
}