From fc49ff9a8c98516f02a22998165afe4dc20f8182 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 7 Jul 2021 20:06:33 -0400 Subject: [PATCH] panfrost: Inline panfrost_get_z_internal_format Trivial, get it out of the way so pan_format can focus on the tables. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/lib/pan_encoder.h | 20 ++++++++++++++++++++ src/panfrost/lib/pan_format.c | 18 ------------------ src/panfrost/lib/pan_texture.h | 4 +--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/panfrost/lib/pan_encoder.h b/src/panfrost/lib/pan_encoder.h index e0fa376..b3ab48c 100644 --- a/src/panfrost/lib/pan_encoder.h +++ b/src/panfrost/lib/pan_encoder.h @@ -28,6 +28,7 @@ #define __PAN_ENCODER_H #include +#include "util/format/u_format.h" #include "pan_bo.h" #include "midgard_pack.h" @@ -214,4 +215,23 @@ panfrost_pack_work_groups_compute( } } +/* Format conversion */ +static inline enum mali_z_internal_format +panfrost_get_z_internal_format(enum pipe_format fmt) +{ + switch (fmt) { + case PIPE_FORMAT_Z16_UNORM: + case PIPE_FORMAT_Z16_UNORM_S8_UINT: + return MALI_Z_INTERNAL_FORMAT_D16; + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + case PIPE_FORMAT_Z24X8_UNORM: + return MALI_Z_INTERNAL_FORMAT_D24; + case PIPE_FORMAT_Z32_FLOAT: + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + return MALI_Z_INTERNAL_FORMAT_D32; + default: + unreachable("Unsupported depth/stencil format."); + } +} + #endif diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c index 299d7d8..27f7696 100644 --- a/src/panfrost/lib/pan_format.c +++ b/src/panfrost/lib/pan_format.c @@ -714,21 +714,3 @@ panfrost_format_to_bifrost_blend(const struct panfrost_device *dev, return dev->formats[format].hw; } } - -enum mali_z_internal_format -panfrost_get_z_internal_format(enum pipe_format fmt) -{ - switch (fmt) { - case PIPE_FORMAT_Z16_UNORM: - case PIPE_FORMAT_Z16_UNORM_S8_UINT: - return MALI_Z_INTERNAL_FORMAT_D16; - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - case PIPE_FORMAT_Z24X8_UNORM: - return MALI_Z_INTERNAL_FORMAT_D24; - case PIPE_FORMAT_Z32_FLOAT: - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - return MALI_Z_INTERNAL_FORMAT_D32; - default: - unreachable("Unsupported depth/stencil format."); - } -} diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index 16b64a0..a1de0da 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -35,6 +35,7 @@ #include "midgard_pack.h" #include "pan_bo.h" #include "pan_device.h" +#include "pan_util.h" #define PAN_MODIFIER_COUNT 4 extern uint64_t pan_best_modifiers[PAN_MODIFIER_COUNT]; @@ -186,9 +187,6 @@ extern const struct pan_blendable_format panfrost_blendable_formats[PIPE_FORMAT_ extern const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT]; extern const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT]; -enum mali_z_internal_format -panfrost_get_z_internal_format(enum pipe_format fmt); - unsigned panfrost_translate_swizzle_4(const unsigned char swizzle[4]); -- 2.7.4