diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2006-09-07 19:05:40 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2006-09-07 19:05:40 +0000 |
commit | 493b2ddecb47fdacc4b73d9c9a3ba2e46489105f (patch) | |
tree | 011c2f4570d336020c0db6562d294d638a981531 /src/mesa/drivers/dri/i965/intel_context.c | |
parent | c26f36c830cc6df1093a145eb43645f535004eb7 (diff) |
Cope with memory pool fragmentation by allowing a second attempt at
rendering operations to take place after evicting all resident
buffers.
Cope better with memory allocation failures throughout the driver and
improve tracking of failures.
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_context.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_context.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index e21c7d89b9..59fc8073ee 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -536,6 +536,13 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv, return GL_TRUE; } + +static void lost_hardware( struct intel_context *intel ) +{ + bm_fake_NotifyContendedLockTake( intel ); + intel->vtbl.lost_hardware( intel ); +} + static void intelContendedLock( struct intel_context *intel, GLuint flags ) { __DRIdrawablePrivate *dPriv = intel->driDrawable; @@ -560,16 +567,7 @@ static void intelContendedLock( struct intel_context *intel, GLuint flags ) */ if (sarea->ctxOwner != me) { sarea->ctxOwner = me; - - /* Should also fence the frontbuffer even if ctxOwner doesn't - * change: - */ - bm_fake_NotifyContendedLockTake( intel ); - - - /* - */ - intel->vtbl.lost_hardware( intel ); + lost_hardware(intel); } /* Drawable changed? @@ -606,19 +604,16 @@ void LOCK_HARDWARE( struct intel_context *intel ) intel->locked = 1; if (intel->aub_wrap) { - /* Should also fence the frontbuffer even if ctxOwner doesn't - * change: - */ bm_fake_NotifyContendedLockTake( intel ); - - /* - */ intel->vtbl.lost_hardware( intel ); intel->vtbl.aub_wrap(intel); - intel->aub_wrap = 0; } + if (bmError(intel)) { + bmEvictAll(intel); + intel->vtbl.lost_hardware( intel ); + } /* Make sure nothing has been emitted prior to getting the lock: */ @@ -626,7 +621,18 @@ void LOCK_HARDWARE( struct intel_context *intel ) /* XXX: postpone, may not be needed: */ - intel_batchbuffer_map(intel->batch); + if (!intel_batchbuffer_map(intel->batch)) { + bmEvictAll(intel); + intel->vtbl.lost_hardware( intel ); + + /* This could only fail if the batchbuffer was greater in size + * than the available texture memory: + */ + if (!intel_batchbuffer_map(intel->batch)) { + _mesa_printf("double failure to map batchbuffer\n"); + assert(0); + } + } } |