diff options
author | Zou Nan hai <nanhai.zou@intel.com> | 2007-07-04 10:52:35 +0800 |
---|---|---|
committer | Zou Nan hai <nanhai.zou@intel.com> | 2007-07-04 10:52:35 +0800 |
commit | fb9ee9b323bff93973a39560b2bc007aace4bddd (patch) | |
tree | 05e1e72e8f4d321cde2c48b8518e6d9736c680dd /src/mesa/drivers/dri/r300/r300_emit.h | |
parent | 285b326c606e9b2f90e4fe177b15b3fa23239b86 (diff) | |
parent | 7ff4359a3be1278b26950f96ab23014a667af838 (diff) |
Merge branch 'master' of git+ssh://znh@git.freedesktop.org/git/mesa/mesa into 965-glsl
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_emit.h')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_emit.h | 125 |
1 files changed, 36 insertions, 89 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index 1101a3545a..a6d69ec5ff 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -44,26 +44,13 @@ #include "r300_cmdbuf.h" #include "radeon_reg.h" -/* - * CP type-3 packets - */ -#define RADEON_CP_PACKET3_UNK1B 0xC0001B00 -#define RADEON_CP_PACKET3_INDX_BUFFER 0xC0003300 -#define RADEON_CP_PACKET3_3D_DRAW_VBUF_2 0xC0003400 -#define RADEON_CP_PACKET3_3D_DRAW_IMMD_2 0xC0003500 -#define RADEON_CP_PACKET3_3D_DRAW_INDX_2 0xC0003600 -#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00 -#define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xC0003202 -#define RADEON_CP_PACKET3_3D_CLEAR_CMASK 0xC0003802 -#define RADEON_CP_PACKET3_3D_CLEAR_HIZ 0xC0003702 - +/* TODO: move these defines (and the ones from DRM) into r300_reg.h and sync up + * with DRM */ #define CP_PACKET0(reg, n) (RADEON_CP_PACKET0 | ((n)<<16) | ((reg)>>2)) +#define CP_PACKET3( pkt, n ) \ + (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) -void static inline check_space(int dwords) -{ -} - -static __inline__ uint32_t cmdpacket0(int reg, int count) +static inline uint32_t cmdpacket0(int reg, int count) { drm_r300_cmd_header_t cmd; @@ -75,7 +62,7 @@ static __inline__ uint32_t cmdpacket0(int reg, int count) return cmd.u; } -static __inline__ uint32_t cmdvpu(int addr, int count) +static inline uint32_t cmdvpu(int addr, int count) { drm_r300_cmd_header_t cmd; @@ -87,7 +74,7 @@ static __inline__ uint32_t cmdvpu(int addr, int count) return cmd.u; } -static __inline__ uint32_t cmdpacket3(int packet) +static inline uint32_t cmdpacket3(int packet) { drm_r300_cmd_header_t cmd; @@ -97,7 +84,7 @@ static __inline__ uint32_t cmdpacket3(int packet) return cmd.u; } -static __inline__ uint32_t cmdcpdelay(unsigned short count) +static inline uint32_t cmdcpdelay(unsigned short count) { drm_r300_cmd_header_t cmd; @@ -107,7 +94,7 @@ static __inline__ uint32_t cmdcpdelay(unsigned short count) return cmd.u; } -static __inline__ uint32_t cmdwait(unsigned char flags) +static inline uint32_t cmdwait(unsigned char flags) { drm_r300_cmd_header_t cmd; @@ -117,7 +104,7 @@ static __inline__ uint32_t cmdwait(unsigned char flags) return cmd.u; } -static __inline__ uint32_t cmdpacify(void) +static inline uint32_t cmdpacify(void) { drm_r300_cmd_header_t cmd; @@ -138,7 +125,7 @@ static __inline__ uint32_t cmdpacify(void) cmd = (drm_radeon_cmd_header_t*) \ r300AllocCmdBuf(rmesa, \ (_n+2), \ - __func__); \ + __FUNCTION__); \ cmd_reserved=_n+2; \ cmd_written=1; \ cmd[0].i=cmdpacket0((reg), _n+1); \ @@ -160,9 +147,9 @@ static __inline__ uint32_t cmdpacify(void) "cmd_written=%d cmd_reserved=%d\n", \ __FILE__, __FUNCTION__, __LINE__, \ cmd_written, cmd_reserved); \ - exit(-1); \ + _mesa_exit(-1); \ } \ - } while(0); + } while(0) #define efloat(f) e32(r300PackFloat32(f)) @@ -173,7 +160,7 @@ static __inline__ uint32_t cmdpacify(void) cmd = (drm_radeon_cmd_header_t*) \ r300AllocCmdBuf(rmesa, \ (_n+1), \ - __func__); \ + __FUNCTION__); \ cmd_reserved = _n+2; \ cmd_written =1; \ cmd[0].i = cmdvpu((dest), _n/4); \ @@ -188,14 +175,14 @@ static __inline__ uint32_t cmdpacify(void) cmd = (drm_radeon_cmd_header_t*) \ r300AllocCmdBuf(rmesa, \ (_n+3), \ - __func__); \ + __FUNCTION__); \ cmd_reserved = _n+3; \ cmd_written = 2; \ if(_n > 0x3fff) { \ fprintf(stderr,"Too big packet3 %08x: cannot " \ "store %d dwords\n", \ _p, _n); \ - exit(-1); \ + _mesa_exit(-1); \ } \ cmd[0].i = cmdpacket3(R300_CMD_PACKET3_RAW); \ cmd[1].i = _p | ((_n & 0x3fff)<<16); \ @@ -208,85 +195,45 @@ void static inline end_3d(r300ContextPtr rmesa) { drm_radeon_cmd_header_t *cmd = NULL; - cmd = (drm_radeon_cmd_header_t*)r300AllocCmdBuf(rmesa, - 1, - __FUNCTION__); - cmd[0].header.cmd_type=R300_CMD_END3D; + cmd = + (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__); + cmd[0].header.cmd_type = R300_CMD_END3D; } void static inline cp_delay(r300ContextPtr rmesa, unsigned short count) { drm_radeon_cmd_header_t *cmd = NULL; - cmd = (drm_radeon_cmd_header_t*)r300AllocCmdBuf(rmesa, - 1, - __FUNCTION__); - cmd[0].i=cmdcpdelay(count); + cmd = + (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__); + cmd[0].i = cmdcpdelay(count); } void static inline cp_wait(r300ContextPtr rmesa, unsigned char flags) { drm_radeon_cmd_header_t *cmd = NULL; - cmd = (drm_radeon_cmd_header_t*)r300AllocCmdBuf(rmesa, - 1, - __FUNCTION__); + cmd = + (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 1, __FUNCTION__); cmd[0].i = cmdwait(flags); } -/** - * fire vertex buffer - */ -static void inline fire_AOS(r300ContextPtr rmesa, int vertex_count, int type) -{ - int cmd_reserved = 0; - int cmd_written = 0; - drm_radeon_cmd_header_t *cmd = NULL; - check_space(9); +extern int r300EmitArrays(GLcontext * ctx); - start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0); -#ifdef NOTNEEDED_ANYMORE - e32(0x840c0024); +#ifdef USER_BUFFERS +void r300UseArrays(GLcontext * ctx); #endif - e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | - (vertex_count<<16) | type); -} -/** - * These are followed by the corresponding data - */ -#define start_index32_packet(vertex_count, type) \ - do { \ - int _vc; \ - _vc = (vertex_count); \ - start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _vc); \ - e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) | \ - type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); \ - } while (0); +extern void r300ReleaseArrays(GLcontext * ctx); +extern int r300PrimitiveType(r300ContextPtr rmesa, int prim); +extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim); -#define start_index16_packet(vertex_count, type) \ - do { \ - int _vc, _n; \ - _vc = (vertex_count); \ - _n = (vertex_count+1)>>1; \ - start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _n); \ - e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) | \ - type); \ - } while (0); +extern void r300EmitCacheFlush(r300ContextPtr rmesa); -/** - * Interestingly enough this ones needs the call to setup_AOS, even thought - * some of the data so setup is not needed and some is not as arbitrary - * as when used by DRAW_VBUF_2 or DRAW_INDX_2 - */ -#define start_immediate_packet(vertex_count, type, vertex_size) \ - do { \ - int _vc; \ - _vc = (vertex_count); \ - start_packet3(RADEON_CP_PACKET3_3D_DRAW_IMMD_2, \ - _vc*(vertex_size)); \ - e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED | \ - (_vc<<16) | type); \ - } while (0); +extern GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr); +extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); +extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); +extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten); +extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten); #endif |