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 *
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);
} 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);
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);
}
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 *
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__);
}
* context
*/
static void noop_flush(struct pipe_context *ctx,
- struct pipe_fence_handle **fence)
+ struct pipe_fence_handle **fence,
+ enum pipe_flush_flags flags)
{
}
}
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;
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);
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;
}
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);
}
}
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);
}
}
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);
}
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);
}
/* 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);
}
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);
}
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,
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);
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;
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);
#include "p_compiler.h"
#include "p_format.h"
#include "p_video_enums.h"
+#include "p_defines.h"
#ifdef __cplusplus
extern "C" {
/** 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.
};
+/**
+ * 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
* Flush flags.
*/
#define ST_FLUSH_FRONT (1 << 0)
+#define ST_FLUSH_END_OF_FRAME (1 << 1)
/**
* Value to st_manager->get_param function.
[](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);
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;
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 &&
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) {
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
if (!pipe)
return FALSE;
- pipe->flush(pipe, &fence);
+ pipe->flush(pipe, &fence, 0);
if (fence == NULL)
return FALSE;
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;
);
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);
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);
}
return;
pipe = ctx->pipe;
- pipe->flush(pipe, NULL);
+ pipe->flush(pipe, NULL, 0);
vg_manager_flush_frontbuffer(ctx);
}
pipe = ctx->pipe;
- pipe->flush(pipe, &fence);
+ pipe->flush(pipe, &fence, 0);
if (fence) {
pipe->screen->fence_finish(pipe->screen, fence,
PIPE_TIMEOUT_INFINITE);
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);
}
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;
}
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;
}
{
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
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;
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);
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);
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);
/* 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 */
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);
ms->ctx->flush(ms->ctx,
ms->dirtyThrottling ?
&ms->fence[XORG_NR_FENCES-1] :
- NULL);
+ NULL, 0);
if (ms->dirtyThrottling) {
if (ms->fence[0])
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)
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);
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);
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
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);
}
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);
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
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);
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);
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);
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);
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);
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);
}
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);
}
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);
}
ctx->draw_vbo(ctx, &info);
- ctx->flush(ctx, NULL);
+ ctx->flush(ctx, NULL, 0);
graw_save_surface_to_file(ctx, surf, NULL);
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);
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);
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]);
}
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]);
}
return;
pipe->transfer_unmap(pipe, wdt->transfer);
- pipe->flush(pipe, NULL);
+ pipe->flush(pipe, NULL, 0);
wdt->transfer = NULL;
}
}
-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);
}
{
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,
* 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);
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);
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)
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);
}