panfrost: Avoid GenXML enum dependences

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11785>
This commit is contained in:
Alyssa Rosenzweig 2021-07-08 14:59:49 -04:00 committed by Marge Bot
parent 7308536f41
commit eddb81c326
3 changed files with 28 additions and 6 deletions

View File

@ -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.

View File

@ -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) | \

View File

@ -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;