From 18a767df35f2a71105703a1132ab5a3c1ec27313 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 13 May 2020 12:22:22 -0400 Subject: [PATCH] panfrost: Determine load classes for formats Via quirks. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/util/pan_lower_framebuffer.c | 29 +++++++++++++++++++++++ src/panfrost/util/pan_lower_framebuffer.h | 10 ++++++++ 2 files changed, 39 insertions(+) diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c index 28c44f7b0cb..33c1d5af75d 100644 --- a/src/panfrost/util/pan_lower_framebuffer.c +++ b/src/panfrost/util/pan_lower_framebuffer.c @@ -52,6 +52,7 @@ #include "compiler/nir/nir_format_convert.h" #include "util/format/u_format.h" #include "pan_lower_framebuffer.h" +#include "panfrost-quirks.h" /* Determines the unpacked type best suiting a given format, so the rest of the * pipeline may be adjusted accordingly */ @@ -84,3 +85,31 @@ pan_unpacked_type_for_format(const struct util_format_description *desc) unreachable("Format not renderable"); } } + +enum pan_format_class +pan_format_class_load(const struct util_format_description *desc, unsigned quirks) +{ + /* Check if we can do anything better than software architecturally */ + if (quirks & MIDGARD_NO_TYPED_BLEND_LOADS) { + return (quirks & NO_BLEND_PACKS) + ? PAN_FORMAT_SOFTWARE : PAN_FORMAT_PACK; + } + + /* Some formats are missing as typed on some GPUs but have unpacks */ + if (quirks & MIDGARD_MISSING_LOADS) { + switch (desc->format) { + case PIPE_FORMAT_R11G11B10_FLOAT: + case PIPE_FORMAT_R10G10B10A2_UNORM: + case PIPE_FORMAT_B10G10R10A2_UNORM: + case PIPE_FORMAT_R10G10B10X2_UNORM: + case PIPE_FORMAT_B10G10R10X2_UNORM: + case PIPE_FORMAT_R10G10B10A2_UINT: + return PAN_FORMAT_PACK; + default: + return PAN_FORMAT_NATIVE; + } + } + + /* Otherwise, we can do native */ + return PAN_FORMAT_NATIVE; +} diff --git a/src/panfrost/util/pan_lower_framebuffer.h b/src/panfrost/util/pan_lower_framebuffer.h index b18660eb9b2..7bca12f561a 100644 --- a/src/panfrost/util/pan_lower_framebuffer.h +++ b/src/panfrost/util/pan_lower_framebuffer.h @@ -30,6 +30,16 @@ #include "compiler/nir/nir.h" #include "util/format/u_format.h" +/* NATIVE formats can use a typed load/store. PACK formats cannot but can use a + * typed pack/unpack instruction. SOFTWARE formats are lowered */ + +enum pan_format_class { + PAN_FORMAT_NATIVE, + PAN_FORMAT_PACK, + PAN_FORMAT_SOFTWARE +}; + nir_alu_type pan_unpacked_type_for_format(const struct util_format_description *desc); +enum pan_format_class pan_format_class_load(const struct util_format_description *desc, unsigned quirks); #endif -- 2.30.2