1 /* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
3 #include "gamma_context.h"
4 #include "gamma_lock.h"
7 char *prevLockFile
= NULL
;
12 /* Update the hardware state. This is called if another context has
13 * grabbed the hardware lock, which includes the X server. This
14 * function also updates the driver's window state after the X server
15 * moves, resizes or restacks a window -- the change will be reflected
16 * in the drawable position and clip rects. Since the X server grabs
17 * the hardware lock when it changes the window state, this routine will
18 * automatically be called after such a change.
20 void gammaGetLock( gammaContextPtr gmesa
, GLuint flags
)
22 __DRIdrawablePrivate
*dPriv
= gmesa
->driDrawable
;
23 __DRIscreenPrivate
*sPriv
= gmesa
->driScreen
;
25 drmGetLock( gmesa
->driFd
, gmesa
->hHWContext
, flags
);
27 /* The window might have moved, so we might need to get new clip
30 * NOTE: This releases and regrabs the hw lock to allow the X server
31 * to respond to the DRI protocol request for new drawable info.
32 * Since the hardware state depends on having the latest drawable
33 * clip rects, all state checking must be done _after_ this call.
35 DRI_VALIDATE_DRAWABLE_INFO( sPriv
, dPriv
);
37 if ( gmesa
->lastStamp
!= dPriv
->lastStamp
) {
38 gmesa
->lastStamp
= dPriv
->lastStamp
;
39 gmesa
->new_state
|= GAMMA_NEW_WINDOW
| GAMMA_NEW_CLIP
;
42 gmesa
->numClipRects
= dPriv
->numClipRects
;
43 gmesa
->pClipRects
= dPriv
->pClipRects
;
48 if ( sarea
->ctxOwner
!= gmesa
->hHWContext
) {
49 sarea
->ctxOwner
= gmesa
->hHWContext
;
50 gmesa
->dirty
= GAMMA_UPLOAD_ALL
;
53 for ( i
= 0 ; i
< gmesa
->lastTexHeap
; i
++ ) {
54 if ( sarea
->texAge
[i
] != gmesa
->lastTexAge
[i
] ) {
55 gammaAgeTextures( gmesa
, i
);