summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2006-07-09 00:04:06 +0000
committerAapo Tahkola <[email protected]>2006-07-09 00:04:06 +0000
commitb9920ba7b7fd8ed9a3c45e0cebafd28b419f73e3 (patch)
tree5aa900bde6be179be9e0ff870095a7ea723cb286 /src/mesa
parent27908d2bcb18c33079013daf29f6ddaf0fdabda2 (diff)
Fix #7195
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c20
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.c2
2 files changed, 20 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 8ba91c9d810..541ffa3997e 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -374,12 +374,26 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
static void r300FreeGartAllocations(r300ContextPtr r300)
{
- int i, ret, tries=0, done_age;
+ int i, ret, tries=0, done_age, in_use=0;
drm_radeon_mem_free_t memfree;
memfree.region = RADEON_MEM_REGION_GART;
#ifdef USER_BUFFERS
+ for (i = r300->rmm->u_last; i > 0; i--) {
+ if (r300->rmm->u_list[i].ptr == NULL) {
+ continue;
+ }
+
+ /* check whether this buffer is still in use */
+ if (r300->rmm->u_list[i].pending) {
+ in_use++;
+ }
+ }
+ /* Cannot flush/lock if no context exists. */
+ if (in_use)
+ r300FlushCmdBuf(r300, __FUNCTION__);
+
done_age = radeonGetAge((radeonContextPtr)r300);
for (i = r300->rmm->u_last; i > 0; i--) {
@@ -465,8 +479,10 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
if (r300->dma.current.buf) {
r300ReleaseDmaRegion(r300, &r300->dma.current, __FUNCTION__ );
+#ifndef USER_BUFFERS
+ r300FlushCmdBuf(r300, __FUNCTION__);
+#endif
}
- r300FlushCmdBuf(r300, __FUNCTION__);
r300FreeGartAllocations(r300);
r300DestroyCmdBuf(r300);
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c
index 893b4b4e7ef..edf26183148 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.c
+++ b/src/mesa/drivers/dri/r300/radeon_lock.c
@@ -153,6 +153,8 @@ void radeonGetLock(radeonContextPtr radeon, GLuint flags)
__DRIdrawablePrivate *dPriv = radeon->dri.drawable;
__DRIscreenPrivate *sPriv = radeon->dri.screen;
drm_radeon_sarea_t *sarea = radeon->sarea;
+
+ assert (dPriv != NULL);
drmGetLock(radeon->dri.fd, radeon->dri.hwContext, flags);