-
- OUT_PKT7(ring, CP_WAIT_FOR_ME, 0);
-
- OUT_PKT7(ring, CP_MEM_TO_REG, 3);
- OUT_RING(ring, CP_MEM_TO_REG_0_REG(OVERFLOW_FLAG_REG) |
- CP_MEM_TO_REG_0_CNT(0));
- OUT_RELOC(ring, control_ptr(fd6_ctx, vsc_scratch)); /* SRC_LO/HI */
-
- /*
- * This is a bit awkward, we really want a way to invert the
- * CP_REG_TEST/CP_COND_REG_EXEC logic, so that we can conditionally
- * execute cmds to use hwbinning when a bit is *not* set. This
- * dance is to invert OVERFLOW_FLAG_REG
- *
- * A CP_NOP packet is used to skip executing the 'else' clause
- * if (b0 set)..
- */
-
- BEGIN_RING(ring, 10); /* ensure if/else doesn't get split */
-
- /* b0 will be set if VSC_DRAW_STRM or VSC_PRIM_STRM overflow: */
- OUT_PKT7(ring, CP_REG_TEST, 1);
- OUT_RING(ring, A6XX_CP_REG_TEST_0_REG(OVERFLOW_FLAG_REG) |
- A6XX_CP_REG_TEST_0_BIT(0) |
- A6XX_CP_REG_TEST_0_WAIT_FOR_ME);
-
- OUT_PKT7(ring, CP_COND_REG_EXEC, 2);
- OUT_RING(ring, CP_COND_REG_EXEC_0_MODE(PRED_TEST));
- OUT_RING(ring, CP_COND_REG_EXEC_1_DWORDS(7));
-
- /* if (b0 set) */ {
- /*
- * On overflow, mirror the value to control->vsc_overflow
- * which CPU is checking to detect overflow (see
- * check_vsc_overflow())
- */
- OUT_PKT7(ring, CP_REG_TO_MEM, 3);
- OUT_RING(ring, CP_REG_TO_MEM_0_REG(OVERFLOW_FLAG_REG) |
- CP_REG_TO_MEM_0_CNT(1 - 1));
- OUT_RELOC(ring, control_ptr(fd6_ctx, vsc_overflow));
-
- OUT_PKT4(ring, OVERFLOW_FLAG_REG, 1);
- OUT_RING(ring, 0x0);
-
- OUT_PKT7(ring, CP_NOP, 2); /* skip 'else' when 'if' is taken */
- } /* else */ {
- OUT_PKT4(ring, OVERFLOW_FLAG_REG, 1);
- OUT_RING(ring, 0x1);
- }