45e9809aff7304721fddb95654901b32195c9c7avboxsync/**************************************************************************
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncAll Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncPermission is hereby granted, free of charge, to any person obtaining a
45e9809aff7304721fddb95654901b32195c9c7avboxsynccopy of this software and associated documentation files (the
45e9809aff7304721fddb95654901b32195c9c7avboxsync"Software"), to deal in the Software without restriction, including
45e9809aff7304721fddb95654901b32195c9c7avboxsyncwithout limitation the rights to use, copy, modify, merge, publish,
45e9809aff7304721fddb95654901b32195c9c7avboxsyncdistribute, sub license, and/or sell copies of the Software, and to
45e9809aff7304721fddb95654901b32195c9c7avboxsyncpermit persons to whom the Software is furnished to do so, subject to
45e9809aff7304721fddb95654901b32195c9c7avboxsyncthe following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncThe above copyright notice and this permission notice (including the
45e9809aff7304721fddb95654901b32195c9c7avboxsyncnext paragraph) shall be included in all copies or substantial portions
45e9809aff7304721fddb95654901b32195c9c7avboxsyncof the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
45e9809aff7304721fddb95654901b32195c9c7avboxsyncOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45e9809aff7304721fddb95654901b32195c9c7avboxsyncMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
45e9809aff7304721fddb95654901b32195c9c7avboxsyncANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
45e9809aff7304721fddb95654901b32195c9c7avboxsyncTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45e9809aff7304721fddb95654901b32195c9c7avboxsyncSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync**************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Authors:
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Jens Owen <jens@tungstengraphics.com>
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef DRI_STRUCT_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DRI_STRUCT_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "xf86drm.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "xf86Crtc.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _DRIDrawablePrivRec
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_drawable_t hwDrawable;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int drawableIndex;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ScreenPtr pScreen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int refCount;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int nrects;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstruct _DRIContextPrivRec
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_context_t hwContext;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ScreenPtr pScreen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool valid3D;
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIContextFlags flags;
45e9809aff7304721fddb95654901b32195c9c7avboxsync void** pContextStore;
45e9809aff7304721fddb95654901b32195c9c7avboxsync};
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIScreenPrivKey))
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DRI_ENT_PRIV(pScrn) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((DRIEntPrivIndex < 0) ? \
45e9809aff7304721fddb95654901b32195c9c7avboxsync NULL: \
45e9809aff7304721fddb95654901b32195c9c7avboxsync ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIEntPrivIndex)->ptr)))
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _DRIScreenPrivRec
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool directRenderingSupport;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int drmFD; /* File descriptor for /dev/video/? */
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
45e9809aff7304721fddb95654901b32195c9c7avboxsync XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_context_t myContext; /* DDX Driver's context */
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
45e9809aff7304721fddb95654901b32195c9c7avboxsync void** hiddenContextStore; /* hidden X context */
45e9809aff7304721fddb95654901b32195c9c7avboxsync void** partial3DContextStore; /* parital 3D context */
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIInfoPtr pDriverInfo;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int nrWindows;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int nrWindowsVisible;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int nrWalked;
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_clip_rect_t private_buffer_rect; /* management of private buffers */
45e9809aff7304721fddb95654901b32195c9c7avboxsync DrawablePtr fullscreen; /* pointer to fullscreen drawable */
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIWrappedFuncsRec wrap;
45e9809aff7304721fddb95654901b32195c9c7avboxsync DestroyWindowProcPtr DestroyWindow;
45e9809aff7304721fddb95654901b32195c9c7avboxsync DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
45e9809aff7304721fddb95654901b32195c9c7avboxsync DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool createDummyCtx;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool createDummyCtxPriv;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool grabbedDRILock;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool drmSIGIOHandlerInstalled;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool wrapped;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool windowsTouched;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int lockRefCount;
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
45e9809aff7304721fddb95654901b32195c9c7avboxsync XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
45e9809aff7304721fddb95654901b32195c9c7avboxsync int* pLockRefCount;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int* pLockingContext;
45e9809aff7304721fddb95654901b32195c9c7avboxsync xf86_crtc_notify_proc_ptr xf86_crtc_notify;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} DRIScreenPrivRec, *DRIScreenPrivPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _DRIEntPrivRec {
45e9809aff7304721fddb95654901b32195c9c7avboxsync int drmFD;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool drmOpened;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool sAreaGrabbed;
45e9809aff7304721fddb95654901b32195c9c7avboxsync drm_handle_t hLSAREA;
45e9809aff7304721fddb95654901b32195c9c7avboxsync XF86DRILSAREAPtr pLSAREA;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned long sAreaSize;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int lockRefCount;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int lockingContext;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ScreenPtr resOwner;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool keepFDOpen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int refCount;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} DRIEntPrivRec, *DRIEntPrivPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* DRI_STRUCT_H */