aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima
diff options
context:
space:
mode:
authorVasily Khoruzhick <[email protected]>2020-02-08 02:05:24 -0800
committerMarge Bot <[email protected]>2020-02-14 10:03:01 +0000
commitf43a3fc28ff8914e4a9391233dfc3b63454c6dac (patch)
treeff4d52f57a5c32216bf9769caa9bcd9fe6f59193 /src/gallium/drivers/lima
parent582d0c5f1474ecbe52a666e30cb115144aeda7c0 (diff)
lima: handle early-z and pixel kill better
[1] calls bit 12 of aux0 'pixel kill' which is likely forward pixel kill described in [2]. Blob sets this bit if early-z is enabled and blending is disabled and colormask is RGBA. Bit 8 seems to be always enabled with bit 9 (early-z). Let's mimic blob behavior. [1] https://web.archive.org/web/20171026123213/http://limadriver.org/Render_State/ [2] https://community.arm.com/developer/tools-software/graphics/b/blog/posts/killing-pixels---a-new-optimization-for-shading-on-arm-mali-gpus Reviewed-by: Andreas Baierl <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3754> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3754>
Diffstat (limited to 'src/gallium/drivers/lima')
-rw-r--r--src/gallium/drivers/lima/lima_draw.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index b9dda6a446c..2309cc6d334 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -1136,6 +1136,8 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
struct lima_render_state *render =
lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_plb_rsw,
sizeof(*render));
+ bool early_z = true;
+ bool pixel_kill = true;
/* do hw support RGBA independ blend?
* PIPE_CAP_INDEP_BLEND_ENABLE
@@ -1239,15 +1241,27 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
render->textures_address = 0x00000000;
- /* more investigation */
- render->aux0 = 0x00000100 | (ctx->vs->varying_stride >> 3);
+ render->aux0 = (ctx->vs->varying_stride >> 3);
render->aux1 = 0x00001000;
if (ctx->blend->base.dither)
render->aux1 |= 0x00002000;
- /* Enable Early-Z if shader doesn't have discard */
- if (!fs->uses_discard)
- render->aux0 |= 0x200;
+ if (fs->uses_discard) {
+ early_z = false;
+ pixel_kill = false;
+ }
+
+ if (rt->blend_enable)
+ pixel_kill = false;
+
+ if ((rt->colormask & PIPE_MASK_RGBA) != PIPE_MASK_RGBA)
+ pixel_kill = false;
+
+ if (early_z)
+ render->aux0 |= 0x300;
+
+ if (pixel_kill)
+ render->aux0 |= 0x1000;
if (ctx->tex_stateobj.num_samplers) {
render->textures_address =