rt->framebuffer = base + header_size;
rt->afbc.metadata = base;
rt->afbc.stride = 0;
- rt->afbc.unk = 0x30009;
+ rt->afbc.flags = MALI_AFBC_FLAGS | MALI_AFBC_YTR;
/* TODO: The blob sets this to something nonzero, but it's not
* clear what/how to calculate/if it matters */
fbx->ds_afbc.depth_stencil_afbc_metadata = base;
fbx->ds_afbc.depth_stencil_afbc_stride = 0;
- fbx->ds_afbc.zero1 = 0x10009;
+ fbx->ds_afbc.flags = MALI_AFBC_FLAGS;
fbx->ds_afbc.padding = 0x1000;
} else if (rsrc->layout == MALI_TEXTURE_LINEAR || rsrc->layout == MALI_TEXTURE_TILED) {
/* TODO: Z32F(S8) support, which is always linear */
unsigned no_preload : 1;
} __attribute__((packed));
+/* Flags for afbc.flags and ds_afbc.flags */
+
+#define MALI_AFBC_FLAGS 0x10009
+
+/* Lossless RGB and RGBA colorspace transform */
+#define MALI_AFBC_YTR (1 << 17)
+
struct mali_render_target {
struct mali_rt_format format;
mali_ptr metadata;
u32 stride; // stride in units of tiles
- u32 unk; // = 0x20000
+ u32 flags; // = 0x20000
} afbc;
mali_ptr framebuffer;
struct {
mali_ptr depth_stencil_afbc_metadata;
u32 depth_stencil_afbc_stride; // in units of tiles
- u32 zero1;
+ u32 flags;
mali_ptr depth_stencil;
};
#undef FLAG_INFO
+#define FLAG_INFO(flag) { MALI_AFBC_##flag, "MALI_AFBC_" #flag }
+static const struct pandecode_flag_info afbc_fmt_flag_info[] = {
+ FLAG_INFO(YTR),
+ {}
+};
+#undef FLAG_INFO
+
#define FLAG_INFO(flag) { MALI_EXTRA_##flag, "MALI_EXTRA_" #flag }
static const struct pandecode_flag_info mfbd_extra_flag_hi_info[] = {
FLAG_INFO(PRESENT),
free(a);
pandecode_prop("stride = %d", rt->afbc.stride);
- pandecode_prop("unk = 0x%" PRIx32, rt->afbc.unk);
+
+ pandecode_log(".flags = ");
+ pandecode_log_decoded_flags(afbc_fmt_flag_info, rt->afbc.flags);
+ pandecode_log_cont(",\n");
pandecode_indent--;
pandecode_log("},\n");
- } else if (rt->afbc.metadata || rt->afbc.stride || rt->afbc.unk) {
+ } else if (rt->afbc.metadata || rt->afbc.stride || rt->afbc.flags) {
pandecode_msg("XXX: AFBC disabled but AFBC field set (0x%lX, 0x%x, 0x%x)\n",
rt->afbc.metadata,
rt->afbc.stride,
- rt->afbc.unk);
+ rt->afbc.flags);
}
MEMORY_PROP(rt, framebuffer);
fbx->ds_afbc.depth_stencil_afbc_stride);
MEMORY_PROP_DIR(fbx->ds_afbc, depth_stencil);
- if (fbx->ds_afbc.zero1 || fbx->ds_afbc.padding) {
+ pandecode_log(".flags = ");
+ pandecode_log_decoded_flags(afbc_fmt_flag_info, fbx->ds_afbc.flags);
+ pandecode_log_cont(",\n");
+
+ if (fbx->ds_afbc.padding) {
pandecode_msg("XXX: Depth/stencil AFBC zeros tripped\n");
- pandecode_prop("zero1 = 0x%" PRIx32,
- fbx->ds_afbc.zero1);
- pandecode_prop("padding = 0x%" PRIx64,
- fbx->ds_afbc.padding);
+ pandecode_prop("padding = 0x%" PRIx64, fbx->ds_afbc.padding);
}
pandecode_indent--;