1 /************************************************************************** 2 * 3 * Copyright 2019 Collabora, Ltd. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28 #ifndef PAN_UTIL_H 29 #define PAN_UTIL_H 30 31 #include <stdint.h> 32 #include <stdbool.h> 33 #include "util/format/u_format.h" 34 35 #define PAN_DBG_PERF 0x0001 36 #define PAN_DBG_TRACE 0x0002 37 #define PAN_DBG_DEQP 0x0004 38 #define PAN_DBG_DIRTY 0x0008 39 #define PAN_DBG_SYNC 0x0010 40 #define PAN_DBG_PRECOMPILE 0x0020 41 #define PAN_DBG_NOFP16 0x0040 42 #define PAN_DBG_NO_CRC 0x0080 43 #define PAN_DBG_GL3 0x0100 44 #define PAN_DBG_NO_AFBC 0x0200 45 #define PAN_DBG_MSAA16 0x0400 46 #define PAN_DBG_INDIRECT 0x0800 47 #define PAN_DBG_LINEAR 0x1000 48 #define PAN_DBG_NO_CACHE 0x2000 49 50 struct panfrost_device; 51 52 unsigned 53 panfrost_translate_swizzle_4(const unsigned char swizzle[4]); 54 55 void 56 panfrost_invert_swizzle(const unsigned char *in, unsigned char *out); 57 58 unsigned 59 panfrost_format_to_bifrost_blend(const struct panfrost_device *dev, 60 enum pipe_format format, 61 bool dithered); 62 63 void 64 pan_pack_color(uint32_t *packed, const union pipe_color_union *color, 65 enum pipe_format format, bool dithered); 66 67 /* Get the last blend shader, for an erratum workaround on v5 */ 68 69 static inline uint64_t 70 panfrost_last_nonnull(uint64_t *ptrs, unsigned count) 71 { 72 for (signed i = ((signed) count - 1); i >= 0; --i) { 73 if (ptrs[i]) 74 return ptrs[i]; 75 } 76 77 return 0; 78 } 79 80 #endif /* PAN_UTIL_H */ 81