panfrost: XMLify attributes

To keep review manageable, this only ports over pandecode and blitting.
The main uses for vertex data and varying linkage will come next, as
they touch considerably more code.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6326>
This commit is contained in:
Alyssa Rosenzweig 2020-08-13 13:27:16 -04:00 committed by Marge Bot
parent cdc3276317
commit 2c8a722b85
4 changed files with 18 additions and 40 deletions

View File

@ -1311,7 +1311,6 @@ pandecode_attributes(const struct pandecode_mapped_memory *mem,
if (mode != MALI_ATTR_LINEAR)
pandecode_log_cont("%s ", pandecode_attr_mode_short(mode));
/* Print the name to link with attr_meta */
pandecode_log_cont("%s_%d", prefix, i);
/* Print the stride and size */
@ -1537,41 +1536,13 @@ pandecode_midgard_blend_mrt(void *descs, int job_no, int rt_no)
static int
pandecode_attribute_meta(int job_no, int count, const struct mali_vertex_tiler_postfix *v, bool varying, char *suffix)
{
char base[128];
char *prefix = varying ? "varying" : "attribute";
unsigned max_index = 0;
snprintf(base, sizeof(base), "%s_meta", prefix);
struct mali_attr_meta *attr_meta;
const char *prefix = varying ? "Varying" : "Attribute";
mali_ptr p = varying ? v->varying_meta : v->attribute_meta;
struct pandecode_mapped_memory *attr_mem = pandecode_find_mapped_gpu_mem_containing(p);
for (int i = 0; i < count; ++i, p += MALI_ATTRIBUTE_LENGTH)
DUMP_ADDR(prefix, ATTRIBUTE, p, 1);
for (int i = 0; i < count; ++i, p += sizeof(struct mali_attr_meta)) {
attr_meta = pandecode_fetch_gpu_mem(attr_mem, p,
sizeof(*attr_mem));
if (attr_meta->index > max_index)
max_index = attr_meta->index;
if (attr_meta->unknown1 != 0x2) {
pandecode_msg("XXX: expected unknown1 = 0x2\n");
pandecode_prop("unknown1 = 0x%" PRIx64, (u64) attr_meta->unknown1);
}
pandecode_log_cont("%s %s_%u", mali_format_as_str(attr_meta->format >> 12), prefix, attr_meta->index);
if (attr_meta->src_offset)
pandecode_log_cont("[%u]", attr_meta->src_offset);
pandecode_swizzle(attr_meta->format & ((1 << 12) - 1), attr_meta->format >> 12);
pandecode_log_cont(";\n");
}
pandecode_log("\n");
return count ? (max_index + 1) : 0;
return count;
}
/* return bits [lo, hi) of word */

View File

@ -215,6 +215,13 @@
<value name="Mirrored Clamp to Border" value="15"/>
</enum>
<struct name="Attribute">
<field name="Buffer index" size="9" start="0" type="uint"/>
<field name="Unknown" size="1" start="9" type="bool" default="true"/>
<field name="Format" size="22" start="10" type="uint"/>
<field name="Offset" size="32" start="32" type="int"/>
</struct>
<struct name="Midgard Sampler">
<field name="Magnify Nearest" size="1" start="0" type="bool" default="true"/>
<field name="Minify Nearest" size="1" start="1" type="bool" default="true"/>

View File

@ -26,7 +26,7 @@
#include "midgard_pack.h"
#include "pan_encoder.h"
/* This file handles attribute descriptors (mali_attr_meta). The
/* This file handles attribute descriptors. The
* bulk of the complexity is from instancing. See mali_job for
* notes on how this works. But basically, for small vertex
* counts, we have a lookup table, and for large vertex counts,

View File

@ -188,6 +188,7 @@ panfrost_load_midg(
struct panfrost_transfer viewport = panfrost_pool_alloc(pool, MALI_VIEWPORT_LENGTH);
struct panfrost_transfer sampler = panfrost_pool_alloc(pool, MALI_MIDGARD_SAMPLER_LENGTH);
struct panfrost_transfer varying_buf = panfrost_pool_alloc(pool, MALI_ATTRIBUTE_LENGTH);
pan_pack(viewport.cpu, VIEWPORT, cfg) {
cfg.scissor_maximum_x = width - 1; /* Inclusive */
@ -200,11 +201,10 @@ panfrost_load_midg(
.size = 4 * sizeof(float) * vertex_count,
};
struct mali_attr_meta varying_meta = {
.index = 0,
.unknown1 = 2,
.format = (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | (MALI_RGBA32F << 12)
};
pan_pack(varying_buf.cpu, ATTRIBUTE, cfg) {
cfg.buffer_index = 0;
cfg.format = (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | (MALI_RGBA32F << 12);
}
struct mali_stencil_packed stencil;
pan_pack(&stencil, STENCIL, cfg) {
@ -348,7 +348,7 @@ panfrost_load_midg(
.sampler_descriptor = sampler.gpu,
.shader = shader_meta_t.gpu,
.varyings = panfrost_pool_upload(pool, &varying, sizeof(varying)),
.varying_meta = panfrost_pool_upload(pool, &varying_meta, sizeof(varying_meta)),
.varying_meta = varying_buf.gpu,
.viewport = viewport.gpu,
.shared_memory = fbd
}