/* In some sequence of events, we can end up with a last_fence that is
* not an "fd" fence, which results in eglDupNativeFenceFDANDROID()
* errors.
- *
*/
if (flags & PIPE_FLUSH_FENCE_FD)
fd_fence_ref(&ctx->last_fence, NULL);
*/
if (ctx->last_fence) {
fd_fence_ref(&fence, ctx->last_fence);
+ fd_bc_dump(ctx->screen, "%p: reuse last_fence, remaining:\n", ctx);
goto out;
}
- if (!batch)
+ if (!batch) {
+ fd_bc_dump(ctx->screen, "%p: NULL batch, remaining:\n", ctx);
return;
+ }
/* Take a ref to the batch's fence (batch can be unref'd when flushed: */
fd_fence_ref(&fence, batch->fence);
if (flags & PIPE_FLUSH_FENCE_FD)
batch->needs_out_fence_fd = true;
+ fd_bc_dump(ctx->screen, "%p: flushing %p<%u>, flags=0x%x, pending:\n",
+ ctx, batch, batch->seqno, flags);
+
if (!ctx->screen->reorder) {
fd_batch_flush(batch);
} else if (flags & PIPE_FLUSH_DEFERRED) {
fd_bc_flush(&ctx->screen->batch_cache, ctx);
}
+ fd_bc_dump(ctx->screen, "%p: remaining:\n", ctx);
+
out:
if (fencep)
fd_fence_ref(fencep, fence);
/* TODO do we need to check for persistently mapped buffers and fd_bo_cpu_prep()?? */
}
-/**
- * emit marker string as payload of a no-op packet, which can be
- * decoded by cffdump.
- */
static void
-fd_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
+emit_string_tail(struct fd_ringbuffer *ring, const char *string, int len)
{
- struct fd_context *ctx = fd_context(pctx);
- struct fd_ringbuffer *ring;
const uint32_t *buf = (const void *)string;
- if (!ctx->batch)
- return;
-
- ctx->batch->needs_flush = true;
-
- ring = ctx->batch->draw;
-
- /* max packet size is 0x3fff dwords: */
- len = MIN2(len, 0x3fff * 4);
-
- if (ctx->screen->gpu_id >= 500)
- OUT_PKT7(ring, CP_NOP, align(len, 4) / 4);
- else
- OUT_PKT3(ring, CP_NOP, align(len, 4) / 4);
while (len >= 4) {
OUT_RING(ring, *buf);
buf++;
}
}
+/* for prior to a5xx: */
+void
+fd_emit_string(struct fd_ringbuffer *ring,
+ const char *string, int len)
+{
+ /* max packet size is 0x3fff+1 dwords: */
+ len = MIN2(len, 0x4000 * 4);
+
+ OUT_PKT3(ring, CP_NOP, align(len, 4) / 4);
+ emit_string_tail(ring, string, len);
+}
+
+/* for a5xx+ */
+void
+fd_emit_string5(struct fd_ringbuffer *ring,
+ const char *string, int len)
+{
+ /* max packet size is 0x3fff dwords: */
+ len = MIN2(len, 0x3fff * 4);
+
+ OUT_PKT7(ring, CP_NOP, align(len, 4) / 4);
+ emit_string_tail(ring, string, len);
+}
+
+/**
+ * emit marker string as payload of a no-op packet, which can be
+ * decoded by cffdump.
+ */
+static void
+fd_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
+{
+ struct fd_context *ctx = fd_context(pctx);
+
+ if (!ctx->batch)
+ return;
+
+ ctx->batch->needs_flush = true;
+
+ if (ctx->screen->gpu_id >= 500) {
+ fd_emit_string5(ctx->batch->draw, string, len);
+ } else {
+ fd_emit_string(ctx->batch->draw, string, len);
+ }
+}
+
void
fd_context_destroy(struct pipe_context *pctx)
{
}
#if DETECT_OS_ANDROID
- if (fd_mesa_debug && FD_DBG_LOG) {
+ 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++);