From 9a7a6bafcc1b2fbfc897e86b53b933ea318ddf0c Mon Sep 17 00:00:00 2001 From: SolDev69 <40839581+SolDev69@users.noreply.github.com> Date: Thu, 21 Dec 2023 19:58:29 +0000 Subject: [PATCH] panfrost patches --- src/gallium/drivers/panfrost/meson.build | 2 +- src/gallium/drivers/panfrost/pan_context.c | 22 ++++++++++++++++++++++ src/gallium/drivers/panfrost/pan_context.h | 12 ++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/meson.build b/src/gallium/drivers/panfrost/meson.build index 58fd5d10b75..987475c76df 100644 --- a/src/gallium/drivers/panfrost/meson.build +++ b/src/gallium/drivers/panfrost/meson.build @@ -54,7 +54,7 @@ compile_args_panfrost = [ '-Wno-pointer-arith' ] -panfrost_versions = ['4', '5', '6', '7', '9'] +panfrost_versions = ['4', '5', '6', '7', '9', '10'] libpanfrost_versions = [] foreach ver : panfrost_versions diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 5eda56009b8..a88f6906447 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -935,6 +935,28 @@ panfrost_fence_server_sync(struct pipe_context *pctx, close(fd); } +static struct panfrost_cs +panfrost_cs_create(struct panfrost_context *ctx, unsigned size, unsigned mask) +{ + struct panfrost_screen *screen = pan_screen(ctx->base.screen); + struct panfrost_device *dev = pan_device(ctx->base.screen); + struct kbase_context *kctx = ctx->kbase_ctx; + + struct panfrost_cs c = {0}; + + c.bo = panfrost_bo_create(dev, size, 0, "Command stream"); + + c.base = dev->mali.cs_bind(&dev->mali, kctx, c.bo->ptr.gpu, size); + + c.event_ptr = dev->mali.event_mem.gpu + c.base.event_mem_offset * PAN_EVENT_SIZE; + c.kcpu_event_ptr = dev->mali.kcpu_event_mem.gpu + c.base.event_mem_offset * PAN_EVENT_SIZE; + + c.hw_resources = mask; + screen->vtbl.init_cs(ctx, &c); + + return c; +} + struct pipe_context * panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags) { diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index dbf0d503ae9..d584345f552 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -50,6 +50,18 @@ #include "compiler/shader_enums.h" #include "midgard/midgard_compile.h" +struct panfrost_cs { + struct kbase_cs base; + struct panfrost_bo *bo; + pan_command_stream cs; + mali_ptr event_ptr; + uint64_t seqnum; + mali_ptr kcpu_event_ptr; + uint64_t kcpu_seqnum; + uint64_t offset; + unsigned hw_resources; +}; + #define SET_BIT(lval, bit, cond) \ if (cond) \ lval |= (bit); \