From eddb81c3268e482c7f4d4fbcc7e9a71b9dd1e424 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 8 Jul 2021 14:59:49 -0400 Subject: [PATCH] panfrost: Avoid GenXML enum dependences Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_screen.c | 6 +++--- src/panfrost/lib/pan_format.h | 17 ++++++++++++++--- src/panfrost/lib/pan_texture.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 55acd1c600e..ebb9b8704e9 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -534,19 +534,19 @@ panfrost_is_format_supported( struct pipe_screen *screen, | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_SAMPLER_VIEW); struct panfrost_format fmt = dev->formats[format]; - enum mali_format indexed = MALI_EXTRACT_INDEX(fmt.hw); /* Also check that compressed texture formats are supported on this * particular chip. They may not be depending on system integration * differences. RGTC can be emulated so is always supported. */ bool is_rgtc = format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC; - bool supported = panfrost_supports_compressed_format(dev, indexed); + bool supported = panfrost_supports_compressed_format(dev, + MALI_EXTRACT_INDEX(fmt.hw)); if (!is_rgtc && !supported) return false; - return indexed && ((relevant_bind & ~fmt.bind) == 0); + return MALI_EXTRACT_INDEX(fmt.hw) && ((relevant_bind & ~fmt.bind) == 0); } /* We always support linear and tiled operations, both external and internal. diff --git a/src/panfrost/lib/pan_format.h b/src/panfrost/lib/pan_format.h index 74919559b4c..244a2f2302e 100644 --- a/src/panfrost/lib/pan_format.h +++ b/src/panfrost/lib/pan_format.h @@ -29,7 +29,6 @@ #define __PAN_FORMAT_H #include "util/format/u_format.h" -#include "midgard_pack.h" /* Formats */ @@ -41,8 +40,8 @@ struct panfrost_format { }; struct pan_blendable_format { - enum mali_color_buffer_internal_format internal : 16; - enum mali_mfbd_color_format writeback : 16; + /* enum mali_color_buffer_internal_format */ uint16_t internal; + /* enum mali_mfbd_color_format */ uint16_t writeback; mali_pixel_format bifrost; }; @@ -52,6 +51,18 @@ extern const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT]; extern const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT]; /* Helpers to construct swizzles */ +#ifndef PAN_PACK_H +/* Avoid the GenXML dependence */ + +enum mali_channel { + MALI_CHANNEL_R = 0, + MALI_CHANNEL_G = 1, + MALI_CHANNEL_B = 2, + MALI_CHANNEL_A = 3, + MALI_CHANNEL_0 = 4, + MALI_CHANNEL_1 = 5, +}; +#endif #define PAN_V6_SWIZZLE(R, G, B, A) ( \ ((MALI_CHANNEL_ ## R) << 0) | \ diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index 25e92c5d9cf..d8d9093f127 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -83,6 +83,17 @@ enum pan_image_crc_mode { PAN_IMAGE_CRC_OOB, }; +#ifndef PAN_PACK_H +/* Avoid the GenXML dependence */ + +enum mali_texture_dimension { + MALI_TEXTURE_DIMENSION_CUBE = 0, + MALI_TEXTURE_DIMENSION_1D = 1, + MALI_TEXTURE_DIMENSION_2D = 2, + MALI_TEXTURE_DIMENSION_3D = 3, +}; +#endif + struct pan_image_layout { uint64_t modifier; enum pipe_format format;