From: Marek Olšák Date: Fri, 21 Dec 2012 16:03:22 +0000 (+0100) Subject: gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=598cc1f74d7ae924e84dee801b456ab7b0b22f84;p=mesa.git gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag Usage with pipe_context: pipe->flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME); Usage with st_context_iface: st->flush(st, ST_FLUSH_END_OF_FRAME, NULL); The flag is only a hint for drivers. Radeon will use it for buffer eviction heuristics in the kernel (e.g. for queries like how many frames have passed since a buffer was used). The flag is currently only generated by st/dri on SwapBuffers. Reviewed-by: Brian Paul Reviewed-by: Stéphane Marchesin --- diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 151c8f48f5e..8901b6ab712 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -843,13 +843,13 @@ galahad_context_clear_depth_stencil(struct pipe_context *_pipe, static void galahad_context_flush(struct pipe_context *_pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; - pipe->flush(pipe, - fence); + pipe->flush(pipe, fence, flags); } static struct pipe_sampler_view * diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c index 50d6642e5a3..d44b6f77c7f 100644 --- a/src/gallium/drivers/i915/i915_flush.c +++ b/src/gallium/drivers/i915/i915_flush.c @@ -39,7 +39,8 @@ static void i915_flush_pipe( struct pipe_context *pipe, - struct pipe_fence_handle **fence ) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags ) { struct i915_context *i915 = i915_context(pipe); diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index 76b232fd3e1..d9f58c01ac1 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -762,7 +762,7 @@ i915_texture_transfer_map(struct pipe_context *pipe, } else { /* TODO this is a sledgehammer */ tex = i915_texture(resource); - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); } offset = i915_texture_offset(tex, transfer->b.level, box->z); @@ -805,7 +805,7 @@ i915_texture_transfer_unmap(struct pipe_context *pipe, itransfer->b.box.x, itransfer->b.box.y, itransfer->b.box.z, itransfer->staging_texture, 0, &sbox); - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); pipe_resource_reference(&itransfer->staging_texture, NULL); } diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 0325b151f83..d0b67ef3a97 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -711,13 +711,13 @@ identity_clear_depth_stencil(struct pipe_context *_pipe, static void identity_flush(struct pipe_context *_pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; - pipe->flush(pipe, - fence); + pipe->flush(pipe, fence, flags); } static struct pipe_sampler_view * diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index eb454b1c41f..25b1cd06319 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -98,7 +98,8 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) static void do_flush( struct pipe_context *pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { llvmpipe_flush(pipe, fence, __FUNCTION__); } diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index b7c73cf084d..02588d9d79c 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -242,7 +242,8 @@ static void noop_blit(struct pipe_context *ctx, * context */ static void noop_flush(struct pipe_context *ctx, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { } diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index 31519de7a24..b0aee8d5755 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -67,7 +67,8 @@ nv30_context_kick_notify(struct nouveau_pushbuf *push) } static void -nv30_context_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence) +nv30_context_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct nv30_context *nv30 = nv30_context(pipe); struct nouveau_pushbuf *push = nv30->base.pushbuf; diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 24ca9f478f0..08e576a214e 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -33,7 +33,8 @@ static void nv50_flush(struct pipe_context *pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct nouveau_screen *screen = nouveau_screen(pipe->screen); diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index e235fe1d4ca..6325ac859f4 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -33,7 +33,8 @@ static void nvc0_flush(struct pipe_context *pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_screen *screen = &nvc0->screen->base; diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 2170c591f99..978a5d93ccf 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -133,7 +133,8 @@ void r300_flush(struct pipe_context *pipe, } static void r300_flush_wrapped(struct pipe_context *pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { r300_flush(pipe, 0, fence); } diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 83d474b04cc..e33ea13f996 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -143,7 +143,8 @@ void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, } static void r600_flush_from_st(struct pipe_context *ctx, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { r600_flush(ctx, fence, 0); } diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index 6eee8825161..6f32a376d70 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -158,7 +158,8 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, } static void r600_flush_from_st(struct pipe_context *ctx, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { radeonsi_flush(ctx, fence, 0); } diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 28f300877cf..36fa8b75f4d 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -941,14 +941,14 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe, static void rbug_flush(struct pipe_context *_pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; pipe_mutex_lock(rb_pipe->call_mutex); - pipe->flush(pipe, - fence); + pipe->flush(pipe, fence, flags); pipe_mutex_unlock(rb_pipe->call_mutex); } diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c index 9cbc0e02f4a..0277b13b24c 100644 --- a/src/gallium/drivers/rbug/rbug_core.c +++ b/src/gallium/drivers/rbug/rbug_core.c @@ -497,7 +497,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, NULL); + rb_context->pipe->flush(rb_context->pipe, NULL, 0); pipe_mutex_unlock(rb_context->call_mutex); pipe_mutex_unlock(rb_screen->list_mutex); diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index e28236afc50..b3e291f1b7e 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -93,8 +93,9 @@ softpipe_flush( struct pipe_context *pipe, } void -softpipe_flush_wrapped( struct pipe_context *pipe, - struct pipe_fence_handle **fence ) +softpipe_flush_wrapped(struct pipe_context *pipe, + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { softpipe_flush(pipe, SP_FLUSH_TEXTURE_CACHE, fence); } diff --git a/src/gallium/drivers/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h index ab01c249abe..d406103809d 100644 --- a/src/gallium/drivers/softpipe/sp_flush.h +++ b/src/gallium/drivers/softpipe/sp_flush.h @@ -41,8 +41,9 @@ softpipe_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence); void -softpipe_flush_wrapped( struct pipe_context *pipe, - struct pipe_fence_handle **fence ); +softpipe_flush_wrapped(struct pipe_context *pipe, + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags); boolean softpipe_flush_resource(struct pipe_context *pipe, diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c index 4578c136cb8..353723df58a 100644 --- a/src/gallium/drivers/svga/svga_pipe_flush.c +++ b/src/gallium/drivers/svga/svga_pipe_flush.c @@ -32,7 +32,8 @@ static void svga_flush( struct pipe_context *pipe, - struct pipe_fence_handle **fence ) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct svga_context *svga = svga_context(pipe); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 64d039c7389..9668aace6e1 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1284,7 +1284,8 @@ trace_context_clear_depth_stencil(struct pipe_context *_pipe, static INLINE void trace_context_flush(struct pipe_context *_pipe, - struct pipe_fence_handle **fence) + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; @@ -1292,8 +1293,9 @@ 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, fence); + pipe->flush(pipe, fence, flags); if(fence) trace_dump_ret(ptr, *fence); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index c5dcae56501..7ed946e2ca9 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -31,6 +31,7 @@ #include "p_compiler.h" #include "p_format.h" #include "p_video_enums.h" +#include "p_defines.h" #ifdef __cplusplus extern "C" { @@ -349,8 +350,9 @@ struct pipe_context { /** Flush draw commands */ - void (*flush)( struct pipe_context *pipe, - struct pipe_fence_handle **fence ); + void (*flush)(struct pipe_context *pipe, + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags); /** * Create a view on a texture to be used by a shader stage. diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 5c4ce8bcfeb..4a0594fc1df 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -288,6 +288,12 @@ enum pipe_transfer_usage { }; +/** + * Flags for the flush function. + */ +enum pipe_flush_flags { + PIPE_FLUSH_END_OF_FRAME = (1 << 0) +}; /* * Resource binding flags -- state tracker must specify in advance all diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 419f825696c..9f3d2a12cb4 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -158,6 +158,7 @@ enum st_context_resource_type { * Flush flags. */ #define ST_FLUSH_FRONT (1 << 0) +#define ST_FLUSH_END_OF_FRAME (1 << 1) /** * Value to st_manager->get_param function. diff --git a/src/gallium/state_trackers/clover/core/queue.cpp b/src/gallium/state_trackers/clover/core/queue.cpp index 7e476c715e0..cd961efbf2f 100644 --- a/src/gallium/state_trackers/clover/core/queue.cpp +++ b/src/gallium/state_trackers/clover/core/queue.cpp @@ -53,7 +53,7 @@ _cl_command_queue::flush() { [](event_ptr &ev) { return !ev->signalled(); }); // Flush and fence them. - pipe->flush(pipe, &fence); + pipe->flush(pipe, &fence, 0); std::for_each(first, last, [&](event_ptr &ev) { ev->fence(fence); }); screen->fence_reference(screen, &fence, NULL); queued_events.erase(first, last); diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index dc63fb90704..2b03dfe5a93 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -1234,7 +1234,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectsurface_destroy(pipe, dst_surface); - pipe->flush(pipe, 0); + pipe->flush(pipe, NULL, 0); memset(&ctrl, 0, sizeof(ctrl)); ctrl.natt = (db) ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT; diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c index ee4d11d1495..2ea54781d17 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.c +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c @@ -441,6 +441,8 @@ dri_flush(__DRIcontext *cPriv, flush_flags = 0; if (flags & __DRI2_FLUSH_CONTEXT) flush_flags |= ST_FLUSH_FRONT; + if (reason == __DRI2_THROTTLE_SWAPBUFFER) + flush_flags |= ST_FLUSH_END_OF_FRAME; /* Flush the context and throttle if needed. */ if (dri_screen(ctx->sPriv)->throttling_enabled && diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 7f4f2f00c77..f8d311ca8fa 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -420,7 +420,7 @@ dri2_flush_frontbuffer(struct dri_context *ctx, struct pipe_context *pipe = ctx->st->pipe; dri_msaa_resolve(ctx, drawable, ST_ATTACHMENT_FRONT_LEFT); - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); } if (loader->flushFrontBuffer) { diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp b/src/gallium/state_trackers/egl/android/native_android.cpp index 01d3a02d364..267727d5d99 100644 --- a/src/gallium/state_trackers/egl/android/native_android.cpp +++ b/src/gallium/state_trackers/egl/android/native_android.cpp @@ -387,7 +387,7 @@ copy_resources(struct native_display *ndpy, u_box_origin_2d(src->width0, src->height0, &box); pipe->resource_copy_region(pipe, dst, 0, 0, 0, 0, src, 0, &box); - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); } static boolean diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c index ebe5144b367..99259b816c0 100644 --- a/src/gallium/state_trackers/egl/common/native_helper.c +++ b/src/gallium/state_trackers/egl/common/native_helper.c @@ -352,7 +352,7 @@ resource_surface_flush(struct resource_surface *rsurf, if (!pipe) return FALSE; - pipe->flush(pipe, &fence); + pipe->flush(pipe, &fence, 0); if (fence == NULL) return FALSE; @@ -398,7 +398,7 @@ native_display_copy_to_pixmap(struct native_display *ndpy, u_box_origin_2d(src->width0, src->height0, &src_box); pipe->resource_copy_region(pipe, dst, 0, 0, 0, 0, src, 0, &src_box); - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); memset(&ctrl, 0, sizeof(ctrl)); ctrl.natt = natt; diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 349654d0625..3dd7f05375e 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -275,7 +275,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, ); pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL); - pipe->flush(pipe, &surf->fence); + pipe->flush(pipe, &surf->fence, 0); if (dump_window == -1) { dump_window = debug_get_num_option("VDPAU_DUMP", 0); diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index c987979f1f4..5c06f8511aa 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -359,5 +359,5 @@ vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf) pipe->clear_render_target(pipe, surfaces[i], &c, 0, 0, surfaces[i]->width, surfaces[i]->height); } - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); } diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c index 19e42dd1562..055277cd76e 100644 --- a/src/gallium/state_trackers/vega/api_context.c +++ b/src/gallium/state_trackers/vega/api_context.c @@ -56,7 +56,7 @@ void vegaFlush(void) return; pipe = ctx->pipe; - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); vg_manager_flush_frontbuffer(ctx); } @@ -72,7 +72,7 @@ void vegaFinish(void) pipe = ctx->pipe; - pipe->flush(pipe, &fence); + pipe->flush(pipe, &fence, 0); if (fence) { pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index c8531f8b53a..7b35f3afeeb 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -143,7 +143,13 @@ 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, fence); + enum pipe_flush_flags pipe_flags = 0; + + if (flags & ST_FLUSH_END_OF_FRAME) { + pipe_flags |= PIPE_FLUSH_END_OF_FRAME; + } + + ctx->pipe->flush(ctx->pipe, fence, pipe_flags); if (flags & ST_FLUSH_FRONT) vg_manager_flush_frontbuffer(ctx); } diff --git a/src/gallium/state_trackers/xa/xa_composite.c b/src/gallium/state_trackers/xa/xa_composite.c index 17d2d7f727d..eb949b93cd1 100644 --- a/src/gallium/state_trackers/xa/xa_composite.c +++ b/src/gallium/state_trackers/xa/xa_composite.c @@ -527,7 +527,7 @@ XA_EXPORT void xa_composite_done(struct xa_context *ctx) { renderer_draw_flush(ctx); - ctx->pipe->flush(ctx->pipe, &ctx->last_fence); + ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); ctx->comp = NULL; ctx->has_solid_color = FALSE; diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index 7b7a90343df..b31d555c50a 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -119,7 +119,7 @@ xa_surface_dma(struct xa_context *ctx, } pipe->transfer_unmap(pipe, transfer); if (to_surface) - pipe->flush(pipe, &ctx->last_fence); + pipe->flush(pipe, &ctx->last_fence, 0); } return XA_ERR_NONE; } @@ -244,9 +244,9 @@ xa_copy_done(struct xa_context *ctx) { if (!ctx->simple_copy) { renderer_draw_flush(ctx); - ctx->pipe->flush(ctx->pipe, &ctx->last_fence); + ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); } else - ctx->pipe->flush(ctx->pipe, &ctx->last_fence); + ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); } static void @@ -325,7 +325,7 @@ XA_EXPORT void xa_solid_done(struct xa_context *ctx) { renderer_draw_flush(ctx); - ctx->pipe->flush(ctx->pipe, &ctx->last_fence); + ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0); ctx->comp = NULL; ctx->has_solid_color = FALSE; diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c index 8bd40ddc7d2..3410144141d 100644 --- a/src/gallium/state_trackers/xa/xa_tracker.c +++ b/src/gallium/state_trackers/xa/xa_tracker.c @@ -407,7 +407,7 @@ xa_surface_redefine(struct xa_surface *srf, xa_min(save_height, template->height0), &src_box); pipe->resource_copy_region(pipe, texture, 0, 0, 0, 0, srf->tex, 0, &src_box); - pipe->flush(pipe, &xa->default_ctx->last_fence); + pipe->flush(pipe, &xa->default_ctx->last_fence, 0); } pipe_resource_reference(&srf->tex, texture); diff --git a/src/gallium/state_trackers/xa/xa_yuv.c b/src/gallium/state_trackers/xa/xa_yuv.c index 912ea77c753..9c7c4d68781 100644 --- a/src/gallium/state_trackers/xa/xa_yuv.c +++ b/src/gallium/state_trackers/xa/xa_yuv.c @@ -153,7 +153,7 @@ xa_yuv_planar_blit(struct xa_context *r, box++; } - r->pipe->flush(r->pipe, &r->last_fence); + r->pipe->flush(r->pipe, &r->last_fence, 0); xa_ctx_sampler_views_destroy(r); xa_ctx_srf_destroy(r); diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 11888096e66..3cbffb59802 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -248,7 +248,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) transfer->stride, 0, 0, 64, 64, (void*)image, 64 * 4, 0, 0); ctx->transfer_unmap(ctx, transfer); - ctx->flush(ctx, &fence); + ctx->flush(ctx, &fence, 0); if (fence) { screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 04e6a211def..fb50ef8ca11 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -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, NULL); + ms->ctx->flush(ms->ctx, NULL, 0); return; } /* pixmap glXWaitGL */ @@ -394,7 +394,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, ms->ctx->flush(ms->ctx, (pDestBuffer->attachment == DRI2BufferFrontLeft && ms->swapThrottling) ? - &dst_priv->fence : NULL); + &dst_priv->fence : NULL, 0); if (cust && cust->winsys_context_throttle) cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_RENDER); diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 69038d9ef47..9d7713c8f5d 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -551,7 +551,7 @@ void xorg_flush(ScreenPtr pScreen) ms->ctx->flush(ms->ctx, ms->dirtyThrottling ? &ms->fence[XORG_NR_FENCES-1] : - NULL); + NULL, 0); if (ms->dirtyThrottling) { if (ms->fence[0]) diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index d78ab74aeef..f010be65227 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -1071,7 +1071,7 @@ xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv) void xorg_exa_flush(struct exa_context *exa, struct pipe_fence_handle **fence) { - exa->pipe->flush(exa->pipe, fence); + exa->pipe->flush(exa->pipe, fence, 0); } void xorg_exa_finish(struct exa_context *exa) diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c index fd3f26c5070..99d2d7072a1 100644 --- a/src/gallium/state_trackers/xvmc/surface.c +++ b/src/gallium/state_trackers/xvmc/surface.c @@ -434,7 +434,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, vl_compositor_set_layer_dst_area(cstate, 1, &dst_rect); vl_compositor_render(cstate, compositor, surf, dirty_area); - pipe->flush(pipe, &surface_priv->fence); + pipe->flush(pipe, &surface_priv->fence, 0); XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface); diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c index 0b78be80a8c..6afdf40aa3a 100644 --- a/src/gallium/tests/graw/clear.c +++ b/src/gallium/tests/graw/clear.c @@ -29,7 +29,7 @@ static void draw( void ) union pipe_color_union clear_color = { {1, 0, 1, 1} }; ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0); - ctx->flush(ctx, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/fs-fragcoord.c b/src/gallium/tests/graw/fs-fragcoord.c index fc4e6b6d4e7..75225b6e858 100644 --- a/src/gallium/tests/graw/fs-fragcoord.c +++ b/src/gallium/tests/graw/fs-fragcoord.c @@ -185,7 +185,7 @@ draw(void) PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, &clear_color, 1.0, 0); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, NUM_VERTS); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); #if 0 /* At the moment, libgraw leaks out/makes available some of the diff --git a/src/gallium/tests/graw/fs-frontface.c b/src/gallium/tests/graw/fs-frontface.c index b9598f562bb..faa43f335c9 100644 --- a/src/gallium/tests/graw/fs-frontface.c +++ b/src/gallium/tests/graw/fs-frontface.c @@ -159,7 +159,7 @@ draw(void) PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, &clear_color, 1.0, 0); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, NUM_VERTS); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); graw_util_flush_front(&info); } diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 2c02f4f1297..0d6e5d3f01c 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -236,7 +236,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, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/fs-write-z.c b/src/gallium/tests/graw/fs-write-z.c index a196cbbe54a..74ab2f475ba 100644 --- a/src/gallium/tests/graw/fs-write-z.c +++ b/src/gallium/tests/graw/fs-write-z.c @@ -164,7 +164,7 @@ draw(void) PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, &clear_color, 1.0, 0); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, NUM_VERTS); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); #if 0 /* At the moment, libgraw leaks out/makes available some of the diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 0bd5e29fdd5..8af0c379c16 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -343,7 +343,7 @@ static void draw( void ) else util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3); - ctx->flush(ctx, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/occlusion-query.c b/src/gallium/tests/graw/occlusion-query.c index d522bce038c..51d6326c2ba 100644 --- a/src/gallium/tests/graw/occlusion-query.c +++ b/src/gallium/tests/graw/occlusion-query.c @@ -193,7 +193,7 @@ draw(void) if (res2.u64 < expected2_min || res2.u64 > expected2_max) printf(" Failure: result2 should be near %d\n", expected2); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); graw_util_flush_front(&info); diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index c9e7646e8e2..2722dd5fbb0 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -152,7 +152,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, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 7eb9104a574..46f8be0c446 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -107,7 +107,7 @@ static void draw( void ) info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); graw_save_surface_to_file(info.ctx, info.color_surf[0], NULL); diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index b685fb98494..e612e62c82a 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -152,7 +152,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, NULL); + ctx->flush(ctx, NULL, 0); ctx->bind_fs_state(ctx, NULL); ctx->delete_fs_state(ctx, fs); diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c index 5442f94f722..296d22afc54 100644 --- a/src/gallium/tests/graw/tex-srgb.c +++ b/src/gallium/tests/graw/tex-srgb.c @@ -136,7 +136,7 @@ static void draw( void ) set_vertices(vertices2, 4); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); graw_util_flush_front(&info); } diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c index 7807b0b80a2..4ee79ee7a24 100644 --- a/src/gallium/tests/graw/tex-swizzle.c +++ b/src/gallium/tests/graw/tex-swizzle.c @@ -108,7 +108,7 @@ static void draw(void) info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0); util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); graw_util_flush_front(&info); } diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 8fdc28d58da..73793401c9d 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -166,7 +166,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, NULL); + ctx->flush(ctx, NULL, 0); screen->flush_frontbuffer(screen, tex, 0, 0, window); } diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 651518a14ed..3f29c9bdead 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -215,7 +215,7 @@ static void draw( void ) ctx->draw_vbo(ctx, &info); - ctx->flush(ctx, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 71dd51afd87..22b3de8803a 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -105,7 +105,7 @@ static void draw( void ) info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0); util_draw_arrays(info.ctx, PIPE_PRIM_TRIANGLES, 0, 3); - info.ctx->flush(info.ctx, NULL); + info.ctx->flush(info.ctx, NULL, 0); graw_save_surface_to_file(info.ctx, info.color_surf[0], NULL); diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index e0358e6868f..0274ee0b542 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -230,7 +230,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, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index db99789280f..e9e1f0e4168 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -333,7 +333,7 @@ static void draw(struct program *p) 4, /* verts */ 2); /* attribs/vert */ - p->pipe->flush(p->pipe, NULL); + p->pipe->flush(p->pipe, NULL, 0); debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]); } diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c index 2c11f72da3a..ad88b869c8d 100644 --- a/src/gallium/tests/trivial/tri.c +++ b/src/gallium/tests/trivial/tri.c @@ -266,7 +266,7 @@ static void draw(struct program *p) 3, /* verts */ 2); /* attribs/vert */ - p->pipe->flush(p->pipe, NULL); + p->pipe->flush(p->pipe, NULL, 0); debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]); } diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 24e679dec48..e552ac24352 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -242,7 +242,7 @@ wsw_dt_unmap(struct sw_winsys *ws, return; pipe->transfer_unmap(pipe, wdt->transfer); - pipe->flush(pipe, NULL); + pipe->flush(pipe, NULL, 0); wdt->transfer = NULL; } diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 7c9f91f1bc7..b569e3b3c6f 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -76,15 +76,16 @@ display_front_buffer(struct st_context *st) } -void st_flush( struct st_context *st, - struct pipe_fence_handle **fence ) +void st_flush(struct st_context *st, + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags) { FLUSH_VERTICES(st->ctx, 0); FLUSH_CURRENT(st->ctx, 0); st_flush_bitmap_cache(st); - st->pipe->flush( st->pipe, fence ); + st->pipe->flush(st->pipe, fence, flags); } @@ -95,7 +96,7 @@ void st_finish( struct st_context *st ) { struct pipe_fence_handle *fence = NULL; - st_flush(st, &fence); + st_flush(st, &fence, 0); if(fence) { st->pipe->screen->fence_finish(st->pipe->screen, fence, @@ -118,7 +119,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, NULL); + st_flush(st, NULL, 0); if (is_front_buffer_dirty(st)) { display_front_buffer(st); diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h index 598536ba045..003e2a2a940 100644 --- a/src/mesa/state_tracker/st_cb_flush.h +++ b/src/mesa/state_tracker/st_cb_flush.h @@ -41,7 +41,8 @@ st_init_flush_functions(struct dd_function_table *functions); extern void st_flush(struct st_context *st, - struct pipe_fence_handle **fence); + struct pipe_fence_handle **fence, + enum pipe_flush_flags flags); extern void st_finish(struct st_context *st); diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c index f9f2348a3e1..94bf4861da9 100644 --- a/src/mesa/state_tracker/st_cb_syncobj.c +++ b/src/mesa/state_tracker/st_cb_syncobj.c @@ -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, &so->fence); + pipe->flush(pipe, &so->fence, 0); } static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 30f5ca5ed1e..a3a67712a2f 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -455,7 +455,13 @@ 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, fence); + enum pipe_flush_flags pipe_flags = 0; + + if (flags & ST_FLUSH_END_OF_FRAME) { + pipe_flags |= PIPE_FLUSH_END_OF_FRAME; + } + + st_flush(st, fence, pipe_flags); if (flags & ST_FLUSH_FRONT) st_manager_flush_frontbuffer(st); }