diff options
author | Dave Airlie <[email protected]> | 2009-01-21 01:40:33 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2009-01-21 01:40:33 +1000 |
commit | d9c4a01bad3a7d4a965fc09d8605afc6ca48f6f9 (patch) | |
tree | c5347c9b5ee3ef1c88855e50a1c25cca0118237b /src/mesa/drivers/dri/radeon | |
parent | 04029e5ddb030445edc98305b091b9a35479282a (diff) |
r200: make tri render on my r200.
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r-- | src/mesa/drivers/dri/radeon/common_lock.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/common_misc.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/common_misc.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_cs_legacy.c | 47 |
4 files changed, 43 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/radeon/common_lock.c b/src/mesa/drivers/dri/radeon/common_lock.c index 09517450a9b..91600ac4cda 100644 --- a/src/mesa/drivers/dri/radeon/common_lock.c +++ b/src/mesa/drivers/dri/radeon/common_lock.c @@ -55,7 +55,6 @@ char *prevLockFile = NULL; int prevLockLine = 0; #endif -#ifdef RADEON_COMMON_FOR_R300 /* Turn on/off page flipping according to the flags in the sarea: */ void radeonUpdatePageFlipping(radeonContextPtr rmesa) @@ -81,18 +80,6 @@ void radeonUpdatePageFlipping(radeonContextPtr rmesa) rmesa->state.depth.rrb = (void *)fb->Attachment[BUFFER_DEPTH].Renderbuffer; } -#else -/* Turn on/off page flipping according to the flags in the sarea: - */ -void radeonUpdatePageFlipping(radeonContextPtr rmesa) -{ - rmesa->doPageFlip = rmesa->sarea->pfState; - if (rmesa->glCtx->WinSysDrawBuffer) { - driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer, - rmesa->sarea->pfCurrentPage); - } -} -#endif /* Update the hardware state. This is called if another context has * grabbed the hardware lock, which includes the X server. This diff --git a/src/mesa/drivers/dri/radeon/common_misc.c b/src/mesa/drivers/dri/radeon/common_misc.c index 51cbe590244..d7c16c4957a 100644 --- a/src/mesa/drivers/dri/radeon/common_misc.c +++ b/src/mesa/drivers/dri/radeon/common_misc.c @@ -1337,3 +1337,16 @@ void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, } radeon_bo_unmap(aos->bo); } + + +void radeon_print_state_atom( struct radeon_state_atom *state ) +{ + int i; + + fprintf(stderr, "emit %s/%d\n", state->name, state->cmd_size); + + if (RADEON_DEBUG & DEBUG_VERBOSE) + for (i = 0 ; i < state->cmd_size ; i++) + fprintf(stderr, "\t%s[%d]: %x\n", state->name, i, state->cmd[i]); + +} diff --git a/src/mesa/drivers/dri/radeon/common_misc.h b/src/mesa/drivers/dri/radeon/common_misc.h index 32cbae7ad3f..e4f200d6a53 100644 --- a/src/mesa/drivers/dri/radeon/common_misc.h +++ b/src/mesa/drivers/dri/radeon/common_misc.h @@ -32,4 +32,5 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, GLvoid * data, int size, int stride, int count); +void radeon_print_state_atom( struct radeon_state_atom *state ); #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c index 0c897815a7b..af9ee4df472 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c @@ -206,8 +206,8 @@ static int cs_end(struct radeon_cs *cs, } cs->section = 0; if (cs->section_ndw != cs->section_cdw) { - fprintf(stderr, "CS section size missmatch start at (%s,%s,%d)\n", - cs->section_file, cs->section_func, cs->section_line); + fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n", + cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw); fprintf(stderr, "CS section end at (%s,%s,%d)\n", file, func, line); return -EPIPE; @@ -221,10 +221,6 @@ static int cs_process_relocs(struct radeon_cs *cs) struct cs_reloc_legacy *relocs; int i, j, r; - if (!IS_R300_CLASS(csm->ctx->radeonScreen)) { - /* FIXME: r300 only right now */ - return -EINVAL; - } csm = (struct cs_manager_legacy*)cs->csm; relocs = (struct cs_reloc_legacy *)cs->relocs; for (i = 0; i < cs->crelocs; i++) { @@ -238,6 +234,8 @@ static int cs_process_relocs(struct radeon_cs *cs) relocs[i].base.bo, soffset, eoffset); return r; } + fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n", + relocs[i].base.bo, soffset, eoffset); cs->packets[relocs[i].indices[j]] += soffset; if (cs->packets[relocs[i].indices[j]] >= eoffset) { radeon_bo_debug(relocs[i].base.bo, 12); @@ -269,6 +267,14 @@ static int cs_set_age(struct radeon_cs *cs) return 0; } +static void dump_cmdbuf(struct radeon_cs *cs) +{ + int i; + for (i = 0; i < cs->cdw; i++){ + fprintf(stderr,"%x: %08x\n", i, cs->packets[i]); + } + +} static int cs_emit(struct radeon_cs *cs) { struct cs_manager_legacy *csm = (struct cs_manager_legacy*)cs->csm; @@ -279,19 +285,22 @@ static int cs_emit(struct radeon_cs *cs) csm->ctx->vtbl.emit_cs_header(cs, csm->ctx); + /* append buffer age */ - age.scratch.cmd_type = R300_CMD_SCRATCH; - /* Scratch register 2 corresponds to what radeonGetAge polls */ - csm->pending_age = 0; - csm->pending_count = 1; - ull = (uint64_t) (intptr_t) &csm->pending_age; - age.scratch.reg = 2; - age.scratch.n_bufs = 1; - age.scratch.flags = 0; - radeon_cs_write_dword(cs, age.u); - radeon_cs_write_dword(cs, ull & 0xffffffff); - radeon_cs_write_dword(cs, ull >> 32); - radeon_cs_write_dword(cs, 0); + if (IS_R300_CLASS(csm->ctx->radeonScreen)) { + age.scratch.cmd_type = R300_CMD_SCRATCH; + /* Scratch register 2 corresponds to what radeonGetAge polls */ + csm->pending_age = 0; + csm->pending_count = 1; + ull = (uint64_t) (intptr_t) &csm->pending_age; + age.scratch.reg = 2; + age.scratch.n_bufs = 1; + age.scratch.flags = 0; + radeon_cs_write_dword(cs, age.u); + radeon_cs_write_dword(cs, ull & 0xffffffff); + radeon_cs_write_dword(cs, ull >> 32); + radeon_cs_write_dword(cs, 0); + } r = cs_process_relocs(cs); if (r) { @@ -308,6 +317,8 @@ static int cs_emit(struct radeon_cs *cs) cmd.boxes = (drm_clip_rect_t *) csm->ctx->pClipRects; } + dump_cmdbuf(cs); + r = drmCommandWrite(cs->csm->fd, DRM_RADEON_CMDBUF, &cmd, sizeof(cmd)); if (r) { return r; |