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"
5 #include "drirenderbuffer.h"
8 char *prevLockFile
= NULL
;
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.
21 void gammaGetLock( gammaContextPtr gmesa
, GLuint flags
)
23 __DRIdrawablePrivate
*dPriv
= gmesa
->driDrawable
;
24 __DRIscreenPrivate
*sPriv
= gmesa
->driScreen
;
26 drmGetLock( gmesa
->driFd
, gmesa
->hHWContext
, flags
);
28 /* The window might have moved, so we might need to get new clip
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.
36 DRI_VALIDATE_DRAWABLE_INFO( sPriv
, dPriv
);
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
;
44 gmesa
->numClipRects
= dPriv
->numClipRects
;
45 gmesa
->pClipRects
= dPriv
->pClipRects
;
50 if ( sarea
->ctxOwner
!= gmesa
->hHWContext
) {
51 sarea
->ctxOwner
= gmesa
->hHWContext
;
52 gmesa
->dirty
= GAMMA_UPLOAD_ALL
;
55 for ( i
= 0 ; i
< gmesa
->lastTexHeap
; i
++ ) {
56 if ( sarea
->texAge
[i
] != gmesa
->lastTexAge
[i
] ) {
57 gammaAgeTextures( gmesa
, i
);