summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.c49
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.h44
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lock.h4
3 files changed, 41 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c
index 978d2fae0c..bc3c2d6c6b 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.c
+++ b/src/mesa/drivers/dri/r300/radeon_lock.c
@@ -84,36 +84,6 @@ void radeonUpdatePageFlipping(radeonContextPtr rmesa)
}
}
-/**
- * Called by radeonGetLock() after the lock has been obtained.
- */
-static void r300RegainedLock(radeonContextPtr rmesa)
-{
- int i;
- __DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
- r300ContextPtr r300 = (r300ContextPtr) rmesa;
- drm_radeon_sarea_t *sarea = rmesa->sarea;
-
- if (rmesa->lastStamp != drawable->lastStamp) {
- radeonUpdatePageFlipping(rmesa);
- radeonSetCliprects(rmesa);
-#if 1
- r300UpdateViewportOffset(rmesa->glCtx);
- driUpdateFramebufferSize(rmesa->glCtx, drawable);
-#else
- radeonUpdateScissor(rmesa->glCtx);
-#endif
- }
-
- if (sarea->ctx_owner != rmesa->dri.hwContext) {
- sarea->ctx_owner = rmesa->dri.hwContext;
-
- for (i = 0; i < r300->nr_heaps; i++) {
- DRI_AGE_TEXTURES(r300->texture_heaps[i]);
- }
- }
-}
-
/* Update the hardware state. This is called if another context has
* grabbed the hardware lock, which includes the X server. This
* function also updates the driver's window state after the X server
@@ -127,6 +97,8 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags)
__DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
__DRIdrawablePrivate *const readable = rmesa->dri.readable;
__DRIscreenPrivate *sPriv = rmesa->dri.screen;
+ drm_radeon_sarea_t *sarea = rmesa->sarea;
+ r300ContextPtr r300 = (r300ContextPtr) rmesa;
assert(drawable != NULL);
@@ -145,8 +117,21 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags)
DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable);
}
- if (IS_R300_CLASS(rmesa->radeonScreen))
- r300RegainedLock(rmesa);
+ if (rmesa->lastStamp != drawable->lastStamp) {
+ radeonUpdatePageFlipping(rmesa);
+ radeonSetCliprects(rmesa);
+ r300UpdateViewportOffset(rmesa->glCtx);
+ driUpdateFramebufferSize(rmesa->glCtx, drawable);
+ }
+
+ if (sarea->ctx_owner != rmesa->dri.hwContext) {
+ int i;
+
+ sarea->ctx_owner = rmesa->dri.hwContext;
+ for (i = 0; i < r300->nr_heaps; i++) {
+ DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+ }
+ }
rmesa->lost_context = GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.h b/src/mesa/drivers/dri/r300/radeon_lock.h
index 2a358e9bdd..e131967e42 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.h
+++ b/src/mesa/drivers/dri/r300/radeon_lock.h
@@ -47,8 +47,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include "radeon_context.h"
-extern void radeonGetLock(radeonContextPtr radeon, GLuint flags);
-extern void radeonUpdatePageFlipping(radeonContextPtr radeon);
+extern void radeonGetLock(radeonContextPtr rmesa, GLuint flags);
+extern void radeonUpdatePageFlipping(radeonContextPtr rmesa);
/* Turn DEBUG_LOCKING on to find locking conflicts.
*/
@@ -72,11 +72,11 @@ extern int prevLockLine;
#define DEBUG_CHECK_LOCK() \
do { \
- if ( prevLockFile ) { \
- fprintf( stderr, \
+ if (prevLockFile) { \
+ fprintf(stderr, \
"LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- exit( 1 ); \
+ prevLockFile, prevLockLine, __FILE__, __LINE__); \
+ exit(1); \
} \
} while (0)
@@ -96,37 +96,37 @@ extern int prevLockLine;
/* Lock the hardware and validate our state.
*/
-#define LOCK_HARDWARE( radeon ) \
+#define LOCK_HARDWARE( rmesa ) \
do { \
char __ret = 0; \
DEBUG_CHECK_LOCK(); \
- DRM_CAS( (radeon)->dri.hwLock, (radeon)->dri.hwContext, \
- (DRM_LOCK_HELD | (radeon)->dri.hwContext), __ret ); \
- if ( __ret ) \
- radeonGetLock( (radeon), 0 ); \
+ DRM_CAS(rmesa->dri.hwLock, rmesa->dri.hwContext, \
+ (DRM_LOCK_HELD | rmesa->dri.hwContext), __ret); \
+ if (__ret) \
+ radeonGetLock(rmesa, 0); \
DEBUG_LOCK(); \
} while (0)
#if R200_MERGED
-#define UNLOCK_HARDWARE( radeon ) \
+#define UNLOCK_HARDWARE( rmesa ) \
do { \
- DRM_UNLOCK( (radeon)->dri.fd, \
- (radeon)->dri.hwLock, \
- (radeon)->dri.hwContext ); \
+ DRM_UNLOCK(rmesa->dri.fd, \
+ rmesa->dri.hwLock, \
+ rmesa->dri.hwContext); \
DEBUG_RESET(); \
- if (IS_R200_CLASS(radeon->radeonScreen)) { \
- r200ContextPtr __r200 = (r200ContextPtr)(radeon); \
+ if (IS_R200_CLASS(rmesa->radeonScreen)) { \
+ r200ContextPtr __r200 = (r200ContextPtr)rmesa; \
if (__r200->save_on_next_unlock) \
- r200SaveHwState( __r200 ); \
+ r200SaveHwState(__r200); \
__r200->save_on_next_unlock = GL_FALSE; \
} \
} while (0)
#else
-#define UNLOCK_HARDWARE( radeon ) \
+#define UNLOCK_HARDWARErmesa \
do { \
- DRM_UNLOCK( (radeon)->dri.fd, \
- (radeon)->dri.hwLock, \
- (radeon)->dri.hwContext ); \
+ DRM_UNLOCK(rmesa->dri.fd, \
+ rmesa->dri.hwLock, \
+ rmesa->dri.hwContext); \
DEBUG_RESET(); \
} while (0)
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.h b/src/mesa/drivers/dri/radeon/radeon_lock.h
index 3ba69e86c1..e793541e3f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_lock.h
+++ b/src/mesa/drivers/dri/radeon/radeon_lock.h
@@ -42,7 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __RADEON_LOCK_H__
#define __RADEON_LOCK_H__
-extern void radeonGetLock( radeonContextPtr rmesa, GLuint flags );
+extern void radeonGetLock(radeonContextPtr rmesa, GLuint flags);
/* Turn DEBUG_LOCKING on to find locking conflicts.
*/
@@ -109,4 +109,4 @@ extern int prevLockLine;
DEBUG_RESET(); \
} while (0)
-#endif /* __RADEON_LOCK_H__ */
+#endif /* __RADEON_LOCK_H__ */