...
 
Commits (3)
......@@ -275,7 +275,9 @@ panfrost_emit_fbd(struct panfrost_context *ctx)
.width2 = MALI_POSITIVE(ctx->pipe_framebuffer.width),
.height2 = MALI_POSITIVE(ctx->pipe_framebuffer.height),
.unk1 = 0x1080,
.unk0 = 0x1e4,
.unk1 = 0x1092,
.unk3 = 0x100,
/* TODO: MRT */
.rt_count_1 = MALI_POSITIVE(1),
......@@ -810,7 +812,7 @@ panfrost_default_shader_backend(struct panfrost_context *ctx)
struct mali_shader_meta shader = {
.alpha_coverage = ~MALI_ALPHA_COVERAGE(0.000000),
.unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x3010 /*| MALI_CAN_DISCARD*/,
.unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x3000 | 0x10,
#ifdef T8XX
.unknown2_4 = MALI_NO_MSAA | 0x4e0,
#else
......@@ -1089,7 +1091,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
/* Set late due to depending on render state */
/* The one at the end seems to mean "1 UBO" */
ctx->fragment_shader_core.midgard1.unknown1 = MALI_NO_ALPHA_TO_COVERAGE | 0x200 | 0x2201;
ctx->fragment_shader_core.midgard1.unknown1 = MALI_NO_ALPHA_TO_COVERAGE | 0x2201;
/* Assign texture/sample count right before upload */
ctx->fragment_shader_core.texture_count = ctx->sampler_view_count[PIPE_SHADER_FRAGMENT];
......@@ -1113,11 +1115,35 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
ctx->fragment_shader_core.midgard1.unknown1 = 0x4200;
}
/* If we're wallpapering, some weird stuff changes */
int saved_unk1 = 0, saved_unk23 = 0, saved_unk24 = 0;
if (ctx->in_wallpaper) {
saved_unk1 = ctx->fragment_shader_core.midgard1.unknown1;
saved_unk23 = ctx->fragment_shader_core.unknown2_3;
saved_unk24 = ctx->fragment_shader_core.unknown2_4;
ctx->fragment_shader_core.unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x3000;
ctx->fragment_shader_core.unknown2_4 = 0x4e0;
ctx->fragment_shader_core.midgard1.unknown1 = MALI_NO_ALPHA_TO_COVERAGE | 0x200;
}
if (ctx->blend->has_blend_shader)
ctx->fragment_shader_core.blend_shader = ctx->blend->blend_shader;
ctx->payload_tiler.postfix._shader_upper = panfrost_upload(&ctx->cmdstream_persistent, &ctx->fragment_shader_core, sizeof(struct mali_shader_meta), true) >> 4;
if (ctx->in_wallpaper) {
/* Restore uncleanly-changed values */
ctx->fragment_shader_core.midgard1.unknown1 = saved_unk1;
ctx->fragment_shader_core.unknown2_3 = saved_unk23;
ctx->fragment_shader_core.unknown2_4 = saved_unk24;
/* The next draw -must- actualize the popped */
ctx->dirty |= PAN_DIRTY_FS;
}
#ifdef T8XX
/* Additional blend descriptor tacked on for newer systems */
......@@ -1152,7 +1178,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
struct mali_blend_meta blend_meta[] = {
{
.unk1 = 0x200 | blend_count,
.unk1 = 0x200 | blend_count | (ctx->in_wallpaper ? 0x800 : 0x0),
.blend_equation_1 = ctx->blend->equation,
.blend_equation_2 = replace_mode
},
......
......@@ -193,6 +193,9 @@ struct panfrost_context {
struct pipe_blend_color blend_color;
struct pipe_depth_stencil_alpha_state *depth_stencil;
struct pipe_stencil_ref stencil_ref;
/* Are we currently drawing a wallpaper? */
bool in_wallpaper;
};
/* Corresponds to the CSO */
......
......@@ -134,6 +134,8 @@ panfrost_draw_wallpaper(struct pipe_context *pipe)
{
struct panfrost_context *ctx = panfrost_context(pipe);
ctx->in_wallpaper = true;
/* Setup payload for elided quad. TODO: Refactor draw_vbo so this can
* be a little more DRY */
......@@ -206,6 +208,7 @@ panfrost_draw_wallpaper(struct pipe_context *pipe)
2048.0, 1280.0, 0.0, 1.0,
};
/* No need to push, normal draws refresh it from a varying */
ctx->payload_tiler.postfix.position_varying = panfrost_upload(&ctx->cmdstream, implied_position_varying, sizeof(implied_position_varying), true);
/* Similarly, setup the texture coordinate varying, hardcoded to match
......@@ -226,6 +229,7 @@ panfrost_draw_wallpaper(struct pipe_context *pipe)
}
};
/* No need to push varyings, since every draw refreshes it anyway */
ctx->payload_tiler.postfix.varyings = panfrost_upload(&ctx->cmdstream, varyings, sizeof(varyings), true);
struct mali_attr_meta varying_meta[1] = {
......@@ -264,4 +268,5 @@ panfrost_draw_wallpaper(struct pipe_context *pipe)
/* Cleanup */
panfrost_disable_wallpaper_program(pipe);
ctx->payload_tiler.postfix.varying_meta = saved_varying_meta;
ctx->in_wallpaper = false;
}