panfrost: Adjust the renderer state definition

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6980>
This commit is contained in:
Boris Brezillon 2020-09-29 15:47:04 +02:00
parent 51331d6d57
commit f734e67b93
6 changed files with 31 additions and 29 deletions

View file

@ -106,10 +106,10 @@ pan_upload_shader_descriptor(struct panfrost_context *ctx,
const struct panfrost_device *dev = pan_device(ctx->base.screen);
struct mali_state_packed *out;
u_upload_alloc(ctx->state_uploader, 0, MALI_STATE_LENGTH, MALI_STATE_LENGTH,
u_upload_alloc(ctx->state_uploader, 0, MALI_RENDERER_STATE_LENGTH, MALI_RENDERER_STATE_LENGTH,
&state->upload.offset, &state->upload.rsrc, (void **) &out);
pan_pack(out, STATE_OPAQUE, cfg) {
pan_pack(out, RENDERER_STATE_OPAQUE, cfg) {
cfg.shader = state->shader;
memcpy(&cfg.properties, &state->properties, sizeof(state->properties));

View file

@ -356,8 +356,8 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
static void
panfrost_emit_frag_shader(struct panfrost_context *ctx,
struct mali_state_packed *fragmeta,
struct panfrost_blend_final *blend)
struct mali_renderer_state_packed *fragmeta,
struct panfrost_blend_final *blend)
{
const struct panfrost_device *dev = pan_device(ctx->base.screen);
struct panfrost_shader_state *fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
@ -456,8 +456,8 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx,
MALI_FUNC_ALWAYS;
cfg.depth_write_mask = zsa->base.depth.writemask;
cfg.near_discard = rast->depth_clip_near;
cfg.far_discard = rast->depth_clip_far;
cfg.fixed_function_near_discard = rast->depth_clip_near;
cfg.fixed_function_far_discard = rast->depth_clip_far;
cfg.unknown_2 = true;
}
@ -500,7 +500,7 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx,
}
}
pan_pack(fragmeta, STATE_OPAQUE, cfg) {
pan_pack(fragmeta, RENDERER_STATE_OPAQUE, cfg) {
cfg.shader = fs->shader;
cfg.properties = properties;
cfg.depth_units = rast->offset_units * 2.0f;
@ -565,8 +565,8 @@ panfrost_emit_frag_shader_meta(struct panfrost_batch *batch)
else
rt_size = sizeof(struct midgard_blend_rt);
unsigned desc_size = MALI_STATE_LENGTH + rt_size * rt_count;
xfer = panfrost_pool_alloc_aligned(&batch->pool, desc_size, MALI_STATE_LENGTH);
unsigned desc_size = MALI_RENDERER_STATE_LENGTH + rt_size * rt_count;
xfer = panfrost_pool_alloc_aligned(&batch->pool, desc_size, MALI_RENDERER_STATE_LENGTH);
struct panfrost_blend_final blend[PIPE_MAX_COLOR_BUFS];
unsigned shader_offset = 0;
@ -575,10 +575,10 @@ panfrost_emit_frag_shader_meta(struct panfrost_batch *batch)
for (unsigned c = 0; c < ctx->pipe_framebuffer.nr_cbufs; ++c)
blend[c] = panfrost_get_blend_for_context(ctx, c, &shader_bo,
&shader_offset);
panfrost_emit_frag_shader(ctx, (struct mali_state_packed *) xfer.cpu, blend);
panfrost_emit_frag_shader(ctx, (struct mali_renderer_state_packed *) xfer.cpu, blend);
if (!(dev->quirks & MIDGARD_SFBD))
panfrost_emit_blend(batch, xfer.cpu + MALI_STATE_LENGTH, blend);
panfrost_emit_blend(batch, xfer.cpu + MALI_RENDERER_STATE_LENGTH, blend);
else
batch->draws |= PIPE_CLEAR_COLOR0;

View file

@ -173,7 +173,7 @@ bit_vertex(struct panfrost_device *dev, panfrost_program prog,
cfg.wls_instances = MALI_LOCAL_STORAGE_NO_WORKGROUP_MEM;
}
pan_pack(shader_desc->cpu, STATE, cfg) {
pan_pack(shader_desc->cpu, RENDERER_STATE, cfg) {
cfg.shader.shader = shader->gpu;
cfg.shader.attribute_count = cfg.shader.varying_count = 1;
cfg.properties = 0x800001;

View file

@ -1138,7 +1138,7 @@ pandecode_vertex_tiler_postfix_pre(
if (p->state) {
struct pandecode_mapped_memory *smem = pandecode_find_mapped_gpu_mem_containing(p->state);
uint32_t *cl = pandecode_fetch_gpu_mem(smem, p->state, MALI_STATE_LENGTH);
uint32_t *cl = pandecode_fetch_gpu_mem(smem, p->state, MALI_RENDERER_STATE_LENGTH);
/* Disassemble ahead-of-time to get stats. Initialize with
* stats for the missing-shader case so we get validation
@ -1155,12 +1155,12 @@ pandecode_vertex_tiler_postfix_pre(
.uniform_buffer_count = 0
};
pan_unpack(cl, STATE, state);
pan_unpack(cl, RENDERER_STATE, state);
if (state.shader.shader & ~0xF)
info = pandecode_shader_disassemble(state.shader.shader & ~0xF, job_no, job_type, is_bifrost, gpu_id);
DUMP_UNPACKED(STATE, state, "State:\n");
DUMP_UNPACKED(RENDERER_STATE, state, "State:\n");
pandecode_indent++;
/* Save for dumps */
@ -1225,7 +1225,7 @@ pandecode_vertex_tiler_postfix_pre(
if (job_type == MALI_JOB_TYPE_TILER &&
(is_bifrost || p->fbd & MALI_FBD_TAG_IS_MFBD)) {
void* blend_base = ((void *) cl) + MALI_STATE_LENGTH;
void* blend_base = ((void *) cl) + MALI_RENDERER_STATE_LENGTH;
for (unsigned i = 0; i < fbd_info.rt_count; i++) {
mali_ptr shader = 0;

View file

@ -516,18 +516,19 @@
<struct name="Multisample, Misc" size="1">
<field name="Sample mask" size="16" start="0" type="uint"/>
<field name="Multisample enable" size="1" start="16" type="bool"/>
<!-- TODO 17 -->
<field name="Multisample late coverage" size="1" start="17" type="bool"/>
<field name="Evaluate per-sample" size="1" start="18" type="bool"/>
<field name="Unknown 1" size="1" start="19" type="bool"/>
<field name="Unknown 2" size="1" start="20" type="bool"/>
<field name="SFBD Load destination" size="1" start="21" type="bool"/>
<field name="SFBD Blend shader" size="1" start="22" type="bool"/>
<!-- TODO 23 -->
<field name="SFBD Blend shader discard" size="1" start="23" type="bool"/>
<field name="Depth function" size="3" start="24" type="Func"/>
<field name="Depth write mask" size="1" start="27" type="bool"/>
<field name="Near discard" size="1" start="28" type="bool"/>
<field name="Far discard" size="1" start="29" type="bool"/>
<!-- TODO: 30-31 -->
<field name="Fixed-function near discard" size="1" start="28" type="bool"/>
<field name="Fixed-function far discard" size="1" start="29" type="bool"/>
<field name="Fragment near discard" size="1" start="30" type="bool"/>
<field name="Fragment far discard" size="1" start="31" type="bool"/>
</struct>
<struct name="Stencil Mask, Misc" size="1">
@ -535,7 +536,8 @@
<field name="Stencil mask back" size="8" start="8" type="uint"/>
<field name="Stencil enable" size="1" start="16" type="bool"/>
<field name="Alpha-to-coverage" size="1" start="17" type="bool"/>
<!-- TODO 18-19 -->
<field name="Alpha-to-coverage Invert" size="1" start="18" type="bool"/>
<field name="Alpha to one" size="1" start="19" type="bool"/>
<field name="SFBD Write enable" size="1" start="20" type="bool"/>
<field name="Unknown 1" size="3" start="21" type="uint"/>
<field name="SFBD sRGB" size="1" start="24" type="bool"/>
@ -544,7 +546,7 @@
<field name="Depth Range 1" size="1" start="28" type="bool"/>
<field name="Depth Range 2" size="1" start="29" type="bool"/>
<field name="Single-sampled lines" size="1" start="30" type="bool"/>
<!-- TODO: 31 -->
<field name="Point snap" size="1" start="31" type="bool"/>
</struct>
<struct name="Stencil">
@ -556,18 +558,18 @@
<field name="Depth Pass" size="3" start="25" type="Stencil Op"/>
</struct>
<struct name="State" with_opaque="true">
<struct name="Renderer State" with_opaque="true">
<field name="Shader" size="128" start="0:0" type="Shader"/>
<field name="Properties" size="32" start="4:0" type="uint"/>
<field name="Depth units" size="32" start="5:0" type="float"/>
<field name="Depth factor" size="32" start="6:0" type="float"/>
<!-- TODO: word 7 -->
<field name="Depth bias clamp" size="32" start="7:0" type="float"/>
<field name="Multisample, Misc" size="32" start="8:0" type="Multisample, Misc"/>
<field name="Stencil Mask, Misc" size="32" start="9:0" type="Stencil Mask, Misc"/>
<field name="Stencil front" size="32" start="10:0" type="Stencil"/>
<field name="Stencil back" size="32" start="11:0" type="Stencil"/>
<field name="Preload" size="32" start="12:0" type="Preload"/>
<!--- TODO: word 13 -->
<field name="Thread Balancing" size="16" start="13:0" type="uint"/>
<field name="SFBD Blend" size="64" start="14:0" type="uint"/>
</struct>

View file

@ -238,7 +238,7 @@ panfrost_load_midg(
struct mali_midgard_properties_packed properties;
struct panfrost_transfer shader_meta_t = panfrost_pool_alloc_aligned(
pool, MALI_STATE_LENGTH + 8 * sizeof(struct midgard_blend_rt), 128);
pool, MALI_RENDERER_STATE_LENGTH + 8 * sizeof(struct midgard_blend_rt), 128);
pan_pack(&properties, MIDGARD_PROPERTIES, cfg) {
cfg.work_register_count = 4;
@ -249,7 +249,7 @@ panfrost_load_midg(
MALI_DEPTH_SOURCE_FIXED_FUNCTION;
}
pan_pack(shader_meta_t.cpu, STATE, cfg) {
pan_pack(shader_meta_t.cpu, RENDERER_STATE, cfg) {
cfg.shader.shader = pool->dev->blit_shaders.loads[loc][T][ms];
cfg.shader.varying_count = 1;
cfg.shader.texture_count = 1;
@ -318,7 +318,7 @@ panfrost_load_midg(
cfg.normalized_coordinates = false;
for (unsigned i = 0; i < 8; ++i) {
void *dest = shader_meta_t.cpu + MALI_STATE_LENGTH + sizeof(struct midgard_blend_rt) * i;
void *dest = shader_meta_t.cpu + MALI_RENDERER_STATE_LENGTH + sizeof(struct midgard_blend_rt) * i;
if (loc == (FRAG_RESULT_DATA0 + i)) {
struct midgard_blend_rt blend_rt = {