diff options
25 files changed, 1017 insertions, 487 deletions
diff --git a/xc/lib/GL/dri/XF86dri.c b/xc/lib/GL/dri/XF86dri.c index 3800110b4..726ae778e 100644 --- a/xc/lib/GL/dri/XF86dri.c +++ b/xc/lib/GL/dri/XF86dri.c @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,8 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Jens Owen <jens@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Jens Owen <jens@valinux.com> + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -592,3 +594,63 @@ Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer, TRACE("GetDeviceInfo... return True"); return True; } + +Bool XF86DRIOpenFullScreen(dpy, screen, drawable) + Display* dpy; + int screen; + Drawable drawable; +{ + XExtDisplayInfo *info = find_display (dpy); + xXF86DRIOpenFullScreenReply rep; + xXF86DRIOpenFullScreenReq *req; + + XF86DRICheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRIOpenFullScreen, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRIOpenFullScreen; + req->screen = screen; + req->drawable = drawable; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + + UnlockDisplay(dpy); + SyncHandle(); + return rep.isFullScreen ? True : False; +} + +Bool XF86DRICloseFullScreen(dpy, screen, drawable) + Display* dpy; + int screen; + Drawable drawable; +{ + XExtDisplayInfo *info = find_display (dpy); + xXF86DRICloseFullScreenReply rep; + xXF86DRICloseFullScreenReq *req; + + XF86DRICheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XF86DRICloseFullScreen, req); + req->reqType = info->codes->major_opcode; + req->driReqType = X_XF86DRICloseFullScreen; + req->screen = screen; + req->drawable = drawable; + + /* The reply doesn't contain any data -- + we just use it as a synchronization + point. */ + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} diff --git a/xc/lib/GL/dri/xf86dri.h b/xc/lib/GL/dri/xf86dri.h index bc75cb64c..65adad4c1 100644 --- a/xc/lib/GL/dri/xf86dri.h +++ b/xc/lib/GL/dri/xf86dri.h @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,9 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Jens Owen <jens@precisioninsight.com> - * Rickard E. Faith <faith@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Jens Owen <jens@valinux.com> + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -52,6 +53,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define X_XF86DRIGetDrawableInfo 9 #define X_XF86DRIGetDeviceInfo 10 #define X_XF86DRIAuthConnection 11 +#define X_XF86DRIOpenFullScreen 12 +#define X_XF86DRICloseFullScreen 13 #define XF86DRINumberEvents 0 @@ -200,6 +203,22 @@ Bool XF86DRIGetDeviceInfo( #endif ); +Bool XF86DRIOpenFullScreen( +#if NeedFunctionPrototypes + Display* /* dpy */, + int /* screen */, + Drawable /* drawable */ +#endif +); + +Bool XF86DRICloseFullScreen( +#if NeedFunctionPrototypes + Display* /* dpy */, + int /* screen */, + Drawable /* drawable */ +#endif +); + _XFUNCPROTOEND #endif /* _XF86DRI_SERVER_ */ diff --git a/xc/lib/GL/dri/xf86dristr.h b/xc/lib/GL/dri/xf86dristr.h index 4f92ba6cf..015ec4c2c 100644 --- a/xc/lib/GL/dri/xf86dristr.h +++ b/xc/lib/GL/dri/xf86dristr.h @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,8 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Jens Owen <jens@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Jens Owen <jens@valinux.com> + * Rickard E. (Rik) Fiath <faith@valinux.com> * */ @@ -282,5 +284,51 @@ typedef struct { } xXF86DRIGetDeviceInfoReply; #define sz_xXF86DRIGetDeviceInfoReply 32 -#endif /* _XF86DRISTR_H_ */ +typedef struct _XF86DRIOpenFullScreen { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIOpenFullScreen */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRIOpenFullScreenReq; +#define sz_xXF86DRIOpenFullScreenReq 12 +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 isFullScreen B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRIOpenFullScreenReply; +#define sz_xXF86DRIOpenFullScreenReply 32 + +typedef struct _XF86DRICloseFullScreen { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseFullScreen */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xXF86DRICloseFullScreenReq; +#define sz_xXF86DRICloseFullScreenReq 12 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xXF86DRICloseFullScreenReply; +#define sz_xXF86DRICloseFullScreenReply 32 + + +#endif /* _XF86DRISTR_H_ */ diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index 0ccc020a8..7dd8ff212 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -157,7 +157,7 @@ struct __DRIcontextRec { ** Method to unbind a DRI drawable to a DRI graphics context. */ Bool (*unbindContext)(Display *dpy, int scrn, GLXDrawable draw, - GLXContext gc); + GLXContext gc, int will_rebind); /* ** Opaque pointer to private per context direct rendering data. diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index 9bed4bb09..d2aec36fb 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -818,10 +818,13 @@ Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc) /* Unbind the old direct rendering context */ if (oldGC->isDirect) { if (oldGC->driContext.private) { + int will_rebind = (gc && gc->isDirect + && draw == oldGC->currentDrawable); if (!(*oldGC->driContext.unbindContext)(oldGC->currentDpy, oldGC->screen, oldGC->currentDrawable, - oldGC)) { + oldGC, + will_rebind)) { /* The make current failed. Just return GL_FALSE. */ return GL_FALSE; } diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index a1a2ea1ea..16a4e975a 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -51,7 +51,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static Bool driMesaBindContext(Display *dpy, int scrn, GLXDrawable draw, GLXContext gc); static Bool driMesaUnbindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc); + GLXDrawable draw, GLXContext gc, + int will_rebind); /* Drawable methods */ static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw, @@ -71,6 +72,21 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config); static void driMesaDestroyScreen(Display *dpy, int scrn, void *private); +static Bool driFeatureOn(const char *name) +{ + char *env = getenv(name); + + if (!env) return GL_FALSE; + if (!strcasecmp(env, "enable")) return GL_TRUE; + if (!strcasecmp(env, "1")) return GL_TRUE; + if (!strcasecmp(env, "on")) return GL_TRUE; + if (!strcasecmp(env, "true")) return GL_TRUE; + if (!strcasecmp(env, "t")) return GL_TRUE; + if (!strcasecmp(env, "yes")) return GL_TRUE; + if (!strcasecmp(env, "y")) return GL_TRUE; + + return GL_FALSE; +} /* @@ -180,12 +196,15 @@ static void driMesaInitAPI(__MesaAPI *MesaAPI) MesaAPI->SwapBuffers = XMesaSwapBuffers; MesaAPI->MakeCurrent = XMesaMakeCurrent; MesaAPI->UnbindContext = XMesaUnbindContext; + MesaAPI->OpenFullScreen = XMesaOpenFullScreen; + MesaAPI->CloseFullScreen = XMesaCloseFullScreen; } /*****************************************************************/ static Bool driMesaUnbindContext(Display *dpy, int scrn, - GLXDrawable draw, GLXContext gc) + GLXDrawable draw, GLXContext gc, + int will_rebind) { __DRIscreen *pDRIScreen; __DRIdrawable *pdraw; @@ -220,6 +239,16 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn, } pdp = (__DRIdrawablePrivate *)pdraw->private; + /* Don't leave fullscreen mode if the + drawable will be rebound in the next + step -- this avoids a protocol + request. */ + if (!will_rebind && psp->fullscreen) { + psp->MesaAPI.CloseFullScreen(pcp); + XF86DRICloseFullScreen(dpy, scrn, draw); + psp->fullscreen = NULL; + } + /* Unbind Mesa's drawable from Mesa's context */ (*psp->MesaAPI.UnbindContext)(pcp); @@ -269,6 +298,8 @@ static Bool driMesaBindContext(Display *dpy, int scrn, __DRIdrawablePrivate *pdp; __DRIscreenPrivate *psp; __DRIcontextPrivate *pcp; + static Bool envchecked = False; + static Bool checkfullscreen = False; /* ** Assume error checking is done properly in glXMakeCurrent before @@ -326,8 +357,10 @@ static Bool driMesaBindContext(Display *dpy, int scrn, /* ** Now that we have a context associated with this drawable, we can ** initialize the drawable information if has not been done before. + ** Also, since we need it when LIBGL_DRI_FULLSCREEN, pick up any changes + ** that are outstanding. */ - if (!pdp->pStamp) { + if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); driMesaUpdateDrawableInfo(dpy, scrn, pdp); DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); @@ -336,6 +369,74 @@ static Bool driMesaBindContext(Display *dpy, int scrn, /* Call device-specific MakeCurrent */ (*psp->MesaAPI.MakeCurrent)(pcp, pdp, pdp); + /* Check for the potential to enter an automatic full-screen mode. + This may need to be moved up. */ + if (!envchecked) { + checkfullscreen = driFeatureOn("LIBGL_DRI_AUTOFULLSCREEN"); + envchecked = GL_TRUE; + } + if (checkfullscreen && pdp->numClipRects == 1) { + /* If there is valid information in the SAREA, we can use it to + avoid a protocol request. The only time when the SAREA + information won't be valid will be initially, so in the worst + case, we'll make one protocol request that we could have + avoided. */ + int try = 1; + int clw = pdp->pClipRects[0].x2 - pdp->pClipRects[0].x1; + int clh = pdp->pClipRects[0].y2 - pdp->pClipRects[0].y1; + +#if 0 + /* Useful client-side debugging message */ + fprintf(stderr, + "********************************************\n" + "********************************************\n" + "********************************************\n" + "%d @ %d,%d,%d,%d\n" + "frame %d,%d,%d,%d\n" + "win %d,%d,%d,%d\n" + "fs = %p pdp = %p sarea = %d\n" + "********************************************\n" + "********************************************\n" + "********************************************\n", + pdp->numClipRects, + pdp->pClipRects[0].x1, + pdp->pClipRects[0].y1, + pdp->pClipRects[0].x2, + pdp->pClipRects[0].y2, + psp->pSAREA->frame.x, + psp->pSAREA->frame.y, + psp->pSAREA->frame.width, + psp->pSAREA->frame.height, + pdp->x, pdp->y, pdp->w, pdp->h, + psp->fullscreen, pdp, psp->pSAREA->frame.fullscreen); +#endif + + + if (pdp->x != pdp->pClipRects[0].x1 + || pdp->y != pdp->pClipRects[0].y1 + || pdp->w != clw + || pdp->h != clh) try = 0; + + if (try && psp->pSAREA->frame.width && psp->pSAREA->frame.height) { + if (pdp->x != psp->pSAREA->frame.x + || pdp->y != psp->pSAREA->frame.y + || pdp->w != psp->pSAREA->frame.width + || pdp->h != psp->pSAREA->frame.height) try = 0; + } + + if (try) { + if (psp->fullscreen && !psp->pSAREA->frame.fullscreen) { + /* Server has closed fullscreen mode */ + __driMesaMessage("server closed fullscreen mode\n"); + psp->fullscreen = NULL; + } + if (XF86DRIOpenFullScreen(dpy, scrn, draw)) { + psp->fullscreen = pdp; + psp->MesaAPI.OpenFullScreen(pcp); + } + } + } + return GL_TRUE; } @@ -594,8 +695,18 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared, static void driMesaDestroyContext(Display *dpy, int scrn, void *private) { __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)private; + __DRIscreenPrivate *psp; + __DRIdrawablePrivate *pdp; if (pcp) { + if ((pdp = pcp->driDrawablePriv)) { + /* Shut down fullscreen mode */ + if ((psp = pdp->driScreenPriv) && psp->fullscreen) { + psp->MesaAPI.CloseFullScreen(pcp); + XF86DRICloseFullScreen(dpy, scrn, pdp->draw); + psp->fullscreen = NULL; + } + } __driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash); (void)XF86DRIDestroyContext(dpy, scrn, pcp->contextID); (*pcp->driScreenPriv->MesaAPI.DestroyContext)(pcp); diff --git a/xc/lib/GL/mesa/dri/dri_mesaint.h b/xc/lib/GL/mesa/dri/dri_mesaint.h index 8b01e1cfc..153a26542 100644 --- a/xc/lib/GL/mesa/dri/dri_mesaint.h +++ b/xc/lib/GL/mesa/dri/dri_mesaint.h @@ -273,6 +273,10 @@ struct __DRIscreenPrivateRec { ** This pointer is never touched by the DRI layer. */ void *private; + + /* If we're in full screen mode (via DRIOpenFullScreen), this points + to the drawable that was bound. Otherwise, this is NULL. */ + __DRIdrawablePrivate *fullscreen; }; diff --git a/xc/lib/GL/mesa/dri/dri_xmesaapi.h b/xc/lib/GL/mesa/dri/dri_xmesaapi.h index dbe1f21b0..c07be31bd 100644 --- a/xc/lib/GL/mesa/dri/dri_xmesaapi.h +++ b/xc/lib/GL/mesa/dri/dri_xmesaapi.h @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,8 +29,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Brian E. Paul <brian@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Brian E. Paul <brianp@valinux.com> */ @@ -84,7 +85,8 @@ extern GLboolean XMesaUnbindContext( __DRIcontextPrivate *driContextPriv ); extern void XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv ); - +extern GLboolean XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv); +extern GLboolean XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv); @@ -131,6 +133,8 @@ struct __MesaAPIRec { __DRIdrawablePrivate *driDrawPriv, __DRIdrawablePrivate *driReadPriv); GLboolean (*UnbindContext)(__DRIcontextPrivate *driContextPriv); + GLboolean (*OpenFullScreen)(__DRIcontextPrivate *driContextPriv); + GLboolean (*CloseFullScreen)(__DRIcontextPrivate *driContextPriv); }; diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c index 021da998d..4e74578ea 100644 --- a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c @@ -517,6 +517,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv) return GL_TRUE; } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + void ffbXMesaUpdateState(ffbContextPtr fmesa) { __DRIdrawablePrivate *dPriv = fmesa->driDrawable; diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c index 6b93a3e09..5e70667ed 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c @@ -528,6 +528,18 @@ GLboolean XMesaUnbindContext( __DRIcontextPrivate *driContextPriv ) return GL_TRUE; } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + void __driRegisterExtensions(void) { diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c index b2bb932ee..04f7d8fb6 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c @@ -555,6 +555,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv) return GL_TRUE; } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driDrawPriv, diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index e1eed7b2b..bcef8dca8 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -474,6 +474,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv) return GL_TRUE; } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + /* This looks buggy to me - the 'b' variable isn't used anywhere... * Hmm - It seems that the drawable is already hooked in to diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c index c33eca347..fcfdc6671 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c @@ -217,4 +217,16 @@ void __driRegisterExtensions( void ) { } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + #endif diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c index 318684ae8..f263c6212 100644 --- a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c @@ -400,6 +400,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv) return GL_TRUE; } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + return GL_TRUE; +} + GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driDrawPriv, __DRIdrawablePrivate *driReadPriv) diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c index 228a59758..9ea65e1b4 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -1,6 +1,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -336,6 +337,20 @@ XMesaUnbindContext(__DRIcontextPrivate * driContextPriv) return GL_TRUE; } +GLboolean +XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv) +{ + fprintf(stderr,"XMesaOpenFullScreen\n"); + return GL_TRUE; +} + +GLboolean +XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv) +{ + fprintf(stderr,"XMesaCloseFullScreen\n"); + return GL_TRUE; +} + /* * This function sends the window position and cliprect list to diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index f70b94fca..33fa2129d 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,7 +29,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Jens Owen <jens@precisioninsight.com> + * Jens Owen <jens@valinux.com> + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -62,6 +64,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86drm.h" #include "glxserver.h" #include "mi.h" +#include "mipointer.h" #include "xf86Priv.h" static int DRIScreenPrivIndex = -1; @@ -70,6 +73,12 @@ static unsigned long DRIGeneration = 0; static unsigned int DRIDrawableValidationStamp = 0; static int lockRefCount=0; + /* Support cleanup for fullscreen mode, + independent of the DRICreateDrawable + resource management. */ +static Bool _DRICloseFullScreen(pointer pResource, XID id); +static RESTYPE DRIFullScreenResType; + static RESTYPE DRIDrawablePrivResType; static RESTYPE DRIContextPrivResType; @@ -134,6 +143,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->pDriverInfo = pDRIInfo; pDRIPriv->nrWindows = 0; + pDRIPriv->fullscreen = NULL; if (drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -181,6 +191,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) "[drm] drmMap failed\n"); return FALSE; } + memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA 0x%08lx to %p\n", pDRIPriv->hSAREA, pDRIPriv->pSAREA); @@ -360,6 +371,12 @@ DRIFinishScreenInit(ScreenPtr pScreen) } if (pDRIInfo->wrap.ClipNotify) miClipNotify(pDRIInfo->wrap.ClipNotify); + + if (pDRIInfo->wrap.AdjustFrame) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; + pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; + } DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); @@ -375,6 +392,12 @@ DRICloseScreen(ScreenPtr pScreen) if (pDRIPriv && pDRIPriv->directRenderingSupport) { + if (pDRIPriv->wrap.AdjustFrame) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; + pDRIPriv->wrap.AdjustFrame = NULL; + } + if (pDRIPriv->pDriverInfo->driverSwapMethod != DRI_KERNEL_SWAP) { if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) { DRIDrvMsg(pScreen->myNum, X_ERROR, @@ -443,6 +466,7 @@ DRIExtensionInit(void) DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete); + DRIFullScreenResType = CreateNewResourceType(_DRICloseFullScreen); for (i = 0; i < screenInfo.numScreens; i++) { @@ -893,7 +917,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, int* numBackClipRects, XF86DRIClipRectPtr* pBackClipRects) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; WindowPtr pWin, pOldWin; int i; @@ -988,6 +1012,17 @@ DRIGetDrawableInfo(ScreenPtr pScreen, *H = (int)(pWin->drawable.height); *numClipRects = REGION_NUM_RECTS(&pWin->clipList); *pClipRects = (XF86DRIClipRectPtr)REGION_RECTS(&pWin->clipList); + + if (!*numClipRects && pDRIPriv->fullscreen) { + /* use fake full-screen clip rect */ + pDRIPriv->fullscreen_rect.x1 = *X; + pDRIPriv->fullscreen_rect.y1 = *Y; + pDRIPriv->fullscreen_rect.x2 = *X + *W; + pDRIPriv->fullscreen_rect.y2 = *Y + *H; + + *numClipRects = 1; + *pClipRects = &pDRIPriv->fullscreen_rect; + } *backX = *X; *backY = *Y; @@ -1070,6 +1105,7 @@ DRICreateInfoRec(void) inforec->wrap.ValidateTree = DRIValidateTree; inforec->wrap.PostValidateTree = DRIPostValidateTree; inforec->wrap.ClipNotify = DRIClipNotify; + inforec->wrap.AdjustFrame = DRIAdjustFrame; inforec->TransitionTo2d = 0; inforec->TransitionTo3d = 0; @@ -1661,3 +1697,145 @@ DRIQueryVersion(int *majorVersion, *minorVersion = XF86DRI_MINOR_VERSION; *patchVersion = XF86DRI_PATCH_VERSION; } + +static void +_DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y) +{ + pDRIPriv->pSAREA->frame.x = x; + pDRIPriv->pSAREA->frame.y = y; + pDRIPriv->pSAREA->frame.width = pScrn->frameX1 - x + 1; + pDRIPriv->pSAREA->frame.height = pScrn->frameY1 - y + 1; +} + +void +DRIAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScreenPtr pScreen = screenInfo.screens[scrnIndex]; + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + int px, py; + + if (!pDRIPriv || !pDRIPriv->pSAREA) { + DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n", + pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL); + return; + } + + if (pDRIPriv->fullscreen) { + /* Fix up frame */ + pScrn->frameX0 = pDRIPriv->pSAREA->frame.x; + pScrn->frameY0 = pDRIPriv->pSAREA->frame.y; + pScrn->frameX1 = pScrn->frameX0 + pDRIPriv->pSAREA->frame.width - 1; + pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1; + + /* Fix up cursor */ + miPointerPosition(&px, &py); + if (px < pScrn->frameX0) px = pScrn->frameX0; + if (px > pScrn->frameX1) px = pScrn->frameX1; + if (py < pScrn->frameY0) py = pScrn->frameY0; + if (py > pScrn->frameY1) py = pScrn->frameY1; + pScreen->SetCursorPosition(pScreen, px, py, TRUE); + return; + } + + if (pDRIPriv->wrap.AdjustFrame) { + /* unwrap */ + pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame; + /* call lower layers */ + (*pScrn->AdjustFrame)(scrnIndex, x, y, flags); + /* rewrap */ + pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; + pScrn->AdjustFrame = DRIAdjustFrame; + } + + _DRIAdjustFrame(pScrn, pDRIPriv, x, y); +} + +/* WARNING WARNING WARNING: Just like every other function call in this + file, the DRIOpenFullScreen and DRICloseFullScreen calls are for + internal use only! They should be used only by GLX internals and + should NEVER be called from a GL application. + + Some time in the future, there will be a (proposed) standard GLX + extension that performs expanded functionality, that is designed for + used by application-level programs, and that should be portable + across multiple GLX implementations. */ +Bool +DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + WindowPtr pWin = (WindowPtr)pDrawable; + XF86DRIClipRectPtr pClipRects = (void *)REGION_RECTS(&pWin->clipList); + + _DRIAdjustFrame(pScrn, pDRIPriv, pScrn->frameX0, pScrn->frameY0); + + if (pDrawable->type != DRAWABLE_WINDOW) return FALSE; + + if (!pScrn->vtSema) return FALSE; /* switched away */ + + if (pDrawable->x != pScrn->frameX0 + || pDrawable->y != pScrn->frameY0 + || pDrawable->width != pScrn->frameX1 - pScrn->frameX0 + 1 + || pDrawable->height != pScrn->frameY1 - pScrn->frameY0 + 1) { + return FALSE; + } + + if (REGION_NUM_RECTS(&pWin->clipList) != 1) return FALSE; + if (pDrawable->x != pClipRects[0].x1 + || pDrawable->y != pClipRects[0].y1 + || pDrawable->width != pClipRects[0].x2 - pClipRects[0].x1 + || pDrawable->height != pClipRects[0].y2 - pClipRects[0].y1) { + return FALSE; + } + + AddResource(pDrawable->id, DRIFullScreenResType, (pointer)pWin); + + xf86EnableVTSwitch(FALSE); + pScrn->EnableDisableFBAccess(pScreen->myNum, FALSE); + pScrn->vtSema = FALSE; + pDRIPriv->fullscreen = pDrawable; + DRIClipNotify(pWin, 0, 0); + + if (pDRIPriv->pDriverInfo->OpenFullScreen) + pDRIPriv->pDriverInfo->OpenFullScreen(pScreen); + + pDRIPriv->pSAREA->frame.fullscreen = 1; + return TRUE; +} + +static Bool +_DRICloseFullScreen(pointer pResource, XID id) +{ + DrawablePtr pDrawable = (DrawablePtr)pResource; + ScreenPtr pScreen = pDrawable->pScreen; + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + WindowPtr pWin = (WindowPtr)pDrawable; + WindowOptPtr optional = pWin->optional; + Mask mask = pWin->eventMask; + + if (pDRIPriv->pDriverInfo->CloseFullScreen) + pDRIPriv->pDriverInfo->CloseFullScreen(pScreen); + + pDRIPriv->fullscreen = NULL; + pScrn->vtSema = TRUE; + + /* Turn off expose events for the top window */ + pWin->eventMask &= ~ExposureMask; + pWin->optional = NULL; + pScrn->EnableDisableFBAccess(pScreen->myNum, TRUE); + pWin->eventMask = mask; + pWin->optional = optional; + + xf86EnableVTSwitch(TRUE); + pDRIPriv->pSAREA->frame.fullscreen = 0; + return TRUE; +} + +Bool +DRICloseFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) +{ + FreeResourceByType(pDrawable->id, DRIFullScreenResType, FALSE); + return TRUE; +} diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h index 723838c27..f4ca375bc 100644 --- a/xc/programs/Xserver/GL/dri/dri.h +++ b/xc/programs/Xserver/GL/dri/dri.h @@ -74,6 +74,7 @@ typedef int DRIWindowRequests; typedef void (*ClipNotifyPtr)( WindowPtr, int, int ); +typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags); /* @@ -90,6 +91,7 @@ typedef struct { ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; ClipNotifyPtr ClipNotify; + AdjustFramePtr AdjustFrame; } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; @@ -121,6 +123,8 @@ typedef struct { void (*TransitionTo3d)(ScreenPtr pScreen); void (*TransitionTo2d)(ScreenPtr pScreen); void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx); + Bool (*OpenFullScreen)(ScreenPtr pScreen); + Bool (*CloseFullScreen)(ScreenPtr pScreen); /* wrapped functions */ DRIWrappedFuncsRec wrap; @@ -298,6 +302,11 @@ extern void DRIQueryVersion(int *majorVersion, int *minorVersion, int *patchVersion); +extern void DRIAdjustFrame(int scrnIndex, int x, int y, int flags); + +extern int DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable); +extern int DRICloseFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable); + #define _DRI_H_ #endif diff --git a/xc/programs/Xserver/GL/dri/dristruct.h b/xc/programs/Xserver/GL/dri/dristruct.h index 02d62ae49..c08dff2c8 100644 --- a/xc/programs/Xserver/GL/dri/dristruct.h +++ b/xc/programs/Xserver/GL/dri/dristruct.h @@ -89,6 +89,8 @@ typedef struct _DRIScreenPrivRec DRIInfoPtr pDriverInfo; int nrWindows; XF86DRIClipRectRec private_buffer_rect; /* management of private buffers */ + DrawablePtr fullscreen; /* pointer to fullscreen drawable */ + XF86DRIClipRectRec fullscreen_rect; /* fake rect for fullscreen mode */ DRIWrappedFuncsRec wrap; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; } DRIScreenPrivRec, *DRIScreenPrivPtr; diff --git a/xc/programs/Xserver/GL/dri/sarea.h b/xc/programs/Xserver/GL/dri/sarea.h index 94f1687d3..0e323dc53 100644 --- a/xc/programs/Xserver/GL/dri/sarea.h +++ b/xc/programs/Xserver/GL/dri/sarea.h @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -30,6 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Kevin E. Martin <kevin@precisioninsight.com> * Jens Owen <jens@precisioninsight.com> + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -56,12 +58,21 @@ typedef struct _XF86DRISAREADrawable { unsigned int flags; } XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr; +typedef struct _XF86DRISAREAFrame { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + unsigned int fullscreen; +} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr; + typedef struct _XF86DRISAREA { /* first thing is always the drm locking structure */ drmLock lock; /* NOT_DONE: Use readers/writer lock for drawable_lock */ drmLock drawable_lock; XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; + XF86DRISAREAFrameRec frame; } XF86DRISAREARec, *XF86DRISAREAPtr; #endif diff --git a/xc/programs/Xserver/GL/dri/xf86dri.c b/xc/programs/Xserver/GL/dri/xf86dri.c index e18185f61..918b50058 100644 --- a/xc/programs/Xserver/GL/dri/xf86dri.c +++ b/xc/programs/Xserver/GL/dri/xf86dri.c @@ -2,6 +2,7 @@ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -28,8 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * Jens Owen <jens@precisioninsight.com> + * Kevin E. Martin <martin@valinux.com> + * Jens Owen <jens@valinux.com> + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -73,6 +75,8 @@ static DISPATCH_PROC(ProcXF86DRIGetDrawableInfo); static DISPATCH_PROC(ProcXF86DRIGetDeviceInfo); static DISPATCH_PROC(ProcXF86DRIDispatch); static DISPATCH_PROC(ProcXF86DRIAuthConnection); +static DISPATCH_PROC(ProcXF86DRIOpenFullScreen); +static DISPATCH_PROC(ProcXF86DRICloseFullScreen); static DISPATCH_PROC(SProcXF86DRIQueryVersion); static DISPATCH_PROC(SProcXF86DRIDispatch); @@ -515,6 +519,57 @@ ProcXF86DRIGetDeviceInfo( } static int +ProcXF86DRIOpenFullScreen ( + register ClientPtr client +) +{ + REQUEST(xXF86DRIOpenFullScreenReq); + xXF86DRIOpenFullScreenReply rep; + DrawablePtr pDrawable; + + REQUEST_SIZE_MATCH(xXF86DRIOpenFullScreenReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + if (!(pDrawable = SecurityLookupDrawable(stuff->drawable, + client, + SecurityReadAccess))) + return BadValue; + + rep.isFullScreen = DRIOpenFullScreen(screenInfo.screens[stuff->screen], + pDrawable); + + WriteToClient(client, sizeof(xXF86DRIOpenFullScreenReply), (char *)&rep); + return client->noClientException; +} + +static int +ProcXF86DRICloseFullScreen ( + register ClientPtr client +) +{ + REQUEST(xXF86DRICloseFullScreenReq); + xXF86DRICloseFullScreenReply rep; + DrawablePtr pDrawable; + + REQUEST_SIZE_MATCH(xXF86DRICloseFullScreenReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + if (!(pDrawable = SecurityLookupDrawable(stuff->drawable, + client, + SecurityReadAccess))) + return BadValue; + + DRICloseFullScreen(screenInfo.screens[stuff->screen], pDrawable); + + WriteToClient(client, sizeof(xXF86DRICloseFullScreenReply), (char *)&rep); + return (client->noClientException); +} + +static int ProcXF86DRIDispatch ( register ClientPtr client ) @@ -554,6 +609,10 @@ ProcXF86DRIDispatch ( return ProcXF86DRIGetDeviceInfo(client); case X_XF86DRIAuthConnection: return ProcXF86DRIAuthConnection(client); + case X_XF86DRIOpenFullScreen: + return ProcXF86DRIOpenFullScreen(client); + case X_XF86DRICloseFullScreen: + return ProcXF86DRICloseFullScreen(client); default: return BadRequest; } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h index bf818fef8..276ff8b91 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.116 1999/08/21 13:48:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.144 2000/11/18 19:37:08 tsi Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -17,14 +17,25 @@ #include "xf86str.h" #include "xf86Opt.h" #include <X11/Xfuncproto.h> +#ifndef IN_MODULE #include <stdarg.h> +#else +#include "xf86_ansic.h" +#endif + +#include "propertyst.h" /* General parameters */ +extern int xf86DoConfigure; +extern Bool xf86DoConfigurePass1; extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */ +extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */ extern int xf86PixmapIndex; extern Bool xf86ResAccessEnter; extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; +extern PropertyPtr *xf86RegisteredPropertiesTable; +extern ScrnInfoPtr xf86CurrentScreen; #define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) @@ -41,6 +52,11 @@ extern const unsigned char byte_reversed[256]; #define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \ (((p) == Pix24Use32) ? 32 : 0)) +/* variables for debugging */ +extern CARD32 xf86DummyVar1; +extern CARD32 xf86DummyVar2; +extern CARD32 xf86DummyVar3; + /* Function Prototypes */ #ifndef _NO_XF86_PROTOTYPES @@ -58,27 +74,38 @@ pciConfigPtr *xf86GetPciConfigInfo(void); #endif void xf86SetPciVideo(pciVideoPtr, resType); void xf86PrintResList(int verb, resPtr list); +resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex); int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); int xf86GetIsaInfoForScreen(int scrnIndex); Bool xf86ParseIsaBusString(const char *busID); void xf86EnableAccess(ScrnInfoPtr pScrn); +void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn); Bool xf86IsPrimaryPci(pciVideoPtr pPci); Bool xf86IsPrimaryIsa(void); int xf86CheckPciGAType(pciVideoPtr pPci); /* new RAC */ +resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex); +resPtr xf86JoinResLists(resPtr rlist1, resPtr rlist2); +resPtr xf86DupResList(const resPtr rlist); +void xf86FreeResList(resPtr rlist); void xf86ClaimFixedResources(resList list, int entityIndex); +Bool xf86DriverHasEntities(DriverPtr drvp); void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); +void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, + int instance); +int xf86GetNumEntityInstances(int entityIndex); +GDevPtr xf86GetDevFromEntity(int entityIndex, int instance); void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); EntityInfoPtr xf86GetEntityInfo(int entityIndex); pciVideoPtr xf86GetPciInfoForEntity(int entityIndex); +int xf86GetPciEntity(int bus, int dev, int func); Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, pointer); void xf86DeallocateResourcesForEntity(int entityIndex, long type); -resPtr xf86RegisterResources(int entityIndex, resList list, int access); +resPtr xf86RegisterResources(int entityIndex, resList list, int Access); Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base); -void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86AccessPtr p_io, - xf86AccessPtr p_mem, xf86AccessPtr p_io_mem, - xf86AccessPtr *ppAccessOld); +void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, + xf86SetAccessFuncPtr oldFuncs); Bool xf86IsEntityPrimary(int entityIndex); Bool xf86FixPciResource(int entityIndex, int prt, memType alignment, long type); @@ -92,17 +119,47 @@ resRange xf86GetSparse(long type, memType fixed_bits, memType decode_mask, memType address_mask, resPtr avoid); memType xf86ChkConflict(resRange *rgp, int entityIndex); - +Bool xf86IsPciDevPresent(int bus, int dev, int func); +ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); +Bool xf86NoSharedResources(int screenIndex, resType res); +resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2); +pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, + char n, pciVideoPtr pvp_exclude); +pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, + char n, pciVideoPtr pvp_exclude); +void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); +Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); +#ifdef async +Bool xf86QueueAsyncEvent(void (*func)(pointer),pointer arg); +#endif + +int xf86GetLastScrnFlag(int entityIndex); +void xf86SetLastScrnFlag(int entityIndex, int scrnIndex); +Bool xf86IsEntityShared(int entityIndex); +void xf86SetEntityShared(int entityIndex); +Bool xf86IsEntitySharable(int entityIndex); +void xf86SetEntitySharable(int entityIndex); +Bool xf86IsPrimInitDone(int entityIndex); +void xf86SetPrimInitDone(int entityIndex); +void xf86ClearPrimInitDone(int entityIndex); +int xf86AllocateEntityPrivateIndex(void); +DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); + +/* xf86Configure.c */ +GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, + void *busData, int chipset); +GDevPtr xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo, + int chipset); /* xf86Cursor.c */ void xf86LockZoom(ScreenPtr pScreen, int lock); void xf86InitViewport(ScrnInfoPtr pScr); -void xf86SetScreenLayout(int scrnIndex, int left, int right, int up, int down); void xf86SetViewport(ScreenPtr pScreen, int x, int y); Bool xf86ZoomLocked(ScreenPtr pScreen); void xf86ZoomViewport(ScreenPtr pScreen, int zoom); void *xf86GetPointerScreenFuncs(void); +void xf86InitOrigins(void); /* xf86DPMS.c */ @@ -117,9 +174,11 @@ Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, void SetTimeSinceLastInputEvent(void); pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data); -void xf86RemoveInputHandler(pointer handler); +int xf86RemoveInputHandler(pointer handler); void xf86DisableInputHandler(pointer handler); void xf86EnableInputHandler(pointer handler); +void xf86InterceptSignals(int *signo); +Bool xf86EnableVTSwitch(Bool new); /* xf86Helper.c */ @@ -134,10 +193,10 @@ Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp, void xf86PrintDepthBpp(ScrnInfoPtr scrp); Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask); Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); -Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma); +Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); void xf86SetBlackWhitePixels(ScreenPtr pScreen); -Bool xf86SaveRestoreImage(int scrnIndex, SaveRestoreFlags what); +void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args); void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, @@ -166,6 +225,7 @@ void xf86GetClocks(ScrnInfoPtr pScrn, int num, void (*ProtectRegs)(ScrnInfoPtr, Bool), void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg, int maskval, int knownclkindex, int knownclkvalue); +void xf86SetPriority(Bool up); const char *xf86GetVisualName(int visual); int xf86GetVerbosity(void); Pix24Flags xf86GetPix24(void); @@ -177,6 +237,7 @@ const char *xf86GetServerName(void); Bool xf86ServerIsExiting(void); Bool xf86ServerIsResetting(void); Bool xf86ServerIsInitialising(void); +Bool xf86ServerIsOnlyDetecting(void); Bool xf86ServerIsOnlyProbing(void); Bool xf86CaughtSignal(void); Bool xf86GetVidModeAllowNonLocal(void); @@ -185,25 +246,41 @@ Bool xf86GetModInDevAllowNonLocal(void); Bool xf86GetModInDevEnabled(void); Bool xf86GetAllowMouseOpenFail(void); Bool xf86IsPc98(void); +pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name); pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); +pointer xf86LoadOneModule(char *name, pointer optlist); +void xf86UnloadSubModule(pointer mod); +Bool xf86LoaderCheckSymbol(const char *name); void xf86LoaderReqSymLists(const char **, ...); void xf86LoaderReqSymbols(const char *, ...); -void xf86Break1(void); -void xf86Break2(void); -void xf86Break3(void); void xf86SetBackingStore(ScreenPtr pScreen); +void xf86SetSilkenMouse(ScreenPtr pScreen); int xf86NewSerialNumber(WindowPtr p, pointer unused); pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name, char **adaptor_name, pointer *adaptor_options); void xf86GetOS(const char **name, int *major, int *minor, int *teeny); -Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, - PciChipsets *p_chip, resList res, - EntityProc init, EntityProc enter, - EntityProc leave, pointer private); -Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex, - IsaChipsets *i_chip, resList res, - EntityProc init, EntityProc enter, - EntityProc leave, pointer private); +ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, + int entityIndex,PciChipsets *p_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); +ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, + int entityIndex, IsaChipsets *i_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); +/* Obsolete! don't use */ +Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, + int entityIndex,PciChipsets *p_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); +/* Obsolete! don't use */ +Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, + int entityIndex, IsaChipsets *i_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, resList res, EntityProc init, EntityProc enter, EntityProc leave, @@ -213,8 +290,32 @@ void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, EntityProc enter, EntityProc leave, pointer private); Bool xf86IsScreenPrimary(int scrnIndex); +int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, + int format, unsigned long len, + pointer value); +Bool xf86IsUnblank(int mode); - +/* xf86Debug.c */ +#ifdef BUILDDEBUG + void xf86Break1(void); +void xf86Break2(void); +void xf86Break3(void); +CARD8 xf86PeekFb8(CARD8 *p); +CARD16 xf86PeekFb16(CARD16 *p); +CARD32 xf86PeekFb32(CARD32 *p); +void xf86PokeFb8(CARD8 *p, CARD8 v); +void xf86PokeFb16(CARD16 *p, CARD16 v); +void xf86PokeFb32(CARD16 *p, CARD32 v); +CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset); +CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset); +CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset); +void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v); +void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v); +void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v); +extern void xf86SPTimestamp(xf86TsPtr* timestamp, char* string); +extern void xf86STimestamp(xf86TsPtr* timestamp); +#endif + /* xf86Init.c */ PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth); @@ -229,6 +330,8 @@ ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, ClockRangePtr clockRanges, LookupModeFlags strategy); ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor); ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, + ClockRangePtr clockRanges, + LookupModeFlags strategy, int maxPitch, int virtualX, int virtualY); ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, @@ -241,7 +344,6 @@ int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, LookupModeFlags strategy); void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode); void xf86PruneDriverModes(ScrnInfoPtr scrp); -void xf86PruneMonitorModes(MonPtr monp); void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); void xf86PrintModes(ScrnInfoPtr scrp); void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index baecd9b5d..2dab5232c 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.75 1999/06/27 09:20:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.101 2000/11/18 19:37:09 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -31,12 +31,12 @@ #include "compiler.h" -#include "Xpoll.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" #include "atKeynames.h" +#include "Xpoll.h" #ifdef XFreeXDGA @@ -60,6 +60,18 @@ extern Bool noXkbExtension; #define XE_POINTER 1 #define XE_KEYBOARD 2 +#ifdef XINPUT +#define __EqEnqueue(ev) xf86eqEnqueue(ev) +#else +#define __EqEnqueue(ev) mieqEnqueue(ev) +#endif + +#define EqEnqueue(ev) { \ + int __sigstate = xf86BlockSIGIO (); \ + __EqEnqueue (ev); \ + xf86UnblockSIGIO(__sigstate); \ +} + #ifdef XTESTEXT1 #define XTestSERVER_SIDE @@ -69,45 +81,19 @@ extern short xtest_mousey; extern int on_steal_input; extern Bool XTestStealKeyData(); extern void XTestStealMotionData(); - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - xf86eqEnqueue((ev)) -#else #define ENQUEUE(ev, code, direction, dev_type) \ (ev)->u.u.detail = (code); \ (ev)->u.u.type = (direction); \ if (!on_steal_input || \ XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ xtest_mousex, xtest_mousey)) \ - mieqEnqueue((ev)) -#endif - -#define MOVEPOINTER(dx, dy, time) \ - if (on_steal_input) \ - XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \ - miPointerDeltaCursor (dx, dy, time) - + EqEnqueue((ev)) #else /* ! XTESTEXT1 */ -#ifdef XINPUT #define ENQUEUE(ev, code, direction, dev_type) \ (ev)->u.u.detail = (code); \ (ev)->u.u.type = (direction); \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - mieqEnqueue((ev)) -#endif -#define MOVEPOINTER(dx, dy, time) \ - miPointerDeltaCursor (dx, dy, time) + EqEnqueue((ev)) #endif @@ -129,13 +115,17 @@ extern void XTestStealMotionData(); #ifdef USE_VT_SYSREQ static Bool VTSysreqToggle = FALSE; #endif /* !USE_VT_SYSREQ */ -static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD */ +static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for + *BSD and for avoiding VT + switches when using the DRI + automatic full screen mode.*/ extern fd_set EnabledDevices; #if defined(XQUEUE) extern void xf86XqueRequest(void); #endif +extern void (*xf86OSPMClose)(void); static void xf86VTSwitch(void); @@ -153,114 +143,6 @@ typedef struct x_IHRec { static IHPtr InputHandlers = NULL; -#ifndef NEW_INPUT -static CARD32 buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg); - -/* - * Lets create a simple finite-state machine: - * - * state[?][0]: action1 - * state[?][1]: action2 - * state[?][2]: next state - * - * action > 0: ButtonPress - * action = 0: nothing - * action < 0: ButtonRelease - * - * Why this stuff ??? Normally you cannot press both mousebuttons together, so - * the mouse reports both pressed at the same time ... - */ - -static signed char stateTab[48][3] = { - -/* nothing pressed */ - { 0, 0, 0 }, - { 0, 0, 8 }, /* 1 right -> delayed right */ - { 0, 0, 0 }, /* 2 nothing */ - { 0, 0, 8 }, /* 3 right -> delayed right */ - { 0, 0, 16 }, /* 4 left -> delayed left */ - { 2, 0, 24 }, /* 5 left & right (middle press) -> middle pressed */ - { 0, 0, 16 }, /* 6 left -> delayed left */ - { 2, 0, 24 }, /* 7 left & right (middle press) -> middle pressed */ - -/* delayed right */ - { 1, -1, 0 }, /* 8 nothing (right event) -> init */ - { 1, 0, 32 }, /* 9 right (right press) -> right pressed */ - { 1, -1, 0 }, /* 10 nothing (right event) -> init */ - { 1, 0, 32 }, /* 11 right (right press) -> right pressed */ - { 1, -1, 16 }, /* 12 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 13 left & right (middle press) -> middle pressed */ - { 1, -1, 16 }, /* 14 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 15 left & right (middle press) -> middle pressed */ - -/* delayed left */ - { 3, -3, 0 }, /* 16 nothing (left event) -> init */ - { 3, -3, 8 }, /* 17 right (left event) -> delayed right */ - { 3, -3, 0 }, /* 18 nothing (left event) -> init */ - { 3, -3, 8 }, /* 19 right (left event) -> delayed right */ - { 3, 0, 40 }, /* 20 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 21 left & right (middle press) -> pressed middle */ - { 3, 0, 40 }, /* 22 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 23 left & right (middle press) -> pressed middle */ - -/* pressed middle */ - { -2, 0, 0 }, /* 24 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 25 right (middle release) -> init */ - { -2, 0, 0 }, /* 26 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 27 right (middle release) -> init */ - { -2, 0, 0 }, /* 28 left (middle release) -> init */ - { 0, 0, 24 }, /* 29 left & right -> pressed middle */ - { -2, 0, 0 }, /* 30 left (middle release) -> init */ - { 0, 0, 24 }, /* 31 left & right -> pressed middle */ - -/* pressed right */ - { -1, 0, 0 }, /* 32 nothing (right release) -> init */ - { 0, 0, 32 }, /* 33 right -> pressed right */ - { -1, 0, 0 }, /* 34 nothing (right release) -> init */ - { 0, 0, 32 }, /* 35 right -> pressed right */ - { -1, 0, 16 }, /* 36 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 37 left & right (r rel, m prs) -> middle pressed */ - { -1, 0, 16 }, /* 38 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 39 left & right (r rel, m prs) -> middle pressed */ - -/* pressed left */ - { -3, 0, 0 }, /* 40 nothing (left release) -> init */ - { -3, 0, 8 }, /* 41 right (left release) -> delayed right */ - { -3, 0, 0 }, /* 42 nothing (left release) -> init */ - { -3, 0, 8 }, /* 43 right (left release) -> delayed right */ - { 0, 0, 40 }, /* 44 left -> left pressed */ - { -3, 2, 24 }, /* 45 left & right (l rel, mprs) -> middle pressed */ - { 0, 0, 40 }, /* 46 left -> left pressed */ - { -3, 2, 24 }, /* 47 left & right (l rel, mprs) -> middle pressed */ -}; - - -/* - * Table to allow quick reversal of natural button mapping to correct mapping - */ - -/* - * [JCH-96/01/21] The ALPS GlidePoint pad extends the MS protocol - * with a fourth button activated by tapping the PAD. - * The 2nd line corresponds to 4th button on; the drv sends - * the buttons in the following map (MSBit described first) : - * 0 | 4th | 1st | 2nd | 3rd - * And we remap them (MSBit described first) : - * 0 | 4th | 3rd | 2nd | 1st - */ -static char reverseMap[32] = { 0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15, - 16, 20, 18, 22, 17, 21, 19, 23, - 24, 28, 26, 30, 25, 29, 27, 31}; - - -static char hitachMap[16] = { 0, 2, 1, 3, - 8, 10, 9, 11, - 4, 6, 5, 7, - 12, 14, 13, 15 }; - -#define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f]) -#endif /* * TimeSinceLastInputEvent -- @@ -417,12 +299,12 @@ ProcessInputEvents () extern u_char SpecialServerMap[]; #endif /* ASSUME_CUSTOM_KEYCODES */ -#if !defined(__EMX__) +#if !defined(__EMX__) && !defined(__SOL8__) && !defined(__CYGWIN__) void xf86PostKbdEvent(unsigned key) { int scanCode = (key & 0x7f); - int specialkey; + int specialkey = 0; Bool down = (key & 0x80 ? FALSE : TRUE); KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; Bool updateLeds = FALSE; @@ -450,7 +332,8 @@ xf86PostKbdEvent(unsigned key) #if defined (__sparc__) if (kbdSun == -1) { - if (xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) + if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) + || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) kbdSun = 1; else kbdSun = 0; @@ -459,7 +342,7 @@ xf86PostKbdEvent(unsigned key) goto special; #endif /* __sparc__ */ -#if defined (i386) && defined (SVR4) && !defined (PC98) +#if defined (i386) && defined (SVR4) /* * PANIX returns DICOP standards based keycodes in using 106jp * keyboard. We need to remap some keys. @@ -494,8 +377,6 @@ xf86PostKbdEvent(unsigned key) if (xf86Info.scanPrefix == 0) { switch (scanCode) { - -#ifndef PC98 case KEY_Prefix0: case KEY_Prefix1: #if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) @@ -508,11 +389,9 @@ xf86PostKbdEvent(unsigned key) } break; #endif -#endif /* not PC98 */ } } -#ifndef PC98 else if ( #ifdef CSRG_BASED (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS @@ -551,8 +430,18 @@ xf86PostKbdEvent(unsigned key) /* * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */ + case 0x2A: + case 0x36: + return; default: - return; /* skip illegal */ + xf86MsgVerb(X_INFO, 2, "Unreported Prefix0 scancode: 0x%02x\n", + scanCode); + /* + * "Internet" keyboards are generating lots of new codes. Let them + * pass. There is little consistency between them, so don't bother + * with symbolic names at this level. + */ + scanCode += 0x78; } } @@ -568,7 +457,6 @@ xf86PostKbdEvent(unsigned key) if (scanCode != KEY_NumLock) return; scanCode = KEY_Pause; /* pause */ } -#endif /* not PC98 */ #endif /* !ASSUME_CUSTOM_KEYCODES */ /* @@ -581,6 +469,27 @@ xf86PostKbdEvent(unsigned key) specialkey = scanCode; #endif /* ASSUME_CUSTOM_KEYCODES */ + if (xf86IsPc98()) { + switch (scanCode) { + case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ + case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ + case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ + case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ + case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ + case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ + case 0x65: specialkey = 0x3e; break; /* KEY_F4 */ + case 0x66: specialkey = 0x3f; break; /* KEY_F5 */ + case 0x67: specialkey = 0x40; break; /* KEY_F6 */ + case 0x68: specialkey = 0x41; break; /* KEY_F7 */ + case 0x69: specialkey = 0x42; break; /* KEY_F8 */ + case 0x6a: specialkey = 0x43; break; /* KEY_F9 */ + case 0x6b: specialkey = 0x44; break; /* KEY_F10 */ + /* case 0x73: specialkey = 0x38; break; KEY_Alt */ + /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */ + default: specialkey = 0x00; break; + } + } + #if defined (__sparc__) special: if (kbdSun) { @@ -648,6 +557,28 @@ special: } break; + /* Under QNX4, we set the vtPending flag for VT switching and + * let the VT switch function do the rest... + * This is a little different from the other OS'es. + */ +#if defined(QNX4) + case KEY_1: + case KEY_2: + case KEY_3: + case KEY_4: + case KEY_5: + case KEY_6: + case KEY_7: + case KEY_8: + case KEY_9: + if (down){ + xf86Info.vtRequestsPending = + specialkey - KEY_1 + 1; + return; + } + break; +#endif + #if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) || defined(SCO) /* * Under Linux, the raw keycodes are consumed before the kernel @@ -792,17 +723,13 @@ special: /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ case KEY_Alt: -#ifndef PC98 case KEY_AltLang: -#endif /* not PC98 */ break; -#ifndef PC98 case KEY_SysReqest: if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask))) VTSysreqToggle = TRUE; break; -#endif /* not PC98 */ default: if (VTSysreqToggle) @@ -910,7 +837,6 @@ special: * ignore releases, toggle on & off on presses. * Don't deal with the Caps_Lock keysym directly, but check the lock modifier */ -#ifndef PC98 if (keyc->modifierMap[keycode] & LockMask || keysym[0] == XK_Scroll_Lock || keysym[1] == XF86XK_ModeLock || @@ -932,14 +858,13 @@ special: if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag; updateLeds = TRUE; } -#endif /* not PC98 */ #ifndef ASSUME_CUSTOM_KEYCODES /* * normal, non-keypad keys */ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) +#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) && !defined(__CYGWIN__) /* * magic ALT_L key on AT84 keyboards for multilingual support */ @@ -961,9 +886,14 @@ special: /* * check for an autorepeat-event */ - if ((down && KeyPressed(keycode)) && - (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode])) - return; + if (down && KeyPressed(keycode)) { + KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed; + if ((xf86Info.autoRepeat != AutoRepeatModeOn) || + keyc->modifierMap[keycode] || + (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) )))) + return; + } + xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); /* @@ -990,208 +920,6 @@ special: #endif /* !__EMX__ */ -#ifndef NEW_INPUT -static CARD32 -buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) -{ -#ifndef NEW_INPUT - MouseDevPtr priv = MOUSE_DEV((DeviceIntPtr) arg); - - xf86PostMseEvent(((DeviceIntPtr) arg), priv->truebuttons, 0, 0); -#endif - return(0); -} -#endif - - -/* - * xf86PostMseEvent -- - * Translate the raw hardware MseEvent into an XEvent(s), and tell DIX - * about it. Perform a 3Button emulation if required. - */ - -#ifndef NEW_INPUT -void -xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy) -{ - static OsTimerPtr timer = NULL; - MouseDevPtr private = MOUSE_DEV(device); - int id, change; - int truebuttons; - xEvent mevent[2]; - -#ifdef AMOEBA - int pressed; - - pressed = ((buttons & BUTTON_PRESS) != 0); - buttons &= ~BUTTON_PRESS; -#endif - - xf86Info.lastEventTime = mevent->u.keyButtonPointer.time = GetTimeInMillis(); - - truebuttons = buttons; - if (private->mseType == PROT_MMHIT) - buttons = reverseBits(hitachMap, buttons); - else - buttons = reverseBits(reverseMap, buttons); - - if (dx || dy) { - /* - * The accelaration stuff is now done in xf86Xinput.c when XInput - * support is enabled. - */ -#ifndef XINPUT - - /* - * accelerate the baby now if sqrt(dx*dx + dy*dy) > threshold ! - * but do some simpler arithmetic here... - */ - if ((abs(dx) + abs(dy)) >= private->threshold) { - dx = (dx * private->num) / private->den; - dy = (dy * private->num)/ private->den; - } - - MOVEPOINTER(dx, dy, mevent->u.keyButtonPointer.time); -#else - xf86PostMotionEvent(device, 0, 0, 2, dx, dy); -#endif - } - - if (private->emulate3Buttons) - { - - /* - * Hack to operate the middle button even with Emulate3Buttons set. - * Modifying the state table to keep track of the middle button state - * would nearly double its size, so I'll stick with this fix. - TJW - */ - if (private->mseType == PROT_MMHIT) - change = buttons ^ reverseBits(hitachMap, private->lastButtons); - else - change = buttons ^ reverseBits(reverseMap, private->lastButtons); - if (change & 02) - { -#ifndef XINPUT - ENQUEUE(mevent, - 2, (buttons & 02) ? ButtonPress : ButtonRelease, - XE_POINTER); -#else - xf86PostButtonEvent(device, 0, 2, (buttons & 02), 0, 0); -#endif - } - - /* - * emulate the third button by the other two - */ - if ((id = stateTab[(buttons & 0x07) + private->emulateState][0]) != 0) - { -#ifndef XINPUT - ENQUEUE(mevent, - abs(id), (id < 0 ? ButtonRelease : ButtonPress), - XE_POINTER); -#else - xf86PostButtonEvent(device, 0, abs(id), (id >= 0), 0, 0); -#endif - } - - if ((id = stateTab[(buttons & 0x07) + private->emulateState][1]) != 0) - { -#ifndef XINPUT - ENQUEUE(mevent, - abs(id), (id < 0 ? ButtonRelease : ButtonPress), - XE_POINTER); -#else - xf86PostButtonEvent(device, 0, abs(id), (id >= 0), 0, 0); -#endif - } - - private->emulateState = stateTab[(buttons & 0x07) + private->emulateState][2]; - if (stateTab[(buttons & 0x07) + private->emulateState][0] || - stateTab[(buttons & 0x07) + private->emulateState][1]) - { - private->truebuttons = truebuttons; - timer = TimerSet(timer, 0, private->emulate3Timeout, buttonTimer, - (pointer)device); - } - else - { - if (timer) - { - TimerFree(timer); - timer = NULL; - } - } - } - else - { -#ifdef AMOEBA - if (truebuttons != 0) { -# ifndef XINPUT - ENQUEUE(mevent, - truebuttons, (pressed ? ButtonPress : ButtonRelease), - XE_POINTER); -# else - xf86PostButtonEvent(device, 0, truebuttons, pressed, 0, 0); -# endif - } -#else - /* - * real three button event - * Note that xf86Info.lastButtons has the hardware button mapping which - * is the reverse of the button mapping reported to the server. - */ - if (private->mseType == PROT_MMHIT) - change = buttons ^ reverseBits(hitachMap, private->lastButtons); - else - change = buttons ^ reverseBits(reverseMap, private->lastButtons); - while (change) - { - id = ffs(change); - change &= ~(1 << (id-1)); -# ifndef XINPUT - ENQUEUE(mevent, - id, (buttons&(1<<(id-1)))? ButtonPress : ButtonRelease, - XE_POINTER); -# else - xf86PostButtonEvent(device, 0, id, (buttons&(1<<(id-1))), 0, 0); -# endif - } -#endif - } - private->lastButtons = truebuttons; -} -#endif - - - -#ifndef NEW_INPUT -/* - * xf86Block -- - * Os block handler. - */ - -/* ARGSUSED */ -void -xf86Block(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) -{ -#if defined(XQUEUE) - /* - * On MP SVR4 boxes, a race condition exists because the XQUEUE does - * not have anyway to lock it for exclusive access. This results in one - * processor putting something on the queue at the same time the other - * processor is taking it something off. The count of items in the queue - * can get off by 1. This just goes and checks to see if an extra event - * was put in the queue a during this period. The signal for this event - * was ignored while processing the previous event. - */ - - if (xf86Screens[0]->vtSema) - xf86XqueRequest(); -#endif -} -#endif - - #ifndef AMOEBA /* @@ -1203,17 +931,14 @@ xf86Block(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) void xf86Wakeup(pointer blockData, int err, pointer pReadmask) { - -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__QNX__) && !defined(__CYGWIN__) #ifdef __OSF__ fd_set kbdDevices; fd_set mseDevices; #endif /* __OSF__ */ fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set devicesWithInput; -#ifdef NEW_INPUT InputInfoPtr pInfo; -#endif if (err >= 0) { @@ -1221,14 +946,14 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) #ifndef __OSF__ if (XFD_ANYSET(&devicesWithInput)) { (xf86Info.kbdEvents)(); -#ifndef NEW_INPUT - (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev); -#else pInfo = xf86InputDevs; while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && (FD_ISSET(pInfo->fd, ((fd_set *)pReadmask)) != 0)) { + int sigstate = xf86BlockSIGIO(); + pInfo->read_input(pInfo); + xf86UnblockSIGIO(sigstate); /* * Must break here because more than one device may share * the same file descriptor. @@ -1237,7 +962,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) } pInfo = pInfo->next; } -#endif /* NEW_INPUT */ } #else /* __OSF__ */ /* @@ -1259,16 +983,33 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) (xf86Info.mouseDev->mseEvents)(1); #endif /* __OSF__ */ } -#else /* __EMX__ */ +#else /* __EMX__ and __QNX__ */ + + InputInfoPtr pInfo; - (xf86Info.kbdEvents)(); /* Under OS/2, always call */ - (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev); + (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */ -#endif /* __EMX__ */ + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->read_input && pInfo->fd >= 0) { + int sigstate = xf86BlockSIGIO(); + + pInfo->read_input(pInfo); + xf86UnblockSIGIO(sigstate); + /* + * Must break here because more than one device may share + * the same file descriptor. + */ + break; + } + pInfo = pInfo->next; + } - { - IHPtr ih; +#endif /* __EMX__ and __QNX__ */ + if (err >= 0) { /* we don't want the handlers called if select() */ + IHPtr ih; /* returned with an error condition, do we? */ + for (ih = InputHandlers; ih; ih = ih->next) { if (ih->enabled && ih->fd >= 0 && ih->ihproc && (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) { @@ -1276,15 +1017,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) } } } - -#ifndef NEW_INPUT -#if defined(XQUEUE) && !defined(XQUEUE_ASYNC) - /* This could be done more cleanly */ - if (xf86Info.mouseDev->xqueSema && xf86Info.mouseDev->xquePending) - xf86XqueRequest(); -#endif -#endif - + if (xf86VTSwitchPending()) xf86VTSwitch(); if (xf86Info.inputPending) ProcessInputEvents(); @@ -1292,16 +1025,74 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) #endif /* AMOEBA */ +/* + * xf86SigioReadInput -- + * signal handler for the SIGIO signal. + */ +static void +xf86SigioReadInput(int fd, + void *closure) +{ + int sigstate = xf86BlockSIGIO(); + InputInfoPtr pInfo = (InputInfoPtr) closure; + + pInfo->read_input(pInfo); + + xf86UnblockSIGIO(sigstate); +} + +/* + * xf86AddEnabledDevice -- + * + */ +void +xf86AddEnabledDevice(InputInfoPtr pInfo) +{ + if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) { + AddEnabledDevice(pInfo->fd); + } +} + +/* + * xf86RemoveEnabledDevice -- + * + */ +void +xf86RemoveEnabledDevice(InputInfoPtr pInfo) +{ + if (!xf86RemoveSIGIOHandler (pInfo->fd)) { + RemoveEnabledDevice(pInfo->fd); + } +} + +static int *xf86SignalIntercept = NULL; + +void +xf86InterceptSignals(int *signo) +{ + if ((xf86SignalIntercept = signo)) + *signo = -1; +} /* * xf86SigHandler -- - * Catch unexpected signals and exit cleanly. + * Catch unexpected signals and exit or continue cleanly. */ void xf86SigHandler(int signo) { + if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) { + /* Re-arm handler just in case */ + (void) signal(signo, xf86SigHandler); + *xf86SignalIntercept = signo; + return; + } + signal(signo,SIG_IGN); xf86Info.caughtSignal = TRUE; +#ifdef XF86BIGFONT + XF86BigfontCleanup(); +#endif #if defined(DEBUG) && defined(XFree86LOADER) if (signo == SIGSEGV) LoaderDumpSymbols(); @@ -1317,9 +1108,7 @@ static void xf86VTSwitch() { int i; -#ifdef NEW_INPUT InputInfoPtr pInfo; -#endif IHPtr ih; #ifdef DEBUG @@ -1339,33 +1128,29 @@ xf86VTSwitch() #ifdef DEBUG ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", - BOOLTOSTRING(xf86Exiting)); + BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); #endif for (i = 0; i < xf86NumScreens; i++) { - if (!xf86Exiting) - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, SaveImage); + if (!(dispatchException & DE_TERMINATE)) + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); } xf86EnterServerState(SETUP); for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->LeaveVT(i, 0); } -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); -#ifndef NEW_INPUT - DisableDevice((DeviceIntPtr)xf86Info.pMouse); -#else pInfo = xf86InputDevs; while (pInfo) { DisableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* NEW_INPUT */ #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86DisableInputHandler(ih); - xf86AccessLeaveState(); /* We need this here, otherwise */ - xf86AccessLeave(); /* console won't be restored */ + xf86AccessLeave(); /* We need this here, otherwise */ + xf86AccessLeaveState(); /* console won't be restored */ if (!xf86VTSwitchAway()) { /* @@ -1382,30 +1167,30 @@ xf86VTSwitch() FatalError("EnterVT failed for screen %d\n", i); } xf86EnterServerState(OPERATING); - if (!xf86Exiting) { + if (!(dispatchException & DE_TERMINATE)) { for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, RestoreImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); } } SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); -#ifndef NEW_INPUT - EnableDevice((DeviceIntPtr)xf86Info.pMouse); -#else pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* NEW_INPUT */ #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); } else { + if (xf86OSPMClose) + xf86OSPMClose(); + xf86OSPMClose = NULL; + for (i = 0; i < xf86NumScreens; i++) { /* * zero all access functions to @@ -1422,7 +1207,8 @@ xf86VTSwitch() ErrorF("xf86VTSwitch: Entering\n"); #endif if (!xf86VTSwitchTo()) return; - + xf86OSPMClose = xf86OSPMOpen(); + xf86EnableIO(); xf86AccessEnter(); xf86EnterServerState(SETUP); @@ -1433,24 +1219,20 @@ xf86VTSwitch() } xf86EnterServerState(OPERATING); for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, RestoreImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE); } /* Turn screen saver off when switching back */ SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); -#ifndef NEW_INPUT - EnableDevice((DeviceIntPtr)xf86Info.pMouse); -#else pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* NEW_INPUT */ #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); @@ -1485,15 +1267,18 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) return ih; } -void +int xf86RemoveInputHandler(pointer handler) { IHPtr ih, p; - + int fd; + if (!handler) - return; + return -1; ih = handler; + fd = ih->fd; + if (ih->fd >= 0) RemoveEnabledDevice(ih->fd); @@ -1507,6 +1292,7 @@ xf86RemoveInputHandler(pointer handler) p->next = ih->next; } xfree(ih); + return fd; } void @@ -1537,6 +1323,14 @@ xf86EnableInputHandler(pointer handler) AddEnabledDevice(ih->fd); } +Bool +xf86EnableVTSwitch(Bool new) +{ + Bool old = VTSwitchEnabled; + VTSwitchEnabled = new; + return old; +} + #ifdef XTESTEXT1 void @@ -1557,8 +1351,6 @@ XTestJumpPointer(int jx, int jy, int dev_type) miPointerAbsoluteCursor(jx, jy, GetTimeInMillis() ); } - - void XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, int mousey) @@ -1582,3 +1374,38 @@ XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, #endif /* XTESTEXT1 */ +#ifdef WSCONS_SUPPORT + +/* XXX Currently XKB is mandatory. */ + +void +xf86PostWSKbdEvent(struct wscons_event *event) +{ + int type = event->type; + int value = event->value; + Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); + KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; + xEvent kevent; + KeySym *keysym; + int keycode; + + /* + * Now map the scancodes to real X-keycodes ... + */ + keycode = value + MIN_KEYCODE; + keysym = keyc->curKeySyms.map + + keyc->curKeySyms.mapWidth * (keycode - keyc->curKeySyms.minKeyCode); + + /* + * check for an autorepeat-event + */ + if ((down && KeyPressed(keycode)) && + (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode])) + return; + + xf86Info.lastEventTime = kevent.u.keyButtonPointer.time + = event->time.tv_sec * 1000 + event->time.tv_nsec / 1000000; + + ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); +} +#endif /* WSCONS_SUPPORT */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c index 5cfefa728..f6c346438 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -352,6 +352,9 @@ static const char *driSymbols[] = { "DRIGetSAREAPrivate", "DRIGetContext", "DRIQueryVersion", + "DRIAdjustFrame", + "DRIOpenFullScreen", + "DRICloseFullScreen", "GlxSetVisualConfigs", NULL }; @@ -3029,6 +3032,16 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); #endif + pScrn->memPhysBase = pMga->FbAddress; + pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); + + if(pMga->SecondCrtc == TRUE) { + pScreen->SaveScreen = MGASaveScreenCrtc2; + } else { + pScreen->SaveScreen = MGASaveScreen; + } + MGAInitVideo(pScreen); + #ifdef XF86DRI /* Initialize the Warp engine */ if (pMga->directRenderingEnabled) { @@ -3050,16 +3063,6 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pMga->have_quiescense = 1; #endif - pScrn->memPhysBase = pMga->FbAddress; - pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); - - if(pMga->SecondCrtc == TRUE) { - pScreen->SaveScreen = MGASaveScreenCrtc2; - } else { - pScreen->SaveScreen = MGASaveScreen; - } - MGAInitVideo(pScreen); - /* Wrap the current CloseScreen function */ pMga->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = MGACloseScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index c64e0d049..39bedb922 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -373,6 +373,8 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->SwapContext = TDFXDRISwapContext; pDRIInfo->InitBuffers = TDFXDRIInitBuffers; pDRIInfo->MoveBuffers = TDFXDRIMoveBuffers; + pDRIInfo->OpenFullScreen = TDFXDRIOpenFullScreen; + pDRIInfo->CloseFullScreen = TDFXDRICloseFullScreen; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index 201a2ff6f..5c2c355f5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -206,6 +206,20 @@ static const char *vgahwSymbols[] = { 0 }; +static const char *ramdacSymbols[] = { + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL +}; + +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86DoEDID_DDC1", + NULL +}; + +#ifdef XFree86LOADER static const char *fbSymbols[] = { "fbScreenInit", #ifdef RENDER @@ -231,19 +245,6 @@ static const char *xaaSymbols[] = { NULL }; -static const char *ramdacSymbols[] = { - "xf86InitCursor", - "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", - NULL -}; - -static const char *ddcSymbols[] = { - "xf86PrintEDID", - "xf86DoEDID_DDC1", - NULL -}; - static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", @@ -289,8 +290,6 @@ static const char *driSymbols[] = { #endif -#ifdef XFree86LOADER - static MODULESETUPPROTO(tdfxSetup); static XF86ModuleVersionInfo tdfxVersRec = |