panfrost: On Bifrost, set the right tiler descriptor

On both fragment and tiler jobs.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4505>
This commit is contained in:
Tomeu Vizoso
2020-04-08 15:58:42 +02:00
parent 547f999e2c
commit 46e4246d49
6 changed files with 67 additions and 30 deletions

View File

@@ -1818,7 +1818,7 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
bifrost_tiler.prefix = *tiler_prefix;
bifrost_tiler.tiler.primitive_size = *primitive_size;
//bifrost_tiler.tiler.tiler_meta;
bifrost_tiler.tiler.tiler_meta = panfrost_batch_get_tiler_meta(batch, ~0);
bifrost_tiler.postfix = *tiler_postfix;
tp = &bifrost_tiler;
tp_size = sizeof(bifrost_tiler);

View File

@@ -699,6 +699,41 @@ panfrost_batch_get_tiler_heap(struct panfrost_batch *batch)
return batch->tiler_heap;
}
/* TODO: Figure out how to remove the hardcoded values */
mali_ptr
panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_count)
{
if (!vertex_count)
return 0;
if (batch->tiler_meta)
return batch->tiler_meta;
struct panfrost_bo *tiler_heap;
tiler_heap = panfrost_batch_get_tiler_heap(batch);
struct bifrost_tiler_heap_meta tiler_heap_meta = {
.heap_size = tiler_heap->size,
.tiler_heap_start = tiler_heap->gpu,
.tiler_heap_free = tiler_heap->gpu,
.tiler_heap_end = tiler_heap->gpu + tiler_heap->size,
};
tiler_heap_meta.zeros[10] = 0x1;
tiler_heap_meta.zeros[11] = 0x7e007e;
struct bifrost_tiler_meta tiler_meta = {
.hierarchy_mask = 0xf0,
.flags = 0x0,
.width = MALI_POSITIVE(batch->key.width),
.height = MALI_POSITIVE(batch->key.height),
.tiler_heap_meta = panfrost_upload_transient(batch, &tiler_heap_meta, sizeof(tiler_heap_meta)),
};
batch->tiler_meta = panfrost_upload_transient(batch, &tiler_meta, sizeof(tiler_meta));
return batch->tiler_meta;
}
struct panfrost_bo *
panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch)
{

View File

@@ -142,6 +142,9 @@ struct panfrost_batch {
/* Framebuffer descriptor. */
struct panfrost_transfer framebuffer;
/* Bifrost tiler meta descriptor. */
mali_ptr tiler_meta;
/* Output sync object. Only valid when submitted is true. */
struct panfrost_batch_fence *out_sync;
@@ -240,4 +243,7 @@ void panfrost_scoreboard_initialize_tiler(struct panfrost_batch *batch);
bool
panfrost_batch_is_scanout(struct panfrost_batch *batch);
mali_ptr
panfrost_batch_get_tiler_meta(struct panfrost_batch *batch, unsigned vertex_count);
#endif

View File

@@ -25,6 +25,7 @@
#include "pan_bo.h"
#include "pan_context.h"
#include "pan_util.h"
#include "panfrost-quirks.h"
static struct mali_rt_format
panfrost_mfbd_format(struct pipe_surface *surf)
@@ -377,8 +378,6 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
.rt_count_1 = MALI_POSITIVE(batch->key.nr_cbufs),
.rt_count_2 = 4,
.tiler = panfrost_emit_midg_tiler(batch, vertex_count),
.shared_memory = {
.stack_shift = shift,
.scratchpad = panfrost_batch_get_scratchpad(batch, shift, dev->thread_tls_alloc, dev->core_count)->gpu,
@@ -386,6 +385,11 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
}
};
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);
return framebuffer;
}

View File

@@ -1702,7 +1702,13 @@ struct mali_framebuffer {
u32 mfbd_flags : 24; // = 0x100
float clear_depth;
struct midgard_tiler_descriptor tiler;
union {
struct midgard_tiler_descriptor tiler;
struct {
mali_ptr tiler_meta;
u32 zeros[16];
};
};
/* optional: struct mali_framebuffer_extra extra */
/* struct mali_render_target rts[] */

View File

@@ -629,24 +629,18 @@ pandecode_midgard_tiler_descriptor(
/* TODO: The Bifrost tiler is not understood at all yet */
static void
pandecode_bifrost_tiler_descriptor(const struct midgard_tiler_descriptor *t)
pandecode_bifrost_tiler_descriptor(const struct mali_framebuffer *fb)
{
pandecode_log(".tiler = {\n");
pandecode_indent++;
pandecode_prop("polygon_list_size = 0x%" PRIx32, t->polygon_list_size);
pandecode_prop("hierarchy_mask = 0x%" PRIx16, t->hierarchy_mask);
pandecode_prop("flags = 0x%" PRIx16, t->flags);
MEMORY_PROP(fb, tiler_meta);
MEMORY_PROP(t, polygon_list);
MEMORY_PROP(t, polygon_list_body);
MEMORY_PROP(t, heap_start);
MEMORY_PROP(t, heap_end);
pandecode_log(".weights = { ");
for (unsigned w = 0; w < ARRAY_SIZE(t->weights); ++w) {
pandecode_log_cont("%d, ", t->weights[w]);
for (int i = 0; i < 16; i++) {
if (fb->zeros[i] != 0) {
pandecode_msg("XXX: tiler descriptor zero %d tripped, value %x\n",
i, fb->zeros[i]);
}
}
pandecode_log("},\n");
@@ -1180,12 +1174,11 @@ pandecode_mfbd_bfr(uint64_t gpu_va, int job_no, bool is_fragment, bool is_comput
if (fb->clear_depth)
pandecode_prop("clear_depth = %f", fb->clear_depth);
const struct midgard_tiler_descriptor t = fb->tiler;
if (!is_compute)
if (is_bifrost)
pandecode_bifrost_tiler_descriptor(&t);
pandecode_bifrost_tiler_descriptor(fb);
else
pandecode_midgard_tiler_descriptor(&t, fb->width1 + 1, fb->height1 + 1, is_fragment, true);
pandecode_midgard_tiler_descriptor(&fb->tiler, fb->width1 + 1, fb->height1 + 1, is_fragment, true);
else
pandecode_msg("XXX: skipping compute MFBD, fixme\n");
@@ -2592,17 +2585,10 @@ pandecode_vertex_tiler_postfix(const struct mali_vertex_tiler_postfix *p, int jo
static void
pandecode_tiler_heap_meta(mali_ptr gpu_va, int job_no)
{
struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
if (gpu_va == 0) {
pandecode_msg("XXX: bifrost_tiler_heap_meta is NULL!!\n");
return;
}
const struct bifrost_tiler_heap_meta *PANDECODE_PTR_VAR(h, mem, gpu_va);
pandecode_log("struct mali_tiler_heap_meta tiler_heap_meta_%d = {\n", job_no);
pandecode_log("struct bifrost_tiler_heap_meta tiler_heap_meta_%"PRIx64"_%d = {\n", gpu_va, job_no);
pandecode_indent++;
if (h->zero) {
@@ -2646,7 +2632,7 @@ pandecode_tiler_meta(mali_ptr gpu_va, int job_no)
pandecode_tiler_heap_meta(t->tiler_heap_meta, job_no);
pandecode_log("struct bifrost_tiler_meta tiler_meta_%d = {\n", job_no);
pandecode_log("struct bifrost_tiler_meta tiler_meta_%"PRIx64"_%d = {\n", gpu_va, job_no);
pandecode_indent++;
if (t->zero0 || t->zero1) {
@@ -2746,7 +2732,7 @@ pandecode_tiler_job_bfr(const struct mali_job_descriptor_header *h,
pandecode_vertex_tiler_postfix_pre(&t->postfix, job_no, h->job_type, "", true, gpu_id);
pandecode_tiler_meta(t->tiler.tiler_meta, job_no);
pandecode_log("struct bifrost_payload_tiler payload_%d = {\n", job_no);
pandecode_log("struct bifrost_payload_tiler payload_%"PRIx64"_%d = {\n", payload, job_no);
pandecode_indent++;
pandecode_vertex_tiler_prefix(&t->prefix, job_no, false);