From 0395b58c92bf70c76accc6387141937bf748553d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 18 Jul 2019 12:43:39 -0700 Subject: [PATCH] panfrost: Set rt_count This doesn't quite work yet, but it illustrates how MRT is implemented in the MFBD: rt_count is set appropriately based on the number of render targets, while additional render target descriptors are appended on with an index variable in them (not quite decoded since there's some aspects we don't understand there, but conceptually this should be right). Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_context.c | 3 +-- src/gallium/drivers/panfrost/pan_mfbd.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 68d74224d07..26e7fca1d2f 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -165,8 +165,7 @@ panfrost_emit_mfbd(struct panfrost_context *ctx, unsigned vertex_count) .unk1 = 0x1080, - /* TODO: MRT */ - .rt_count_1 = MALI_POSITIVE(1), + .rt_count_1 = MALI_POSITIVE(ctx->pipe_framebuffer.nr_cbufs), .rt_count_2 = 4, .unknown2 = 0x1f, diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index bbaa9f29414..3039ab96ab1 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -394,17 +394,18 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws) struct bifrost_fb_extra fbx = {}; struct bifrost_render_target rts[4] = {}; - /* XXX: MRT case */ - fb.rt_count_2 = 1; + /* We always upload at least one dummy GL_NONE render target */ + + unsigned rt_descriptors = + MAX2(ctx->pipe_framebuffer.nr_cbufs, 1); + + fb.rt_count_1 = MALI_POSITIVE(rt_descriptors); + fb.rt_count_2 = rt_descriptors; fb.mfbd_flags = 0x100; /* TODO: MRT clear */ panfrost_mfbd_clear(job, &fb, &fbx, rts, fb.rt_count_2); - /* We always upload at least one dummy GL_NONE render target */ - - unsigned rt_descriptors = - MAX2(ctx->pipe_framebuffer.nr_cbufs, 1); /* Upload either the render target or a dummy GL_NONE target */ @@ -430,6 +431,9 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws) rts[cb].framebuffer = 0; rts[cb].framebuffer_stride = 0; } + + /* TODO: Break out the field */ + rts[cb].format.unk1 |= (cb * 0x400); } if (ctx->pipe_framebuffer.zsbuf) { -- 2.30.2