r600g: setup basic loop consts on r600 + evergreen.
authorDave Airlie <airlied@redhat.com>
Fri, 1 Oct 2010 05:56:05 +0000 (15:56 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 1 Oct 2010 06:06:31 +0000 (16:06 +1000)
this sets up a single loop constant like r600c does.

src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/evergreend.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600d.h
src/gallium/winsys/r600/drm/evergreen_hw_context.c
src/gallium/winsys/r600/drm/r600_hw_context.c

index 4fa94e31e71c95a1c41bb68a55277ebc61776741..70799f6378ed65a69e2ac02c3b6e30078a55a024 100644 (file)
@@ -1593,6 +1593,10 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
                                        S_02880C_KILL_ENABLE(1),
                                        S_02880C_KILL_ENABLE(1), NULL);
        }
+
+       r600_pipe_state_add_reg(rstate,
+                               R_03A200_SQ_LOOP_CONST_0, 0x01000FFF,
+                               0xFFFFFFFF, NULL);
 }
 
 void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader)
@@ -1640,6 +1644,10 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader
        r600_pipe_state_add_reg(rstate,
                        R_0288A4_SQ_PGM_START_FS,
                        0x00000000, 0xFFFFFFFF, shader->bo);
+
+       r600_pipe_state_add_reg(rstate,
+                               R_03A200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
+                               0xFFFFFFFF, NULL);
 }
 
 void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx)
index e265348a19c11a1d4059937806bea5fe95070667..9971dded7827e33fcbe2736eb607be496fd0eba8 100644 (file)
 #define R_03CFF0_SQ_VTX_BASE_VTX_LOC                    0x03CFF0
 #define R_03CFF4_SQ_VTX_START_INST_LOC                  0x03CFF4
 
+#define R_03A200_SQ_LOOP_CONST_0                     0x3A200
 #endif
index 66cc035e7d97e935205f739c65f61ce69ab371e0..41c01d4a7b35bdf7605255aa087e4f39436d0a7d 100644 (file)
@@ -81,6 +81,11 @@ static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shade
        r600_pipe_state_add_reg(rstate,
                        R_028894_SQ_PGM_START_FS,
                        0x00000000, 0xFFFFFFFF, shader->bo);
+
+       r600_pipe_state_add_reg(rstate,
+                               R_03E200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
+                               0xFFFFFFFF, NULL);
+
 }
 
 int r600_find_vs_semantic_index(struct r600_shader *vs,
@@ -182,6 +187,9 @@ static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shade
                                        S_02880C_KILL_ENABLE(1),
                                        S_02880C_KILL_ENABLE(1), NULL);
        }
+       r600_pipe_state_add_reg(rstate,
+                               R_03E200_SQ_LOOP_CONST_0, 0x01000FFF,
+                               0xFFFFFFFF, NULL);
 }
 
 static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader)
index 3d1c5dbfd8712350d606a38a73b4a92f2668ff24..a96d2ce26c1b1dd8b0de3b5f56798edb81939dd3 100644 (file)
 #define R_03CFF0_SQ_VTX_BASE_VTX_LOC                 0x03CFF0
 #define R_03CFF4_SQ_VTX_START_INST_LOC               0x03CFF4
 
+#define R_03E200_SQ_LOOP_CONST_0                     0x3E200
+
 #define SQ_TEX_INST_LD 0x03
 #define SQ_TEX_INST_GET_GRADIENTS_H 0x7
 #define SQ_TEX_INST_GET_GRADIENTS_V 0x8
index 129f571a04fec8ee176c0d9fc3d068671ac439fe..c3569e60e881a8d7502258f21c04ab7a12444711 100644 (file)
@@ -493,6 +493,22 @@ static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 off
        return 0;
 }
 
+static int evergreen_loop_const_init(struct r600_context *ctx, u32 offset)
+{
+       unsigned nreg = 32;
+       struct r600_reg r600_loop_consts[32];
+       int i;
+
+       for (i = 0; i < nreg; i++) {
+               r600_loop_consts[i].opcode = PKT3_SET_LOOP_CONST;
+               r600_loop_consts[i].offset_base = EVERGREEN_LOOP_CONST_OFFSET;
+               r600_loop_consts[i].offset = EVERGREEN_LOOP_CONST_OFFSET + ((offset + i) * 4);
+               r600_loop_consts[i].need_bo = 0;
+               r600_loop_consts[i].flush_flags = 0;
+       }
+       return r600_context_add_block(ctx, r600_loop_consts, nreg);
+}
+
 int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon)
 {
        int r;
@@ -566,6 +582,11 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon)
                        goto out_err;
        }
 
+       /* PS loop const */
+       evergreen_loop_const_init(ctx, 0);
+       /* VS loop const */
+       evergreen_loop_const_init(ctx, 32);
+
        /* setup block table */
        ctx->blocks = calloc(ctx->nblocks, sizeof(void*));
        for (int i = 0, c = 0; i < 256; i++) {
index 4d7547c97583f89bde4d9beb02533a1aeb6f68ff..2ca5a45e03d6f817b88f4ca5b00f3a0ab0f20070 100644 (file)
@@ -542,6 +542,22 @@ static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset)
        return r600_context_add_block(ctx, r600_shader_sampler_border, nreg);
 }
 
+static int r600_loop_const_init(struct r600_context *ctx, u32 offset)
+{
+       unsigned nreg = 32;
+       struct r600_reg r600_loop_consts[32];
+       int i;
+
+       for (i = 0; i < nreg; i++) {
+               r600_loop_consts[i].opcode = PKT3_SET_LOOP_CONST;
+               r600_loop_consts[i].offset_base = R600_LOOP_CONST_OFFSET;
+               r600_loop_consts[i].offset = R600_LOOP_CONST_OFFSET + ((offset + i) * 4);
+               r600_loop_consts[i].need_bo = 0;
+               r600_loop_consts[i].flush_flags = 0;
+       }
+       return r600_context_add_block(ctx, r600_loop_consts, nreg);
+}
+
 /* initialize */
 void r600_context_fini(struct r600_context *ctx)
 {
@@ -639,6 +655,11 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon)
                        goto out_err;
        }
 
+       /* PS loop const */
+       r600_loop_const_init(ctx, 0);
+       /* VS loop const */
+       r600_loop_const_init(ctx, 32);
+
        /* setup block table */
        ctx->blocks = calloc(ctx->nblocks, sizeof(void*));
        for (int i = 0, c = 0; i < 256; i++) {