panfrost: Pack message preloads from compiler

Include full message preload descriptors in the RSD on v7, and do the obvious
packing for fragment shader message preloads.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9438>
This commit is contained in:
Alyssa Rosenzweig 2022-02-23 13:49:16 -05:00
parent bd06a26662
commit 6618697e0e
3 changed files with 32 additions and 7 deletions

View File

@ -881,8 +881,8 @@
<field name="Thread Balancing" size="16" start="13:0" type="uint"/>
<field name="Secondary preload" size="32" start="13:0" type="Preload"/>
<field name="Secondary shader" size="64" start="14:0" type="address"/>
<field name="Message Preload 1" size="16" start="15:0" type="uint"/>
<field name="Message Preload 2" size="16" start="15:16" type="uint"/>
<field name="Message Preload 1" size="16" start="15:0" type="Message Preload"/>
<field name="Message Preload 2" size="16" start="15:16" type="Message Preload"/>
</struct>
<struct name="Uniform Buffer" align="8">

View File

@ -160,6 +160,33 @@ pan_make_preload(gl_shader_stage stage,
}
}
#if PAN_ARCH == 7
static inline void
pan_pack_message_preload(struct MALI_MESSAGE_PRELOAD *cfg,
const struct bifrost_message_preload *msg)
{
enum mali_message_preload_register_format regfmt = msg->fp16 ?
MALI_MESSAGE_PRELOAD_REGISTER_FORMAT_F16 :
MALI_MESSAGE_PRELOAD_REGISTER_FORMAT_F32;
if (msg->enabled && msg->texture) {
cfg->type = MALI_MESSAGE_TYPE_VAR_TEX;
cfg->var_tex.varying_index = msg->varying_index;
cfg->var_tex.sampler_index = msg->sampler_index;
cfg->var_tex.register_format = regfmt;
cfg->var_tex.skip = msg->skip;
cfg->var_tex.zero_lod = msg->zero_lod;
} else if (msg->enabled) {
cfg->type = MALI_MESSAGE_TYPE_LD_VAR;
cfg->ld_var.varying_index = msg->varying_index;
cfg->ld_var.register_format = regfmt;
cfg->ld_var.num_components = msg->num_components;
} else {
cfg->type = MALI_MESSAGE_TYPE_DISABLED;
}
}
#endif
static inline void
pan_shader_prepare_bifrost_rsd(const struct pan_shader_info *info,
struct MALI_RENDERER_STATE *rsd)
@ -188,8 +215,8 @@ pan_shader_prepare_bifrost_rsd(const struct pan_shader_info *info,
rsd->properties.shader_wait_dependency_6 = info->bifrost.wait_6;
rsd->properties.shader_wait_dependency_7 = info->bifrost.wait_7;
rsd->message_preload_1 = info->bifrost.messages[0];
rsd->message_preload_2 = info->bifrost.messages[1];
pan_pack_message_preload(&rsd->message_preload_1, &info->bifrost.messages[0]);
pan_pack_message_preload(&rsd->message_preload_2, &info->bifrost.messages[1]);
#endif
} else if (info->stage == MESA_SHADER_VERTEX && info->vs.secondary_enable) {
rsd->secondary_preload.uniform_count = fau_count;

View File

@ -217,9 +217,7 @@ struct bifrost_shader_info {
struct bifrost_shader_blend_info blend[8];
nir_alu_type blend_src1_type;
bool wait_6, wait_7;
/* Packed, preloaded message descriptors */
uint16_t messages[2];
struct bifrost_message_preload messages[2];
};
struct midgard_shader_info {