#include "r300_cs.h"
#include "r300_screen.h"
+void r300_emit_blend_state(struct r300_context* r300,
+ struct r300_blend_state* blend)
+{
+ CS_LOCALS(r300);
+ OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 2);
+ OUT_CS(blend->blend_control);
+ OUT_CS(blend->alpha_blend_control);
+ OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
+ OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither);
+}
+
static void r300_emit_dirty_state(struct r300_context* r300)
{
struct r300_screen* r300screen = (struct r300_screen*)r300->context.screen;
/* XXX check size */
if (r300->dirty_state & R300_NEW_BLEND) {
- struct r300_blend_state* blend = r300->blend_state;
- /* XXX next two are contiguous regs */
- OUT_CS_REG(R300_RB3D_CBLEND, blend->blend_control);
- OUT_CS_REG(R300_RB3D_ABLEND, blend->alpha_blend_control);
- OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
- OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither);
+ r300_emit_blend_state(r300, r300->blend_state);
}
if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
BEGIN_CS(276);
R300_PACIFY;
-OUT_CS_REG(0x4100, 0x00000000);
+OUT_CS_REG(R300_TX_INVALTAGS, 0x0);
R300_PACIFY;
+/* Viewport setup */
OUT_CS_REG(0x1D98, 0x43000000);
OUT_CS_REG(0x1D9C, 0x43002000);
OUT_CS_REG(0x1DA0, 0xC3000000);
OUT_CS_REG(0x1DA4, 0x43002000);
OUT_CS_REG(0x1DA8, 0x3F000000);
OUT_CS_REG(0x1DAC, 0x3F000000);
-OUT_CS_REG(0x2284, 0x00000000);
-OUT_CS_REG(0x20B0, 0x0000043F);
-OUT_CS_REG(0x20B4, 0x00000008);
-OUT_CS_REG(0x2134, 0x00FFFFFF);
-OUT_CS_REG(0x2138, 0x00000000);
-OUT_CS_REG(0x2140, 0x00000000);
-OUT_CS_REG(0x2150, 0x00000000);
-OUT_CS_REG(0x21E0, 0x00000000);
-OUT_CS_REG(0x2180, 0x00000000);
-OUT_CS_REG(0x2184, 0x00000000);
+/* Flush PVS. */
+OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+
+OUT_CS_REG(R300_SE_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
+ R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
+ R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
+ R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
+/* Vertex size. */
+OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
+/* Max and min vertex index clamp. */
+OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF);
+OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
+/* XXX endian */
+OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
+OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0);
OUT_CS_REG(0x21DC, 0xAAAAAAAA);
OUT_CS_REG(0x221C, 0x00000000);
OUT_CS_REG(0x2220, 0x3F800000);
OUT_CS_REG(0x4BD8, 0x00000000);
OUT_CS_REG(0x4BD8, 0x00000000);
OUT_CS_REG(0x4E00, 0x00000000);
-OUT_CS_REG(0x4E04, 0x20210000);
-OUT_CS_REG(0x4E08, 0x20210000);
OUT_CS_REG(0x4E0C, 0x0000000F);
OUT_CS_REG(0x4E10, 0x00000000);
-OUT_CS_REG(0x4E18, 0x00000000);
-OUT_CS_REG(0x4E50, 0x00000000);
OUT_CS_REG(0x4E54, 0x00000000);
OUT_CS_REG(0x4E58, 0x00000000);
OUT_CS_REG(0x4E5C, 0x00000000);
OUT_CS_REG(0x2208, 0x00000000);
OUT_CS_REG(0x2150, 0x21030003);
OUT_CS_REG(0x4BC0, 0x00000000);
-OUT_CS_REG(0x21E0, 0xF688F688);
-OUT_CS_REG(0x2180, 0x00000001);
-OUT_CS_REG(0x2184, 0x00000405);
+OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, 0xF688F688);
+OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
+OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
OUT_CS_REG(0x20B0, 0x0000043F);
OUT_CS_REG(0x20B4, 0x00000008);
OUT_CS_REG(0x21DC, 0xAAAAAAAA);
OUT_CS_REG(0x1DA8, 0x3F800000);
OUT_CS_REG(0x1DAC, 0x00000000);
OUT_CS_REG(0x4BD4, 0x00000000);
-OUT_CS_REG(0x4E04, 0x00000000);
-OUT_CS_REG(0x4E08, 0x00000000);
+r300_emit_blend_state(r300, &blend_clear_state);
+/* XXX emit blend state */
OUT_CS_REG(0x221C, 0x0001C000);
OUT_CS_REG(R300_GA_POINT_SIZE, ((h * 6) & R300_POINTSIZE_Y_MASK) |
((w * 6) << R300_POINTSIZE_X_SHIFT));