Commit 41535ee8 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Move setup_framebuffer

parent 280fc4ff
......@@ -933,6 +933,27 @@ trans_allocate_slab(struct panfrost_context *ctx,
mem->stack_bottom = 0;
}
static void
trans_setup_framebuffer(struct panfrost_context *ctx)
{
size_t framebuffer_sz = ctx->width * ctx->height * 4;
posix_memalign((void **) &ctx->framebuffer.cpu, CACHE_LINE_SIZE, framebuffer_sz);
slowfb_init((uint8_t*) (ctx->framebuffer.cpu + 144*4), ctx->width, ctx->height);
struct mali_mem_import_user_buffer framebuffer_handle = { .ptr = (uint64_t) (uintptr_t) ctx->framebuffer.cpu, .length = framebuffer_sz };
struct mali_ioctl_mem_import framebuffer_import = {
.phandle = (uint64_t) (uintptr_t) &framebuffer_handle,
.type = MALI_MEM_IMPORT_TYPE_USER_BUFFER,
.flags = MALI_MEM_PROT_CPU_RD | MALI_MEM_PROT_CPU_WR | MALI_MEM_PROT_GPU_RD | MALI_MEM_PROT_GPU_WR,
};
pandev_ioctl(ctx->fd, MALI_IOCTL_MEM_IMPORT, &framebuffer_import);
ctx->framebuffer.gpu = framebuffer_import.gpu_va;
}
static void
trans_setup_hardware(struct panfrost_context *ctx)
{
......@@ -943,22 +964,7 @@ trans_setup_hardware(struct panfrost_context *ctx)
exit(0);
}
size_t framebuffer_sz = ctx->width * ctx->height * 4;
posix_memalign((void **) &ctx->framebuffer.cpu, CACHE_LINE_SIZE, framebuffer_sz);
slowfb_init((uint8_t*) (ctx->framebuffer.cpu + 144*4), ctx->width, ctx->height);
struct mali_mem_import_user_buffer framebuffer_handle = { .ptr = (uint64_t) (uintptr_t) ctx->framebuffer.cpu, .length = framebuffer_sz };
struct mali_ioctl_mem_import framebuffer_import = {
.phandle = (uint64_t) (uintptr_t) &framebuffer_handle,
.type = MALI_MEM_IMPORT_TYPE_USER_BUFFER,
.flags = MALI_MEM_PROT_CPU_RD | MALI_MEM_PROT_CPU_WR | MALI_MEM_PROT_GPU_RD | MALI_MEM_PROT_GPU_WR,
};
pandev_ioctl(ctx->fd, MALI_IOCTL_MEM_IMPORT, &framebuffer_import);
ctx->framebuffer.gpu = framebuffer_import.gpu_va;
trans_setup_framebuffer(ctx);
trans_allocate_slab(ctx, &ctx->cmdstream, 8*64, true, true, 0, 0, 0);
trans_allocate_slab(ctx, &ctx->scratchpad, 8, true, true, 0, 0, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment