diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index a2b0382b874..d75a77b55f9 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -355,7 +355,7 @@ _intel_flush(struct gl_context *ctx, const char *file, int line) } static void -intel_glFlush(struct gl_context *ctx) +intel_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags) { struct intel_context *intel = intel_context(ctx); diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 464a54338eb..bd473915334 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -302,7 +302,7 @@ brw_display_shared_buffer(struct brw_context *brw) } static void -brw_glFlush(struct gl_context *ctx) +brw_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags) { struct brw_context *brw = brw_context(ctx); @@ -342,7 +342,7 @@ brw_finish(struct gl_context * ctx) { struct brw_context *brw = brw_context(ctx); - brw_glFlush(ctx); + brw_glFlush(ctx, 0); if (brw->batch.last_bo) brw_bo_wait_rendering(brw->batch.last_bo); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 1698df6ab19..1165786a284 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -64,7 +64,7 @@ nouveau_get_string(struct gl_context *ctx, GLenum name) } static void -nouveau_flush(struct gl_context *ctx) +nouveau_flush(struct gl_context *ctx, unsigned gallium_flush_flags) { struct nouveau_context *nctx = to_nouveau_context(ctx); struct nouveau_pushbuf *push = context_push(ctx); @@ -90,7 +90,7 @@ nouveau_finish(struct gl_context *ctx) struct nouveau_pushbuf_refn refn = { nctx->fence, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR }; - nouveau_flush(ctx); + nouveau_flush(ctx, 0); if (!nouveau_pushbuf_space(push, 16, 0, 0) && !nouveau_pushbuf_refn(push, &refn, 1)) { diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c index ae4968fd95e..5c4f8170a3c 100644 --- a/src/mesa/drivers/dri/r200/r200_blit.c +++ b/src/mesa/drivers/dri/r200/r200_blit.c @@ -534,7 +534,7 @@ unsigned r200_blit(struct gl_context *ctx, } /* Flush is needed to make sure that source buffer has correct data */ - radeonFlush(&r200->radeon.glCtx); + radeonFlush(&r200->radeon.glCtx, 0); rcommonEnsureCmdBufSpace(&r200->radeon, 102, __func__); @@ -554,7 +554,7 @@ unsigned r200_blit(struct gl_context *ctx, reg_width, reg_height, flip_y); - radeonFlush(ctx); + radeonFlush(ctx, 0); /* We submitted those packets outside our state atom mechanism. Thus * make sure the atoms are resubmitted the next time. */ diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 2e0285cc6a2..b6643e1f9ea 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -61,7 +61,7 @@ static void r200Clear( struct gl_context *ctx, GLbitfield mask ) BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL | BUFFER_BIT_COLOR0; - radeonFlush( ctx ); + radeonFlush( ctx, 0 ); hwmask = mask & hwbits; swmask = mask & ~hwbits; diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c index c186e5bbdae..089f3d8ef74 100644 --- a/src/mesa/drivers/dri/radeon/radeon_blit.c +++ b/src/mesa/drivers/dri/radeon/radeon_blit.c @@ -386,7 +386,7 @@ unsigned r100_blit(struct gl_context *ctx, } /* Flush is needed to make sure that source buffer has correct data */ - radeonFlush(ctx); + radeonFlush(ctx, 0); rcommonEnsureCmdBufSpace(&r100->radeon, 59, __func__); @@ -406,7 +406,7 @@ unsigned r100_blit(struct gl_context *ctx, reg_width, reg_height, flip_y); - radeonFlush(ctx); + radeonFlush(ctx, 0); /* We submitted those packets outside our state atom mechanism. Thus * make sure they are all resubmitted the next time. */ diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 71fe9302cf7..26bfca15067 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -185,7 +185,7 @@ radeonMapBufferRange(struct gl_context * ctx, (access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == GL_MAP_WRITE_BIT; if (write_only) { - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); } if (radeon_obj->bo == NULL) { diff --git a/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h b/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h index d34ca18a158..a047271903d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h +++ b/src/mesa/drivers/dri/radeon/radeon_cmdbuf.h @@ -101,7 +101,7 @@ void rcommonBeginBatch(radeonContextPtr rmesa, static inline void radeon_firevertices(radeonContextPtr radeon) { if (radeon->cmdbuf.cs->cdw || radeon->dma.flush ) - radeon->glCtx.Driver.Flush(&radeon->glCtx); /* +r6/r7 */ + radeon->glCtx.Driver.Flush(&radeon->glCtx, 0); /* +r6/r7 */ } #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 1b734d26a57..047f8559d7e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -369,7 +369,7 @@ void radeon_viewport(struct gl_context *ctx) if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) { - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); } radeon_update_renderbuffers(driContext, driContext->driDrawablePriv, GL_FALSE); if (driContext->driDrawablePriv != driContext->driReadablePriv) @@ -523,7 +523,7 @@ void radeonEmitState(radeonContextPtr radeon) } -void radeonFlush(struct gl_context *ctx) +void radeonFlush(struct gl_context *ctx, unsigned gallium_flush_flags) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (RADEON_DEBUG & RADEON_IOCTL) @@ -572,7 +572,7 @@ void radeonFinish(struct gl_context * ctx) int i; if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); /* +r6/r7 */ + ctx->Driver.Flush(ctx, 0); /* +r6/r7 */ for (i = 0; i < fb->_NumColorDrawBuffers; i++) { struct radeon_renderbuffer *rrb; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index a39b9360efd..9553eb9909a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -12,7 +12,7 @@ void radeonScissor(struct gl_context *ctx); extern uint32_t radeonGetAge(radeonContextPtr radeon); -void radeonFlush(struct gl_context *ctx); +void radeonFlush(struct gl_context *ctx, unsigned gallium_flush_flags); void radeonFinish(struct gl_context * ctx); void radeonEmitState(radeonContextPtr radeon); GLuint radeonCountStateEmitSize(radeonContextPtr radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index cff0c0d6f5f..b89f6cf4a17 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -534,7 +534,7 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); /* +r6/r7 */ + ctx->Driver.Flush(ctx, 0); /* +r6/r7 */ if (rrb->bo) radeon_bo_unref(rrb->bo); @@ -578,7 +578,7 @@ radeon_image_target_renderbuffer_storage(struct gl_context *ctx, rrb = radeon_renderbuffer(rb); if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); /* +r6/r7 */ + ctx->Driver.Flush(ctx, 0); /* +r6/r7 */ if (rrb->bo) radeon_bo_unref(rrb->bo); @@ -720,7 +720,7 @@ radeon_framebuffer_renderbuffer(struct gl_context * ctx, { if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); /* +r6/r7 */ + ctx->Driver.Flush(ctx, 0); /* +r6/r7 */ radeon_print(RADEON_TEXTURE, RADEON_TRACE, "%s(%p, fb %p, rb %p) \n", @@ -829,7 +829,7 @@ radeon_finish_render_texture(struct gl_context *ctx, struct gl_renderbuffer *rb) radeon_image->used_as_render_target = GL_FALSE; if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); /* +r6/r7 */ + ctx->Driver.Flush(ctx, 0); /* +r6/r7 */ } static void radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/src/mesa/drivers/dri/radeon/radeon_ioctl.h index 701dcddfc7e..a4de035a572 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.h +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.h @@ -76,7 +76,7 @@ extern void radeonEmitWait( r100ContextPtr rmesa, GLuint flags ); extern void radeonFlushCmdBuf( r100ContextPtr rmesa, const char * ); -extern void radeonFlush( struct gl_context *ctx ); +extern void radeonFlush( struct gl_context *ctx, unsigned gallium_flush_flags ); extern void radeonFinish( struct gl_context *ctx ); extern void radeonInitIoctlFuncs( struct gl_context *ctx ); extern void radeonGetAllParams( r100ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index ae2c721ce66..b7864d419e1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -91,7 +91,7 @@ static void radeonWaitQuery(struct gl_context *ctx, struct gl_query_object *q) /* If the cmdbuf with packets for this query hasn't been flushed yet, do it now */ if (radeon_bo_is_referenced_by_cs(query->bo, radeon->cmdbuf.cs)) - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s: query id %d, bo %p, offset %d\n", __func__, q->Id, query->bo, query->curr_offset); @@ -169,7 +169,7 @@ static void radeonCheckQuery(struct gl_context *ctx, struct gl_query_object *q) /* Need to perform a flush, as per ARB_occlusion_query spec */ if (radeon_bo_is_referenced_by_cs(query->bo, radeon->cmdbuf.cs)) { - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); } if (radeon_bo_is_busy(query->bo, &domain) == 0) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 67b3af674e6..3764a5d6538 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -192,7 +192,7 @@ radeonDRI2Flush(__DRIdrawable *drawable) radeonContextPtr rmesa; rmesa = (radeonContextPtr) drawable->driContextPriv->driverPrivate; - radeonFlush(&rmesa->glCtx); + radeonFlush(&rmesa->glCtx, 0); } static const struct __DRI2flushExtensionRec radeonFlushExtension = { diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 195684450a8..4b50a3ce9b3 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -51,7 +51,7 @@ static void -finish_or_flush( struct gl_context *ctx ) +finish(struct gl_context *ctx) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (xmesa) { @@ -62,6 +62,13 @@ finish_or_flush( struct gl_context *ctx ) } +static void +flush(struct gl_context *ctx, unsigned gallium_flush_flags) +{ + finish(ctx); +} + + /* Implements glColorMask() */ static void color_mask(struct gl_context *ctx, @@ -837,8 +844,8 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, { driver->GetString = get_string; driver->UpdateState = xmesa_update_state; - driver->Flush = finish_or_flush; - driver->Finish = finish_or_flush; + driver->Flush = flush; + driver->Finish = finish; driver->ColorMask = color_mask; driver->Enable = enable; driver->Viewport = xmesa_viewport; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index aedb50eafe9..8f3f9fc287a 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -184,7 +184,7 @@ _mesa_notifySwapBuffers(struct gl_context *ctx) _mesa_debug(ctx, "SwapBuffers\n"); FLUSH_VERTICES(ctx, 0, 0); if (ctx->Driver.Flush) { - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); } } @@ -1634,7 +1634,9 @@ _mesa_make_current( struct gl_context *newCtx, curCtx != newCtx && curCtx->Const.ContextReleaseBehavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) { - _mesa_flush(curCtx); + FLUSH_VERTICES(curCtx, 0, 0); + if (curCtx->Driver.Flush) + curCtx->Driver.Flush(curCtx, 0); } /* Call this periodically to detect when the user has begun using @@ -1791,7 +1793,7 @@ _mesa_flush(struct gl_context *ctx) { FLUSH_VERTICES(ctx, 0, 0); if (ctx->Driver.Flush) { - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); } } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 8db6848be95..da6d4a5e231 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -125,7 +125,7 @@ struct dd_function_table { /** * This is called whenever glFlush() is called. */ - void (*Flush)( struct gl_context *ctx ); + void (*Flush)(struct gl_context *ctx, unsigned gallium_flush_flags); /** * Clear the color/depth/stencil/accum buffer(s). diff --git a/src/mesa/main/performance_query.c b/src/mesa/main/performance_query.c index b3febdd57af..6698d508e16 100644 --- a/src/mesa/main/performance_query.c +++ b/src/mesa/main/performance_query.c @@ -641,7 +641,7 @@ _mesa_GetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags, if (!obj->Ready) { if (flags == GL_PERFQUERY_FLUSH_INTEL) { - ctx->Driver.Flush(ctx); + ctx->Driver.Flush(ctx, 0); } else if (flags == GL_PERFQUERY_WAIT_INTEL) { ctx->Driver.WaitPerfQuery(ctx, obj); obj->Ready = true; diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 12289d8cf4e..97e0c73dcfd 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -87,7 +87,7 @@ st_finish(struct st_context *st) * Called via ctx->Driver.Flush() */ static void -st_glFlush(struct gl_context *ctx) +st_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags) { struct st_context *st = st_context(ctx); @@ -96,7 +96,7 @@ 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, 0); + st_flush(st, NULL, gallium_flush_flags); st_manager_flush_frontbuffer(st); }