| 1 |
/* |
| 2 |
* Copyright 2019 Collabora, Ltd. |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef PAN_UTIL_H |
| 7 |
#define PAN_UTIL_H |
| 8 |
|
| 9 |
#include <stdbool.h> |
| 10 |
#include <stdint.h> |
| 11 |
#include "util/format/u_format.h" |
| 12 |
|
| 13 |
#define PAN_DBG_PERF 0x0001 |
| 14 |
#define PAN_DBG_TRACE 0x0002 |
| 15 |
/* 0x4 unused */ |
| 16 |
#define PAN_DBG_DIRTY 0x0008 |
| 17 |
#define PAN_DBG_SYNC 0x0010 |
| 18 |
/* 0x20 unused */ |
| 19 |
#define PAN_DBG_NOFP16 0x0040 |
| 20 |
#define PAN_DBG_NO_CRC 0x0080 |
| 21 |
#define PAN_DBG_GL3 0x0100 |
| 22 |
#define PAN_DBG_NO_AFBC 0x0200 |
| 23 |
/* 0x400 unused */ |
| 24 |
#define PAN_DBG_STRICT_IMPORT 0x0800 |
| 25 |
#define PAN_DBG_LINEAR 0x1000 |
| 26 |
#define PAN_DBG_NO_CACHE 0x2000 |
| 27 |
#define PAN_DBG_DUMP 0x4000 |
| 28 |
|
| 29 |
#ifndef NDEBUG |
| 30 |
#define PAN_DBG_OVERFLOW 0x8000 |
| 31 |
#endif |
| 32 |
|
| 33 |
#define PAN_DBG_YUV 0x20000 |
| 34 |
#define PAN_DBG_FORCE_PACK 0x40000 |
| 35 |
#define PAN_DBG_CS 0x80000 |
| 36 |
|
| 37 |
struct pan_blendable_format; |
| 38 |
|
| 39 |
unsigned pan_translate_swizzle_4(const unsigned char swizzle[4]); |
| 40 |
|
| 41 |
void pan_invert_swizzle(const unsigned char *in, unsigned char *out); |
| 42 |
|
| 43 |
void pan_pack_color(const struct pan_blendable_format *blendable_formats, |
| 44 |
uint32_t *packed, const union pipe_color_union *color, |
| 45 |
enum pipe_format format, bool dithered); |
| 46 |
|
| 47 |
/* Get the last blend shader, for an erratum workaround on v5 */ |
| 48 |
|
| 49 |
static inline uint64_t |
| 50 |
pan_last_nonnull(uint64_t *ptrs, unsigned count) |
| 51 |
{ |
| 52 |
for (signed i = ((signed)count - 1); i >= 0; --i) { |
| 53 |
if (ptrs[i]) |
| 54 |
return ptrs[i]; |
| 55 |
} |
| 56 |
|
| 57 |
return 0; |
| 58 |
} |
| 59 |
|
| 60 |
#endif /* PAN_UTIL_H */ |