Commit d5079510 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

panfrost: Decode rendering block type

A mode for rendering tiled/uncompressed was noticed, so we reshuffle the
MFBD render target definitions to explicitly include block type.
Signed-off-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
parent 83c02a5e
......@@ -1408,8 +1408,14 @@ struct mali_single_framebuffer {
/* Format bits for the render target flags */
#define MALI_MFBD_FORMAT_AFBC (1 << 5)
#define MALI_MFBD_FORMAT_MSAA (1 << 7)
#define MALI_MFBD_FORMAT_MSAA (1 << 1)
enum mali_mfbd_block_format {
MALI_MFBD_BLOCK_TILED = 0x0,
MALI_MFBD_BLOCK_UNKNOWN = 0x1,
MALI_MFBD_BLOCK_LINEAR = 0x2,
MALI_MFBD_BLOCK_AFBC = 0x3,
};
struct mali_rt_format {
unsigned unk1 : 32;
......@@ -1417,7 +1423,9 @@ struct mali_rt_format {
unsigned nr_channels : 2; /* MALI_POSITIVE */
unsigned flags : 11;
unsigned unk3 : 5;
enum mali_mfbd_block_format block : 2;
unsigned flags : 4;
unsigned swizzle : 12;
......
......@@ -42,7 +42,8 @@ panfrost_mfbd_format(struct pipe_surface *surf)
.unk1 = 0x4000000,
.unk2 = 0x1,
.nr_channels = MALI_POSITIVE(desc->nr_channels),
.flags = 0x444,
.unk3 = 0x4,
.flags = 0x8,
.swizzle = panfrost_translate_swizzle_4(desc->swizzle),
.unk4 = 0x8
};
......@@ -52,7 +53,7 @@ panfrost_mfbd_format(struct pipe_surface *surf)
if (surf->texture->format == PIPE_FORMAT_B5G6R5_UNORM) {
fmt.unk1 = 0x14000000;
fmt.nr_channels = MALI_POSITIVE(2);
fmt.flags |= 0x1;
fmt.unk3 |= 0x1;
}
return fmt;
......@@ -100,6 +101,7 @@ panfrost_mfbd_set_cbuf(
/* Now, we set the layout specific pieces */
if (rsrc->bo->layout == PAN_LINEAR) {
rt->format.block = MALI_MFBD_BLOCK_LINEAR;
rt->framebuffer = rsrc->bo->gpu + offset;
rt->framebuffer_stride = stride / 16;
} else if (rsrc->bo->layout == PAN_AFBC) {
......@@ -108,7 +110,7 @@ panfrost_mfbd_set_cbuf(
rt->afbc.stride = 0;
rt->afbc.unk = 0x30009;
rt->format.flags |= MALI_MFBD_FORMAT_AFBC;
rt->format.block = MALI_MFBD_BLOCK_AFBC;
mali_ptr afbc_main = rsrc->bo->afbc_slab.gpu + rsrc->bo->afbc_metadata_size;
rt->framebuffer = afbc_main;
......
/*
* Copyright (C) 2017-2019 Alyssa Rosenzweig
* Copyright (C) 2017-2019 Connor Abbott
* Copyright (C) 2019 Collabora
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
......@@ -206,7 +207,6 @@ static const struct pandecode_flag_info fb_fmt_flag_info[] = {
#define FLAG_INFO(flag) { MALI_MFBD_FORMAT_##flag, "MALI_MFBD_FORMAT_" #flag }
static const struct pandecode_flag_info mfbd_fmt_flag_info[] = {
FLAG_INFO(AFBC),
FLAG_INFO(MSAA),
{}
};
......@@ -423,6 +423,22 @@ pandecode_texture_type(enum mali_texture_type type)
}
#undef DEFINE_CASE
#define DEFINE_CASE(name) case MALI_MFBD_BLOCK_## name: return "MALI_MFBD_BLOCK_" #name
static char *
pandecode_mfbd_block_format(enum mali_mfbd_block_format fmt)
{
switch (fmt) {
DEFINE_CASE(TILED);
DEFINE_CASE(UNKNOWN);
DEFINE_CASE(LINEAR);
DEFINE_CASE(AFBC);
default:
unreachable("Invalid case");
}
}
#undef DEFINE_CASE
static inline char *
pandecode_decode_fbd_type(enum mali_fbd_type type)
{
......@@ -540,6 +556,10 @@ pandecode_rt_format(struct mali_rt_format format)
pandecode_prop("unk1 = 0x%" PRIx32, format.unk1);
pandecode_prop("unk2 = 0x%" PRIx32, format.unk2);
pandecode_prop("unk3 = 0x%" PRIx32, format.unk3);
pandecode_prop("block = %s",
pandecode_mfbd_block_format(format.block));
pandecode_prop("nr_channels = MALI_POSITIVE(%d)",
MALI_NEGATIVE(format.nr_channels));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment