mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
mesa/st: move perfomance monitor 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:
parent
097646cf7c
commit
b79d12bbb2
5 changed files with 34 additions and 60 deletions
|
|
@ -776,31 +776,6 @@ struct dd_function_table {
|
|||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Performance monitors
|
||||
*/
|
||||
/*@{*/
|
||||
void (*InitPerfMonitorGroups)(struct gl_context *ctx);
|
||||
struct gl_perf_monitor_object * (*NewPerfMonitor)(struct gl_context *ctx);
|
||||
void (*DeletePerfMonitor)(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m);
|
||||
GLboolean (*BeginPerfMonitor)(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m);
|
||||
|
||||
/** Stop an active performance monitor, discarding results. */
|
||||
void (*ResetPerfMonitor)(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m);
|
||||
void (*EndPerfMonitor)(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m);
|
||||
GLboolean (*IsPerfMonitorResultAvailable)(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m);
|
||||
void (*GetPerfMonitorResult)(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m,
|
||||
GLsizei dataSize,
|
||||
GLuint *data,
|
||||
GLint *bytesWritten);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name GREMEDY debug/marker functions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@
|
|||
#include "util/bitset.h"
|
||||
#include "util/ralloc.h"
|
||||
|
||||
#include "state_tracker/st_cb_perfmon.h"
|
||||
|
||||
void
|
||||
_mesa_init_performance_monitors(struct gl_context *ctx)
|
||||
{
|
||||
|
|
@ -57,14 +59,14 @@ static inline void
|
|||
init_groups(struct gl_context *ctx)
|
||||
{
|
||||
if (unlikely(!ctx->PerfMonitor.Groups))
|
||||
ctx->Driver.InitPerfMonitorGroups(ctx);
|
||||
st_InitPerfMonitorGroups(ctx);
|
||||
}
|
||||
|
||||
static struct gl_perf_monitor_object *
|
||||
new_performance_monitor(struct gl_context *ctx, GLuint index)
|
||||
{
|
||||
unsigned i;
|
||||
struct gl_perf_monitor_object *m = ctx->Driver.NewPerfMonitor(ctx);
|
||||
struct gl_perf_monitor_object *m = st_NewPerfMonitor(ctx);
|
||||
|
||||
if (m == NULL)
|
||||
return NULL;
|
||||
|
|
@ -96,7 +98,7 @@ new_performance_monitor(struct gl_context *ctx, GLuint index)
|
|||
fail:
|
||||
ralloc_free(m->ActiveGroups);
|
||||
ralloc_free(m->ActiveCounters);
|
||||
ctx->Driver.DeletePerfMonitor(ctx, m);
|
||||
st_DeletePerfMonitor(ctx, m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +110,7 @@ free_performance_monitor(void *data, void *user)
|
|||
|
||||
ralloc_free(m->ActiveGroups);
|
||||
ralloc_free(m->ActiveCounters);
|
||||
ctx->Driver.DeletePerfMonitor(ctx, m);
|
||||
st_DeletePerfMonitor(ctx, m);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -393,14 +395,14 @@ _mesa_DeletePerfMonitorsAMD(GLsizei n, GLuint *monitors)
|
|||
if (m) {
|
||||
/* Give the driver a chance to stop the monitor if it's active. */
|
||||
if (m->Active) {
|
||||
ctx->Driver.ResetPerfMonitor(ctx, m);
|
||||
st_ResetPerfMonitor(ctx, m);
|
||||
m->Ended = false;
|
||||
}
|
||||
|
||||
_mesa_HashRemove(ctx->PerfMonitor.Monitors, monitors[i]);
|
||||
ralloc_free(m->ActiveGroups);
|
||||
ralloc_free(m->ActiveCounters);
|
||||
ctx->Driver.DeletePerfMonitor(ctx, m);
|
||||
st_DeletePerfMonitor(ctx, m);
|
||||
} else {
|
||||
/* "INVALID_VALUE error will be generated if any of the monitor IDs
|
||||
* in the <monitors> parameter to DeletePerfMonitorsAMD do not
|
||||
|
|
@ -460,7 +462,7 @@ _mesa_SelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable,
|
|||
* results for that monitor become invalidated and the result queries
|
||||
* PERFMON_RESULT_SIZE_AMD and PERFMON_RESULT_AVAILABLE_AMD are reset to 0."
|
||||
*/
|
||||
ctx->Driver.ResetPerfMonitor(ctx, m);
|
||||
st_ResetPerfMonitor(ctx, m);
|
||||
|
||||
/* Sanity check the counter ID list. */
|
||||
for (i = 0; i < numCounters; i++) {
|
||||
|
|
@ -515,7 +517,7 @@ _mesa_BeginPerfMonitorAMD(GLuint monitor)
|
|||
/* The driver is free to return false if it can't begin monitoring for
|
||||
* any reason. This translates into an INVALID_OPERATION error.
|
||||
*/
|
||||
if (ctx->Driver.BeginPerfMonitor(ctx, m)) {
|
||||
if (st_BeginPerfMonitor(ctx, m)) {
|
||||
m->Active = true;
|
||||
m->Ended = false;
|
||||
} else {
|
||||
|
|
@ -544,7 +546,7 @@ _mesa_EndPerfMonitorAMD(GLuint monitor)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->Driver.EndPerfMonitor(ctx, m);
|
||||
st_EndPerfMonitor(ctx, m);
|
||||
|
||||
m->Active = false;
|
||||
m->Ended = true;
|
||||
|
|
@ -606,7 +608,7 @@ _mesa_GetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname,
|
|||
|
||||
/* If the monitor has never ended, there is no result. */
|
||||
result_available = m->Ended &&
|
||||
ctx->Driver.IsPerfMonitorResultAvailable(ctx, m);
|
||||
st_IsPerfMonitorResultAvailable(ctx, m);
|
||||
|
||||
/* AMD appears to return 0 for all queries unless a result is available. */
|
||||
if (!result_available) {
|
||||
|
|
@ -628,7 +630,7 @@ _mesa_GetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname,
|
|||
*bytesWritten = sizeof(GLuint);
|
||||
break;
|
||||
case GL_PERFMON_RESULT_AMD:
|
||||
ctx->Driver.GetPerfMonitorResult(ctx, m, dataSize, data, bytesWritten);
|
||||
st_GetPerfMonitorResult(ctx, m, dataSize, data, bytesWritten);
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ reset_perf_monitor(struct st_perf_monitor_object *stm,
|
|||
stm->batch_result = NULL;
|
||||
}
|
||||
|
||||
static struct gl_perf_monitor_object *
|
||||
struct gl_perf_monitor_object *
|
||||
st_NewPerfMonitor(struct gl_context *ctx)
|
||||
{
|
||||
struct st_perf_monitor_object *stq = ST_CALLOC_STRUCT(st_perf_monitor_object);
|
||||
|
|
@ -157,7 +157,7 @@ st_NewPerfMonitor(struct gl_context *ctx)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_DeletePerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
||||
{
|
||||
struct st_perf_monitor_object *stm = st_perf_monitor_object(m);
|
||||
|
|
@ -167,7 +167,7 @@ st_DeletePerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
|||
FREE(stm);
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
GLboolean
|
||||
st_BeginPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
||||
{
|
||||
struct st_perf_monitor_object *stm = st_perf_monitor_object(m);
|
||||
|
|
@ -199,7 +199,7 @@ fail:
|
|||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_EndPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
||||
{
|
||||
struct st_perf_monitor_object *stm = st_perf_monitor_object(m);
|
||||
|
|
@ -217,7 +217,7 @@ st_EndPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
|||
pipe->end_query(pipe, stm->batch_query);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_ResetPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
||||
{
|
||||
struct st_perf_monitor_object *stm = st_perf_monitor_object(m);
|
||||
|
|
@ -232,7 +232,7 @@ st_ResetPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
|
|||
st_BeginPerfMonitor(ctx, m);
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
GLboolean
|
||||
st_IsPerfMonitorResultAvailable(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m)
|
||||
{
|
||||
|
|
@ -261,7 +261,7 @@ st_IsPerfMonitorResultAvailable(struct gl_context *ctx,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_GetPerfMonitorResult(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m,
|
||||
GLsizei dataSize,
|
||||
|
|
@ -339,7 +339,7 @@ st_have_perfmon(struct st_context *st)
|
|||
return screen->get_driver_query_group_info(screen, 0, NULL) != 0;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
st_InitPerfMonitorGroups(struct gl_context *ctx)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
|
@ -463,15 +463,3 @@ st_destroy_perfmon(struct st_context *st)
|
|||
FREE(st->perfmon);
|
||||
FREE((void *)perfmon->Groups);
|
||||
}
|
||||
|
||||
void st_init_perfmon_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->InitPerfMonitorGroups = st_InitPerfMonitorGroups;
|
||||
functions->NewPerfMonitor = st_NewPerfMonitor;
|
||||
functions->DeletePerfMonitor = st_DeletePerfMonitor;
|
||||
functions->BeginPerfMonitor = st_BeginPerfMonitor;
|
||||
functions->EndPerfMonitor = st_EndPerfMonitor;
|
||||
functions->ResetPerfMonitor = st_ResetPerfMonitor;
|
||||
functions->IsPerfMonitorResultAvailable = st_IsPerfMonitorResultAvailable;
|
||||
functions->GetPerfMonitorResult = st_GetPerfMonitorResult;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,17 @@ st_have_perfmon(struct st_context *st);
|
|||
void
|
||||
st_destroy_perfmon(struct st_context *st);
|
||||
|
||||
extern void
|
||||
st_init_perfmon_functions(struct dd_function_table *functions);
|
||||
|
||||
struct gl_perf_monitor_object *st_NewPerfMonitor(struct gl_context *ctx);
|
||||
void st_DeletePerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m);
|
||||
GLboolean st_BeginPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m);
|
||||
void st_EndPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m);
|
||||
void st_ResetPerfMonitor(struct gl_context *ctx, struct gl_perf_monitor_object *m);
|
||||
GLboolean st_IsPerfMonitorResultAvailable(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m);
|
||||
void st_GetPerfMonitorResult(struct gl_context *ctx,
|
||||
struct gl_perf_monitor_object *m,
|
||||
GLsizei dataSize,
|
||||
GLuint *data,
|
||||
GLint *bytesWritten);
|
||||
void st_InitPerfMonitorGroups(struct gl_context *ctx);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -944,7 +944,6 @@ st_init_driver_functions(struct pipe_screen *screen,
|
|||
|
||||
st_init_fbo_functions(functions);
|
||||
st_init_msaa_functions(functions);
|
||||
st_init_perfmon_functions(functions);
|
||||
st_init_program_functions(functions);
|
||||
st_init_readpixels_functions(functions);
|
||||
st_init_texture_functions(functions);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue