#define FD_DBG_NOBYPASS 0x0040
#define FD_DBG_FRAGHALF 0x0080
#define FD_DBG_NOBIN 0x0100
-#define FD_DBG_OPTMSGS 0x0200
+/* unused 0x0200 */
#define FD_DBG_GLSL120 0x0400
#define FD_DBG_SHADERDB 0x0800
#define FD_DBG_FLUSH 0x1000
#define FD_DBG_HIPRIO 0x100000
#define FD_DBG_TTILE 0x200000
#define FD_DBG_PERFC 0x400000
-#define FD_DBG_SOFTPIN 0x800000
-
+#define FD_DBG_NOUBWC 0x800000
extern int fd_mesa_debug;
extern bool fd_binning_enabled;
}
static inline uint32_t DRAW_A20X(enum pc_di_primtype prim_type,
+ enum pc_di_face_cull_sel faceness_cull_select,
enum pc_di_src_sel source_select, enum pc_di_index_size index_size,
- enum pc_di_vis_cull_mode vis_cull_mode,
+ bool pre_fetch_cull_enable,
+ bool grp_cull_enable,
uint16_t count)
{
return (prim_type << 0) |
(source_select << 6) |
+ (faceness_cull_select << 8) |
((index_size & 1) << 11) |
((index_size >> 1) << 13) |
- (vis_cull_mode << 9) |
+ (pre_fetch_cull_enable << 14) |
+ (grp_cull_enable << 15) |
(count << 16);
}
return true;
}
+/* Note sure if this is same on all gens, but seems to be same on the later
+ * gen's
+ */
+static inline unsigned
+fd_calc_guardband(unsigned x)
+{
+ float l = log2(x);
+ if (l <= 8)
+ return 511;
+ return 511 - ((l - 8) * 65);
+}
+
#define LOG_DWORDS 0
static inline void emit_marker(struct fd_ringbuffer *ring, int scratch_idx);
*/
static inline void
-OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo,
- uint32_t offset, uint64_t or, int32_t shift)
+__out_reloc(struct fd_ringbuffer *ring, struct fd_bo *bo,
+ uint32_t offset, uint64_t or, int32_t shift, uint32_t flags)
{
if (LOG_DWORDS) {
DBG("ring[%p]: OUT_RELOC %04x: %p+%u << %d", ring,
debug_assert(offset < fd_bo_size(bo));
fd_ringbuffer_reloc(ring, &(struct fd_reloc){
.bo = bo,
- .flags = FD_RELOC_READ,
+ .flags = flags,
.offset = offset,
.or = or,
.shift = shift,
});
}
+static inline void
+OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo,
+ uint32_t offset, uint64_t or, int32_t shift)
+{
+ __out_reloc(ring, bo, offset, or, shift, FD_RELOC_READ);
+}
+
static inline void
OUT_RELOCW(struct fd_ringbuffer *ring, struct fd_bo *bo,
uint32_t offset, uint64_t or, int32_t shift)
{
- if (LOG_DWORDS) {
- DBG("ring[%p]: OUT_RELOCW %04x: %p+%u << %d", ring,
- (uint32_t)(ring->cur - ring->start), bo, offset, shift);
- }
- debug_assert(offset < fd_bo_size(bo));
- fd_ringbuffer_reloc(ring, &(struct fd_reloc){
- .bo = bo,
- .flags = FD_RELOC_READ | FD_RELOC_WRITE,
- .offset = offset,
- .or = or,
- .shift = shift,
- .orhi = or >> 32,
- });
+ __out_reloc(ring, bo, offset, or, shift, FD_RELOC_READ | FD_RELOC_WRITE);
+}
+
+static inline void
+OUT_RELOCD(struct fd_ringbuffer *ring, struct fd_bo *bo,
+ uint32_t offset, uint64_t or, int32_t shift)
+{
+ __out_reloc(ring, bo, offset, or, shift, FD_RELOC_READ | FD_RELOC_DUMP);
}
static inline void
OUT_RING(ring, ++marker_cnt);
}
-/* helper to get numeric value from environment variable.. mostly
- * just leaving this here because it is helpful to brute-force figure
- * out unknown formats, etc, which blob driver does not support:
- */
-static inline uint32_t env2u(const char *envvar)
-{
- char *str = getenv(envvar);
- if (str)
- return strtoul(str, NULL, 0);
- return 0;
-}
-
static inline uint32_t
pack_rgba(enum pipe_format format, const float *rgba)
{
switch (samples) {
default:
debug_assert(0);
+ case 0:
case 1: return MSAA_ONE;
case 2: return MSAA_TWO;
case 4: return MSAA_FOUR;
+ case 8: return MSAA_EIGHT;
}
}
case MESA_SHADER_FRAGMENT:
return SB4_FS_SHADER;
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
return SB4_CS_SHADER;
default:
unreachable("bad shader type");
}
}
+static inline enum a4xx_index_size
+fd4_size2indextype(unsigned index_size)
+{
+ switch (index_size) {
+ case 1: return INDEX4_SIZE_8_BIT;
+ case 2: return INDEX4_SIZE_16_BIT;
+ case 4: return INDEX4_SIZE_32_BIT;
+ }
+ DBG("unsupported index size: %d", index_size);
+ assert(0);
+ return INDEX4_SIZE_32_BIT;
+}
+
#endif /* FREEDRENO_UTIL_H_ */