#include "freedreno_blitter.h"
#include "freedreno_draw.h"
#include "freedreno_fence.h"
+#include "freedreno_log.h"
#include "freedreno_program.h"
#include "freedreno_resource.h"
#include "freedreno_texture.h"
#include "freedreno_util.h"
#include "util/u_upload_mgr.h"
+#if DETECT_OS_ANDROID
+#include "util/u_process.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#endif
+
static void
fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
unsigned flags)
fd_fence_ref(&ctx->last_fence, fence);
fd_fence_ref(&fence, NULL);
+
+ if (flags & PIPE_FLUSH_END_OF_FRAME)
+ fd_log_eof(ctx);
}
static void
DBG("");
+ fd_screen_lock(ctx->screen);
+ list_del(&ctx->node);
+ fd_screen_unlock(ctx->screen);
+
+ fd_log_process(ctx, true);
+ assert(list_is_empty(&ctx->log_chunks));
+
fd_fence_ref(&ctx->last_fence, NULL);
util_copy_framebuffer_state(&ctx->framebuffer, NULL);
(void) mtx_init(&ctx->gmem_lock, mtx_plain);
- /* need some sane default in case state tracker doesn't
+ /* need some sane default in case gallium frontends don't
* set some state:
*/
ctx->sample_mask = 0xffff;
+ ctx->active_queries = true;
pctx = &ctx->base;
pctx->screen = pscreen;
goto fail;
pctx->const_uploader = pctx->stream_uploader;
- if (!ctx->screen->reorder)
- ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx, false);
-
slab_create_child(&ctx->transfer_pool, &screen->transfer_pool);
fd_draw_init(pctx);
list_inithead(&ctx->hw_active_queries);
list_inithead(&ctx->acc_active_queries);
+ list_inithead(&ctx->log_chunks);
+
+ fd_screen_lock(ctx->screen);
+ list_add(&ctx->node, &ctx->screen->context_list);
+ fd_screen_unlock(ctx->screen);
+
+ ctx->current_scissor = &ctx->disabled_scissor;
+
+ ctx->log_out = stdout;
+
+ if ((fd_mesa_debug & FD_DBG_LOG) &&
+ !(ctx->record_timestamp && ctx->ts_to_ns)) {
+ printf("logging not supported!\n");
+ fd_mesa_debug &= ~FD_DBG_LOG;
+ }
+
+#if DETECT_OS_ANDROID
+ if (fd_mesa_debug & FD_DBG_LOG) {
+ static unsigned idx = 0;
+ char *p;
+ asprintf(&p, "/data/fdlog/%s-%d.log", util_get_process_name(), idx++);
+
+ FILE *f = fopen(p, "w");
+ if (f)
+ ctx->log_out = f;
+ }
+#endif
return pctx;