fix up radeon span functions using latest r200 code from Brian,
[mesa.git] / src / mesa / drivers / dri / gamma / gamma_lock.c
1 /* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
2
3 #include "gamma_context.h"
4 #include "gamma_lock.h"
5 #include "drirenderbuffer.h"
6
7 #ifdef DEBUG_LOCKING
8 char *prevLockFile = NULL;
9 int prevLockLine = 0;
10 #endif
11
12
13 /* Update the hardware state. This is called if another context has
14 * grabbed the hardware lock, which includes the X server. This
15 * function also updates the driver's window state after the X server
16 * moves, resizes or restacks a window -- the change will be reflected
17 * in the drawable position and clip rects. Since the X server grabs
18 * the hardware lock when it changes the window state, this routine will
19 * automatically be called after such a change.
20 */
21 void gammaGetLock( gammaContextPtr gmesa, GLuint flags )
22 {
23 __DRIdrawablePrivate *dPriv = gmesa->driDrawable;
24 __DRIscreenPrivate *sPriv = gmesa->driScreen;
25
26 drmGetLock( gmesa->driFd, gmesa->hHWContext, flags );
27
28 /* The window might have moved, so we might need to get new clip
29 * rects.
30 *
31 * NOTE: This releases and regrabs the hw lock to allow the X server
32 * to respond to the DRI protocol request for new drawable info.
33 * Since the hardware state depends on having the latest drawable
34 * clip rects, all state checking must be done _after_ this call.
35 */
36 DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
37
38 if ( gmesa->lastStamp != dPriv->lastStamp ) {
39 driUpdateFramebufferSize(gmesa->glCtx, dPriv);
40 gmesa->lastStamp = dPriv->lastStamp;
41 gmesa->new_state |= GAMMA_NEW_WINDOW | GAMMA_NEW_CLIP;
42 }
43
44 gmesa->numClipRects = dPriv->numClipRects;
45 gmesa->pClipRects = dPriv->pClipRects;
46
47 #if 0
48 gmesa->dirty = ~0;
49
50 if ( sarea->ctxOwner != gmesa->hHWContext ) {
51 sarea->ctxOwner = gmesa->hHWContext;
52 gmesa->dirty = GAMMA_UPLOAD_ALL;
53 }
54
55 for ( i = 0 ; i < gmesa->lastTexHeap ; i++ ) {
56 if ( sarea->texAge[i] != gmesa->lastTexAge[i] ) {
57 gammaAgeTextures( gmesa, i );
58 }
59 }
60 #endif
61 }