summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r300/r300_cs.h15
-rw-r--r--src/gallium/drivers/r300/r300_surface.c320
-rw-r--r--src/gallium/winsys/drm/amd/amd_context.c2
3 files changed, 322 insertions, 15 deletions
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index e6860cbaf7b..edcfb9628f7 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -72,19 +72,24 @@ static uint32_t pack_float_32(float f)
cs_winsys->begin_cs(cs, (size), __FILE__, __FUNCTION__, __LINE__); \
} while (0)
-#define OUT_CS(value) \
- cs_winsys->write_cs_dword(cs, value)
+#define OUT_CS(value) do { \
+ cs_winsys->write_cs_dword(cs, value); \
+} while (0)
-#define OUT_CS_32F(value) \
- cs_winsys->write_cs_dword(cs, pack_float_32(value))
+#define OUT_CS_32F(value) do { \
+ cs_winsys->write_cs_dword(cs, pack_float_32(value)); \
+} while (0)
#define OUT_CS_REG(register, value) do { \
+ debug_printf("writing 0x%x to register 0x%x\n", value, register); \
OUT_CS(CP_PACKET0(register, 0)); \
- OUT_CS(value); } while (0)
+ OUT_CS(value); \
+} while (0)
/* Note: This expects count to be the number of registers,
* not the actual packet0 count! */
#define OUT_CS_REG_SEQ(register, count) do { \
+ debug_printf("writing register sequence 0x%x\n", register); \
OUT_CS(CP_PACKET0(register, ((count) - 1))); \
} while (0)
diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c
index c9957a0af25..8afa06dec8f 100644
--- a/src/gallium/drivers/r300/r300_surface.c
+++ b/src/gallium/drivers/r300/r300_surface.c
@@ -30,14 +30,9 @@ static void r300_surface_fill(struct pipe_context* pipe,
unsigned w, unsigned h,
unsigned color)
{
-
-void *dst_map = pipe->screen->surface_map( pipe->screen, dest,
-PIPE_BUFFER_USAGE_CPU_WRITE );
-pipe_fill_rect(dst_map, &dest->block, dest->stride, x, y, w, h, color);
-pipe->screen->surface_unmap(pipe->screen, dest);
-return;
struct r300_context* r300 = r300_context(pipe);
CS_LOCALS(r300);
+#if 0
struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
boolean has_tcl = caps->has_tcl;
boolean is_r500 = caps->is_r500;
@@ -47,6 +42,13 @@ return;
* XXX it goes without saying that this needs to be cleaned up and
* shifted around to work with the rest of the driver's state handling.
*/
+ BEGIN_CS(450);
+ /* XXX */
+ OUT_CS_REG(RADEON_WAIT_UNTIL, (1 << 15) | (1 << 17) | (1 << 18));
+ OUT_CS_REG(R300_TX_INVALTAGS, 0x0);
+ OUT_CS_REG(RADEON_WAIT_UNTIL, (1 << 15) | (1 << 17) | (1 << 18));
+ OUT_CS_REG(R300_TX_INVALTAGS, 0x0);
+
/* Sequence starting at R300_VAP_PROG_STREAM_CNTL_0 */
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 1);
if (has_tcl) {
@@ -93,8 +95,23 @@ return;
R300_VPORT_Z_OFFSET_ENA);
OUT_CS(0x8);
+ /* XXX */
+ OUT_CS_REG_SEQ(R300_VAP_VF_MAX_VTX_INDX, 2);
+ OUT_CS(0xFFFFFF);
+ OUT_CS(0x0);
+
+ OUT_CS_REG(R300_VAP_CNTL_STATUS, 0x0);
+
+ OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4);
+ OUT_CS(0x3f800000);
+ OUT_CS(0x3f800000);
+ OUT_CS(0x3f800000);
+ OUT_CS(0x3f800000);
+
OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xaaaaaaaa);
+ OUT_CS_REG(VAP_PVS_VTX_TIMEOUT_REG, 0xffff);
+
OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
OUT_CS(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT |
R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT);
@@ -135,7 +152,7 @@ return;
OUT_CS_REG(R500_RS_INST_0, R500_RS_INST_COL_CN_WRITE);
} else {
- OUT_CS_REG(R300_RS_IP_0, 8);
+ OUT_CS_REG_SEQ(R300_RS_IP_0, 8);
for (i = 0; i < 8; ++i) {
OUT_CS(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3));
}
@@ -287,7 +304,6 @@ return;
OUT_CS_RELOC(dest->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
/* XXX this needs more TLC (or TCL, as it were) */
OUT_CS_REG(R300_RB3D_COLORPITCH0, R300_COLOR_FORMAT_ARGB8888);
-#if 0
if (flags & (CLEARBUFFER_DEPTH | CLEARBUFFER_STENCIL)) {
assert(rrbd != 0);
cbpitch = (rrbd->pitch / rrbd->cpp);
@@ -337,7 +353,11 @@ return;
(ctx->Stencil.Clear & R300_STENCILREF_MASK));
END_BATCH();
}
-#endif
+
+ OUT_CS_REG_SEQ(R300_ZB_CNTL, 3);
+ OUT_CS(0x0);
+ OUT_CS(0x0);
+ OUT_CS(0x0);
OUT_CS(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
@@ -355,7 +375,289 @@ return;
/* XXX this should be split off, also figure out WTF with the numbers */
OUT_CS_REG(RADEON_WAIT_UNTIL, (1 << 15) | (1 << 17) | (1 << 18));
+ END_CS;
FLUSH_CS;
+#endif
+BEGIN_CS(276);
+OUT_CS_REG(0x1720, 0x00068000);
+OUT_CS_REG(0x4100, 0x00000000);
+OUT_CS_REG(0x1720, 0x00068000);
+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(0x2080, 0x0030046A);
+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);
+OUT_CS_REG(0x21DC, 0xAAAAAAAA);
+OUT_CS_REG(0x221C, 0x00000000);
+OUT_CS_REG(0x2220, 0x3F800000);
+OUT_CS_REG(0x2224, 0x3F800000);
+OUT_CS_REG(0x2228, 0x3F800000);
+OUT_CS_REG(0x222C, 0x3F800000);
+OUT_CS_REG(0x2288, 0x0000FFFF);
+OUT_CS_REG(0x2090, 0x00000000);
+OUT_CS_REG(0x2094, 0x00000000);
+OUT_CS_REG(0x22D0, 0x00000000);
+OUT_CS_REG(0x22D4, 0x00000000);
+OUT_CS_REG(0x22D8, 0x00000000);
+OUT_CS_REG(0x4008, 0x00000007);
+OUT_CS_REG(0x4010, 0x66666666);
+OUT_CS_REG(0x4014, 0x06666666);
+OUT_CS_REG(0x4018, 0x00000011);
+OUT_CS_REG(0x401C, 0x00000004);
+OUT_CS_REG(0x4020, 0x00000000);
+OUT_CS_REG(0x4104, 0x00000000);
+OUT_CS_REG(0x4200, 0x00000000);
+OUT_CS_REG(0x4204, 0x00000000);
+OUT_CS_REG(0x4208, 0x3F800000);
+OUT_CS_REG(0x420C, 0x3F800000);
+OUT_CS_REG(0x4214, 0x00050005);
+OUT_CS_REG(0x421C, 0x00060006);
+OUT_CS_REG(0x4230, 0x18000006);
+OUT_CS_REG(0x4234, 0x00020006);
+OUT_CS_REG(0x4238, 0x3BAAAAAB);
+OUT_CS_REG(0x4234, 0x00030006);
+OUT_CS_REG(0x4260, 0x00000000);
+OUT_CS_REG(0x4264, 0x00000000);
+OUT_CS_REG(0x4268, 0x3F800000);
+OUT_CS_REG(0x4274, 0x00000002);
+OUT_CS_REG(0x4278, 0x0003AAAA);
+OUT_CS_REG(0x427C, 0x00000000);
+OUT_CS_REG(0x4280, 0x00000000);
+OUT_CS_REG(0x4288, 0x00000000);
+OUT_CS_REG(0x428C, 0x00000001);
+OUT_CS_REG(0x4290, 0x00000000);
+OUT_CS_REG(0x4294, 0x3DBF1412);
+OUT_CS_REG(0x4298, 0x00000000);
+OUT_CS_REG(0x42A0, 0x00000000);
+OUT_CS_REG(0x42A4, 0x00000000);
+OUT_CS_REG(0x42A8, 0x00000000);
+OUT_CS_REG(0x42AC, 0x00000000);
+OUT_CS_REG(0x42B0, 0x00000000);
+OUT_CS_REG(0x42B4, 0x00000000);
+OUT_CS_REG(0x42B8, 0x00000000);
+OUT_CS_REG(0x42C0, 0x4B7FFFFF);
+OUT_CS_REG(0x42C4, 0x00000000);
+OUT_CS_REG(0x4300, 0x00000000);
+OUT_CS_REG(0x4304, 0x00000000);
+OUT_CS_REG(0x4310, 0x00000000);
+OUT_CS_REG(0x4314, 0x00000000);
+OUT_CS_REG(0x4318, 0x00000000);
+OUT_CS_REG(0x431C, 0x00000000);
+OUT_CS_REG(0x4320, 0x00000000);
+OUT_CS_REG(0x4324, 0x00000000);
+OUT_CS_REG(0x4328, 0x00000000);
+OUT_CS_REG(0x432C, 0x00000000);
+OUT_CS_REG(0x4330, 0x00000000);
+OUT_CS_REG(0x43A4, 0x0000001C);
+OUT_CS_REG(0x43A8, 0x2DA49525);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x46A4, 0x00001B00);
+OUT_CS_REG(0x46A8, 0x00001B0F);
+OUT_CS_REG(0x46AC, 0x00001B0F);
+OUT_CS_REG(0x46B0, 0x00001B0F);
+OUT_CS_REG(0x46B4, 0x00000001);
+OUT_CS_REG(0x4600, 0x00000000);
+OUT_CS_REG(0x4604, 0x00000000);
+OUT_CS_REG(0x4608, 0x00000000);
+OUT_CS_REG(0x4610, 0x00000000);
+OUT_CS_REG(0x4614, 0x00000000);
+OUT_CS_REG(0x4618, 0x00000000);
+OUT_CS_REG(0x461C, 0x00000000);
+OUT_CS_REG(0x48C0, 0x00000000);
+OUT_CS_REG(0x46C0, 0x00000000);
+OUT_CS_REG(0x49C0, 0x00000000);
+OUT_CS_REG(0x47C0, 0x00000000);
+OUT_CS_REG(0x4BC0, 0x00000002);
+OUT_CS_REG(0x4BC8, 0x00000000);
+OUT_CS_REG(0x4BCC, 0x00000000);
+OUT_CS_REG(0x4BD0, 0x00000000);
+OUT_CS_REG(0x4BD4, 0x00000000);
+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(0x4E28, 0x00000000);
+OUT_CS_REG(0x4E38, 0x00C00100);
+OUT_CS_REG(0x4E50, 0x00000000);
+OUT_CS_REG(0x4E54, 0x00000000);
+OUT_CS_REG(0x4E58, 0x00000000);
+OUT_CS_REG(0x4E5C, 0x00000000);
+OUT_CS_REG(0x4E60, 0x00000000);
+OUT_CS_REG(0x4E64, 0x00000000);
+OUT_CS_REG(0x4E68, 0x00000000);
+OUT_CS_REG(0x4E6C, 0x00000000);
+OUT_CS_REG(0x4E70, 0x00000000);
+OUT_CS_REG(0x4E88, 0x00000000);
+OUT_CS_REG(0x4EA0, 0x00000000);
+OUT_CS_REG(0x4EA4, 0xFFFFFFFF);
+OUT_CS_REG(0x4F00, 0x00000010);
+OUT_CS_REG(0x4F04, 0x00038038);
+OUT_CS_REG(0x4F08, 0x00FFFF00);
+OUT_CS_REG(0x4F10, 0x00000002);
+OUT_CS_REG(0x4F14, 0x00000001);
+OUT_CS_REG(0x4F18, 0x00000003);
+OUT_CS_REG(0x4F1C, 0x00000000);
+OUT_CS_REG(0x4F20, 0x00000000);
+OUT_CS_REG(0x4F24, 0x00000100);
+OUT_CS_REG(0x4F28, 0x00000000);
+OUT_CS_REG(0x4F30, 0x00000000);
+OUT_CS_REG(0x4F34, 0x00000000);
+OUT_CS_REG(0x4F44, 0x00000000);
+OUT_CS_REG(0x4F54, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000406);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x3F800000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000400);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000401);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000402);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000403);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000404);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000405);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 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(0x20B0, 0x0000043F);
+OUT_CS_REG(0x20B4, 0x00000008);
+OUT_CS_REG(0x21DC, 0xAAAAAAAA);
+OUT_CS_REG(0x2090, 0x00000003);
+OUT_CS_REG(0x2094, 0x00000000);
+OUT_CS_REG(0x4104, 0x00000000);
+OUT_CS_REG(0x1D98, 0x3F800000);
+OUT_CS_REG(0x1D9C, 0x00000000);
+OUT_CS_REG(0x1DA0, 0x3F800000);
+OUT_CS_REG(0x1DA4, 0x00000000);
+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);
+OUT_CS_REG(0x221C, 0x0001C000);
+OUT_CS_REG(0x421C, 0x06000600);
+OUT_CS_REG(0x4310, 0x00D10000);
+OUT_CS_REG(0x4314, 0x00D10000);
+OUT_CS_REG(0x4318, 0x00D10000);
+OUT_CS_REG(0x431C, 0x00D10000);
+OUT_CS_REG(0x4320, 0x00D10000);
+OUT_CS_REG(0x4324, 0x00D10000);
+OUT_CS_REG(0x4328, 0x00D10000);
+OUT_CS_REG(0x432C, 0x00D10000);
+OUT_CS_REG(0x4300, 0x00040080);
+OUT_CS_REG(0x4304, 0x00000000);
+OUT_CS_REG(0x4330, 0x00004000);
+OUT_CS_REG(0x4600, 0x00000000);
+OUT_CS_REG(0x4604, 0x00000000);
+OUT_CS_REG(0x4608, 0x00000000);
+OUT_CS_REG(0x4610, 0x00000000);
+OUT_CS_REG(0x4614, 0x00000000);
+OUT_CS_REG(0x4618, 0x00000000);
+OUT_CS_REG(0x461C, 0x00400000);
+OUT_CS_REG(0x48C0, 0x00050A80);
+OUT_CS_REG(0x46C0, 0x1C000000);
+OUT_CS_REG(0x49C0, 0x00040889);
+OUT_CS_REG(0x47C0, 0x01000000);
+OUT_CS_REG(0x2284, 0x00000000);
+OUT_CS_REG(0x2080, 0x0030045A);
+OUT_CS_REG(0x22D0, 0x00100000);
+OUT_CS_REG(0x22D4, 0x00000000);
+OUT_CS_REG(0x22D8, 0x00000001);
+OUT_CS_REG(0x43E8, 0x00000000);
+OUT_CS_REG(0x1720, 0x10008000);
+OUT_CS_REG(0x43E8, 0x00FFFFFF);
+OUT_CS_REG(0x2284, 0x00000001);
+OUT_CS_REG(0x2200, 0x00000000);
+OUT_CS_REG(0x2208, 0x00F00203);
+OUT_CS_REG(0x2208, 0x00D10001);
+OUT_CS_REG(0x2208, 0x01248001);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x2208, 0x00F02203);
+OUT_CS_REG(0x2208, 0x00D10021);
+OUT_CS_REG(0x2208, 0x01248021);
+OUT_CS_REG(0x2208, 0x00000000);
+OUT_CS_REG(0x1720, 0x00068000);
+OUT_CS_REG(0x4E28, 0x00000000);
+OUT_CS_REG(0x4E38, 0x00C00100);
+OUT_CS_REG(0x4E0C, 0x0000000F);
+OUT_CS_REG(0x4F00, 0x00000000);
+OUT_CS_REG(0x4F04, 0x00000000);
+OUT_CS_REG(0x4F08, 0x00FF0000);
+OUT_CS_REG(0x4E4C, 0x0000000A);
+OUT_CS_REG(0x4F18, 0x00000003);
+OUT_CS_REG(0x1720, 0x00068000);
+
+END_CS;
+FLUSH_CS;
r300->dirty_state = R300_NEW_KITCHEN_SINK;
}
diff --git a/src/gallium/winsys/drm/amd/amd_context.c b/src/gallium/winsys/drm/amd/amd_context.c
index df8eb850c81..9b3c9c2ab2e 100644
--- a/src/gallium/winsys/drm/amd/amd_context.c
+++ b/src/gallium/winsys/drm/amd/amd_context.c
@@ -242,7 +242,7 @@ GLboolean amd_context_create(const __GLcontextModes *visual,
return GL_FALSE;
}
- if (GL_TRUE) {
+ if (1) {
fprintf(stderr, "Creating r300 context...\n");
pipe =
r300_create_context(NULL,