/* 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;
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;
.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
};
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;
/* 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) {
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"),
#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),
{}
};
}
#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)
{
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));