summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.c19
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.h1
-rw-r--r--src/mesa/drivers/dri/r300/radeon_mm.c18
3 files changed, 29 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c
index f7a217c1aae..f5627628783 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c
@@ -81,6 +81,25 @@ static uint32_t radeonGetLastFrame(radeonContextPtr radeon)
return frame;
}
+uint32_t radeonGetAge(radeonContextPtr radeon)
+{
+ drm_radeon_getparam_t gp;
+ int ret;
+ uint32_t age;
+
+ gp.param = RADEON_PARAM_LAST_CLEAR;
+ gp.value = (int *)&age;
+ ret = drmCommandWriteRead(radeon->dri.fd, DRM_RADEON_GETPARAM,
+ &gp, sizeof(gp));
+ if (ret) {
+ fprintf(stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__,
+ ret);
+ exit(1);
+ }
+
+ return age;
+}
+
static void radeonEmitIrqLocked(radeonContextPtr radeon)
{
drm_radeon_irq_emit_t ie;
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.h b/src/mesa/drivers/dri/r300/radeon_ioctl.h
index 7c19325dd3a..4ddd776602d 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.h
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.h
@@ -49,5 +49,6 @@ extern void radeonPageFlip(const __DRIdrawablePrivate * drawable);
extern void radeonFlush(GLcontext * ctx);
extern void radeonFinish(GLcontext * ctx);
extern void radeonWaitForIdleLocked(radeonContextPtr radeon);
+extern uint32_t radeonGetAge(radeonContextPtr radeon);
#endif /* __RADEON_IOCTL_H__ */
diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c
index d46629a508d..ccfef6226ce 100644
--- a/src/mesa/drivers/dri/r300/radeon_mm.c
+++ b/src/mesa/drivers/dri/r300/radeon_mm.c
@@ -98,7 +98,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size)
again:
- done_age = rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH];
+ done_age = radeonGetAge((radeonContextPtr)rmesa);
for (i = rmesa->rmm->u_last + 1; i > 0; i --) {
if (rmesa->rmm->u_list[i].ptr == NULL) {
@@ -120,7 +120,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size)
exit(1);
} else {
#ifdef MM_DEBUG
- fprintf(stderr, "really freed %d at age %x\n", i, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ fprintf(stderr, "really freed %d at age %x\n", i, radeonGetAge((radeonContextPtr)rmesa));
#endif
if (i == rmesa->rmm->u_last)
rmesa->rmm->u_last --;
@@ -196,7 +196,7 @@ int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size)
//fprintf(stderr, "alloc %p at id %d\n", rmesa->rmm->u_list[i].ptr, i);
#ifdef MM_DEBUG
- fprintf(stderr, "allocated %d at age %x\n", i, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ fprintf(stderr, "allocated %d at age %x\n", i, radeonGetAge((radeonContextPtr)rmesa));
#endif
return i;
@@ -261,7 +261,7 @@ void radeon_mm_use(r300ContextPtr rmesa, int id)
{
uint64_t ull;
#ifdef MM_DEBUG
- fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
drm_r300_cmd_header_t *cmd;
@@ -345,7 +345,7 @@ int radeon_mm_on_card(r300ContextPtr rmesa, int id)
void *radeon_mm_map(r300ContextPtr rmesa, int id, int access)
{
#ifdef MM_DEBUG
- fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
void *ptr;
int tries = 0;
@@ -385,12 +385,12 @@ void *radeon_mm_map(r300ContextPtr rmesa, int id, int access)
return NULL;
}
- while(rmesa->rmm->u_list[id].age > rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH] && tries++ < 1000)
+ while(rmesa->rmm->u_list[id].age > radeonGetAge((radeonContextPtr)rmesa) && tries++ < 1000)
usleep(10);
if (tries >= 1000) {
fprintf(stderr, "Idling failed (%x vs %x)\n",
- rmesa->rmm->u_list[id].age, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ rmesa->rmm->u_list[id].age, radeonGetAge((radeonContextPtr)rmesa));
return NULL;
}
@@ -406,7 +406,7 @@ void *radeon_mm_map(r300ContextPtr rmesa, int id, int access)
void radeon_mm_unmap(r300ContextPtr rmesa, int id)
{
#ifdef MM_DEBUG
- fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
if(rmesa->rmm->u_list[id].mapped == 0)
@@ -423,7 +423,7 @@ void radeon_mm_unmap(r300ContextPtr rmesa, int id)
void radeon_mm_free(r300ContextPtr rmesa, int id)
{
#ifdef MM_DEBUG
- fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, rmesa->radeon.radeonScreen->scratch[RADEON_MM_SCRATCH]);
+ fprintf(stderr, "%s: %d at age %x\n", __FUNCTION__, id, radeonGetAge((radeonContextPtr)rmesa));
#endif
if(id == 0)