00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00036 #ifndef BRW_WINSYS_H
00037 #define BRW_WINSYS_H
00038
00039
00040 #include "pipe/p_defines.h"
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 struct pipe_buffer;
00054 struct pipe_fence_handle;
00055 struct pipe_winsys;
00056 struct pipe_screen;
00057
00058
00059
00060
00061 #define PCI_CHIP_I965_G 0x29A2
00062 #define PCI_CHIP_I965_Q 0x2992
00063 #define PCI_CHIP_I965_G_1 0x2982
00064 #define PCI_CHIP_I965_GM 0x2A02
00065 #define PCI_CHIP_I965_GME 0x2A12
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 enum brw_cache_id {
00078 BRW_CC_VP,
00079 BRW_CC_UNIT,
00080 BRW_WM_PROG,
00081 BRW_SAMPLER_DEFAULT_COLOR,
00082 BRW_SAMPLER,
00083 BRW_WM_UNIT,
00084 BRW_SF_PROG,
00085 BRW_SF_VP,
00086 BRW_SF_UNIT,
00087 BRW_VS_UNIT,
00088 BRW_VS_PROG,
00089 BRW_GS_UNIT,
00090 BRW_GS_PROG,
00091 BRW_CLIP_VP,
00092 BRW_CLIP_UNIT,
00093 BRW_CLIP_PROG,
00094 BRW_SS_SURFACE,
00095 BRW_SS_SURF_BIND,
00096
00097 BRW_MAX_CACHE
00098 };
00099
00100 #define BRW_CONSTANT_BUFFER BRW_MAX_CACHE
00101
00113 struct brw_winsys {
00114
00115 void (*destroy)(struct brw_winsys *);
00116
00125 unsigned *(*batch_start)(struct brw_winsys *sws,
00126 unsigned dwords,
00127 unsigned relocs);
00128
00129 void (*batch_dword)(struct brw_winsys *sws,
00130 unsigned dword);
00131
00142 void (*batch_reloc)(struct brw_winsys *sws,
00143 struct pipe_buffer *buf,
00144 unsigned access_flags,
00145 unsigned delta);
00146
00147
00148
00149
00150 void (*batch_end)( struct brw_winsys *sws );
00151
00158 void (*batch_flush)(struct brw_winsys *sws,
00159 struct pipe_fence_handle **fence);
00160
00161
00162
00163
00164
00165 void (*buffer_subdata_typed)(struct brw_winsys *sws,
00166 struct pipe_buffer *buf,
00167 unsigned long offset,
00168 unsigned long size,
00169 const void *data,
00170 unsigned data_type);
00171
00172
00173
00174
00175
00176 unsigned (*get_buffer_offset)( struct brw_winsys *sws,
00177 struct pipe_buffer *buf,
00178 unsigned flags );
00179
00180 };
00181
00182 #define BRW_BUFFER_ACCESS_WRITE 0x1
00183 #define BRW_BUFFER_ACCESS_READ 0x2
00184
00185 #define BRW_BUFFER_USAGE_LIT_VERTEX (PIPE_BUFFER_USAGE_CUSTOM << 0)
00186
00187
00188 struct pipe_context *brw_create(struct pipe_screen *,
00189 struct brw_winsys *,
00190 unsigned pci_id);
00191
00192 static inline boolean brw_batchbuffer_data(struct brw_winsys *winsys,
00193 const void *data,
00194 unsigned bytes)
00195 {
00196 static const unsigned incr = sizeof(unsigned);
00197 uint i;
00198 const unsigned *udata = (const unsigned*)(data);
00199 unsigned size = bytes/incr;
00200
00201 winsys->batch_start(winsys, size, 0);
00202 for (i = 0; i < size; ++i) {
00203 winsys->batch_dword(winsys, udata[i]);
00204 }
00205 winsys->batch_end(winsys);
00206
00207 return (i == size);
00208 }
00209 #endif