#include <string.h>
#include "pan_bo.h"
#include "pan_context.h"
+#include "pan_format.h"
#include "pan_util.h"
#include "compiler/nir/nir.h"
struct panfrost_transfer
panfrost_vertex_tiler_job(struct panfrost_context *ctx, bool is_tiler);
-unsigned
-panfrost_get_default_swizzle(unsigned components);
-
void
panfrost_flush(
struct pipe_context *pipe,
return out;
}
-unsigned
-panfrost_get_default_swizzle(unsigned components)
-{
- unsigned char default_swizzles[4][4] = {
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_0, PIPE_SWIZZLE_0, PIPE_SWIZZLE_1},
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_0, PIPE_SWIZZLE_1},
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_1},
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W},
- };
-
- assert(components >= 1 && components <= 4);
- return panfrost_translate_swizzle_4(default_swizzles[components - 1]);
-}
-
static unsigned
panfrost_translate_channel_width(unsigned size)
{
unsigned
panfrost_translate_swizzle_4(const unsigned char swizzle[4]);
-unsigned
-panfrost_get_default_swizzle(unsigned components);
-
enum mali_format
panfrost_find_format(const struct util_format_description *desc);
bool
panfrost_is_z24s8_variant(enum pipe_format fmt);
+static inline unsigned
+panfrost_get_default_swizzle(unsigned components)
+{
+ switch (components) {
+ case 1:
+ return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_ZERO << 3) |
+ (MALI_CHANNEL_ZERO << 6) | (MALI_CHANNEL_ONE << 9);
+ case 2:
+ return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) |
+ (MALI_CHANNEL_ZERO << 6) | (MALI_CHANNEL_ONE << 9);
+ case 3:
+ return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) |
+ (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ONE << 9);
+ case 4:
+ return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) |
+ (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ALPHA << 9);
+ default:
+ unreachable("Invalid number of components");
+ }
+}
+
#endif
#include "pan_bo.h"
#include "pan_context.h"
+#include "pan_format.h"
#include "util/u_prim.h"
static mali_ptr