r300: Reduced the diff on radeon_lock.[ch].
authorOliver McFadden <z3ro.geek@gmail.com>
Fri, 11 May 2007 22:21:19 +0000 (22:21 +0000)
committerOliver McFadden <z3ro.geek@gmail.com>
Fri, 11 May 2007 22:21:19 +0000 (22:21 +0000)
src/mesa/drivers/dri/r300/radeon_lock.c
src/mesa/drivers/dri/r300/radeon_lock.h
src/mesa/drivers/dri/radeon/radeon_lock.h

index 978d2fae0ccaf1662781e6926873c5f6e15b00ef..bc3c2d6c6b36e5996578ca4f87a1df448a5ebcd4 100644 (file)
@@ -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;
 }
index 2a358e9bdd660fc5a6926417fc7b2af39471accc..e131967e42343d780c6523df3f2262a77353f0fc 100644 (file)
@@ -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
index 3ba69e86c1c2471098f2299d3d7bddd9693d287a..e793541e3f05c8452bc82db22b98faf9866edd29 100644 (file)
@@ -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__ */