mesa: add gallium flush_flags param into ctx->Driver.Flush

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11341>
This commit is contained in:
Marek Olšák 2021-06-12 12:20:06 -04:00 committed by Marge Bot
parent ee6929a779
commit b7dc72380a
19 changed files with 43 additions and 34 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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)) {

View File

@ -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. */

View File

@ -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;

View File

@ -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. */

View File

@ -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) {

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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 );

View File

@ -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) {

View File

@ -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 = {

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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).

View File

@ -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;

View File

@ -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);
}