summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r600
diff options
context:
space:
mode:
authorRichard Li <richardradeon@gmail.com>2009-07-08 14:49:48 -0400
committerRichard Li <richardradeon@gmail.com>2009-07-08 14:49:48 -0400
commit93ab69a0eff8e0b264ec8888cfd0ac11ea0e274f (patch)
treeb970b7b917195ec2308ef97a63bcf556edca26a1 /src/mesa/drivers/dri/r600
parentf9db04878bc08931766bd827417012c30887bb7c (diff)
Fix buffer age implementaion bug.
Diffstat (limited to 'src/mesa/drivers/dri/r600')
-rw-r--r--src/mesa/drivers/dri/r600/r600_cmdbuf.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c
index 9f26b257d0..0035910792 100644
--- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c
+++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c
@@ -378,7 +378,36 @@ static int r600_cs_emit(struct radeon_cs *cs)
/* TODO : put chip level things here if need. */
/* csm->ctx->vtbl.emit_cs_header(cs, csm->ctx); */
- /* TODO : append buffer age */
+ BATCH_LOCALS(csm->ctx);
+ drm_radeon_getparam_t gp;
+ uint32_t current_scratchx_age;
+
+ gp.param = RADEON_PARAM_LAST_CLEAR;
+ gp.value = (int *)&current_scratchx_age;
+ r = drmCommandWriteRead(cs->csm->fd,
+ DRM_RADEON_GETPARAM,
+ &gp,
+ sizeof(gp));
+ if (r)
+ {
+ fprintf(stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, r);
+ exit(1);
+ }
+
+ csm->pending_age = 0;
+ csm->pending_count = 1;
+
+ current_scratchx_age++;
+ csm->pending_age = current_scratchx_age;
+
+ BEGIN_BATCH_NO_AUTOSTATE(2);
+ R600_OUT_BATCH(0x2142); /* scratch 2 */
+ R600_OUT_BATCH(current_scratchx_age);
+ END_BATCH();
+ COMMIT_BATCH();
+
+ //TODO ioctl to get back cs id assigned in drm
+ //csm->pending_age = cs_id_back;
r = r600_cs_process_relocs(cs, &(reloc_chunk[0]), &length_dw_reloc_chunk);
if (r) {