00001 /************************************************************************** 00002 * 00003 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 00004 * All Rights Reserved. 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a 00007 * copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sub license, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice (including the 00015 * next paragraph) shall be included in all copies or substantial portions 00016 * of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00019 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 00021 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 00022 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00023 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00024 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00025 * 00026 **************************************************************************/ 00027 00028 #ifndef INTEL_CONTEXT_H 00029 #define INTEL_CONTEXT_H 00030 00031 #include <stdint.h> 00032 #include "drm.h" 00033 00034 #include "pipe/p_debug.h" 00035 00036 #include "intel_screen.h" 00037 #include "i915_drm.h" 00038 00039 #include "intel_be_context.h" 00040 00041 00042 struct pipe_context; 00043 struct intel_context; 00044 struct _DriBufferObject; 00045 struct st_context; 00046 00047 00048 #define INTEL_MAX_FIXUP 64 00049 00053 struct intel_context 00054 { 00055 struct intel_be_context base; 00056 struct st_context *st; 00057 00058 struct _DriFenceObject *last_swap_fence; 00059 struct _DriFenceObject *first_swap_fence; 00060 00061 // struct intel_batchbuffer *batch; 00062 00063 boolean locked; 00064 char *prevLockFile; 00065 int prevLockLine; 00066 00067 uint irqsEmitted; 00068 drm_i915_irq_wait_t iw; 00069 00070 drm_context_t hHWContext; 00071 drmLock *driHwLock; 00072 int driFd; 00073 00074 __DRIdrawablePrivate *driDrawable; 00075 __DRIscreenPrivate *driScreen; 00076 struct intel_screen *intelScreen; 00077 drmI830Sarea *sarea; 00078 00079 uint lastStamp; 00080 00084 driOptionCache optionCache; 00085 }; 00086 00087 00088 00092 struct intel_framebuffer 00093 { 00094 struct st_framebuffer *stfb; 00095 00096 /* other fields TBD */ 00097 int other; 00098 }; 00099 00100 00101 00102 00103 /* These are functions now: 00104 */ 00105 void LOCK_HARDWARE( struct intel_context *intel ); 00106 void UNLOCK_HARDWARE( struct intel_context *intel ); 00107 00108 extern char *__progname; 00109 00110 00111 00112 /* ================================================================ 00113 * Debugging: 00114 */ 00115 #ifdef DEBUG 00116 extern int __intel_debug; 00117 00118 #define DEBUG_SWAP 0x1 00119 #define DEBUG_LOCK 0x2 00120 #define DEBUG_IOCTL 0x4 00121 #define DEBUG_BATCH 0x8 00122 00123 #define DBG(flag, ...) do { \ 00124 if (__intel_debug & (DEBUG_##flag)) \ 00125 printf(__VA_ARGS__); \ 00126 } while(0) 00127 00128 #else 00129 #define DBG(flag, ...) 00130 #endif 00131 00132 00133 00134 #define PCI_CHIP_845_G 0x2562 00135 #define PCI_CHIP_I830_M 0x3577 00136 #define PCI_CHIP_I855_GM 0x3582 00137 #define PCI_CHIP_I865_G 0x2572 00138 #define PCI_CHIP_I915_G 0x2582 00139 #define PCI_CHIP_I915_GM 0x2592 00140 #define PCI_CHIP_I945_G 0x2772 00141 #define PCI_CHIP_I945_GM 0x27A2 00142 #define PCI_CHIP_I945_GME 0x27AE 00143 #define PCI_CHIP_G33_G 0x29C2 00144 #define PCI_CHIP_Q35_G 0x29B2 00145 #define PCI_CHIP_Q33_G 0x29D2 00146 00147 00149 static INLINE struct intel_context * 00150 intel_context(__DRIcontextPrivate *driContextPriv) 00151 { 00152 return (struct intel_context *) driContextPriv->driverPrivate; 00153 } 00154 00155 00157 static INLINE struct intel_framebuffer * 00158 intel_framebuffer(__DRIdrawablePrivate * driDrawPriv) 00159 { 00160 return (struct intel_framebuffer *) driDrawPriv->driverPrivate; 00161 } 00162 00163 00164 #endif