r300: Reduced the diff on radeon_lock.[ch].

This commit is contained in:
Oliver McFadden
2007-05-11 22:21:19 +00:00
parent 98d25a5a28
commit 5a09ea01e0
3 changed files with 41 additions and 56 deletions
+17 -32
View 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;
}
+22 -22
View 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
+2 -2
View 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__ */