static void
panfrost_invalidate_frame(struct panfrost_context *ctx)
{
- unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
- DBG("Uploaded transient %d bytes\n", transient_count);
-
- /* Rotate cmdstream */
- if ((++ctx->cmdstream_i) == (sizeof(ctx->transient_pools) / sizeof(ctx->transient_pools[0])))
- ctx->cmdstream_i = 0;
-
if (ctx->require_sfbd)
ctx->vt_framebuffer_sfbd = panfrost_emit_sfbd(ctx, ~0);
else
/* Reset varyings allocated */
ctx->varying_height = 0;
- /* The transient cmdstream is dirty every frame; the only bits worth preserving
- * (textures, shaders, etc) are in other buffers anyways */
-
- ctx->transient_pools[ctx->cmdstream_i].entry_index = 0;
- ctx->transient_pools[ctx->cmdstream_i].entry_offset = 0;
-
if (ctx->rasterizer)
ctx->dirty |= PAN_DIRTY_RASTERIZER;
panfrost_drm_free_slab(screen, &panfrost->tiler_polygon_list);
panfrost_drm_free_slab(screen, &panfrost->tiler_dummy);
- for (int i = 0; i < ARRAY_SIZE(panfrost->transient_pools); ++i) {
- struct panfrost_memory_entry *entry;
- entry = panfrost->transient_pools[i].entries[0];
- pb_slab_free(&screen->slabs, (struct pb_slab_entry *)entry);
- }
-
ralloc_free(pipe);
}
struct pipe_context *gallium = (struct pipe_context *) ctx;
struct panfrost_screen *screen = pan_screen(gallium->screen);
- for (int i = 0; i < ARRAY_SIZE(ctx->transient_pools); ++i) {
- /* Allocate the beginning of the transient pool */
- int entry_size = (1 << 22); /* 4MB */
-
- ctx->transient_pools[i].entry_size = entry_size;
- ctx->transient_pools[i].entry_count = 1;
-
- ctx->transient_pools[i].entries[0] = (struct panfrost_memory_entry *) pb_slab_alloc(&screen->slabs, entry_size, HEAP_TRANSIENT);
- }
-
panfrost_drm_allocate_slab(screen, &ctx->scratchpad, 64, false, 0, 0, 0);
panfrost_drm_allocate_slab(screen, &ctx->varying_mem, 16384, false, PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_COHERENT_LOCAL, 0, 0);
panfrost_drm_allocate_slab(screen, &ctx->shaders, 4096, true, PAN_ALLOCATE_EXECUTE, 0, 0);
int fd;
};
-#define PANFROST_MAX_TRANSIENT_ENTRIES 64
-
-struct panfrost_transient_pool {
- /* Memory blocks in the pool */
- struct panfrost_memory_entry *entries[PANFROST_MAX_TRANSIENT_ENTRIES];
-
- /* Number of entries we own */
- unsigned entry_count;
-
- /* Current entry that we are writing to, zero-indexed, strictly less than entry_count */
- unsigned entry_index;
-
- /* Number of bytes into the current entry we are */
- off_t entry_offset;
-
- /* Entry size (all entries must be homogenous) */
- size_t entry_size;
-};
-
struct panfrost_context {
/* Gallium context */
struct pipe_context base;
struct pipe_framebuffer_state pipe_framebuffer;
- /* The number of concurrent FBOs allowed depends on the number of pools
- * used; pools are ringed for parallelism opportunities */
-
- struct panfrost_transient_pool transient_pools[2];
- int cmdstream_i;
-
struct panfrost_memory cmdstream_persistent;
struct panfrost_memory shaders;
struct panfrost_memory scratchpad;