mesa/st: move clear/flush/finish to direct call

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
Dave Airlie 2021-12-07 11:37:07 +10:00 committed by Marge Bot
parent 37fb8058fb
commit cb400f368a
9 changed files with 20 additions and 49 deletions

View File

@ -155,6 +155,7 @@
#include "util/u_memory.h"
#include "state_tracker/st_cb_texture.h"
#include "state_tracker/st_cb_flush.h"
#ifndef MESA_VERBOSE
int MESA_VERBOSE = 0;
@ -1633,8 +1634,7 @@ _mesa_make_current( struct gl_context *newCtx,
curCtx->Const.ContextReleaseBehavior ==
GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) {
FLUSH_VERTICES(curCtx, 0, 0);
if (curCtx->Driver.Flush)
curCtx->Driver.Flush(curCtx, 0);
st_glFlush(curCtx, 0);
}
/* Call this periodically to detect when the user has begun using
@ -1789,12 +1789,10 @@ _mesa_get_dispatch(struct gl_context *ctx)
void
_mesa_flush(struct gl_context *ctx)
{
bool async = !ctx->Shared->HasExternallySharedImages;
FLUSH_VERTICES(ctx, 0, 0);
if (ctx->Driver.Flush) {
bool async = !ctx->Shared->HasExternallySharedImages;
ctx->Driver.Flush(ctx, async ? PIPE_FLUSH_ASYNC : 0);
}
st_glFlush(ctx, async ? PIPE_FLUSH_ASYNC : 0);
}
@ -1813,9 +1811,7 @@ _mesa_Finish(void)
FLUSH_VERTICES(ctx, 0, 0);
if (ctx->Driver.Finish) {
ctx->Driver.Finish(ctx);
}
st_glFinish(ctx);
}

View File

@ -116,24 +116,6 @@ struct pipe_vertex_element;
* file should be updated too!!!
*/
struct dd_function_table {
/**
* Notify the driver after Mesa has made some internal state changes.
*
* This is in addition to any state change callbacks Mesa may already have
* made.
*/
void (*UpdateState)(struct gl_context *ctx);
/**
* This is called whenever glFinish() is called.
*/
void (*Finish)( struct gl_context *ctx );
/**
* This is called whenever glFlush() is called.
*/
void (*Flush)(struct gl_context *ctx, unsigned gallium_flush_flags);
/**
* Called by glCopyImageSubData().
*

View File

@ -37,6 +37,7 @@
#include "util/ralloc.h"
#include "state_tracker/st_cb_perfquery.h"
#include "state_tracker/st_cb_flush.h"
void
_mesa_init_performance_queries(struct gl_context *ctx)
@ -640,7 +641,7 @@ _mesa_GetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags,
if (!obj->Ready) {
if (flags == GL_PERFQUERY_FLUSH_INTEL) {
ctx->Driver.Flush(ctx, 0);
st_glFlush(ctx, 0);
} else if (flags == GL_PERFQUERY_WAIT_INTEL) {
st_WaitPerfQuery(ctx, obj);
obj->Ready = true;

View File

@ -55,6 +55,7 @@
#include "viewport.h"
#include "blend.h"
#include "state_tracker/st_context.h"
void
_mesa_update_allow_draw_out_of_order(struct gl_context *ctx)
@ -487,7 +488,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
* Also, this is where the driver can invalidate the state of any
* active modules (such as swrast_setup, swrast, tnl, etc).
*/
ctx->Driver.UpdateState(ctx);
st_invalidate_state(ctx);
ctx->NewState = 0;
}

View File

@ -48,6 +48,7 @@
#include "state_tracker/st_cb_texture.h"
#include "state_tracker/st_format.h"
#include "state_tracker/st_cb_flush.h"
/**********************************************************************/
/** \name Internal functions */
@ -1029,8 +1030,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
/* Complete the driver's operation in case another context will also
* use the same fallback texture. */
if (ctx->Driver.Finish)
ctx->Driver.Finish(ctx);
st_glFinish(ctx);
}
return ctx->Shared->FallbackTex[tex];
}

View File

@ -82,11 +82,7 @@ st_finish(struct st_context *st)
}
/**
* Called via ctx->Driver.Flush()
*/
static void
void
st_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags)
{
struct st_context *st = st_context(ctx);
@ -101,11 +97,7 @@ st_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags)
st_manager_flush_frontbuffer(st);
}
/**
* Called via ctx->Driver.Finish()
*/
static void
void
st_glFinish(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
@ -187,9 +179,6 @@ void
st_init_flush_functions(struct pipe_screen *screen,
struct dd_function_table *functions)
{
functions->Flush = st_glFlush;
functions->Finish = st_glFinish;
if (screen->get_param(screen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY))
functions->GetGraphicsResetStatus = st_get_graphics_reset_status;
}

View File

@ -40,6 +40,9 @@ extern void
st_init_flush_functions(struct pipe_screen *screen,
struct dd_function_table *functions);
void st_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags);
void st_glFinish(struct gl_context *ctx);
extern void
st_flush(struct st_context *st,
struct pipe_fence_handle **fence,

View File

@ -183,10 +183,7 @@ st_vp_uses_current_values(const struct gl_context *ctx)
}
/**
* Called via ctx->Driver.UpdateState()
*/
static void
void
st_invalidate_state(struct gl_context *ctx)
{
GLbitfield new_state = ctx->NewState;
@ -945,7 +942,6 @@ st_init_driver_functions(struct pipe_screen *screen,
if (screen->get_param(screen, PIPE_CAP_STRING_MARKER))
functions->EmitStringMarker = st_emit_string_marker;
functions->UpdateState = st_invalidate_state;
functions->SetBackgroundContext = st_set_background_context;
functions->GetDriverUuid = st_get_driver_uuid;
functions->GetDeviceUuid = st_get_device_uuid;

View File

@ -455,6 +455,9 @@ struct st_framebuffer
void st_Enable(struct gl_context *ctx, GLenum cap);
void st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out);
void st_invalidate_state(struct gl_context *ctx);
#ifdef __cplusplus
}
#endif