gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag
authorMarek Olšák <maraeo@gmail.com>
Fri, 21 Dec 2012 16:03:22 +0000 (17:03 +0100)
committerMarek Olšák <maraeo@gmail.com>
Fri, 4 Jan 2013 12:18:33 +0000 (13:18 +0100)
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 <brianp@vmware.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
63 files changed:
src/gallium/drivers/galahad/glhd_context.c
src/gallium/drivers/i915/i915_flush.c
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/noop/noop_pipe.c
src/gallium/drivers/nv30/nv30_context.c
src/gallium/drivers/nv50/nv50_context.c
src/gallium/drivers/nvc0/nvc0_context.c
src/gallium/drivers/r300/r300_flush.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeonsi/radeonsi_pipe.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/drivers/rbug/rbug_core.c
src/gallium/drivers/softpipe/sp_flush.c
src/gallium/drivers/softpipe/sp_flush.h
src/gallium/drivers/svga/svga_pipe_flush.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/clover/core/queue.cpp
src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
src/gallium/state_trackers/dri/common/dri_drawable.c
src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/state_trackers/egl/android/native_android.cpp
src/gallium/state_trackers/egl/common/native_helper.c
src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/vdpau/surface.c
src/gallium/state_trackers/vega/api_context.c
src/gallium/state_trackers/vega/vg_manager.c
src/gallium/state_trackers/xa/xa_composite.c
src/gallium/state_trackers/xa/xa_context.c
src/gallium/state_trackers/xa/xa_tracker.c
src/gallium/state_trackers/xa/xa_yuv.c
src/gallium/state_trackers/xorg/xorg_crtc.c
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xvmc/surface.c
src/gallium/tests/graw/clear.c
src/gallium/tests/graw/fs-fragcoord.c
src/gallium/tests/graw/fs-frontface.c
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/fs-write-z.c
src/gallium/tests/graw/gs-test.c
src/gallium/tests/graw/occlusion-query.c
src/gallium/tests/graw/quad-sample.c
src/gallium/tests/graw/quad-tex.c
src/gallium/tests/graw/shader-leak.c
src/gallium/tests/graw/tex-srgb.c
src/gallium/tests/graw/tex-swizzle.c
src/gallium/tests/graw/tri-gs.c
src/gallium/tests/graw/tri-instanced.c
src/gallium/tests/graw/tri.c
src/gallium/tests/graw/vs-test.c
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c
src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
src/mesa/state_tracker/st_cb_flush.c
src/mesa/state_tracker/st_cb_flush.h
src/mesa/state_tracker/st_cb_syncobj.c
src/mesa/state_tracker/st_manager.c

index 151c8f48f5e5dca908cdef1908a5b462718f81bc..8901b6ab712fa8116d6741972e00fb6954c4e976 100644 (file)
@@ -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 *
index 50d6642e5a3edce0cabfeea6c2cb98f755b72777..d44b6f77c7f44d60ce39243148151867b5c09488 100644 (file)
@@ -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);
 
index 76b232fd3e11cca1fa12715d990d0067839b033f..d9f58c01ac19e4daab958e56d439c7fbc1d184ff 100644 (file)
@@ -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);
    }
 
index 0325b151f834c943ddf53897db99bbe10826524c..d0b67ef3a975b70c8aa39dd42c986cc41043309f 100644 (file)
@@ -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 *
index eb454b1c41f946d7b2a04583ab673ca87d85e946..25b1cd063196dbb2b3b7c6804d9ff19ccaa084bf 100644 (file)
@@ -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__);
 }
index b7c73cf084da6af500792a5e8ebeea78cbfa2d88..02588d9d79c30d769729eeab302bc3390c3a6a17 100644 (file)
@@ -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)
 {
 }
 
index 31519de7a2438bcf19222e28988ab445f2101a03..b0aee8d5755079381eb930de59a42e48df0d9bf4 100644 (file)
@@ -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;
index 24ca9f478f084235535617f166786f11870fd111..08e576a214e85ac6c736037e1128c233a36104cc 100644 (file)
@@ -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);
 
index e235fe1d4cabf138c6ca77117b2a827a811252ac..6325ac859f4cfe19ebf2a4784f0f4c536727b587 100644 (file)
@@ -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;
index 2170c591f99465092876844e828211a3f2008343..978a5d93ccf81a88ea59bdcd6c6b13886020080d 100644 (file)
@@ -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);
 }
index 83d474b04cc61f866ff02012fd630acb839cd2f1..e33ea13f996f99b5b7f75b3381936eedb6ba4266 100644 (file)
@@ -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);
 }
index 6eee8825161e0d9cfac8b3976728ce576ff16a5d..6f32a376d7013247ad482ac9513bc9362b242581 100644 (file)
@@ -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);
 }
index 28f300877cf9cbda4a990d929b118c2290f72945..36fa8b75f4d7a6dbf5ca13d80ad91fc0a1f0c5e8 100644 (file)
@@ -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);
 }
 
index 9cbc0e02f4afc6c7e2f04c3f053abff0d84dc2cb..0277b13b24ca0c47e78a0deb79581b5452caf3b1 100644 (file)
@@ -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);
index e28236afc5065bbb35d9e4de38d473ef16ab5fe8..b3e291f1b7ee4a828fbe4eb24d6c46d09b855701 100644 (file)
@@ -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);
 }
index ab01c249abe1c639ebfa3a79b656f623d30d1ce5..d406103809d80864e8b8eaac972b7f2c07b12167 100644 (file)
@@ -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,
index 4578c136cb8787bfbb216238fdad434a0ea9e41a..353723df58a045918a077fd0329bbd29709f0f48 100644 (file)
@@ -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);
 
index 64d039c7389db2f9c6c0e28bdac3a7017427d91c..9668aace6e1c3212651660a59d16b6852d9bdd08 100644 (file)
@@ -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);
index c5dcae565011fe699d687d69ba59f65db1bf8a8f..7ed946e2ca957cd9fcba7477c5e6b512aaf96165 100644 (file)
@@ -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.
index 5c4ce8bcfebaa4ead5ecaaf8dd241a7971b3b1d4..4a0594fc1df6758d16410c85a5cf2b86dd09999c 100644 (file)
@@ -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
index 419f825696cc7ab84620204a7d6318a7f3d01d05..9f3d2a12cb4f8443cb209f7cd174fff747b7bc53 100644 (file)
@@ -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.
index 7e476c715e09407ddd685825ac5f47d2905a8bb9..cd961efbf2f0ecc5cb6c6f945acead7fcb76655c 100644 (file)
@@ -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);
index dc63fb907045e7d6ee81f6dcc0aaac4f4ae9b872..2b03dfe5a935a1bfba88a9933695d4b215e2b575 100644 (file)
@@ -1234,7 +1234,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
                if(dst_surface)
                        pipe->surface_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;
index ee4d11d1495c23c0f77cd378d3d78901225d0d86..2ea54781d17f45615f7d4dc7a82d091c83bffd09 100644 (file)
@@ -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 &&
index 7f4f2f00c776f236049d8fe0ade033302e8f473d..f8d311ca8fa1c5b10077fb087d5f67a393edf520 100644 (file)
@@ -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) {
index 01d3a02d364f5411a03ec2a596e4af69af8ac4e2..267727d5d993325b8353411f87962779d3a2583c 100644 (file)
@@ -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
index ebe5144b36799819fab79c5b712f05c37c38ee76..99259b816c0eb847cf6cb4b346af0a4754b862d6 100644 (file)
@@ -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;
index 349654d06257b5bc3db9f7292395db428fd1a311..3dd7f05375e7368b6d85166890c4fe29a636b00e 100644 (file)
@@ -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);
index c987979f1f4e50eb7639a18f345655d48271e9ad..5c06f8511aaf3a79ad1e2e96acd227c9f8ee4433 100644 (file)
@@ -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);
 }
index 19e42dd1562bb6a81f2f8625428ed6e656972616..055277cd76e24a46a5330fd79e621ffec5b483d7 100644 (file)
@@ -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);
index c8531f8b53a2008fcbec74cc651580f0b782cdd9..7b35f3afeeb5b776c9d05eb23f6c11636420eca2 100644 (file)
@@ -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);
 }
index 17d2d7f727d9abb5fd6f441fb1d559bd2810a74d..eb949b93cd194cf93d22ac2d33924aef1357be2f 100644 (file)
@@ -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;
index 7b7a90343df99066bc3c42a6e1c46c33cef9b035..b31d555c50a0e8398a68d0f562727d520cdbae8e 100644 (file)
@@ -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;
index 8bd40ddc7d2ee36f01db59d9531c41c28287fee3..3410144141d7a6b632c7b9320838cb4b35b63ee7 100644 (file)
@@ -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);
index 912ea77c753a1f5177d9c96eccd27dcd2d665662..9c7c4d68781801f5f22f3e557323012d13b8b073 100644 (file)
@@ -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);
index 11888096e66f3479dabb122b62bfd10d72080526..3cbffb5980255cd77b622aa880b3a9a21cf7ef69 100644 (file)
@@ -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);
index 04e6a211def940169bf028b1c98eae26f43e2355..fb50ef8ca119171c8ce5d3d24687a015bebb65ec 100644 (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, 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);
index 69038d9ef4798f1ebc900b7d54089ed59cf2a8bd..9d7713c8f5dae37b38f2e1923aedf592d40548fc 100644 (file)
@@ -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])
index d78ab74aeef4ad4121079f88861a08488234b056..f010be6522706a1f5a37840d9915faf8e9959560 100644 (file)
@@ -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)
index fd3f26c50705bf3b6152141cbd3d777ccf40746f..99d2d7072a150fe08906d6e38dafbf10f744cd9b 100644 (file)
@@ -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);
 
index 0b78be80a8c0c99cc4aaaf552c44ac4d75361a79..6afdf40aa3aaec4478ebfb7543a4e43f58ea51fd 100644 (file)
@@ -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);
 
index fc4e6b6d4e77dedd91a5bb017b8f56cc94178e7e..75225b6e8584b80daa4305d30902c7fd9b8217a3 100644 (file)
@@ -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
index b9598f562bbe4ed8e39e221b2d916666a80bb61e..faa43f335c97e5daac0ba95eacb139aaa4e027bc 100644 (file)
@@ -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);
 }
index 2c02f4f1297b2a337c45ed477a17c925c7f20bee..0d6e5d3f01c0be73373407db73cfacc3860a803d 100644 (file)
@@ -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);
 
index a196cbbe54ab24382acb2f88b242d3d264150427..74ab2f475ba986e80fd2874c2ad26966bfc5bb2c 100644 (file)
@@ -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
index 0bd5e29fdd568965f06fe4bf55edc46766d4fd20..8af0c379c16812592b358d4621d5acbefec05899 100644 (file)
@@ -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);
 
index d522bce038cebef817e16a7ffeced21a92a71949..51d6326c2baf27e5530522f515f4818917ebc5e7 100644 (file)
@@ -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);
 
index c9e7646e8e2fe712ff9ea91aa11c00a3b3c25a97..2722dd5fbb065bf845d8e9407a9ef6ddc3023292 100644 (file)
@@ -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);
 
index 7eb9104a5749f1826f144b6b08c9cde5a0abe022..46f8be0c44660805b9d71b45ba6566a32d5d74e5 100644 (file)
@@ -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);
 
index b685fb98494c3a519b6f947403319dd28d716bfa..e612e62c82a6329c347c11e8d4b516a82429f01c 100644 (file)
@@ -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);
index 5442f94f722b6c115504593ce37c9cb1915ce359..296d22afc541ed4a3500c0408183f32cf22ceefc 100644 (file)
@@ -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);
 }
index 7807b0b80a290edee535d4d5882b77a8b53bce98..4ee79ee7a24da058fddeae505cc351fe68f4a6f6 100644 (file)
@@ -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);
 }
index 8fdc28d58da958ef235f08662442da8b445c289d..73793401c9d211fc1beda51ffc911a2da2483b59 100644 (file)
@@ -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);
 }
index 651518a14ed8bd8c3dcc067f58ffd2f918b91ea6..3f29c9bdead1996d1ddd7e7daf3026e73f372975 100644 (file)
@@ -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);
 
index 71dd51afd876edf71afafa75f66af93a2d5727bb..22b3de8803ae81d9f08a355cc84b7034f799043e 100644 (file)
@@ -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);
 
index e0358e6868ffe620579d74dbb428e61e905a5d05..0274ee0b5420e21c32753eacc52207ab6d6cb8b1 100644 (file)
@@ -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);
 
index db99789280f75b0f02b9e18db21ce590071626a8..e9e1f0e4168107727530854d8de64b7fad60f131 100644 (file)
@@ -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]);
 }
index 2c11f72da3adcf0f9ba5ef6ea70650980239d1ed..ad88b869c8d45e4d476bf30d0daf09670933138e 100644 (file)
@@ -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]);
 }
index 24e679dec48c42aa75661c3d04b15dc6f95d1a5b..e552ac243525a720b4149ed95364a1dbcb689a6e 100644 (file)
@@ -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;
 }
 
index 7c9f91f1bc759be1e4e1e4eba0adbecf8540c7c1..b569e3b3c6f50f00f886c6a1670c301626e8264b 100644 (file)
@@ -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);
index 598536ba045a657f713c18c57c068bf56ce1b649..003e2a2a940177842b0e2558ab78c2a7d7153264 100644 (file)
@@ -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);
index f9f2348a3e1ece4da2c2857d2ed3891624dc1018..94bf4861da92c1333b7e7ff0bbd9aa932f0107f2 100644 (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, &so->fence);
+   pipe->flush(pipe, &so->fence, 0);
 }
 
 static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
index 30f5ca5ed1e59347bbf39bd5e0f6d4c51b4553b7..a3a67712a2ffbf7a65f2d6e2ff7de72def9738c1 100644 (file)
@@ -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);
 }