aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/encoder/pan_texture.c
diff options
context:
space:
mode:
authorTomeu Vizoso <[email protected]>2020-04-17 14:23:49 +0200
committerTomeu Vizoso <[email protected]>2020-04-24 06:53:42 +0200
commite41894ba15b4150a8dfd884503ba04c2c33aab6f (patch)
tree8badfcae88b4aef0637c3ecfff7b67619a194897 /src/panfrost/encoder/pan_texture.c
parentd3eb23adb50c621f49000191e6c024df01f090b7 (diff)
panfrost: Emit texture descriptor on bifrost
Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4680>
Diffstat (limited to 'src/panfrost/encoder/pan_texture.c')
-rw-r--r--src/panfrost/encoder/pan_texture.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/panfrost/encoder/pan_texture.c b/src/panfrost/encoder/pan_texture.c
index 0c92464af08..b0b630c7b93 100644
--- a/src/panfrost/encoder/pan_texture.c
+++ b/src/panfrost/encoder/pan_texture.c
@@ -242,6 +242,47 @@ panfrost_new_texture(
}
}
+void
+panfrost_new_texture_bifrost(
+ struct bifrost_texture_descriptor *descriptor,
+ uint16_t width, uint16_t height,
+ uint16_t depth, uint16_t array_size,
+ enum pipe_format format,
+ enum mali_texture_type type,
+ enum mali_texture_layout layout,
+ unsigned first_level, unsigned last_level,
+ unsigned first_layer, unsigned last_layer,
+ unsigned cube_stride,
+ unsigned swizzle,
+ mali_ptr base,
+ struct panfrost_slice *slices)
+{
+ const struct util_format_description *desc =
+ util_format_description(format);
+
+ enum mali_format mali_format = panfrost_find_format(desc);
+
+ descriptor->format_unk = 0x2;
+ descriptor->type = type;
+ descriptor->format_unk2 = 0x100;
+ descriptor->format = mali_format;
+ descriptor->srgb = (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB);
+ descriptor->format_unk3 = 0x0;
+ descriptor->width = MALI_POSITIVE(u_minify(width, first_level));
+ descriptor->height = MALI_POSITIVE(u_minify(height, first_level));
+ descriptor->swizzle = swizzle;
+ descriptor->unk0 = 0x1;
+ descriptor->levels = last_level - first_level;
+ descriptor->unk1 = 0x0;
+ descriptor->levels_unk = 0;
+ descriptor->level_2 = 0;
+ descriptor->payload = base;
+ descriptor->array_size = MALI_POSITIVE(array_size);
+ descriptor->unk4 = 0x0;
+ descriptor->depth = MALI_POSITIVE(u_minify(depth, first_level));
+ descriptor->unk5 = 0x0;
+}
+
/* Computes sizes for checksumming, which is 8 bytes per 16x16 tile.
* Checksumming is believed to be a CRC variant (CRC64 based on the size?).
* This feature is also known as "transaction elimination". */