1706f2543Smrg/************************************************************************** 2706f2543Smrg 3706f2543SmrgCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. 4706f2543SmrgAll Rights Reserved. 5706f2543Smrg 6706f2543SmrgPermission is hereby granted, free of charge, to any person obtaining a 7706f2543Smrgcopy of this software and associated documentation files (the 8706f2543Smrg"Software"), to deal in the Software without restriction, including 9706f2543Smrgwithout limitation the rights to use, copy, modify, merge, publish, 10706f2543Smrgdistribute, sub license, and/or sell copies of the Software, and to 11706f2543Smrgpermit persons to whom the Software is furnished to do so, subject to 12706f2543Smrgthe following conditions: 13706f2543Smrg 14706f2543SmrgThe above copyright notice and this permission notice (including the 15706f2543Smrgnext paragraph) shall be included in all copies or substantial portions 16706f2543Smrgof the Software. 17706f2543Smrg 18706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19706f2543SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20706f2543SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21706f2543SmrgIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 22706f2543SmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23706f2543SmrgTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24706f2543SmrgSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25706f2543Smrg 26706f2543Smrg**************************************************************************/ 27706f2543Smrg 28706f2543Smrg/* 29706f2543Smrg * Authors: 30706f2543Smrg * Jens Owen <jens@tungstengraphics.com> 31706f2543Smrg * 32706f2543Smrg */ 33706f2543Smrg 34706f2543Smrg#ifndef DRI_STRUCT_H 35706f2543Smrg#define DRI_STRUCT_H 36706f2543Smrg 37706f2543Smrg#include "xf86drm.h" 38706f2543Smrg#include "xf86Crtc.h" 39706f2543Smrg 40706f2543Smrg 41706f2543Smrg#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ 42706f2543Smrg dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey)) 43706f2543Smrg#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ 44706f2543Smrg dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey)) 45706f2543Smrg 46706f2543Smrgtypedef struct _DRIDrawablePrivRec 47706f2543Smrg{ 48706f2543Smrg drm_drawable_t hwDrawable; 49706f2543Smrg int drawableIndex; 50706f2543Smrg ScreenPtr pScreen; 51706f2543Smrg int refCount; 52706f2543Smrg int nrects; 53706f2543Smrg} DRIDrawablePrivRec, *DRIDrawablePrivPtr; 54706f2543Smrg 55706f2543Smrgstruct _DRIContextPrivRec 56706f2543Smrg{ 57706f2543Smrg drm_context_t hwContext; 58706f2543Smrg ScreenPtr pScreen; 59706f2543Smrg Bool valid3D; 60706f2543Smrg DRIContextFlags flags; 61706f2543Smrg void** pContextStore; 62706f2543Smrg}; 63706f2543Smrg 64706f2543Smrg#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ 65706f2543Smrg (dixPrivateKeyRegistered(DRIScreenPrivKey) ? \ 66706f2543Smrg dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL)) 67706f2543Smrg 68706f2543Smrg#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ 69706f2543Smrg dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \ 70706f2543Smrg DRIScreenPrivKey)) 71706f2543Smrg 72706f2543Smrg#define DRI_ENT_PRIV(pScrn) \ 73706f2543Smrg ((DRIEntPrivIndex < 0) ? \ 74706f2543Smrg NULL: \ 75706f2543Smrg ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \ 76706f2543Smrg DRIEntPrivIndex)->ptr))) 77706f2543Smrg 78706f2543Smrgtypedef struct _DRIScreenPrivRec 79706f2543Smrg{ 80706f2543Smrg Bool directRenderingSupport; 81706f2543Smrg int drmFD; /* File descriptor for /dev/video/? */ 82706f2543Smrg drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ 83706f2543Smrg XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ 84706f2543Smrg drm_context_t myContext; /* DDX Driver's context */ 85706f2543Smrg DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */ 86706f2543Smrg DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ 87706f2543Smrg void** hiddenContextStore; /* hidden X context */ 88706f2543Smrg void** partial3DContextStore; /* parital 3D context */ 89706f2543Smrg DRIInfoPtr pDriverInfo; 90706f2543Smrg int nrWindows; 91706f2543Smrg int nrWindowsVisible; 92706f2543Smrg int nrWalked; 93706f2543Smrg drm_clip_rect_t private_buffer_rect; /* management of private buffers */ 94706f2543Smrg DrawablePtr fullscreen; /* pointer to fullscreen drawable */ 95706f2543Smrg drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ 96706f2543Smrg DRIWrappedFuncsRec wrap; 97706f2543Smrg DestroyWindowProcPtr DestroyWindow; 98706f2543Smrg DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; 99706f2543Smrg DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ 100706f2543Smrg Bool createDummyCtx; 101706f2543Smrg Bool createDummyCtxPriv; 102706f2543Smrg Bool grabbedDRILock; 103706f2543Smrg Bool drmSIGIOHandlerInstalled; 104706f2543Smrg Bool wrapped; 105706f2543Smrg Bool windowsTouched; 106706f2543Smrg int lockRefCount; 107706f2543Smrg drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */ 108706f2543Smrg XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */ 109706f2543Smrg int* pLockRefCount; 110706f2543Smrg int* pLockingContext; 111706f2543Smrg xf86_crtc_notify_proc_ptr xf86_crtc_notify; 112706f2543Smrg} DRIScreenPrivRec, *DRIScreenPrivPtr; 113706f2543Smrg 114706f2543Smrg 115706f2543Smrgtypedef struct _DRIEntPrivRec { 116706f2543Smrg int drmFD; 117706f2543Smrg Bool drmOpened; 118706f2543Smrg Bool sAreaGrabbed; 119706f2543Smrg drm_handle_t hLSAREA; 120706f2543Smrg XF86DRILSAREAPtr pLSAREA; 121706f2543Smrg unsigned long sAreaSize; 122706f2543Smrg int lockRefCount; 123706f2543Smrg int lockingContext; 124706f2543Smrg ScreenPtr resOwner; 125706f2543Smrg Bool keepFDOpen; 126706f2543Smrg int refCount; 127706f2543Smrg} DRIEntPrivRec, *DRIEntPrivPtr; 128706f2543Smrg 129706f2543Smrg#endif /* DRI_STRUCT_H */ 130