105b261ecSmrg/************************************************************************** 205b261ecSmrg 305b261ecSmrgCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. 405b261ecSmrgAll Rights Reserved. 505b261ecSmrg 605b261ecSmrgPermission is hereby granted, free of charge, to any person obtaining a 705b261ecSmrgcopy of this software and associated documentation files (the 805b261ecSmrg"Software"), to deal in the Software without restriction, including 905b261ecSmrgwithout limitation the rights to use, copy, modify, merge, publish, 1005b261ecSmrgdistribute, sub license, and/or sell copies of the Software, and to 1105b261ecSmrgpermit persons to whom the Software is furnished to do so, subject to 1205b261ecSmrgthe following conditions: 1305b261ecSmrg 1405b261ecSmrgThe above copyright notice and this permission notice (including the 1505b261ecSmrgnext paragraph) shall be included in all copies or substantial portions 1605b261ecSmrgof the Software. 1705b261ecSmrg 1805b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1905b261ecSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2005b261ecSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 2105b261ecSmrgIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 2205b261ecSmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 2305b261ecSmrgTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 2405b261ecSmrgSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2505b261ecSmrg 2605b261ecSmrg**************************************************************************/ 2705b261ecSmrg 2805b261ecSmrg/* 2905b261ecSmrg * Authors: 3005b261ecSmrg * Jens Owen <jens@tungstengraphics.com> 3105b261ecSmrg * 3205b261ecSmrg */ 3305b261ecSmrg 3405b261ecSmrg#ifndef DRI_STRUCT_H 3505b261ecSmrg#define DRI_STRUCT_H 3605b261ecSmrg 3705b261ecSmrg#include "xf86drm.h" 384642e01fSmrg#include "xf86Crtc.h" 3905b261ecSmrg 404642e01fSmrg#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ 414642e01fSmrg dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey)) 424642e01fSmrg#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ 434642e01fSmrg dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey)) 4405b261ecSmrg 4535c4bbdfSmrgtypedef struct _DRIDrawablePrivRec { 4635c4bbdfSmrg drm_drawable_t hwDrawable; 4735c4bbdfSmrg int drawableIndex; 4835c4bbdfSmrg ScreenPtr pScreen; 4935c4bbdfSmrg int refCount; 5035c4bbdfSmrg int nrects; 5105b261ecSmrg} DRIDrawablePrivRec, *DRIDrawablePrivPtr; 5205b261ecSmrg 5335c4bbdfSmrgstruct _DRIContextPrivRec { 5435c4bbdfSmrg drm_context_t hwContext; 5535c4bbdfSmrg ScreenPtr pScreen; 5635c4bbdfSmrg Bool valid3D; 5735c4bbdfSmrg DRIContextFlags flags; 5835c4bbdfSmrg void **pContextStore; 5905b261ecSmrg}; 6005b261ecSmrg 614642e01fSmrg#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ 626747b715Smrg (dixPrivateKeyRegistered(DRIScreenPrivKey) ? \ 636747b715Smrg dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL)) 6405b261ecSmrg 6505b261ecSmrg#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ 664642e01fSmrg dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \ 674642e01fSmrg DRIScreenPrivKey)) 6805b261ecSmrg 6905b261ecSmrg#define DRI_ENT_PRIV(pScrn) \ 7005b261ecSmrg ((DRIEntPrivIndex < 0) ? \ 7105b261ecSmrg NULL: \ 7205b261ecSmrg ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \ 7305b261ecSmrg DRIEntPrivIndex)->ptr))) 7405b261ecSmrg 7535c4bbdfSmrgtypedef struct _DRIScreenPrivRec { 7635c4bbdfSmrg Bool directRenderingSupport; 7735c4bbdfSmrg int drmFD; /* File descriptor for /dev/video/? */ 7835c4bbdfSmrg drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ 7935c4bbdfSmrg XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ 8035c4bbdfSmrg drm_context_t myContext; /* DDX Driver's context */ 8135c4bbdfSmrg DRIContextPrivPtr myContextPriv; /* Pointer to server's private area */ 8235c4bbdfSmrg DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ 8335c4bbdfSmrg void **hiddenContextStore; /* hidden X context */ 8435c4bbdfSmrg void **partial3DContextStore; /* parital 3D context */ 8535c4bbdfSmrg DRIInfoPtr pDriverInfo; 8635c4bbdfSmrg int nrWindows; 8735c4bbdfSmrg int nrWindowsVisible; 8835c4bbdfSmrg int nrWalked; 8935c4bbdfSmrg drm_clip_rect_t private_buffer_rect; /* management of private buffers */ 9035c4bbdfSmrg DrawablePtr fullscreen; /* pointer to fullscreen drawable */ 9135c4bbdfSmrg drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ 9235c4bbdfSmrg DRIWrappedFuncsRec wrap; 9305b261ecSmrg DestroyWindowProcPtr DestroyWindow; 9435c4bbdfSmrg DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; 9535c4bbdfSmrg DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ 9635c4bbdfSmrg Bool createDummyCtx; 9735c4bbdfSmrg Bool createDummyCtxPriv; 9835c4bbdfSmrg Bool grabbedDRILock; 9935c4bbdfSmrg Bool drmSIGIOHandlerInstalled; 10035c4bbdfSmrg Bool wrapped; 10135c4bbdfSmrg Bool windowsTouched; 10235c4bbdfSmrg int lockRefCount; 10335c4bbdfSmrg drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */ 10435c4bbdfSmrg XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */ 10535c4bbdfSmrg int *pLockRefCount; 10635c4bbdfSmrg int *pLockingContext; 10735c4bbdfSmrg xf86_crtc_notify_proc_ptr xf86_crtc_notify; 10805b261ecSmrg} DRIScreenPrivRec, *DRIScreenPrivPtr; 10905b261ecSmrg 11005b261ecSmrgtypedef struct _DRIEntPrivRec { 11105b261ecSmrg int drmFD; 11205b261ecSmrg Bool drmOpened; 11305b261ecSmrg Bool sAreaGrabbed; 11405b261ecSmrg drm_handle_t hLSAREA; 11505b261ecSmrg XF86DRILSAREAPtr pLSAREA; 11605b261ecSmrg unsigned long sAreaSize; 11705b261ecSmrg int lockRefCount; 11805b261ecSmrg int lockingContext; 11905b261ecSmrg ScreenPtr resOwner; 12005b261ecSmrg Bool keepFDOpen; 12105b261ecSmrg int refCount; 12205b261ecSmrg} DRIEntPrivRec, *DRIEntPrivPtr; 12305b261ecSmrg 12435c4bbdfSmrg#endif /* DRI_STRUCT_H */ 125