static void timed_winsys_destroy( struct pipe_winsys *winsys ) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; backend->destroy( backend ); FREE(winsys); }
static void timed_buffer_destroy(struct pipe_buffer *buf) { struct pipe_winsys *winsys = buf->screen->winsys; struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); backend->buffer_destroy( buf ); time_finish(winsys, start, 4, __FUNCTION__); }
static void timed_buffer_unmap(struct pipe_winsys *winsys, struct pipe_buffer *buf) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); backend->buffer_unmap( backend, buf ); time_finish(winsys, start, 3, __FUNCTION__); }
static void timed_fence_reference(struct pipe_winsys *winsys, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); backend->fence_reference( backend, ptr, fence ); time_finish(winsys, start, 10, __FUNCTION__); }
static const char * timed_get_name( struct pipe_winsys *winsys ) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); const char *ret = backend->get_name( backend ); time_finish(winsys, start, 9, __FUNCTION__); return ret; }
static void timed_flush_frontbuffer( struct pipe_winsys *winsys, struct pipe_surface *surf, void *context_private) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); backend->flush_frontbuffer( backend, surf, context_private ); time_finish(winsys, start, 5, __FUNCTION__); }
static int timed_fence_finish( struct pipe_winsys *winsys, struct pipe_fence_handle *fence, unsigned flag ) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); int ret = backend->fence_finish( backend, fence, flag ); time_finish(winsys, start, 12, __FUNCTION__); return ret; }
static void * timed_buffer_map(struct pipe_winsys *winsys, struct pipe_buffer *buf, unsigned flags) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); void *map = backend->buffer_map( backend, buf, flags ); time_finish(winsys, start, 2, __FUNCTION__); return map; }
static struct pipe_buffer * timed_user_buffer_create(struct pipe_winsys *winsys, void *data, unsigned bytes) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); struct pipe_buffer *buf = backend->user_buffer_create( backend, data, bytes ); time_finish(winsys, start, 1, __FUNCTION__); return buf; }
/* Pipe has no concept of pools, but the psb driver passes a flag that * can be mapped onto pools in the backend. */ static struct pipe_buffer * timed_buffer_create(struct pipe_winsys *winsys, unsigned alignment, unsigned usage, unsigned size ) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); struct pipe_buffer *buf = backend->buffer_create( backend, alignment, usage, size ); time_finish(winsys, start, 0, __FUNCTION__); return buf; }
static struct pipe_buffer * timed_surface_buffer_create(struct pipe_winsys *winsys, unsigned width, unsigned height, enum pipe_format format, unsigned usage, unsigned *stride) { struct pipe_winsys *backend = timed_winsys(winsys)->backend; uint64_t start = time_start(); struct pipe_buffer *ret = backend->surface_buffer_create( backend, width, height, format, usage, stride ); time_finish(winsys, start, 7, __FUNCTION__); return ret; }
static void time_display( struct pipe_winsys *winsys ) { struct timed_winsys *tws = timed_winsys(winsys); unsigned i; double overall = 0; for (i = 0; i < Elements(tws->funcs); i++) { if (tws->funcs[i].name_key) { debug_printf("*** %-25s %5.3fms (%d calls, avg %.3fms)\n", tws->funcs[i].name_key, tws->funcs[i].total, tws->funcs[i].calls, tws->funcs[i].total / tws->funcs[i].calls); overall += tws->funcs[i].total; tws->funcs[i].calls = 0; tws->funcs[i].total = 0; } } debug_printf("*** %-25s %5.3fms\n", "OVERALL WINSYS", overall); }
static void time_finish( struct pipe_winsys *winsys, long long startval, unsigned idx, const char *name ) { struct timed_winsys *tws = timed_winsys(winsys); uint64_t endval = util_time_micros(); double elapsed = (endval - startval)/1000.0; if (endval - startval > 1000LL) debug_printf("*** %s %.3f\n", name, elapsed ); assert( tws->funcs[idx].name_key == name || tws->funcs[idx].name_key == NULL); tws->funcs[idx].name_key = name; tws->funcs[idx].total += elapsed; tws->funcs[idx].calls++; if (endval - tws->last_dump > 10LL * 1000LL * 1000LL) { time_display( winsys ); tws->last_dump = endval; } }