From: Alyssa Rosenzweig Date: Mon, 6 Apr 2020 23:44:58 +0000 (-0400) Subject: panfrost: Set mfbd.msaa.sample_locations on Bifrost X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0a9fa4bcb6875f94700ec55d4f68560713cbba72;p=mesa.git panfrost: Set mfbd.msaa.sample_locations on Bifrost And mfbd.shared_memory only on Midgard. Signed-off-by: Alyssa Rosenzweig Signed-off-by: Tomeu Vizoso Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 784f170a34c..e207c6d9614 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1859,3 +1859,61 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tp, tp_size, false); } + +/* TODO: stop hardcoding this */ +mali_ptr +panfrost_emit_sample_locations(struct panfrost_batch *batch) +{ + uint16_t locations[] = { + 128, 128, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 0, 256, + 128, 128, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + }; + + return panfrost_upload_transient(batch, locations, 96 * sizeof(uint16_t)); +} diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index 11fe0a6481f..e56fb4a44c3 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -108,4 +108,7 @@ panfrost_vt_update_primitive_size(struct panfrost_context *ctx, struct mali_vertex_tiler_prefix *prefix, union midgard_primitive_size *primitive_size); +mali_ptr +panfrost_emit_sample_locations(struct panfrost_batch *batch); + #endif /* __PAN_CMDSTREAM_H__ */ diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index b0e295ea51c..c4063c317ea 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -24,6 +24,7 @@ #include "pan_bo.h" #include "pan_context.h" +#include "pan_cmdstream.h" #include "pan_util.h" #include "panfrost-quirks.h" @@ -365,9 +366,7 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count) unsigned width = batch->key.width; unsigned height = batch->key.height; - unsigned shift = panfrost_get_stack_shift(batch->stack_size); - - struct mali_framebuffer framebuffer = { + struct mali_framebuffer mfbd = { .width1 = MALI_POSITIVE(width), .height1 = MALI_POSITIVE(height), .width2 = MALI_POSITIVE(width), @@ -377,20 +376,25 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count) .rt_count_1 = MALI_POSITIVE(batch->key.nr_cbufs), .rt_count_2 = 4, - - .shared_memory = { - .stack_shift = shift, - .scratchpad = panfrost_batch_get_scratchpad(batch, shift, dev->thread_tls_alloc, dev->core_count)->gpu, - .shared_workgroup_count = ~0, - } }; - if (dev->quirks & IS_BIFROST) - framebuffer.tiler_meta = panfrost_batch_get_tiler_meta(batch, vertex_count); - else - framebuffer.tiler = panfrost_emit_midg_tiler(batch, vertex_count); + if (dev->quirks & IS_BIFROST) { + mfbd.msaa.sample_locations = panfrost_emit_sample_locations(batch); + mfbd.tiler_meta = panfrost_batch_get_tiler_meta(batch, vertex_count); + } else { + unsigned shift = panfrost_get_stack_shift(batch->stack_size); + struct panfrost_bo *bo = panfrost_batch_get_scratchpad(batch, + shift, + dev->thread_tls_alloc, + dev->core_count); + mfbd.shared_memory.stack_shift = shift; + mfbd.shared_memory.scratchpad = bo->gpu; + mfbd.shared_memory.shared_workgroup_count = ~0; + + mfbd.tiler = panfrost_emit_midg_tiler(batch, vertex_count); + } - return framebuffer; + return mfbd; } void