panfrost: Set mfbd.msaa.sample_locations on Bifrost

And mfbd.shared_memory only on Midgard.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4505>
This commit is contained in:
Alyssa Rosenzweig
2020-04-06 19:44:58 -04:00
committed by Tomeu Vizoso
parent 46e4246d49
commit 0a9fa4bcb6
3 changed files with 79 additions and 14 deletions

View File

@@ -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));
}

View File

@@ -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__ */

View File

@@ -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;
return framebuffer;
mfbd.tiler = panfrost_emit_midg_tiler(batch, vertex_count);
}
return mfbd;
}
void