panfrost: Determine load classes for formats
Via quirks. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5265>
This commit is contained in:
committed by
Marge Bot
parent
e53d27de61
commit
18a767df35
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user