/*@}*/
/**
- * \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
*/
/*@{*/
#include "util/bitset.h"
#include "util/ralloc.h"
+#include "state_tracker/st_cb_perfmon.h"
+
void
_mesa_init_performance_monitors(struct gl_context *ctx)
{
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;
fail:
ralloc_free(m->ActiveGroups);
ralloc_free(m->ActiveCounters);
- ctx->Driver.DeletePerfMonitor(ctx, m);
+ st_DeletePerfMonitor(ctx, m);
return NULL;
}
ralloc_free(m->ActiveGroups);
ralloc_free(m->ActiveCounters);
- ctx->Driver.DeletePerfMonitor(ctx, m);
+ st_DeletePerfMonitor(ctx, m);
}
void
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
* 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++) {
/* 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 {
return;
}
- ctx->Driver.EndPerfMonitor(ctx, m);
+ st_EndPerfMonitor(ctx, m);
m->Active = false;
m->Ended = true;
/* 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) {
*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,
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);
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);
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);
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);
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);
st_BeginPerfMonitor(ctx, m);
}
-static GLboolean
+GLboolean
st_IsPerfMonitorResultAvailable(struct gl_context *ctx,
struct gl_perf_monitor_object *m)
{
return true;
}
-static void
+void
st_GetPerfMonitorResult(struct gl_context *ctx,
struct gl_perf_monitor_object *m,
GLsizei dataSize,
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);
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;
-}
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
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);