.unk3 = 0x4,
.flags = 0x8,
.swizzle = panfrost_translate_swizzle_4(swizzle),
- .unk4 = 0x8
+ .no_preload = true
};
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
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);
- for (int cb = 0; cb < ctx->pipe_framebuffer.nr_cbufs; ++cb) {
+
+ /* Upload either the render target or a dummy GL_NONE target */
+
+ for (int cb = 0; cb < rt_descriptors; ++cb) {
struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[cb];
- if (!surf)
- continue;
+ if (surf) {
+ panfrost_mfbd_set_cbuf(&rts[cb], surf);
- unsigned bpp = util_format_get_blocksize(surf->format);
+ /* What is this? Looks like some extension of the bpp
+ * field. Maybe it establishes how much internal
+ * tilebuffer space is reserved? */
- panfrost_mfbd_set_cbuf(&rts[cb], surf);
+ unsigned bpp = util_format_get_blocksize(surf->format);
+ fb.rt_count_2 = MAX2(fb.rt_count_2, ALIGN_POT(bpp, 4) / 4);
+ } else {
+ struct mali_rt_format null_rt = {
+ .unk1 = 0x4000000,
+ .no_preload = true
+ };
- /* What is this? Looks like some extension of the bpp field.
- * Maybe it establishes how much internal tilebuffer space is
- * reserved? */
- fb.rt_count_2 = MAX2(fb.rt_count_2, ALIGN_POT(bpp, 4) / 4);
+ rts[cb].format = null_rt;
+ 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) {
panfrost_mfbd_set_zsbuf(&fb, &fbx, ctx->pipe_framebuffer.zsbuf);
}
- /* For the special case of a depth-only FBO, we need to attach a dummy render target */
-
- if (ctx->pipe_framebuffer.nr_cbufs == 0) {
- struct mali_rt_format null_rt = {
- .unk1 = 0x4000000,
- .unk4 = 0x8
- };
-
- rts[0].format = null_rt;
- rts[0].framebuffer = 0;
- rts[0].framebuffer_stride = 0;
- }
-
/* When scanning out, the depth buffer is immediately invalidated, so
* we don't need to waste bandwidth writing it out. This can improve
* performance substantially (Z32_UNORM 1080p @ 60fps is 475 MB/s of