static struct _tnl_dynfn *makeX86Attribute2fv( GLcontext *ctx, int dest ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Attribute2fv, tnl->vtx.cache.Attribute[2-1], dest ); FIXUP(dfn->code, 0, 0, dest); FIXUP(dfn->code, 0, 1, 4+dest); return dfn; }
static struct dynfn *radeon_makeSSEAttribute3fv( struct dynfn * cache, int key, const char * name, void * dest) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", name, key ); DFN ( _sse_Attribute3fv, (*cache) ); FIXUP(dfn->code, 13, 0x0, (int)dest); FIXUP(dfn->code, 18, 0x8, 8+(int)dest); return dfn; }
struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *ctx, const int *key ) { #if 0 static char temp[] = { 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0x8b, 0x54, 0x24, 0x08, /* mov 0x8(%esp,1),%edx */ 0x2d, 0xc0, 0x84, 0x00, 0x00, /* sub $0x84c0,%eax */ 0x8b, 0x4c, 0x24, 0x0c, /* mov 0xc(%esp,1),%ecx */ 0x83, 0xe0, 0x01, /* and $0x1,%eax */ 0xc1, 0xe0, 0x03, /* shl $0x3,%eax */ 0x89, 0x90, 0, 0, 0, 0, /* mov %edx,DEST(%eax) */ 0x89, 0x88, 0, 0, 0, 0, /* mov %ecx,DEST+8(%eax) */ 0xc3, /* ret */ }; static char temp2[] = { 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0x8b, 0x54, 0x24, 0x08, /* mov 0x8(%esp,1),%edx */ 0x2d, 0xc0, 0x84, 0x00, 0x00, /* sub $0x84c0,%eax */ 0x8b, 0x4c, 0x24, 0x0c, /* mov 0xc(%esp,1),%ecx */ 0x83, 0xe0, 0x01, /* and $0x1,%eax */ 0x8b, 0x04, 0x85, 0, 0, 0, 0, /* mov DEST(,%eax,4),%eax */ 0x89, 0x10, /* mov %edx,(%eax) */ 0x89, 0x48, 0x04, /* mov %ecx,0x4(%eax) */ 0xc3, /* ret */ }; #endif struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] ); if (vb.texcoordptr[1] == vb.texcoordptr[0]+4) { DFN ( _x86_MultiTexCoord2fARB, rmesa->vb.dfn_cache.MultiTexCoord2fARB ); FIXUP(dfn->code, 25, 0xdeadbeef, (int)vb.texcoordptr[0]); FIXUP(dfn->code, 31, 0xdeadbeef, (int)vb.texcoordptr[0]+4); } else { /* Note: this might get generated multiple times, even though the * actual emitted code is the same. */ DFN ( _x86_MultiTexCoord2fARB_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB ); FIXUP(dfn->code, 23, 0x0, (int)vb.texcoordptr); } return dfn; }
void Splitter::onResize(ResizeEvent& ev) { #define FIXUP(x, y, w, h, l, t, r, b) \ do { \ avail = rect.w - this->child_spacing; \ \ pos.x = rect.x; \ pos.y = rect.y; \ switch (m_type) { \ case ByPercentage: \ pos.w = avail*m_pos/100; \ break; \ case ByPixel: \ pos.w = m_pos; \ break; \ } \ \ /* TODO uncomment this to make a restricted splitter */ \ /* pos.w = MID(reqSize1.w, pos.w, avail-reqSize2.w); */ \ pos.h = rect.h; \ \ child1->setBounds(pos); \ gfx::Rect child1Pos = child1->getBounds(); \ \ pos.x = child1Pos.x + child1Pos.w + this->child_spacing; \ pos.y = rect.y; \ pos.w = avail - child1Pos.w; \ pos.h = rect.h; \ \ child2->setBounds(pos); \ } while(0) gfx::Rect rect(ev.getBounds()); gfx::Rect pos(0, 0, 0, 0); int avail; setBoundsQuietly(rect); if (getChildren().size() == 2) { Widget* child1 = getChildren()[0]; Widget* child2 = getChildren()[1]; if (this->getAlign() & JI_HORIZONTAL) FIXUP(x, y, w, h, l, t, r, b); else FIXUP(y, x, h, w, t, l, b, r); } }
struct dynfn *tnl_makeX86Attr3f( TNLcontext *tnl, int key ) { static char temp[] = { 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0x89, 0x02, /* mov %eax,(%edx) */ 0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ 0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ 0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ 0x89, 0x42, 0x08, /* mov %eax,0x8(%edx) */ 0xc3, /* ret */ }; struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); dfn->key = key; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); return dfn; }
static struct dynfn *makeSSENormal3fv( GLcontext *ctx, const int *key ) { /* Requires P4 (sse2?) */ static unsigned char temp[] = { 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $0x12345678,%edx */ 0xf3, 0x0f, 0x7e, 0x00, /* movq (%eax),%xmm0 */ 0x66, 0x0f, 0x6e, 0x48, 0x08, /* movd 0x8(%eax),%xmm1 */ 0x66, 0x0f, 0xd6, 0x42, 0x0c, /* movq %xmm0,0xc(%edx) */ 0x66, 0x0f, 0x7e, 0x4a, 0x14, /* movd %xmm1,0x14(%edx) */ 0xc3, /* ret */ }; struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); insert_at_head( &rmesa->vb.dfn_cache.Normal3fv, dfn ); dfn->key[0] = key[0]; dfn->key[1] = key[1]; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 5, 0x0, (int)vb.normalptr); return dfn; }
struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *ctx, const int *key ) { #if 0 static char temp[] = { 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0x8b, 0x4c, 0x24, 0x08, /* mov 0x8(%esp,1),%ecx */ 0x2d, 0xc0, 0x84, 0x00, 0x00, /* sub $0x84c0,%eax */ 0x83, 0xe0, 0x01, /* and $0x1,%eax */ 0x8b, 0x11, /* mov (%ecx),%edx */ 0xc1, 0xe0, 0x03, /* shl $0x3,%eax */ 0x8b, 0x49, 0x04, /* mov 0x4(%ecx),%ecx */ 0x89, 0x90, 0, 0, 0, 0,/* mov %edx,DEST(%eax) */ 0x89, 0x88, 0, 0, 0, 0,/* mov %ecx,DEST+8(%eax) */ 0xc3, /* ret */ }; static char temp2[] = { 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0x8b, 0x4c, 0x24, 0x08, /* mov 0x8(%esp,1),%ecx */ 0x2d, 0xc0, 0x84, 0x00, 0x00, /* sub $0x84c0,%eax */ 0x83, 0xe0, 0x01, /* and $0x1,%eax */ 0x8b, 0x14, 0x85, 0, 0, 0, 0, /* mov DEST(,%eax,4),%edx */ 0x8b, 0x01, /* mov (%ecx),%eax */ 0x89, 0x02, /* mov %eax,(%edx) */ 0x8b, 0x41, 0x04, /* mov 0x4(%ecx),%eax */ 0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ 0xc3, /* ret */ }; #endif struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] ); if (vb.texcoordptr[1] == vb.texcoordptr[0]+4) { DFN ( _x86_MultiTexCoord2fvARB, rmesa->vb.dfn_cache.MultiTexCoord2fvARB ); FIXUP(dfn->code, 26, 0xdeadbeef, (int)vb.texcoordptr[0]); FIXUP(dfn->code, 32, 0xdeadbeef, (int)vb.texcoordptr[0]+4); } else { DFN ( _x86_MultiTexCoord2fvARB_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB ); FIXUP(dfn->code, 19, 0x0, (int)vb.texcoordptr); } return dfn; }
static struct dynfn *radeon_makeSSEMultiTexCoord2f( GLcontext *ctx, int key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); radeonContextPtr rmesa = RADEON_CONTEXT(ctx); if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) == (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) { DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB ); FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]); } else { DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB ); FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr); } return dfn; }
struct dynfn *r200_makeX86Color4ub( GLcontext *ctx, const int *key ) { if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] ); if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub ); FIXUP(dfn->code, 18, 0x0, (int)vb.colorptr); FIXUP(dfn->code, 24, 0x0, (int)vb.colorptr+1); FIXUP(dfn->code, 30, 0x0, (int)vb.colorptr+2); FIXUP(dfn->code, 36, 0x0, (int)vb.colorptr+3); return dfn; } else return 0; }
struct dynfn *radeon_makeX86Color4ub( GLcontext *ctx, int key ) { if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); if (key & RADEON_CP_VC_FRMT_PKCOLOR) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); radeonContextPtr rmesa = RADEON_CONTEXT(ctx); DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub ); FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr); FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1); FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2); FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3); return dfn; } else return 0; }
/* Install the codegen'ed choosers. * We should keep a list and free them in the end... */ void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], tnl_attrfv_func (*do_choose)( GLuint attr, GLuint sz )) { int attr, size; for (attr = 0; attr < _TNL_MAX_ATTR_CODEGEN; attr++) { for (size = 0; size < 4; size++) { char *code; char *start = (char *)&_tnl_x86_choose_fv; char *end = (char *)&_tnl_x86_choose_fv_end; int offset = 0; code = ALIGN_MALLOC( end - start, 16 ); memcpy (code, start, end - start); FIXUP(code, 0, 0, attr); FIXUP(code, 0, 1, size + 1); FIXUPREL(code, 0, 2, do_choose); choose[attr][size] = (tnl_attrfv_func)code; } } }
struct dynfn *r200_makeX86Normal3f( GLcontext *ctx, const int *key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] ); DFN ( _x86_Normal3f, rmesa->vb.dfn_cache.Normal3f ); FIXUP(dfn->code, 1, 0x12345678, (int)vb.normalptr); return dfn; }
struct dynfn *r200_makeX86Color4ubv( GLcontext *ctx, const int *key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] ); if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) { DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv); FIXUP(dfn->code, 5, 0x12345678, (int)vb.colorptr); return dfn; } else { DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv); FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); FIXUP(dfn->code, 27, 0xdeadbeaf, (int)vb.floatcolorptr); FIXUP(dfn->code, 33, 0xdeadbeaf, (int)vb.floatcolorptr+4); FIXUP(dfn->code, 55, 0xdeadbeaf, (int)vb.floatcolorptr+8); FIXUP(dfn->code, 61, 0xdeadbeaf, (int)vb.floatcolorptr+12); return dfn; } }
static int load_data(const struct vfs_cap_data *filedata, int size) { unsigned int magic; if (m.cap_ver == 1) return -1; // Should never get here but just in case magic = FIXUP(filedata->magic_etc); switch (magic & VFS_CAP_REVISION_MASK) { case VFS_CAP_REVISION_1: m.cap_ver = 1; if (size != XATTR_CAPS_SZ_1) return -1; break; case VFS_CAP_REVISION_2: m.cap_ver = 2; if (size != XATTR_CAPS_SZ_2) return -1; break; default: return -1; } // Now stuff the data structures m.data.v3[0].permitted = FIXUP(filedata->data[0].permitted); m.data.v3[1].permitted = FIXUP(filedata->data[1].permitted); m.data.v3[0].inheritable = FIXUP(filedata->data[0].inheritable); m.data.v3[1].inheritable = FIXUP(filedata->data[1].inheritable); if (magic & VFS_CAP_FLAGS_EFFECTIVE) { m.data.v3[0].effective = m.data.v3[0].permitted | m.data.v3[0].inheritable; m.data.v3[1].effective = m.data.v3[1].permitted | m.data.v3[1].inheritable; } else { m.data.v3[0].effective = 0; m.data.v3[1].effective = 0; } return 0; }
struct dynfn *radeon_makeX86Color4ubv( GLcontext *ctx, int key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); radeonContextPtr rmesa = RADEON_CONTEXT(ctx); if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); if (key & RADEON_CP_VC_FRMT_PKCOLOR) { DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv); FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr); return dfn; } else { DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv); FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr); FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4); FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8); FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12); return dfn; } }
struct dynfn *tnl_makeX86Attr4ubv( TNLcontext *tnl, int key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); insert_at_head( &tnl->dfn_cache.Color4ubv, dfn ); dfn->key = key; if (TNL_DEBUG & DEBUG_CODEGEN) _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); if (key & TNL_CP_VC_FRMT_PKCOLOR) { static char temp[] = { 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ 0x8b, 0x00, /* mov (%eax),%eax */ 0x89, 0x02, /* mov %eax,(%edx) */ 0xc3, /* ret */ }; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 5, 0x12345678, (int)tnl->ubytecolorptr); return dfn; } else { static char temp[] = { 0x53, /* push %ebx */ 0xba, 0x00, 0x00, 0x00, 0x00, /* mov $0x0,%edx */ 0x31, 0xc0, /* xor %eax,%eax */ 0x31, 0xc9, /* xor %ecx,%ecx */ 0x8b, 0x5c, 0x24, 0x08, /* mov 0x8(%esp,1), %ebx */ 0x8b, 0x1b, /* mov (%ebx), %ebx */ 0x88, 0xd8, /* mov %bl, %al */ 0x88, 0xf9, /* mov %bh, %cl */ 0x8b, 0x04, 0x82, /* mov (%edx,%eax,4),%eax */ 0x8b, 0x0c, 0x8a, /* mov (%edx,%ecx,4),%ecx */ 0xa3, 0xaf, 0xbe, 0xad, 0xde, /* mov %eax,0xdeadbeaf */ 0x89, 0x0d, 0xaf, 0xbe, 0xad, 0xde, /* mov %ecx,0xdeadbeaf */ 0x31, 0xc0, /* xor %eax,%eax */ 0x31, 0xc9, /* xor %ecx,%ecx */ 0xc1, 0xeb, 0x10, /* shr $0x10, %ebx */ 0x88, 0xd8, /* mov %bl, %al */ 0x88, 0xf9, /* mov %bh, %cl */ 0x8b, 0x04, 0x82, /* mov (%edx,%eax,4),%eax */ 0x8b, 0x0c, 0x8a, /* mov (%edx,%ecx,4),%ecx */ 0xa3, 0xaf, 0xbe, 0xad, 0xde, /* mov %eax,0xdeadbeaf */ 0x89, 0x0d, 0xaf, 0xbe, 0xad, 0xde, /* mov %ecx,0xdeadbeaf */ 0x5b, /* pop %ebx */ 0xc3, /* ret */ }; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); FIXUP(dfn->code, 27, 0xdeadbeaf, (int)tnl->floatcolorptr); FIXUP(dfn->code, 33, 0xdeadbeaf, (int)tnl->floatcolorptr+4); FIXUP(dfn->code, 55, 0xdeadbeaf, (int)tnl->floatcolorptr+8); FIXUP(dfn->code, 61, 0xdeadbeaf, (int)tnl->floatcolorptr+12); return dfn; } }
struct dynfn *r200_makeX86TexCoord2fv( GLcontext *ctx, const int *key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] ); DFN ( _x86_TexCoord2fv, rmesa->vb.dfn_cache.TexCoord2fv ); FIXUP(dfn->code, 5, 0x12345678, (int)vb.texcoordptr[0]); return dfn; }
struct dynfn *tnl_makeX86Vertex2f( TNLcontext *tnl, int key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (RADEON_DEBUG & DEBUG_CODEGEN) _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); switch (tnl->vertex_size) { default: { /* Repz convenient as it's possible to emit code for any size * vertex with little tweaking. Might as well read vertsize * though, and have only one of these. */ static char temp[] = { 0x57, /* push %edi */ 0x56, /* push %esi */ 0xbe, 0, 0, 0, 0, /* mov $VERTEX+2,%esi */ 0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ 0x8b, 0x44, 0x24, 0x0c, /* mov 0x0c(%esp,1),%eax */ 0x8b, 0x54, 0x24, 0x10, /* mov 0x10(%esp,1),%edx */ 0x89, 0x07, /* mov %eax,(%edi) */ 0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ 0x83, 0xc7, 0x08, /* add $0x8,%edi */ 0xb9, 0, 0, 0, 0, /* mov $VERTSIZE-2,%ecx */ 0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ 0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ 0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ 0x48, /* dec %eax */ 0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ 0x5e, /* pop %esi */ 0x5f, /* pop %edi */ 0x74, 0x01, /* je +1 */ 0xc3, /* ret */ 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ }; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[2]); FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr); FIXUP(dfn->code, 37, 0x0, tnl->vertex_size-2); FIXUP(dfn->code, 44, 0x0, (int)&tnl->counter); FIXUP(dfn->code, 50, 0x0, (int)&tnl->dmaptr); FIXUP(dfn->code, 56, 0x0, (int)&tnl->counter); FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); break; } } insert_at_head( &tnl->dfn_cache.Vertex3f, dfn ); dfn->key = key; return dfn; }
struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *ctx, int key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); radeonContextPtr rmesa = RADEON_CONTEXT(ctx); if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) == (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) { DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB ); FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]); FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4); } else { /* Note: this might get generated multiple times, even though the * actual emitted code is the same. */ DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB ); FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr); } return dfn; }
struct dynfn *tnl_makeX86Attr4ub( TNLcontext *tnl, int key ) { if (TNL_DEBUG & DEBUG_CODEGEN) _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); if (key & TNL_CP_VC_FRMT_PKCOLOR) { /* XXX push/pop */ static char temp[] = { 0x53, /* push %ebx */ 0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ 0x8b, 0x54, 0x24, 0x0c, /* mov 0xc(%esp,1),%edx */ 0x8b, 0x4c, 0x24, 0x10, /* mov 0x10(%esp,1),%ecx */ 0x8b, 0x5c, 0x24, 0x14, /* mov 0x14(%esp,1),%ebx */ 0xa2, 0, 0, 0, 0, /* mov %al,DEST */ 0x88, 0x15, 0, 0, 0, 0, /* mov %dl,DEST+1 */ 0x88, 0x0d, 0, 0, 0, 0, /* mov %cl,DEST+2 */ 0x88, 0x1d, 0, 0, 0, 0, /* mov %bl,DEST+3 */ 0x5b, /* pop %ebx */ 0xc3, /* ret */ }; struct dynfn *dfn = MALLOC_STRUCT( dynfn ); insert_at_head( &tnl->dfn_cache.Color4ub, dfn ); dfn->key = key; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 18, 0x0, (int)tnl->ubytecolorptr); FIXUP(dfn->code, 24, 0x0, (int)tnl->ubytecolorptr+1); FIXUP(dfn->code, 30, 0x0, (int)tnl->ubytecolorptr+2); FIXUP(dfn->code, 36, 0x0, (int)tnl->ubytecolorptr+3); return dfn; } else return 0; }
PUBLIC long bytes_free_in_queue (QUEUE *q) { //returns amount of space available in a queue long ix; FIXUP (q); ix = q->Rear - q->Front; if (ix >= 0) { return (q->End - q->Start) - ix - 1; } else { return -ix - 1; } }
PUBLIC long bytes_in_queue (QUEUE *q) { //returns number of bytes in a queue long ix; FIXUP (q); if (q->Front == q->Rear) { return 0; } if ((ix = (q->Rear - q->Front)) > 0) { return ix; } return (q->End - q->Front) + (q->Rear - q->Start); }
struct dynfn *r200_makeX86Color3f( GLcontext *ctx, const int *key ) { if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB) return 0; else { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); r200ContextPtr rmesa = R200_CONTEXT(ctx); if (R200_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] ); DFN ( _x86_Color3f_3f, rmesa->vb.dfn_cache.Color3f ); FIXUP(dfn->code, 1, 0x12345678, (int)vb.floatcolorptr); return dfn; } }
static struct _tnl_dynfn *makeX86Vertex4fv( GLcontext *ctx, int vertex_size ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Vertex4fv, tnl->vtx.cache.Vertex[4-1], vertex_size ); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 1, vertex_size - 4); FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[4]); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 4, (int)ctx); FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); return dfn; }
struct dynfn *radeon_makeX86Vertex3f( GLcontext *ctx, int key ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size ); switch (rmesa->vb.vertex_size) { case 4: { DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f ); FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]); FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter); FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter); FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify); break; } case 6: { DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f ); FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]); FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]); FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]); FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter); FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter); FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify); break; } default: { DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f ); FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]); FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3); FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter); FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter); FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify); break; } } return dfn; }
struct dynfn *radeon_makeX86Vertex3fv( GLcontext *ctx, int key ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (RADEON_DEBUG & DEBUG_CODEGEN) fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size ); switch (rmesa->vb.vertex_size) { case 6: { DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv ); FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]); FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]); FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]); FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter); FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter); FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify); break; } case 8: { DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv ); FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]); FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]); FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]); FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]); FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]); FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter); FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter); FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify); break; } default: { DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv ); FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3); FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]); FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr); FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter); FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter); FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify); break; } } return dfn; }
struct dynfn *tnl_makeX86Vertex3fv( TNLcontext *tnl, int key ) { struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); switch (tnl->vertex_size) { case 6: { static char temp[] = { 0xa1, 0x00, 0x00, 0, 0, /* mov 0x0,%eax */ 0x8b, 0x4c, 0x24, 0x04, /* mov 0x4(%esp,1),%ecx */ 0x8b, 0x11, /* mov (%ecx),%edx */ 0x89, 0x10, /* mov %edx,(%eax) */ 0x8b, 0x51, 0x04, /* mov 0x4(%ecx),%edx */ 0x8b, 0x49, 0x08, /* mov 0x8(%ecx),%ecx */ 0x89, 0x50, 0x04, /* mov %edx,0x4(%eax) */ 0x89, 0x48, 0x08, /* mov %ecx,0x8(%eax) */ 0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ 0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ 0x89, 0x50, 0x0c, /* mov %edx,0xc(%eax) */ 0x89, 0x48, 0x10, /* mov %ecx,0x10(%eax) */ 0x8b, 0x15, 0x24, 0, 0, 0, /* mov 0x24,%edx */ 0x89, 0x50, 0x14, /* mov %edx,0x14(%eax) */ 0x83, 0xc0, 0x18, /* add $0x18,%eax */ 0xa3, 0x00, 0x00, 0, 0, /* mov %eax,0x0 */ 0xa1, 0x04, 0x00, 0, 0, /* mov 0x4,%eax */ 0x48, /* dec %eax */ 0xa3, 0x04, 0x00, 0, 0, /* mov %eax,0x4 */ 0x74, 0x01, /* je 2a4 <.f11> */ 0xc3, /* ret */ 0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */ }; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr); FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]); FIXUP(dfn->code, 33, 0x00000020, (int)&tnl->vertex[4]); FIXUP(dfn->code, 45, 0x00000024, (int)&tnl->vertex[5]); FIXUP(dfn->code, 56, 0x00000000, (int)&tnl->dmaptr); FIXUP(dfn->code, 61, 0x00000004, (int)&tnl->counter); FIXUP(dfn->code, 67, 0x00000004, (int)&tnl->counter); FIXUP(dfn->code, 76, 0x00000008, (int)&tnl->notify); break; } case 8: { static char temp[] = { 0xa1, 0x00, 0x00, 0, 0, /* mov 0x0,%eax */ 0x8b, 0x4c, 0x24, 0x04, /* mov 0x4(%esp,1),%ecx */ 0x8b, 0x11, /* mov (%ecx),%edx */ 0x89, 0x10, /* mov %edx,(%eax) */ 0x8b, 0x51, 0x04, /* mov 0x4(%ecx),%edx */ 0x8b, 0x49, 0x08, /* mov 0x8(%ecx),%ecx */ 0x89, 0x50, 0x04, /* mov %edx,0x4(%eax) */ 0x89, 0x48, 0x08, /* mov %ecx,0x8(%eax) */ 0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ 0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ 0x89, 0x50, 0x0c, /* mov %edx,0xc(%eax) */ 0x89, 0x48, 0x10, /* mov %ecx,0x10(%eax) */ 0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ 0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ 0x89, 0x50, 0x14, /* mov %edx,0x14(%eax) */ 0x89, 0x48, 0x18, /* mov %ecx,0x18(%eax) */ 0x8b, 0x15, 0x24, 0, 0, 0, /* mov 0x24,%edx */ 0x89, 0x50, 0x1c, /* mov %edx,0x1c(%eax) */ 0x83, 0xc0, 0x20, /* add $0x20,%eax */ 0xa3, 0x00, 0x00, 0, 0, /* mov %eax,0x0 */ 0xa1, 0x04, 0x00, 0, 0, /* mov 0x4,%eax */ 0x48, /* dec %eax */ 0xa3, 0x04, 0x00, 0, 0, /* mov %eax,0x4 */ 0x74, 0x01, /* je 2a4 <.f11> */ 0xc3, /* ret */ 0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */ }; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr); FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]); FIXUP(dfn->code, 33, 0x00000020, (int)&tnl->vertex[4]); FIXUP(dfn->code, 45, 0x0000001c, (int)&tnl->vertex[5]); FIXUP(dfn->code, 51, 0x00000020, (int)&tnl->vertex[6]); FIXUP(dfn->code, 63, 0x00000024, (int)&tnl->vertex[7]); FIXUP(dfn->code, 74, 0x00000000, (int)&tnl->dmaptr); FIXUP(dfn->code, 79, 0x00000004, (int)&tnl->counter); FIXUP(dfn->code, 85, 0x00000004, (int)&tnl->counter); FIXUP(dfn->code, 94, 0x00000008, (int)&tnl->notify); break; } default: { /* Repz convenient as it's possible to emit code for any size * vertex with little tweaking. Might as well read vertsize * though, and have only one of these. */ static char temp[] = { 0x8b, 0x54, 0x24, 0x04, /* mov 0x4(%esp,1),%edx */ 0x57, /* push %edi */ 0x56, /* push %esi */ 0x8b, 0x3d, 1,1,1,1, /* mov DMAPTR,%edi */ 0x8b, 0x02, /* mov (%edx),%eax */ 0x8b, 0x4a, 0x04, /* mov 0x4(%edx),%ecx */ 0x8b, 0x72, 0x08, /* mov 0x8(%edx),%esi */ 0x89, 0x07, /* mov %eax,(%edi) */ 0x89, 0x4f, 0x04, /* mov %ecx,0x4(%edi) */ 0x89, 0x77, 0x08, /* mov %esi,0x8(%edi) */ 0x83, 0xc7, 0x0c, /* add $0xc,%edi */ 0xb9, 0x06, 0x00, 0x00, 0x00, /* mov $VERTSIZE-3,%ecx */ 0xbe, 0x58, 0x00, 0x00, 0x00, /* mov $VERTEX[3],%esi */ 0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ 0x89, 0x3d, 1, 1, 1, 1, /* mov %edi,DMAPTR */ 0xa1, 2, 2, 2, 2, /* mov COUNTER,%eax */ 0x5e, /* pop %esi */ 0x5f, /* pop %edi */ 0x48, /* dec %eax */ 0xa3, 2, 2, 2, 2, /* mov %eax,COUNTER */ 0x74, 0x01, /* je +1 */ 0xc3, /* ret */ 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ }; dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); memcpy (dfn->code, temp, sizeof(temp)); FIXUP(dfn->code, 8, 0x01010101, (int)&tnl->dmaptr); FIXUP(dfn->code, 32, 0x00000006, tnl->vertex_size-3); FIXUP(dfn->code, 37, 0x00000058, (int)&tnl->vertex[3]); FIXUP(dfn->code, 45, 0x01010101, (int)&tnl->dmaptr); FIXUP(dfn->code, 50, 0x02020202, (int)&tnl->counter); FIXUP(dfn->code, 58, 0x02020202, (int)&tnl->counter); FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); break; } } insert_at_head( &tnl->dfn_cache.Vertex3fv, dfn ); dfn->key = key; return dfn; }