95 lines
3.1 KiB
Diff
95 lines
3.1 KiB
Diff
From c75a717af6aee750f673ff1809faf69e8fe2527a Mon Sep 17 00:00:00 2001
|
|
From: Luc Verhaegen <libv@skynet.be>
|
|
Date: Mon, 14 Apr 2008 22:51:36 +0200
|
|
Subject: [PATCH] unichrome: Do not clear the current context before attempting to use it.
|
|
|
|
Beautified from Gabriel Mansi's (gabriel.mansi@gmail.com) original patch,
|
|
available from http://rudin.suse.de:8888/attachment.cgi?id=181709
|
|
---
|
|
src/mesa/drivers/dri/unichrome/via_context.c | 56 +++++++++++++------------
|
|
1 files changed, 29 insertions(+), 27 deletions(-)
|
|
|
|
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
|
|
index 1d5b1e0..d489d80 100644
|
|
--- a/src/mesa/drivers/dri/unichrome/via_context.c
|
|
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
|
|
@@ -686,46 +686,48 @@ void
|
|
viaDestroyContext(__DRIcontextPrivate *driContextPriv)
|
|
{
|
|
GET_CURRENT_CONTEXT(ctx);
|
|
- struct via_context *vmesa =
|
|
+ struct via_context *vmesa =
|
|
(struct via_context *)driContextPriv->driverPrivate;
|
|
struct via_context *current = ctx ? VIA_CONTEXT(ctx) : NULL;
|
|
+
|
|
assert(vmesa); /* should never be null */
|
|
|
|
+ if (vmesa->driDrawable) {
|
|
+ viaWaitIdle(vmesa, GL_FALSE);
|
|
+
|
|
+ if (vmesa->doPageFlip) {
|
|
+ LOCK_HARDWARE(vmesa);
|
|
+ if (vmesa->pfCurrentOffset != 0) {
|
|
+ fprintf(stderr, "%s - reset pf\n", __FUNCTION__);
|
|
+ viaResetPageFlippingLocked(vmesa);
|
|
+ }
|
|
+ UNLOCK_HARDWARE(vmesa);
|
|
+ }
|
|
+ }
|
|
+
|
|
/* check if we're deleting the currently bound context */
|
|
if (vmesa == current) {
|
|
VIA_FLUSH_DMA(vmesa);
|
|
_mesa_make_current(NULL, NULL, NULL);
|
|
}
|
|
|
|
- if (vmesa) {
|
|
- viaWaitIdle(vmesa, GL_FALSE);
|
|
- if (vmesa->doPageFlip) {
|
|
- LOCK_HARDWARE(vmesa);
|
|
- if (vmesa->pfCurrentOffset != 0) {
|
|
- fprintf(stderr, "%s - reset pf\n", __FUNCTION__);
|
|
- viaResetPageFlippingLocked(vmesa);
|
|
- }
|
|
- UNLOCK_HARDWARE(vmesa);
|
|
- }
|
|
-
|
|
- _swsetup_DestroyContext(vmesa->glCtx);
|
|
- _tnl_DestroyContext(vmesa->glCtx);
|
|
- _vbo_DestroyContext(vmesa->glCtx);
|
|
- _swrast_DestroyContext(vmesa->glCtx);
|
|
- /* free the Mesa context */
|
|
- _mesa_destroy_context(vmesa->glCtx);
|
|
- /* release our data */
|
|
- FreeBuffer(vmesa);
|
|
+ _swsetup_DestroyContext(vmesa->glCtx);
|
|
+ _tnl_DestroyContext(vmesa->glCtx);
|
|
+ _vbo_DestroyContext(vmesa->glCtx);
|
|
+ _swrast_DestroyContext(vmesa->glCtx);
|
|
+ /* free the Mesa context */
|
|
+ _mesa_destroy_context(vmesa->glCtx);
|
|
+ /* release our data */
|
|
+ FreeBuffer(vmesa);
|
|
|
|
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP]));
|
|
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO]));
|
|
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM]));
|
|
- assert (is_empty_list(&vmesa->freed_tex_buffers));
|
|
+ assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP]));
|
|
+ assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO]));
|
|
+ assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM]));
|
|
+ assert (is_empty_list(&vmesa->freed_tex_buffers));
|
|
|
|
- driDestroyOptionCache(&vmesa->optionCache);
|
|
+ driDestroyOptionCache(&vmesa->optionCache);
|
|
|
|
- FREE(vmesa);
|
|
- }
|
|
+ FREE(vmesa);
|
|
}
|
|
|
|
|
|
--
|
|
1.4.3.4
|
|
|