meta->sampler_count = ctx->sampler_count[st];
if (dev->quirks & IS_BIFROST) {
- meta->bifrost1.unk1 = 0x800000;
+ struct mali_bifrost_properties_packed prop;
+
+ pan_pack(&prop, BIFROST_PROPERTIES, cfg) {
+ cfg.unknown = 0x800000; /* XXX */
+ cfg.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+ }
+
+ memcpy(&meta->bifrost_props, &prop, sizeof(prop));
+
meta->bifrost2.preload_regs = 0xC0;
meta->bifrost2.uniform_count = ss->uniform_count;
- meta->bifrost1.uniform_buffer_count = panfrost_ubo_count(ctx, st);
} else {
struct mali_midgard_properties_packed prop;
cfg.suppress_inf_nan = true; /* XXX */
}
- memcpy(&meta->midgard1, &prop, sizeof(prop));
+ memcpy(&meta->midgard_props, &prop, sizeof(prop));
}
}
fragmeta->sampler_count = ctx->sampler_count[PIPE_SHADER_FRAGMENT];
if (dev->quirks & IS_BIFROST) {
- /* First clause ATEST |= 0x4000000.
- * Lefs than 32 regs |= 0x200 */
- fragmeta->bifrost1.unk1 = 0x950020;
+ struct mali_bifrost_properties_packed prop;
+
+ bool no_blend = true;
+
+ for (unsigned i = 0; i < rt_count; ++i)
+ no_blend &= (!blend[i].load_dest | blend[i].no_colour);
+
+ pan_pack(&prop, BIFROST_PROPERTIES, cfg) {
+ cfg.unknown = 0x950020; /* XXX */
+ cfg.uniform_buffer_count = panfrost_ubo_count(ctx, PIPE_SHADER_FRAGMENT);
+ cfg.early_z_enable = !fs->can_discard && !fs->writes_depth && no_blend;
+ }
+
+ memcpy(&fragmeta->bifrost_props, &prop, sizeof(prop));
- fragmeta->bifrost1.uniform_buffer_count = panfrost_ubo_count(ctx, PIPE_SHADER_FRAGMENT);
fragmeta->bifrost2.preload_regs = 0x1;
SET_BIT(fragmeta->bifrost2.preload_regs, 0x10, fs->reads_frag_coord);
cfg.reads_depth_stencil = zs_enabled && fs->can_discard;
}
- memcpy(&fragmeta->midgard1, &prop, sizeof(prop));
+ memcpy(&fragmeta->midgard_props, &prop, sizeof(prop));
}
bool msaa = rast->multisample;
fragmeta->unknown2_3 |= MALI_DEPTH_FUNC(panfrost_translate_compare_func(
zsa->base.depth.enabled ? zsa->base.depth.func : PIPE_FUNC_ALWAYS));
- SET_BIT(fragmeta->unknown2_4, MALI_NO_DITHER,
- (dev->quirks & MIDGARD_SFBD) && ctx->blend &&
- !ctx->blend->base.dither);
-
- SET_BIT(fragmeta->unknown2_4, 0x10, dev->quirks & MIDGARD_SFBD);
-
SET_BIT(fragmeta->unknown2_4, MALI_ALPHA_TO_COVERAGE,
ctx->blend->base.alpha_to_coverage);
cfg.early_z_enable = true;
}
- memcpy(&fragmeta->midgard1, &prop, sizeof(prop));
+ memcpy(&fragmeta->midgard_props, &prop, sizeof(prop));
}
if (dev->quirks & MIDGARD_SFBD) {
SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD,
blend[0].load_dest);
+
+ fragmeta->unknown2_4 |= 0x10;
+ SET_BIT(fragmeta->unknown2_4, MALI_NO_DITHER, !ctx->blend->base.dither);
} else if (!(dev->quirks & IS_BIFROST)) {
/* Bug where MRT-capable hw apparently reads the last blend
* shader from here instead of the usual location? */
break;
}
}
-
- if (dev->quirks & IS_BIFROST) {
- bool no_blend = true;
-
- for (unsigned i = 0; i < rt_count; ++i)
- no_blend &= (!blend[i].load_dest | blend[i].no_colour);
-
- SET_BIT(fragmeta->bifrost1.unk1, MALI_BIFROST_EARLY_Z,
- !fs->can_discard && !fs->writes_depth && no_blend);
- }
}
void