BEGIN_RING() could decide we can't fit the next packet in the current
cmdstream segment, and grow a new segment. So we need to grab ring->cur
*after* BEGIN_RING(), otherwise we are writing cmdstream past the end of
the previous segment.
Fixes: bdd98b892f3 ("freedreno: New struct packing macros")
Signed-off-by: Rob Clark <robdclark@chromium.org>
do { \
const struct fd_reg_pair regs[] = { __VA_ARGS__ }; \
unsigned count = ARRAY_SIZE(regs); \
- uint32_t *p = ring->cur; \
\
STATIC_ASSERT(count > 0); \
STATIC_ASSERT(count <= 16); \
\
BEGIN_RING(ring, count + 1); \
+ uint32_t *p = ring->cur; \
*p++ = CP_TYPE4_PKT | count | \
(_odd_parity_bit(count) << 7) | \
((regs[0].reg & 0x3ffff) << 8) | \