From fefb3e9b7008e92c456f47bb1ceb58d84b24e1d3 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 23 Sep 2020 11:08:02 +0200 Subject: [PATCH] panfrost: Add preliminary support for Mali G72 Signed-off-by: Boris Brezillon Reviewed-by: Kristian H. Kristensen Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 2 ++ src/gallium/drivers/panfrost/pan_context.c | 1 + src/gallium/drivers/panfrost/pan_screen.c | 1 + src/panfrost/include/panfrost-quirks.h | 1 + src/panfrost/lib/pan_props.c | 1 + src/panfrost/lib/pan_texture.c | 5 +++++ src/panfrost/lib/pan_texture.h | 1 + 7 files changed, 12 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index fd90107..f9dbb3d 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -326,6 +326,8 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts, brts[i].constant = blend[i].equation.constant; brts[i].format = panfrost_format_to_bifrost_blend(format_desc); + if (dev->quirks & HAS_SWIZZLES) + brts[i].swizzle = panfrost_get_default_swizzle(4); /* 0x19 disables blending and forces REPLACE * mode (equivalent to rgb_mode = alpha_mode = diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 9218187..07c54d4 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1021,6 +1021,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, so->bo = panfrost_bo_create(device, size, 0); panfrost_new_texture_bifrost( + device, &so->bifrost_descriptor, texture->width0, texture->height0, depth, array_size, diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index bd71b23..e8092af 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -714,6 +714,7 @@ panfrost_create_screen(int fd, struct renderonly *ro) case 0x820: /* T820 */ case 0x860: /* T860 */ break; + case 0x6221: /* G72 */ case 0x7093: /* G31 */ case 0x7212: /* G52 */ if (dev->debug & PAN_DBG_BIFROST) diff --git a/src/panfrost/include/panfrost-quirks.h b/src/panfrost/include/panfrost-quirks.h index 22a79c9..e3aae4f 100644 --- a/src/panfrost/include/panfrost-quirks.h +++ b/src/panfrost/include/panfrost-quirks.h @@ -105,6 +105,7 @@ panfrost_get_quirks(unsigned gpu_id) return MIDGARD_QUIRKS; case 0x6000: /* G71 */ + case 0x6221: /* G72 */ return BIFROST_QUIRKS | HAS_SWIZZLES; case 0x7093: /* G31 */ diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c index 7176f9b..831b203 100644 --- a/src/panfrost/lib/pan_props.c +++ b/src/panfrost/lib/pan_props.c @@ -146,6 +146,7 @@ panfrost_model_name(unsigned gpu_id) case 0x750: return "Mali T760 (Panfrost)"; case 0x860: return "Mali T860 (Panfrost)"; case 0x880: return "Mali T880 (Panfrost)"; + case 0x6221: return "Mali G72 (Panfrost)"; case 0x7093: return "Mali G31 (Panfrost)"; case 0x7212: return "Mali G52 (Panfrost)"; default: diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c index 5a54fd5..4ea05e0 100644 --- a/src/panfrost/lib/pan_texture.c +++ b/src/panfrost/lib/pan_texture.c @@ -28,6 +28,7 @@ #include "util/macros.h" #include "util/u_math.h" #include "pan_texture.h" +#include "panfrost-quirks.h" /* Generates a texture descriptor. Ideally, descriptors are immutable after the * texture is created, so we can keep these hanging around in GPU memory in a @@ -352,6 +353,7 @@ panfrost_new_texture( void panfrost_new_texture_bifrost( + const struct panfrost_device *dev, struct mali_bifrost_texture_packed *out, uint16_t width, uint16_t height, uint16_t depth, uint16_t array_size, @@ -393,6 +395,9 @@ panfrost_new_texture_bifrost( pan_pack(out, BIFROST_TEXTURE, cfg) { cfg.dimension = dim; cfg.format = (mali_format << 12) | (srgb << 20); + if (dev->quirks & HAS_SWIZZLES) + cfg.format |= panfrost_get_default_swizzle(desc->nr_channels); + cfg.width = u_minify(width, first_level); cfg.height = u_minify(height, first_level); cfg.swizzle = swizzle; diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index 852c103..fe25f96 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -113,6 +113,7 @@ panfrost_new_texture( void panfrost_new_texture_bifrost( + const struct panfrost_device *dev, struct mali_bifrost_texture_packed *out, uint16_t width, uint16_t height, uint16_t depth, uint16_t array_size, -- 2.7.4