diff -ruN xc/xc/config/cf/host.def xc-sis-0-1/xc/config/cf/host.def --- xc/xc/config/cf/host.def Tue Aug 5 21:57:04 2003 +++ xc-sis-0-1/xc/config/cf/host.def Tue Aug 5 21:55:09 2003 @@ -32,7 +32,7 @@ #else #define XF86CardDrivers tdfx i810 mga ati glint vga -#define DriDrivers r200 tdfx mga i810 r128 radeon gamma i830 ffb /* sis */ +#define DriDrivers r200 tdfx mga i810 r128 radeon gamma i830 ffb sis #endif diff -ruN xc/xc/extras/Mesa/include/GL/glxext.h xc-sis-0-1/xc/extras/Mesa/include/GL/glxext.h --- xc/xc/extras/Mesa/include/GL/glxext.h Tue Aug 5 21:57:15 2003 +++ xc-sis-0-1/xc/extras/Mesa/include/GL/glxext.h Tue Aug 5 21:55:21 2003 @@ -597,7 +597,7 @@ #define GLX_OML_swap_method 1 #endif -#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(_STDINT_H) || defined(_SYS_INTTYPES_H_) +#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(_STDINT_H) || defined(_SYS_INTTYPES_H_) || 1 /* Include ISO C99 integer types for OML_sync_control; need a better test */ #include diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc --- xc/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/Imakefile.inc Tue Aug 5 21:55:46 2003 @@ -17,14 +17,16 @@ #if BuildXF86DRI DRI_DEFINES = GlxDefines $(SIS_DEFINES) - DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ - -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ - -I$(GLXLIBSRC)/mesa/dri \ + DRI_INCLUDES = -I$(GLXLIBSRC)/dri \ + -I$(GLXLIBSRC)/glx \ + -I$(INCLUDESRC) \ + -I$(INCLUDESRC)/GL \ -I$(SERVERSRC)/GL/dri \ -I$(XF86OSSRC) \ -I$(XF86DRIVERSRC)/sis \ + -I$(XF86COMSRC) \ -I$(GLXLIBSRC)/dri/drm \ - -I$(GLXLIBSRC)/mesa/src/X + -I$(GLXLIBSRC)/include #endif MESA_INCLUDES = -I$(MESASRCDIR)/src -I$(MESASRCDIR)/include \ diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_alloc.c Tue Aug 5 21:55:46 2003 @@ -37,15 +37,7 @@ #include "sis_ctx.h" #include "sis_mesa.h" -#if defined(XFree86Server) && !defined(XF86DRI) -# include "xf86fbman.h" -#else -# define CONFIG_DRM_SIS -# include "drm.h" -# undef CONFIG_DRM_SIS -# include "sis_drm.h" -# include -#endif +#include "sis_common.h" #define Z_BUFFER_HW_ALIGNMENT 16 #define Z_BUFFER_HW_PLUS (16 + 4) @@ -67,42 +59,6 @@ #endif #define ALIGNMENT(value, align) (ROUNDUP((value),(align))*(align)) -#if defined(XFree86Server) && !defined(XF86DRI) - -static void * -sis_alloc_fb (__GLSiScontext * hwcx, GLuint size, void **free) -{ - GLcontext *ctx = hwcx->gc; - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - - ScreenPtr pScreen = xmesa->display; - - GLuint offset; - BoxPtr pBox; - - size = ROUNDUP (size, GET_DEPTH (hwcx)); - *free = xf86AllocateLinearOffscreenArea (pScreen, size, 1, - NULL, NULL, NULL); - - if (!*free) - return NULL; - - pBox = &((FBAreaPtr) (*free))->box; - offset = pBox->y1 * GET_PITCH (hwcx) + pBox->x1 * GET_DEPTH (hwcx); - - return GET_FbBase (hwcx) + offset; -} - -static void -sis_free_fb (int hHWContext, void *free) -{ - xf86FreeOffscreenArea ((FBAreaPtr) free); -} - -#else - -int gDRMSubFD = -1; - /* debug */ #if 1 @@ -110,9 +66,9 @@ static int _total_video_memory_count = 0; static void * -sis_alloc_fb (__GLSiScontext * hwcx, GLuint size, void **free) +sis_alloc_fb (sisContextPtr smesa, GLuint size, void **free) { - GLcontext *ctx = hwcx->gc; + GLcontext *ctx = smesa->gc; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; drm_sis_mem_t fb; @@ -121,21 +77,24 @@ fb.context = xmesa->driContextPriv->hHWContext; fb.size = size; - if(ioctl(hwcx->drmSubFD, SIS_IOCTL_FB_ALLOC, &fb) || !fb.offset) + if (drmCommandWriteRead( smesa->drmSubFD, DRM_SIS_FB_ALLOC, &fb, + sizeof(drm_sis_mem_t) ) || fb.offset == NULL) + { return NULL; + } *free = (void *)fb.free; /* debug */ - /* memset(fb.offset + GET_FbBase(hwcx), 0xff, size); */ + /* memset(fb.offset + GET_FbBase(smesa), 0xff, size); */ if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) { - fprintf(stderr, "sis_alloc_fb: size=%u, offset=%lu, pid=%lu, count=%d\n", - size, (DWORD)fb.offset, (DWORD)getpid(), + fprintf(stderr, "sis_alloc_fb: size=%d, offset=%lu, pid=%d, count=%d\n", + size, fb.offset, (GLint)getpid(), ++_total_video_memory_count); } - return (void *)(fb.offset + GET_FbBase(hwcx)); + return (void *)(fb.offset + GET_FbBase(smesa)); } static void @@ -145,19 +104,19 @@ if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) { - fprintf(stderr, "sis_free_fb: free=%lu, pid=%lu, count=%d\n", - (DWORD)free, (DWORD)getpid(), --_total_video_memory_count); + fprintf(stderr, "sis_free_fb: free=%p, pid=%d, count=%d\n", + free, (GLint)getpid(), --_total_video_memory_count); } fb.context = hHWContext; - fb.free = (unsigned long)free; - ioctl(gDRMSubFD, SIS_IOCTL_FB_FREE, &fb); + fb.free = free; + drmCommandWrite( gDRMSubFD, DRM_SIS_FB_FREE, &fb, sizeof(drm_sis_mem_t) ); } #else static void * -sis_alloc_fb (__GLSiScontext * hwcx, GLuint size, void **free) +sis_alloc_fb (sisContextPtr smesa, GLuint size, void **free) { static char *vidmem_base = 0x400000; char *rval = vidmem_base; @@ -166,9 +125,9 @@ if(vidmem_base >= 31*0x100000) return NULL; - *free = rval + (DWORD)hwcx->FbBase; + *free = rval + (GLint)smesa->FbBase; - return rval + (DWORD)hwcx->FbBase; + return rval + (GLint)smesa->FbBase; } static void @@ -179,33 +138,34 @@ #endif -#endif - static void * -sis_alloc_agp (__GLSiScontext * hwcx, GLuint size, void **free) +sis_alloc_agp (sisContextPtr smesa, GLuint size, void **free) { - GLcontext *ctx = hwcx->gc; + GLcontext *ctx = smesa->gc; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; drm_sis_mem_t agp; - if(!hwcx->AGPSize) + if(!smesa->AGPSize) return NULL; agp.context = xmesa->driContextPriv->hHWContext; agp.size = size; - if(ioctl(hwcx->drmSubFD, SIS_IOCTL_AGP_ALLOC, &agp) || !agp.offset) + if (drmCommandWriteRead( smesa->drmSubFD, DRM_SIS_AGP_ALLOC, &agp, + sizeof(drm_sis_mem_t) ) || !agp.offset) + { return NULL; + } *free = (void *)agp.free; if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) { - fprintf(stderr, "sis_alloc_agp: size=%u, offset=%lu, pid=%lu, count=%d\n", - size, (DWORD)agp.offset, (DWORD)getpid(), + fprintf(stderr, "sis_alloc_agp: size=%u, offset=%lu, pid=%d, count=%d\n", + size, agp.offset, (GLint)getpid(), ++_total_video_memory_count); } - return (void *)(agp.offset + GET_AGPBase(hwcx)); + return (void *)(agp.offset + GET_AGPBase(smesa)); } static void @@ -215,13 +175,13 @@ if (SIS_VERBOSE&VERBOSE_SIS_MEMORY) { - fprintf(stderr, "sis_free_agp: free=%lu, pid=%lu, count=%d\n", - (DWORD)free, (DWORD)getpid(), --_total_video_memory_count); + fprintf(stderr, "sis_free_agp: free=%p, pid=%d, count=%d\n", + free, (GLint)getpid(), --_total_video_memory_count); } agp.context = hHWContext; - agp.free = (unsigned long)free; - ioctl(gDRMSubFD, SIS_IOCTL_AGP_FREE, &agp); + agp.free = free; + drmCommandWrite( gDRMSubFD, DRM_SIS_AGP_FREE, &agp, sizeof(drm_sis_mem_t) ); } /* debug */ @@ -232,7 +192,7 @@ sis_alloc_z_stencil_buffer (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); XMesaBuffer xm_buffer = xmesa->xm_buffer; sisBufferInfo *priv = (sisBufferInfo *) xm_buffer->private; @@ -254,7 +214,7 @@ sis_free_z_stencil_buffer (xm_buffer); } - addr = sis_alloc_fb (hwcx, totalBytes, &priv->zbFree); + addr = sis_alloc_fb (smesa, totalBytes, &priv->zbFree); if (!addr) { fprintf (stderr, "SIS driver : out of video memory\n"); @@ -263,7 +223,7 @@ if (SIS_VERBOSE&VERBOSE_SIS_BUFFER) { - fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%lu\n", (DWORD)addr); + fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%p\n", addr); } addr = (GLubyte *) ALIGNMENT ((unsigned long) addr, Z_BUFFER_HW_ALIGNMENT); @@ -271,35 +231,35 @@ xm_buffer->depthbuffer = (void *) addr; /* software render */ - hwcx->swZBase = addr; - hwcx->swZPitch = width2; + smesa->swZBase = addr; + smesa->swZPitch = width2; /* set pZClearPacket */ memset (priv->pZClearPacket, 0, sizeof (ENGPACKET)); priv->pZClearPacket->dwSrcPitch = (z_depth == 2) ? 0x80000000 : 0xf0000000; priv->pZClearPacket->dwDestBaseAddr = - (DWORD) addr - (DWORD) GET_FbBase (hwcx); + (GLint) addr - (GLint) GET_FbBase (smesa); priv->pZClearPacket->wDestPitch = width2; priv->pZClearPacket->stdwDestPos.wY = 0; priv->pZClearPacket->stdwDestPos.wX = 0; - priv->pZClearPacket->wDestHeight = hwcx->virtualY; - priv->pZClearPacket->stdwDim.wWidth = (WORD) width2 / z_depth; - priv->pZClearPacket->stdwDim.wHeight = (WORD) xm_buffer->height; + priv->pZClearPacket->wDestHeight = smesa->virtualY; + priv->pZClearPacket->stdwDim.wWidth = (GLshort) width2 / z_depth; + priv->pZClearPacket->stdwDim.wHeight = (GLshort) xm_buffer->height; priv->pZClearPacket->stdwCmd.cRop = 0xf0; - if (hwcx->blockWrite) + if (smesa->blockWrite) { - priv->pZClearPacket->stdwCmd.cCmd0 = (BYTE) (CMD0_PAT_FG_COLOR); + priv->pZClearPacket->stdwCmd.cCmd0 = (GLbyte) (CMD0_PAT_FG_COLOR); priv->pZClearPacket->stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } else { priv->pZClearPacket->stdwCmd.cCmd0 = 0; priv->pZClearPacket->stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } } @@ -319,11 +279,11 @@ ENGPACKET *packet) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); XMesaBuffer xm_buffer = xmesa->xm_buffer; - GLuint depth = GET_DEPTH (hwcx); + GLuint depth = GET_DEPTH (smesa); GLuint size, width2; GLbyte *addr; @@ -338,7 +298,7 @@ size = width2 * xm_buffer->height * depth + DRAW_BUFFER_HW_PLUS; /* Fixme: unique context alloc/free back-buffer? */ - addr = sis_alloc_fb (hwcx, size, free); + addr = sis_alloc_fb (smesa, size, free); if (!addr) { fprintf (stderr, "SIS driver : out of video memory\n"); @@ -356,26 +316,26 @@ packet->dwSrcPitch = (depth == 2) ? 0x80000000 : 0xf0000000; packet->dwDestBaseAddr = - (DWORD) addr - (DWORD) GET_FbBase (hwcx); + (GLint) addr - (GLint) GET_FbBase (smesa); packet->wDestPitch = image->bytes_per_line; packet->stdwDestPos.wY = 0; packet->stdwDestPos.wX = 0; - packet->wDestHeight = hwcx->virtualY; - packet->stdwDim.wWidth = (WORD) width2; - packet->stdwDim.wHeight = (WORD) xm_buffer->height; + packet->wDestHeight = smesa->virtualY; + packet->stdwDim.wWidth = (GLshort) width2; + packet->stdwDim.wHeight = (GLshort) xm_buffer->height; packet->stdwCmd.cRop = 0xf0; - if (hwcx->blockWrite) + if (smesa->blockWrite) { - packet->stdwCmd.cCmd0 = (BYTE) (CMD0_PAT_FG_COLOR); + packet->stdwCmd.cCmd0 = (GLbyte) (CMD0_PAT_FG_COLOR); packet->stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } else { packet->stdwCmd.cCmd0 = 0; - packet->stdwCmd.cCmd1 = (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + packet->stdwCmd.cCmd1 = (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } } @@ -392,7 +352,7 @@ sis_alloc_texture_image (GLcontext * ctx, GLtextureImage * image) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); GLuint size; @@ -482,13 +442,13 @@ size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS; do{ - addr = sis_alloc_fb (hwcx, size, &area->free); + addr = sis_alloc_fb (smesa, size, &area->free); area->memType = VIDEO_TYPE; if(addr) break; /* TODO: swap to agp memory*/ /* video memory allocation fails */ - addr = sis_alloc_agp(hwcx, size, &area->free); + addr = sis_alloc_agp(smesa, size, &area->free); area->memType = AGP_TYPE; if(addr) break; diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_clear.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_clear.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_clear.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_clear.c Tue Aug 5 21:55:46 2003 @@ -52,7 +52,7 @@ GLint x, GLint y, GLint width, GLint height) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); XMesaBuffer xm_buffer = xmesa->xm_buffer; GLint x1, y1, width1, height1; @@ -83,7 +83,7 @@ if ((ctx->Visual->StencilBits && ((mask | GL_DEPTH_BUFFER_BIT) ^ (mask | GL_STENCIL_BUFFER_BIT))) - || (*(DWORD *) (ctx->Color.ColorMask) != 0xffffffff) + || (*(GLint *) (ctx->Color.ColorMask) != 0xffffffff) ) { /* only Clear either depth or stencil buffer */ @@ -114,35 +114,35 @@ sis_ClearDepth (GLcontext * ctx, GLclampd d) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - set_z_stencil_pattern (hwcx, d, ctx->Stencil.Clear); + set_z_stencil_pattern (smesa, d, ctx->Stencil.Clear); } void sis_ClearStencil (GLcontext * ctx, GLint s) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - set_z_stencil_pattern (hwcx, ctx->Depth.Clear, s); + set_z_stencil_pattern (smesa, ctx->Depth.Clear, s); } #define MAKE_CLEAR_COLOR_8888(cc) \ - ( (((DWORD)(((GLubyte *)(cc))[3] * 255.0 + 0.5))<<24) | \ - (((DWORD)(((GLubyte *)(cc))[0] * 255.0 + 0.5))<<16) | \ - (((DWORD)(((GLubyte *)(cc))[1] * 255.0 + 0.5))<<8) | \ - ((DWORD)(((GLubyte *)(cc))[2] * 255.0 + 0.5)) ) + ( (((GLint)(((GLubyte *)(cc))[3] * 255.0 + 0.5))<<24) | \ + (((GLint)(((GLubyte *)(cc))[0] * 255.0 + 0.5))<<16) | \ + (((GLint)(((GLubyte *)(cc))[1] * 255.0 + 0.5))<<8) | \ + ((GLint)(((GLubyte *)(cc))[2] * 255.0 + 0.5)) ) __inline__ static GLbitfield sis_3D_Clear (GLcontext * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *current = &smesa->current; #define RESETSTATE (GFLAG_ENABLESETTING | GFLAG_ENABLESETTING2 | \ GFLAG_ZSETTING | GFLAG_DESTSETTING | \ @@ -151,10 +151,10 @@ SiS_SPASS_ZPASS_REPLACE) float left, top, right, bottom, zClearVal; - DWORD dwColor=0; - DWORD bClrColor, bClrDepth, bClrStencil; - DWORD dwPrimitiveSet; - DWORD dwEnable1, dwEnable2, dwDepthMask=0, dwSten1=0, dwSten2=0; + GLint dwColor=0; + GLint bClrColor, bClrDepth, bClrStencil; + GLint dwPrimitiveSet; + GLint dwEnable1, dwEnable2, dwDepthMask=0, dwSten1=0, dwSten2=0; int count; BoxPtr pExtents; @@ -169,9 +169,9 @@ /* TODO: if enclosing sis_Clear by sis_RenderStart and sis_RenderEnd is * uniform, but it seems needless to do so */ - if (hwcx->GlobalFlag) + if (smesa->GlobalFlag) { - sis_update_render_state (hwcx, 0); + sis_update_render_state (smesa, 0); } dwEnable2 = 0; @@ -186,18 +186,18 @@ if (bClrDepth && bClrStencil) { - DWORD wmask, smask; + GLint wmask, smask; GLstencil sten; zClearVal = ctx->Depth.Clear; sten = ctx->Stencil.Clear; - wmask = (DWORD) ctx->Stencil.WriteMask; + wmask = (GLint) ctx->Stencil.WriteMask; smask = 0xff; dwEnable1 = MASK_ZWriteEnable | MASK_StencilTestEnable; dwEnable2 |= MASK_ZMaskWriteEnable; dwDepthMask = ((wmask << 24) | 0x00ffffff); - dwSten1 = S_8 | (((DWORD) sten << 8) | smask) | SiS_STENCIL_ALWAYS; + dwSten1 = S_8 | (((GLint) sten << 8) | smask) | SiS_STENCIL_ALWAYS; dwSten2 = STEN_OP; } else if (bClrDepth) @@ -209,18 +209,18 @@ } else if (bClrStencil) { - DWORD wmask, smask; + GLint wmask, smask; GLstencil sten; sten = (GLstencil) ctx->Stencil.Clear; - wmask = (DWORD) ctx->Stencil.WriteMask; + wmask = (GLint) ctx->Stencil.WriteMask; smask = 0xff; zClearVal = 0; dwEnable1 = MASK_ZWriteEnable | MASK_StencilTestEnable; dwEnable2 |= MASK_ZMaskWriteEnable; dwDepthMask = (wmask << 24) & 0xff000000; - dwSten1 = S_8 | (((DWORD) sten << 8) | smask) | SiS_STENCIL_ALWAYS; + dwSten1 = S_8 | (((GLint) sten << 8) | smask) | SiS_STENCIL_ALWAYS; dwSten2 = STEN_OP; } else @@ -292,27 +292,27 @@ pExtents++; } - MMIO (REG_3D_ClipTopBottom, ((DWORD) top << 13) | (DWORD) bottom); - MMIO (REG_3D_ClipLeftRight, ((DWORD) left << 13) | (DWORD) right); + MMIO (REG_3D_ClipTopBottom, ((GLint) top << 13) | (GLint) bottom); + MMIO (REG_3D_ClipLeftRight, ((GLint) left << 13) | (GLint) right); /* the first triangle */ dwPrimitiveSet = (OP_3D_TRIANGLE_DRAW | OP_3D_FIRE_TSARGBc | SHADE_FLAT_VertexC); MMIO (REG_3D_PrimitiveSet, dwPrimitiveSet); - MMIO (REG_3D_TSZa, *(DWORD *) & zClearVal); - MMIO (REG_3D_TSXa, *(DWORD *) & right); - MMIO (REG_3D_TSYa, *(DWORD *) & top); + MMIO (REG_3D_TSZa, *(GLint *) & zClearVal); + MMIO (REG_3D_TSXa, *(GLint *) & right); + MMIO (REG_3D_TSYa, *(GLint *) & top); MMIO (REG_3D_TSARGBa, dwColor); - MMIO (REG_3D_TSZb, *(DWORD *) & zClearVal); - MMIO (REG_3D_TSXb, *(DWORD *) & left); - MMIO (REG_3D_TSYb, *(DWORD *) & top); + MMIO (REG_3D_TSZb, *(GLint *) & zClearVal); + MMIO (REG_3D_TSXb, *(GLint *) & left); + MMIO (REG_3D_TSYb, *(GLint *) & top); MMIO (REG_3D_TSARGBb, dwColor); - MMIO (REG_3D_TSZc, *(DWORD *) & zClearVal); - MMIO (REG_3D_TSXc, *(DWORD *) & left); - MMIO (REG_3D_TSYc, *(DWORD *) & bottom); + MMIO (REG_3D_TSZc, *(GLint *) & zClearVal); + MMIO (REG_3D_TSXc, *(GLint *) & left); + MMIO (REG_3D_TSYc, *(GLint *) & bottom); MMIO (REG_3D_TSARGBc, dwColor); /* second triangle */ @@ -320,15 +320,15 @@ SHADE_FLAT_VertexB); MMIO (REG_3D_PrimitiveSet, dwPrimitiveSet); - MMIO (REG_3D_TSZb, *(DWORD *) & zClearVal); - MMIO (REG_3D_TSXb, *(DWORD *) & right); - MMIO (REG_3D_TSYb, *(DWORD *) & bottom); + MMIO (REG_3D_TSZb, *(GLint *) & zClearVal); + MMIO (REG_3D_TSXb, *(GLint *) & right); + MMIO (REG_3D_TSYb, *(GLint *) & bottom); MMIO (REG_3D_TSARGBb, dwColor); } mEndPrimitive (); - hwcx->GlobalFlag |= RESETSTATE; + smesa->GlobalFlag |= RESETSTATE; #undef RESETSTATE #undef STEN_OP @@ -340,13 +340,13 @@ } __inline__ static void -sis_bitblt_clear_cmd (__GLSiScontext * hwcx, ENGPACKET * pkt) +sis_bitblt_clear_cmd (sisContextPtr smesa, ENGPACKET * pkt) { - LPDWORD lpdwDest, lpdwSrc; + GLint *lpdwDest, *lpdwSrc; int i; - lpdwSrc = (DWORD *) pkt + 1; - lpdwDest = (DWORD *) (GET_IOBase (hwcx) + REG_SRC_ADDR) + 1; + lpdwSrc = (GLint *) pkt + 1; + lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR) + 1; mWait3DCmdQueue (10); @@ -358,7 +358,7 @@ *lpdwDest++ = *lpdwSrc++; } - MMIO (REG_CMD0, *(DWORD *) & pkt->stdwCmd); + MMIO (REG_CMD0, *(GLint *) & pkt->stdwCmd); MMIO (0x8240, -1); } @@ -368,14 +368,14 @@ GLint x, GLint y, GLint width, GLint height) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); XMesaBuffer xm_buffer = xmesa->xm_buffer; sisBufferInfo *priv = (sisBufferInfo *) xm_buffer->private; int count; GLuint origin_x, origin_y; - GLuint depth = GET_DEPTH (hwcx); + GLuint depth = GET_DEPTH (smesa); BoxPtr pExtents = NULL; GLint xx, yy; GLint x0, y0, width0, height0; @@ -389,11 +389,11 @@ case GL_BACK_LEFT: priv->pCbClearPacket->stdwDestPos.wY = y; priv->pCbClearPacket->stdwDestPos.wX = x; - priv->pCbClearPacket->stdwDim.wWidth = (WORD) width; - priv->pCbClearPacket->stdwDim.wHeight = (WORD) height; - priv->pCbClearPacket->dwFgRopColor = hwcx->clearColorPattern; + priv->pCbClearPacket->stdwDim.wWidth = (GLshort) width; + priv->pCbClearPacket->stdwDim.wHeight = (GLshort) height; + priv->pCbClearPacket->dwFgRopColor = smesa->clearColorPattern; - sis_bitblt_clear_cmd (hwcx, priv->pCbClearPacket); + sis_bitblt_clear_cmd (smesa, priv->pCbClearPacket); return; case GL_FRONT_LEFT: x0 = x; @@ -401,7 +401,7 @@ width0 = width; height0 = height; - pitch = GET_PITCH (hwcx); + pitch = GET_PITCH (smesa); sis_get_drawable_origin (xmesa, &origin_x, &origin_y); sis_get_clip_rects (xmesa, &pExtents, &count); break; @@ -435,30 +435,30 @@ stEngPacket.dwSrcPitch = (depth == 2) ? 0x80000000 : 0xc0000000; stEngPacket.stdwDestPos.wY = y + origin_y; stEngPacket.stdwDestPos.wX = x + origin_x; - stEngPacket.dwDestBaseAddr = (DWORD) 0; + stEngPacket.dwDestBaseAddr = (GLint) 0; stEngPacket.wDestPitch = pitch; /* TODO: set maximum value? */ - stEngPacket.wDestHeight = hwcx->virtualY; - stEngPacket.stdwDim.wWidth = (WORD) width; - stEngPacket.stdwDim.wHeight = (WORD) height; + stEngPacket.wDestHeight = smesa->virtualY; + stEngPacket.stdwDim.wWidth = (GLshort) width; + stEngPacket.stdwDim.wHeight = (GLshort) height; stEngPacket.stdwCmd.cRop = 0xf0; - stEngPacket.dwFgRopColor = hwcx->clearColorPattern; + stEngPacket.dwFgRopColor = smesa->clearColorPattern; /* for SGRAM Block Write Enable */ - if (hwcx->blockWrite) + if (smesa->blockWrite) { - stEngPacket.stdwCmd.cCmd0 = (BYTE) (CMD0_PAT_FG_COLOR); + stEngPacket.stdwCmd.cCmd0 = (GLbyte) (CMD0_PAT_FG_COLOR); stEngPacket.stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } else { stEngPacket.stdwCmd.cCmd0 = 0; stEngPacket.stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } - sis_bitblt_clear_cmd (hwcx, &stEngPacket); + sis_bitblt_clear_cmd (smesa, &stEngPacket); } } @@ -467,7 +467,7 @@ GLint x, GLint y, GLint width, GLint height) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); XMesaBuffer xm_buffer = xmesa->xm_buffer; sisBufferInfo *priv = (sisBufferInfo *) xmesa->xm_buffer->private; @@ -480,21 +480,21 @@ /* TODO: consider alignment of width, height? */ priv->pZClearPacket->stdwDestPos.wY = y; priv->pZClearPacket->stdwDestPos.wX = x; - priv->pZClearPacket->stdwDim.wWidth = (WORD) width; - priv->pZClearPacket->stdwDim.wHeight = (WORD) height; - priv->pZClearPacket->dwFgRopColor = hwcx->clearZStencilPattern; + priv->pZClearPacket->stdwDim.wWidth = (GLshort) width; + priv->pZClearPacket->stdwDim.wHeight = (GLshort) height; + priv->pZClearPacket->dwFgRopColor = smesa->clearZStencilPattern; - sis_bitblt_clear_cmd (hwcx, priv->pZClearPacket); + sis_bitblt_clear_cmd (smesa, priv->pZClearPacket); } __inline__ static void -sis_bitblt_copy_cmd (__GLSiScontext * hwcx, ENGPACKET * pkt) +sis_bitblt_copy_cmd (sisContextPtr smesa, ENGPACKET * pkt) { - LPDWORD lpdwDest, lpdwSrc; + GLint *lpdwDest, *lpdwSrc; int i; - lpdwSrc = (DWORD *) pkt; - lpdwDest = (DWORD *) (GET_IOBase (hwcx) + REG_SRC_ADDR); + lpdwSrc = (GLint *) pkt; + lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR); mWait3DCmdQueue (10); @@ -503,7 +503,7 @@ *lpdwDest++ = *lpdwSrc++; } - MMIO (REG_CMD0, *(DWORD *) & pkt->stdwCmd); + MMIO (REG_CMD0, *(GLint *) & pkt->stdwCmd); MMIO (0x8240, -1); } @@ -511,11 +511,11 @@ sis_swap_image (XMesaBuffer b, XMesaDrawable d, XMesaImage * image) { XMesaContext xmesa = b->xm_context; - __GLSiScontext *hwcx = (__GLSiScontext *) b->xm_context->private; + sisContextPtr smesa = (sisContextPtr) b->xm_context->private; - GLuint depth = GET_DEPTH (hwcx); + GLuint depth = GET_DEPTH (smesa); ENGPACKET stEngPacket; - DWORD src; + GLint src; GLuint srcPitch, dstPitch; BoxPtr pExtents; @@ -532,9 +532,9 @@ count = 1; } - src = (DWORD) image->data - (DWORD) GET_FbBase (hwcx); + src = (GLint) image->data - (GLint) GET_FbBase (smesa); srcPitch = image->bytes_per_line; - dstPitch = GET_PITCH (hwcx); + dstPitch = GET_PITCH (smesa); sis_get_drawable_origin (xmesa, &origin_x, &origin_y); while(count --) @@ -548,29 +548,29 @@ stEngPacket.stdwSrcPos.wX = pExtents->x1 - origin_x; stEngPacket.stdwDestPos.wY = pExtents->y1; stEngPacket.stdwDestPos.wX = pExtents->x1; - stEngPacket.dwDestBaseAddr = (DWORD) 0; + stEngPacket.dwDestBaseAddr = (GLint) 0; stEngPacket.wDestPitch = dstPitch; /* TODO: set maximum value? */ - stEngPacket.wDestHeight = hwcx->virtualY; - stEngPacket.stdwDim.wWidth = (WORD) pExtents->x2 - pExtents->x1; - stEngPacket.stdwDim.wHeight = (WORD) pExtents->y2 - pExtents->y1; + stEngPacket.wDestHeight = smesa->virtualY; + stEngPacket.stdwDim.wWidth = (GLshort) pExtents->x2 - pExtents->x1; + stEngPacket.stdwDim.wHeight = (GLshort) pExtents->y2 - pExtents->y1; stEngPacket.stdwCmd.cRop = 0xcc; - if (hwcx->blockWrite) + if (smesa->blockWrite) { - stEngPacket.stdwCmd.cCmd0 = (BYTE) (CMD0_PAT_FG_COLOR); + stEngPacket.stdwCmd.cCmd0 = (GLbyte) (CMD0_PAT_FG_COLOR); stEngPacket.stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } else { stEngPacket.stdwCmd.cCmd0 = 0; stEngPacket.stdwCmd.cCmd1 = - (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + (GLbyte) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); } - sis_bitblt_copy_cmd (hwcx, &stEngPacket); + sis_bitblt_copy_cmd (smesa, &stEngPacket); pExtents++; } @@ -580,8 +580,8 @@ sis_swap_buffers (XMesaBuffer b) { XMesaContext xmesa = b->xm_context; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - GLcontext *ctx = hwcx->gc; + sisContextPtr smesa = SIS_CONTEXT(ctx); + GLcontext *ctx = smesa->gc; /* debug */ /* return; */ @@ -593,7 +593,7 @@ { int repeat = 0; - while(((*hwcx->FrameCountPtr) - *(DWORD volatile *)(hwcx->IOBase+0x8a2c) + while(((*smesa->FrameCountPtr) - *(GLint volatile *)(smesa->IOBase+0x8a2c) > SIS_MAX_FRAME_LENGTH) && (repeat++ < 10)); } @@ -602,8 +602,8 @@ LOCK_HARDWARE (); sis_swap_image (b, b->frontbuffer, b->backimage); - *(DWORD *)(hwcx->IOBase+0x8a2c) = *hwcx->FrameCountPtr; - (*hwcx->FrameCountPtr)++; + *(GLint *)(smesa->IOBase+0x8a2c) = *smesa->FrameCountPtr; + (*smesa->FrameCountPtr)++; UNLOCK_HARDWARE (); } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_common.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_common.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_common.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_common.h Wed Dec 31 16:00:00 1969 @@ -1,230 +0,0 @@ -/************************************************************************** - -Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.5 2000/09/26 15:56:48 tsi Exp $ */ - -/* - * Authors: - * Sung-Ching Lin - * - */ - -#ifndef _sis_common_h_ -#define _sis_common_h_ - -#include "types.h" -#include "sis_xmesaP.h" - -#if 0 -#define free(x) -#define calloc(x,y) sis_debug_malloc((x)*(y)) -extern void *sis_debug_malloc(int x); -#endif - -#if defined(SIS_DUMP) -#include "sis_debug.h" -#endif - -#if SIS_STEREO -# include "sis_stereo.h" -#else -# define STEREO_OFFSET(v) 0 -# define STEREO_SAMPLE(v) do{}while(0) -#endif - -#ifdef XFree86Server -# include "resource.h" -# include "windowstr.h" -# include "gcstruct.h" -# include "GL/xf86glx.h" -# include "xf86glx_util.h" -# include "xf86_ansic.h" -# include "xf86_libc.h" -#else -# ifdef GLX_DIRECT_RENDERING -# include -# include -# include -# include -# include "dri_mesaint.h" -typedef struct _Box -{ - short x1, y1, x2, y2; -} -BoxRec; -#define NullBox ((BoxPtr)0) -typedef struct _Box *BoxPtr; -# endif -#endif - -typedef unsigned short WORD; -typedef unsigned long DWORD; -typedef unsigned int UINT; -typedef int INT; -typedef long LONG; -typedef DWORD *LPDWORD; - -/* BitBlt Commands */ -#define Index_SR_Misc_Ctrl11 0x3e -#define CMD0_DD_ENABLE 0x06 -#define CMD0_SRC_VIDEO 0x00 -#define CMD0_SRC_CPU 0x10 -#define CMD0_PAT_FG_COLOR 0x00 -#define CMD1_DIR_X_DEC 0x00 -#define CMD1_DIR_X_INC 0x01 -#define CMD1_DIR_Y_DEC 0x00 -#define CMD1_DIR_Y_INC 0x02 -#define REG_SRC_ADDR 0x8200 -#define REG_CMD0 0x823c - -typedef struct -{ - WORD wSrcPitch; - WORD wDestPitch; -} -_PITCH; -typedef struct -{ - WORD wWidth; - WORD wHeight; -} -_DIM; -typedef struct -{ - WORD wY; - WORD wX; -} -_POS; - -typedef struct -{ - BYTE cCmd0; - BYTE cRop; - BYTE cCmd1; - BYTE cReserved; -} -_CMD; - -typedef struct -{ - WORD wStatus0; - BYTE cStatus0_BYTE3; - BYTE cStatus0_BYTE4; -} -_CMDQUESTATUS; - -typedef struct -{ - DWORD dwSrcBaseAddr; - DWORD dwSrcPitch; - _POS stdwSrcPos; - _POS stdwDestPos; - DWORD dwDestBaseAddr; - WORD wDestPitch; - WORD wDestHeight; - _DIM stdwDim; - DWORD dwFgRopColor; - DWORD dwBgRopColor; - DWORD dwSrcHiCKey; - DWORD dwSrcLoCKey; - DWORD dwMaskA; - DWORD dwMaskB; - DWORD dwClipA; - DWORD dwClipB; - _CMD stdwCmd; - _CMDQUESTATUS stdwCmdQueStatus; -} -ENGPACKET, *LPENGPACKET; - -/* Hardware Info */ -#include "sis_reg.h" -#include "sis_init.h" - -typedef struct gl_texture_object GLtextureObject; -typedef struct gl_texture_image GLtextureImage; - -#define VIDEO_TYPE 0 -#define AGP_TYPE 1 - -typedef struct sis_texure_area -{ - GLbyte *Data; - GLenum Format; - void *free; - GLuint memType; - GLuint Pitch; - GLuint Size; - GLuint texelSize; - unsigned int hHWContext; - - /* Debug */ - GLuint realSize; -} -SIStextureArea; - -/* dirtyFlag */ -#define SIS_TEX_ENV 0x1 -#define SIS_TEX_IMAGE 0x2 /* image in video memory is stale */ -#define SIS_TEX_PARAMETER 0x4 -#define SIS_TEX_ALL (SIS_TEX_IMAGE | SIS_TEX_PARAMETER) - -typedef struct sis_texobj_area -{ - DWORD dirtyFlag; - GLboolean valid; - struct sis_texobj_area *prev, *next; -} -sisTexobjInfo; - -typedef struct sis_buffer_private -{ - void *zbFree, *bbFree; - - ENGPACKET *pZClearPacket, *pCbClearPacket; - - ENGPACKET zClearPacket, cbClearPacket; - -#if SIS_STEREO - XMesaImage *pStereoImages[3]; - ENGPACKET *pStereoPackets[3]; - void *stereoFrees[3]; /* stereoFrees[0] is useless */ - - ENGPACKET stereoPackets[2]; -#endif -} -sisBufferInfo; - -/* HW capability */ -#define SIS_MAX_MIPMAP_LEVEL 11 -#define SIS_MAX_TEXTURE_SIZE 2048 -#define SIS_MAX_TEXTURES 2 - -#define SIS_MAX_FRAME_LENGTH 3 - -DWORD doFPtoFixedNoRound (DWORD dwInValue, int nFraction); - -#define Y_FLIP(Y) (xmesa->xm_buffer->bottom-(Y)) -#endif diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_common2.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_common2.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_common2.h Wed Dec 31 16:00:00 1969 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_common2.h Tue Aug 5 21:55:46 2003 @@ -0,0 +1,211 @@ +/************************************************************************** + +Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.5 2000/09/26 15:56:48 tsi Exp $ */ + +/* + * Authors: + * Sung-Ching Lin + * + */ + +#ifndef _sis_common_h_ +#define _sis_common_h_ + +#include "sis_xmesaP.h" + +#if 0 +#define free(x) +#define calloc(x,y) sis_debug_malloc((x)*(y)) +extern void *sis_debug_malloc(int x); +#endif + +#if defined(SIS_DUMP) +#include "sis_debug.h" +#endif + +#if SIS_STEREO +# include "sis_stereo.h" +#else +# define STEREO_OFFSET(v) 0 +# define STEREO_SAMPLE(v) do{}while(0) +#endif + +#ifdef GLX_DIRECT_RENDERING +# include +# include +# include +# include +typedef struct _Box +{ + short x1, y1, x2, y2; +} +BoxRec; +#define NullBox ((BoxPtr)0) +typedef struct _Box *BoxPtr; +#endif /* GLX_DIRECT_RENDERING */ + +/* BitBlt Commands */ +#define Index_SR_Misc_Ctrl11 0x3e +#define CMD0_DD_ENABLE 0x06 +#define CMD0_SRC_VIDEO 0x00 +#define CMD0_SRC_CPU 0x10 +#define CMD0_PAT_FG_COLOR 0x00 +#define CMD1_DIR_X_DEC 0x00 +#define CMD1_DIR_X_INC 0x01 +#define CMD1_DIR_Y_DEC 0x00 +#define CMD1_DIR_Y_INC 0x02 +#define REG_SRC_ADDR 0x8200 +#define REG_CMD0 0x823c + +typedef struct +{ + GLshort wSrcPitch; + GLshort wDestPitch; +} +_PITCH; +typedef struct +{ + GLshort wWidth; + GLshort wHeight; +} +_DIM; +typedef struct +{ + GLshort wY; + GLshort wX; +} +_POS; + +typedef struct +{ + GLbyte cCmd0; + GLbyte cRop; + GLbyte cCmd1; + GLbyte cReserved; +} +_CMD; + +typedef struct +{ + GLshort wStatus0; + GLbyte cStatus0_GLbyte3; + GLbyte cStatus0_GLbyte4; +} +_CMDQUESTATUS; + +typedef struct +{ + GLint dwSrcBaseAddr; + GLint dwSrcPitch; + _POS stdwSrcPos; + _POS stdwDestPos; + GLint dwDestBaseAddr; + GLshort wDestPitch; + GLshort wDestHeight; + _DIM stdwDim; + GLint dwFgRopColor; + GLint dwBgRopColor; + GLint dwSrcHiCKey; + GLint dwSrcLoCKey; + GLint dwMaskA; + GLint dwMaskB; + GLint dwClipA; + GLint dwClipB; + _CMD stdwCmd; + _CMDQUESTATUS stdwCmdQueStatus; +} +ENGPACKET, *LPENGPACKET; + +/* Hardware Info */ +#include "sis_reg.h" +#include "sis_init.h" + +typedef struct gl_texture_object GLtextureObject; +typedef struct gl_texture_image GLtextureImage; + +#define VIDEO_TYPE 0 +#define AGP_TYPE 1 + +typedef struct sis_texure_area +{ + GLbyte *Data; + GLenum Format; + void *free; + GLuint memType; + GLuint Pitch; + GLuint Size; + GLuint texelSize; + unsigned int hHWContext; + + /* Debug */ + GLuint realSize; +} +SIStextureArea; + +/* dirtyFlag */ +#define SIS_TEX_ENV 0x1 +#define SIS_TEX_IMAGE 0x2 /* image in video memory is stale */ +#define SIS_TEX_PARAMETER 0x4 +#define SIS_TEX_ALL (SIS_TEX_IMAGE | SIS_TEX_PARAMETER) + +typedef struct sis_texobj_area +{ + GLint dirtyFlag; + GLboolean valid; + struct sis_texobj_area *prev, *next; +} +sisTexobjInfo; + +typedef struct sis_buffer_private +{ + void *zbFree, *bbFree; + + ENGPACKET *pZClearPacket, *pCbClearPacket; + + ENGPACKET zClearPacket, cbClearPacket; + +#if SIS_STEREO + XMesaImage *pStereoImages[3]; + ENGPACKET *pStereoPackets[3]; + void *stereoFrees[3]; /* stereoFrees[0] is useless */ + + ENGPACKET stereoPackets[2]; +#endif +} +sisBufferInfo; + +/* HW capability */ +#define SIS_MAX_MIPMAP_LEVEL 11 +#define SIS_MAX_TEXTURE_SIZE 2048 +#define SIS_MAX_TEXTURES 2 + +#define SIS_MAX_FRAME_LENGTH 3 + +GLint doFPtoFixedNoRound (GLint dwInValue, int nFraction); + +#define Y_FLIP(Y) (xmesa->xm_buffer->bottom-(Y)) +#endif diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_ctx.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_ctx.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_ctx.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_ctx.c Tue Aug 5 21:55:46 2003 @@ -32,31 +32,7 @@ * */ -#ifdef XFree86Server -# define PSZ 8 -# include "cfb.h" -# undef PSZ -# include "cfb16.h" -# include "cfb24.h" -# include "cfb32.h" -# include "cfb24_32.h" -/* for SISPtr */ -# include "xf86.h" -# include "xf86_OSproc.h" -# include "xf86Resources.h" -# include "xf86Version.h" -# include "xf86PciInfo.h" -# include "xf86Pci.h" -# include "xf86cmap.h" -# include "vgaHW.h" -# include "xf86RAC.h" -# include "sis_regs.h" -# include "sis.h" -# include "dristruct.h" -# include "dri.h" -#else #include "sis_dri.h" -#endif #include "extensions.h" @@ -68,29 +44,29 @@ int GlobalCmdQueueLen = 0; void -WaitEngIdle (__GLSiScontext * hwcx) +WaitEngIdle (sisContextPtr smesa) { - BYTE *IOBase = GET_IOBase (hwcx); - BYTE cEngineState; + GLbyte *IOBase = GET_IOBase (smesa); + GLbyte cEngineState; - cEngineState = *((BYTE volatile *) (IOBase + 0x8243)); + cEngineState = *((GLbyte volatile *) (IOBase + 0x8243)); while (((cEngineState & 0x80) == 0) || ((cEngineState & 0x40) == 0) || ((cEngineState & 0x20) == 0)) { - cEngineState = *((BYTE volatile *) (IOBase + 0x8243)); + cEngineState = *((GLbyte volatile *) (IOBase + 0x8243)); } } void -Wait2DEngIdle (__GLSiScontext * hwcx) +Wait2DEngIdle (sisContextPtr smesa) { - BYTE *IOBase = GET_IOBase (hwcx); - BYTE cEngineState; + GLbyte *IOBase = GET_IOBase (smesa); + GLbyte cEngineState; - cEngineState = *((BYTE volatile *) (IOBase + 0x8243)); + cEngineState = *((GLbyte volatile *) (IOBase + 0x8243)); while (!(cEngineState & 0x80)) { - cEngineState = *((BYTE volatile *) (IOBase + 0x8243)); + cEngineState = *((GLbyte volatile *) (IOBase + 0x8243)); } } @@ -98,10 +74,10 @@ sis_init_opengl_state (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *current = &hwcx->current; - __GLSiSHardware *prev = &(hwcx->prev); + __GLSiSHardware *current = &smesa->current; + __GLSiSHardware *prev = &(smesa->prev); /* prev->hwCapEnable = INIT_6327_CapsEnable ; @@ -166,7 +142,7 @@ /* Init the texture transparency color high range value */ #if 0 - lpdwRegIO = ((LPDWORD)hwcx->lpEngIO + REG_3D_TransparencyColorHigh); + lpdwRegIO = ((GLint *)smesa->lpEngIO + REG_3D_TransparencyColorHigh); prev->hwTextureClrHigh = INIT_6326_TextureClrHigh; *(lpdwRegIO) = INIT_6327_TextureClrHigh; #endif @@ -176,7 +152,7 @@ sis_init_user_setting (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); /* disable all unsupported per-pixel extensions */ gl_extensions_disable (ctx, "GL_EXT_blend_color"); @@ -203,13 +179,13 @@ /* debug */ if(getenv ("SIS_NO_AGP_CMDS")) - hwcx->AGPCmdModeEnabled = GL_FALSE; + smesa->AGPCmdModeEnabled = GL_FALSE; #if SIS_STEREO - if(getenv ("SIS_STEREO") && hwcx->irqEnabled) - hwcx->useStereo = GL_TRUE; + if(getenv ("SIS_STEREO") && smesa->irqEnabled) + smesa->useStereo = GL_TRUE; else - hwcx->useStereo = GL_FALSE; + smesa->useStereo = GL_FALSE; { float val; @@ -240,12 +216,12 @@ SiSCreateContext (XMesaContext xmesa) { GLcontext *ctx = xmesa->gl_ctx; - __GLSiScontext *hwcx; + sisContextPtr smesa; int i; - hwcx = (__GLSiScontext *) calloc (1, sizeof (__GLSiScontext)); - if (!hwcx) + smesa = (sisContextPtr) calloc (1, sizeof (sisContextRec)); + if (!smesa) { fprintf (stderr, "SIS Driver : allocating context fails\n"); sis_fatal_error (); @@ -253,73 +229,53 @@ } /* set gc */ - hwcx->gc = ctx; - xmesa->private = hwcx; + smesa->glCtx = ctx; + xmesa->private = smesa; /* set static part in ctx->Driver */ sis_init_driver (ctx); /* Set 2D data (from X-Server) */ /* i assume the data will not change during X-server's lifetime */ -#ifdef XFree86Server - { - ScrnInfoPtr pScrn = xf86Screens[xmesa->display->myNum]; - SISPtr pSiS = SISPTR (pScrn); - - hwcx->virtualX = pSiS->pScrn->virtualX; - hwcx->virtualY = pSiS->pScrn->virtualY; - hwcx->bytesPerPixel = (pSiS->pScrn->bitsPerPixel + 7) / 8; - hwcx->IOBase = pSiS->IOBase; - hwcx->FbBase = pSiS->FbBase; - hwcx->displayWidth = pSiS->pScrn->displayWidth * hwcx->bytesPerPixel; - hwcx->pitch = pSiS->scrnOffset; - hwcx->Chipset = pSiS->Chipset; - hwcx->drmSubFD = pSiS->drmSubFD; -#if SIS_STEREO - hwcx->irqEnabled = pSiS->irqEnabled; -#endif - } -#else { __DRIscreenPrivate *psp = xmesa->driContextPriv->driScreenPriv; SISDRIPtr priv = (SISDRIPtr) psp->pDevPriv; - hwcx->virtualX = priv->width; - hwcx->virtualY = priv->height; - hwcx->bytesPerPixel = priv->bytesPerPixel; - hwcx->IOBase = priv->regs.map; - hwcx->FbBase = psp->pFB; - hwcx->displayWidth = psp->fbWidth; - hwcx->pitch = psp->fbStride; - hwcx->Chipset = priv->deviceID; + smesa->virtualX = priv->width; + smesa->virtualY = priv->height; + smesa->bytesPerPixel = priv->bytesPerPixel; + smesa->IOBase = priv->regs.map; + smesa->FbBase = psp->pFB; + smesa->displayWidth = psp->fbWidth; + smesa->pitch = psp->fbStride; + smesa->Chipset = priv->deviceID; /* TODO: make sure psp->fd is sub-driver's fd */ - hwcx->drmSubFD = psp->fd; + smesa->drmSubFD = psp->fd; #if SIS_STEREO - hwcx->irqEnabled = priv->irqEnabled; + smesa->irqEnabled = priv->irqEnabled; #endif } -#endif #if defined(SIS_DUMP) - IOBase4Debug = GET_IOBase (hwcx); + IOBase4Debug = GET_IOBase (smesa); #endif /* support ARGB8888 and RGB565 */ - switch (hwcx->bytesPerPixel) + switch (smesa->bytesPerPixel) { case 4: - hwcx->redMask = 0x00ff0000; - hwcx->greenMask = 0x0000ff00; - hwcx->blueMask = 0x000000ff; - hwcx->alphaMask = 0xff000000; - hwcx->colorFormat = DST_FORMAT_ARGB_8888; + smesa->redMask = 0x00ff0000; + smesa->greenMask = 0x0000ff00; + smesa->blueMask = 0x000000ff; + smesa->alphaMask = 0xff000000; + smesa->colorFormat = DST_FORMAT_ARGB_8888; break; case 2: - hwcx->redMask = 0xf800; - hwcx->greenMask = 0x07e0; - hwcx->blueMask = 0x001f; - hwcx->alphaMask = 0; - hwcx->colorFormat = DST_FORMAT_RGB_565; + smesa->redMask = 0xf800; + smesa->greenMask = 0x07e0; + smesa->blueMask = 0x001f; + smesa->alphaMask = 0; + smesa->colorFormat = DST_FORMAT_RGB_565; break; default: assert (0); @@ -329,53 +285,6 @@ /* TODO: index mode */ -#if defined(XFree86Server) - { -#if defined(XF86DRI) - ScreenPtr pScreen = xmesa->display; - ScrnInfoPtr pScrn = xf86Screens[xmesa->display->myNum]; - SISPtr pSiS = SISPTR (pScrn); - - if (pSiS->directRenderingEnabled) - { - SISSAREAPriv *saPriv = (SISSAREAPriv *) DRIGetSAREAPrivate (pScreen); - - drmContextPtr contextPtr; - - /* in DR, the action is done by DRI */ - hwcx->pDRIContextPriv = DRICreateContextPriv (pScreen, contextPtr, 0); - if (!contextPtr) - { - /* TODO */ - assert(0); - } - - hwcx->serialNumber = (int) *contextPtr; - hwcx->CurrentHwcxPtr = &(saPriv->CtxOwner); - hwcx->CurrentQueueLenPtr = pSiS->cmdQueueLenPtr; - /* hwcx->FrameCountPtr = */ - - /* what does this do? */ - /* - drmFreeReservedContextList (contextPtr); - */ - - /* TODO, set AGP command buffer */ - hwcx->AGPCmdModeEnabled = GL_FALSE; - } - else -#endif - { - hwcx->serialNumber = GlobalHwcxCountBase++; - hwcx->CurrentHwcxPtr = &GlobalCurrentHwcx; - hwcx->CurrentQueueLenPtr = pSiS->cmdQueueLenPtr; - /* hwcx->FrameCountPtr = */ - - /* TODO, set AGP command buffer */ - hwcx->AGPCmdModeEnabled = GL_FALSE; - } - } -#else { __DRIscreenPrivate *psp = xmesa->driContextPriv->driScreenPriv; SISDRIPtr priv = (SISDRIPtr) psp->pDevPriv; @@ -386,41 +295,40 @@ * use hHWContext is better, but limit ID to [0..2^31-1] (modify driver) * hHWContext is CARD32 */ - hwcx->serialNumber = xmesa->driContextPriv->hHWContext; - hwcx->CurrentHwcxPtr = &(saPriv->CtxOwner); - hwcx->CurrentQueueLenPtr = &(saPriv->QueueLength); - hwcx->FrameCountPtr = &(saPriv->FrameCount); + smesa->serialNumber = xmesa->driContextPriv->hHWContext; + smesa->CurrentHwcxPtr = &(saPriv->CtxOwner); + smesa->CurrentQueueLenPtr = &(saPriv->QueueLength); + smesa->FrameCountPtr = &(saPriv->FrameCount); /* set AGP */ - hwcx->AGPSize = priv->agp.size; - hwcx->AGPBase = priv->agp.map; - hwcx->AGPAddr = priv->agp.handle; + smesa->AGPSize = priv->agp.size; + smesa->AGPBase = priv->agp.map; + smesa->AGPAddr = priv->agp.handle; /* set AGP command buffer */ - hwcx->AGPCmdModeEnabled = GL_FALSE; - if (hwcx->AGPSize){ + smesa->AGPCmdModeEnabled = GL_FALSE; + if (smesa->AGPSize){ if(priv->AGPCmdBufSize){ - hwcx->AGPCmdBufBase = hwcx->AGPBase + priv->AGPCmdBufOffset; - hwcx->AGPCmdBufAddr = hwcx->AGPAddr + priv->AGPCmdBufOffset; - hwcx->AGPCmdBufSize = priv->AGPCmdBufSize; + smesa->AGPCmdBufBase = smesa->AGPBase + priv->AGPCmdBufOffset; + smesa->AGPCmdBufAddr = smesa->AGPAddr + priv->AGPCmdBufOffset; + smesa->AGPCmdBufSize = priv->AGPCmdBufSize; - hwcx->pAGPCmdBufNext = (DWORD *)&(saPriv->AGPCmdBufNext); - hwcx->AGPCmdModeEnabled = GL_TRUE; + smesa->pAGPCmdBufNext = (GLint *)&(saPriv->AGPCmdBufNext); + smesa->AGPCmdModeEnabled = GL_TRUE; } } } -#endif - hwcx->GlobalFlag = 0L; + smesa->GlobalFlag = 0L; - hwcx->swRenderFlag = 0; - hwcx->swForceRender = GL_FALSE; - hwcx->Primitive = 0; - hwcx->useFastPath = GL_FALSE; + smesa->swRenderFlag = 0; + smesa->swForceRender = GL_FALSE; + smesa->Primitive = 0; + smesa->useFastPath = GL_FALSE; /* TODO */ - /* hwcx->blockWrite = SGRAMbw = IsBlockWrite (); */ - hwcx->blockWrite = GL_FALSE; + /* smesa->blockWrite = SGRAMbw = IsBlockWrite (); */ + smesa->blockWrite = GL_FALSE; /* this function will over-write AGPCmdModeEnabled */ /* TODO: pay attention to side-effect */ @@ -428,54 +336,50 @@ sis_init_opengl_state (ctx); sis_set_buffer_static (ctx); - set_color_pattern (hwcx, 0, 0, 0, 0); - set_z_stencil_pattern (hwcx, 1.0, 0); + set_color_pattern (smesa, 0, 0, 0, 0); + set_z_stencil_pattern (smesa, 1.0, 0); /* TODO: need to clear cache? */ - hwcx->clearTexCache = GL_TRUE; + smesa->clearTexCache = GL_TRUE; - hwcx->AGPParseSet = 0x00000040; - hwcx->dwPrimitiveSet = 0x00060000; + smesa->AGPParseSet = 0x00000040; + smesa->dwPrimitiveSet = 0x00060000; for (i = 0; i < SIS_MAX_TEXTURES; i++) { - hwcx->TexStates[i] = 0; - hwcx->PrevTexFormat[i] = 0; + smesa->TexStates[i] = 0; + smesa->PrevTexFormat[i] = 0; } #if SIS_STEREO - hwcx->isFullScreen = GL_FALSE; - hwcx->stereoEnabled = GL_FALSE; + smesa->isFullScreen = GL_FALSE; + smesa->stereoEnabled = GL_FALSE; #endif } void SiSDestroyContext (XMesaContext xmesa) { - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); -#if defined(XFree86Server) && defined(XF86DRI) - DRIDestroyContextPriv ((DRIContextPrivPtr)hwcx->pDRIContextPriv); -#endif - /* * TODO: if the context ID given by kernel will be recycled, * then, the current ID will set to -1 if the current ID * is equal to my id */ - free (hwcx); + free (smesa); } void -sis_update_render_state (__GLSiScontext * hwcx, GLuint stateType) +sis_update_render_state (sisContextPtr smesa, GLuint stateType) { - __GLSiSHardware *prev = &hwcx->prev; + __GLSiSHardware *prev = &smesa->prev; mWait3DCmdQueue (45); - if (hwcx->GlobalFlag & GFLAG_ENABLESETTING) + if (smesa->GlobalFlag & GFLAG_ENABLESETTING) { - if (!hwcx->clearTexCache) + if (!smesa->clearTexCache) { MMIO (REG_3D_TEnable, prev->hwCapEnable); } @@ -483,17 +387,17 @@ { MMIO (REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear); MMIO (REG_3D_TEnable, prev->hwCapEnable); - hwcx->clearTexCache = GL_FALSE; + smesa->clearTexCache = GL_FALSE; } } - if (hwcx->GlobalFlag & GFLAG_ENABLESETTING2) + if (smesa->GlobalFlag & GFLAG_ENABLESETTING2) { MMIO (REG_3D_TEnable2, prev->hwCapEnable2); } /* Z Setting */ - if (hwcx->GlobalFlag & GFLAG_ZSETTING) + if (smesa->GlobalFlag & GFLAG_ZSETTING) { MMIO (REG_3D_ZSet, prev->hwZ); MMIO (REG_3D_ZStWriteMask, prev->hwZMask); @@ -501,12 +405,12 @@ } /* Alpha Setting */ - if (hwcx->GlobalFlag & GFLAG_ALPHASETTING) + if (smesa->GlobalFlag & GFLAG_ALPHASETTING) { MMIO (REG_3D_AlphaSet, prev->hwAlpha); } - if (hwcx->GlobalFlag & GFLAG_DESTSETTING) + if (smesa->GlobalFlag & GFLAG_DESTSETTING) { MMIO (REG_3D_DstSet, prev->hwDstSet); MMIO (REG_3D_DstAlphaWriteMask, prev->hwDstMask); @@ -515,14 +419,14 @@ /* Line Setting */ #if 0 - if (hwcx->GlobalFlag & GFLAG_LINESETTING) + if (smesa->GlobalFlag & GFLAG_LINESETTING) { MMIO(REG_3D_LinePattern, prev->hwLinePattern); } #endif /* Fog Setting */ - if (hwcx->GlobalFlag & GFLAG_FOGSETTING) + if (smesa->GlobalFlag & GFLAG_FOGSETTING) { MMIO (REG_3D_FogSet, prev->hwFog); MMIO (REG_3D_FogInverseDistance, prev->hwFogInverse); @@ -531,46 +435,46 @@ } /* Stencil Setting */ - if (hwcx->GlobalFlag & GFLAG_STENCILSETTING) + if (smesa->GlobalFlag & GFLAG_STENCILSETTING) { MMIO (REG_3D_StencilSet, prev->hwStSetting); MMIO (REG_3D_StencilSet2, prev->hwStSetting2); } /* Miscellaneous Setting */ - if (hwcx->GlobalFlag & GFLAG_DSTBLEND) + if (smesa->GlobalFlag & GFLAG_DSTBLEND) { MMIO (REG_3D_DstBlendMode, prev->hwDstSrcBlend); } - if (hwcx->GlobalFlag & GFLAG_CLIPPING) + if (smesa->GlobalFlag & GFLAG_CLIPPING) { MMIO (REG_3D_ClipTopBottom, prev->clipTopBottom); MMIO (REG_3D_ClipLeftRight, prev->clipLeftRight); } - hwcx->GlobalFlag &= ~GFLAG_RENDER_STATES; + smesa->GlobalFlag &= ~GFLAG_RENDER_STATES; } void -sis_update_texture_state (__GLSiScontext * hwcx) +sis_update_texture_state (sisContextPtr smesa) { - __GLSiSHardware *prev = &hwcx->prev; + __GLSiSHardware *prev = &smesa->prev; mWait3DCmdQueue (55); - if (hwcx->clearTexCache) + if (smesa->clearTexCache) { MMIO (REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear); MMIO (REG_3D_TEnable, prev->hwCapEnable); - hwcx->clearTexCache = GL_FALSE; + smesa->clearTexCache = GL_FALSE; } /* Texture Setting */ - if (hwcx->GlobalFlag & CFLAG_TEXTURERESET) + if (smesa->GlobalFlag & CFLAG_TEXTURERESET) { MMIO (REG_3D_TextureSet, prev->texture[0].hwTextureSet); } - if (hwcx->GlobalFlag & GFLAG_TEXTUREMIPMAP) + if (smesa->GlobalFlag & GFLAG_TEXTUREMIPMAP) { MMIO (REG_3D_TextureMip, prev->texture[0].hwTextureMip); } @@ -580,11 +484,11 @@ MMIO(REG_3D_TextureTransparencyColorLow, prev->texture[0].hwTextureClrLow); */ - if (hwcx->GlobalFlag & GFLAG_TEXBORDERCOLOR) + if (smesa->GlobalFlag & GFLAG_TEXBORDERCOLOR) { MMIO (REG_3D_TextureBorderColor, prev->texture[0].hwTextureBorderColor); } - if (hwcx->GlobalFlag & GFLAG_TEXTUREADDRESS) + if (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS) { MMIO (REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear); MMIO (REG_3D_TEnable, prev->hwCapEnable); @@ -623,21 +527,21 @@ MMIO (REG_3D_TexturePitch0, prev->texture[0].texPitch01); } } - if (hwcx->GlobalFlag & CFLAG_TEXTURERESET_1) + if (smesa->GlobalFlag & CFLAG_TEXTURERESET_1) { MMIO (REG_3D_Texture1Set, prev->texture[1].hwTextureSet); } - if (hwcx->GlobalFlag & GFLAG_TEXTUREMIPMAP_1) + if (smesa->GlobalFlag & GFLAG_TEXTUREMIPMAP_1) { MMIO (REG_3D_Texture1Mip, prev->texture[1].hwTextureMip); } - if (hwcx->GlobalFlag & GFLAG_TEXBORDERCOLOR_1) + if (smesa->GlobalFlag & GFLAG_TEXBORDERCOLOR_1) { MMIO (REG_3D_Texture1BorderColor, prev->texture[1].hwTextureBorderColor); } - if (hwcx->GlobalFlag & GFLAG_TEXTUREADDRESS_1) + if (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS_1) { switch ((prev->texture[1].hwTextureSet & MASK_TextureLevel) >> 8) { @@ -675,26 +579,26 @@ } /* texture environment */ - if (hwcx->GlobalFlag & GFLAG_TEXTUREENV) + if (smesa->GlobalFlag & GFLAG_TEXTUREENV) { MMIO (REG_3D_TextureBlendFactor, prev->hwTexEnvColor); MMIO (REG_3D_TextureColorBlendSet0, prev->hwTexBlendClr0); MMIO (REG_3D_TextureAlphaBlendSet0, prev->hwTexBlendAlpha0); } - if (hwcx->GlobalFlag & GFLAG_TEXTUREENV_1) + if (smesa->GlobalFlag & GFLAG_TEXTUREENV_1) { MMIO (REG_3D_TextureBlendFactor, prev->hwTexEnvColor); MMIO (REG_3D_TextureColorBlendSet1, prev->hwTexBlendClr1); MMIO (REG_3D_TextureAlphaBlendSet1, prev->hwTexBlendAlpha1); } - hwcx->GlobalFlag &= ~GFLAG_TEXTURE_STATES; + smesa->GlobalFlag &= ~GFLAG_TEXTURE_STATES; } void -sis_validate_all_state (__GLSiScontext * hwcx) +sis_validate_all_state (sisContextPtr smesa) { - __GLSiSHardware *prev = &hwcx->prev; + __GLSiSHardware *prev = &smesa->prev; mEndPrimitive (); mWait3DCmdQueue (40); @@ -804,7 +708,7 @@ } /* TODO */ - /* if (hwcx->ctx->Texture.Unit[1].ReallyEnabled) */ + /* if (smesa->ctx->Texture.Unit[1].ReallyEnabled) */ { MMIO (REG_3D_Texture1Set, prev->texture[1].hwTextureSet); MMIO (REG_3D_Texture1Mip, prev->texture[1].hwTextureMip); @@ -857,7 +761,7 @@ MMIO (REG_3D_TextureAlphaBlendSet1, prev->hwTexBlendAlpha1); } - hwcx->GlobalFlag = 0; + smesa->GlobalFlag = 0; } void @@ -865,10 +769,6 @@ { /* free video memory, or the framebuffer device will do it automatically */ -#ifdef XFree86Server - FatalError ("Fatal errors in libGLcore.a\n"); -#else fprintf(stderr, "Fatal errors in sis_dri.so\n"); exit (-1); -#endif } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_ctx.h Tue Aug 5 21:55:46 2003 @@ -35,7 +35,10 @@ #ifndef _sis_ctx_h_ #define _sis_ctx_h_ -#include "sis_common.h" +#include "context.h" + +#include "sis_screen.h" +#include "sis_common2.h" /* for GLboolean */ #include @@ -69,84 +72,87 @@ */ typedef struct __GLSiSTextureRec { - DWORD hwTextureSet; - DWORD hwTextureMip; - DWORD hwTextureClrHigh; - DWORD hwTextureClrLow; - DWORD hwTextureBorderColor; - - DWORD texOffset0; - DWORD texOffset1; - DWORD texOffset2; - DWORD texOffset3; - DWORD texOffset4; - DWORD texOffset5; - DWORD texOffset6; - DWORD texOffset7; - DWORD texOffset8; - DWORD texOffset9; - DWORD texOffset10; - DWORD texOffset11; - - DWORD texPitch01; - DWORD texPitch23; - DWORD texPitch45; - DWORD texPitch67; - DWORD texPitch89; - DWORD texPitch10; + GLint hwTextureSet; + GLint hwTextureMip; + GLint hwTextureClrHigh; + GLint hwTextureClrLow; + GLint hwTextureBorderColor; + + GLint texOffset0; + GLint texOffset1; + GLint texOffset2; + GLint texOffset3; + GLint texOffset4; + GLint texOffset5; + GLint texOffset6; + GLint texOffset7; + GLint texOffset8; + GLint texOffset9; + GLint texOffset10; + GLint texOffset11; + + GLint texPitch01; + GLint texPitch23; + GLint texPitch45; + GLint texPitch67; + GLint texPitch89; + GLint texPitch10; } __GLSiSTexture; typedef struct __GLSiSHardwareRec { - DWORD hwCapEnable, hwCapEnable2; /* Enable Setting */ + GLint hwCapEnable, hwCapEnable2; /* Enable Setting */ - DWORD hwOffsetZ, hwZ; /* Z Setting */ + GLint hwOffsetZ, hwZ; /* Z Setting */ - DWORD hwZBias, hwZMask; /* Z Setting */ + GLint hwZBias, hwZMask; /* Z Setting */ - DWORD hwAlpha; /* Alpha Setting */ + GLint hwAlpha; /* Alpha Setting */ - DWORD hwDstSet, hwDstMask; /* Destination Setting */ + GLint hwDstSet, hwDstMask; /* Destination Setting */ - DWORD hwOffsetDest; /* Destination Setting */ + GLint hwOffsetDest; /* Destination Setting */ - DWORD hwLinePattern; /* Line Setting */ + GLint hwLinePattern; /* Line Setting */ - DWORD hwFog; /* Fog Setting */ + GLint hwFog; /* Fog Setting */ - DWORD hwFogFar, hwFogInverse; /* Fog Distance setting */ + GLint hwFogFar, hwFogInverse; /* Fog Distance setting */ - DWORD hwFogDensity; /* Fog factor & density */ + GLint hwFogDensity; /* Fog factor & density */ - DWORD hwStSetting, hwStSetting2; /* Stencil Setting */ + GLint hwStSetting, hwStSetting2; /* Stencil Setting */ - DWORD hwStOffset; /* Stencil Setting */ + GLint hwStOffset; /* Stencil Setting */ - DWORD hwDstSrcBlend; /* Blending mode Setting */ + GLint hwDstSrcBlend; /* Blending mode Setting */ - DWORD clipTopBottom; /* Clip for Top & Bottom */ + GLint clipTopBottom; /* Clip for Top & Bottom */ - DWORD clipLeftRight; /* Clip for Left & Right */ + GLint clipLeftRight; /* Clip for Left & Right */ struct __GLSiSTextureRec texture[2]; - DWORD hwTexEnvColor; /* Texture Blending Setting */ + GLint hwTexEnvColor; /* Texture Blending Setting */ - DWORD hwTexBlendClr0; - DWORD hwTexBlendClr1; - DWORD hwTexBlendAlpha0; - DWORD hwTexBlendAlpha1; + GLint hwTexBlendClr0; + GLint hwTexBlendClr1; + GLint hwTexBlendAlpha0; + GLint hwTexBlendAlpha1; } __GLSiSHardware; /* Device dependent context state */ -typedef struct __GLSiScontextRec +typedef struct sis_context sisContextRec; +typedef struct sis_context *sisContextPtr; + +struct sis_context { /* This must be first in this structure */ - GLcontext *gc; + GLcontext *glCtx; unsigned int virtualX, virtualY; unsigned int bytesPerPixel; @@ -190,26 +196,27 @@ unsigned int AGPAddr; /* AGP Command Buffer */ - /* TODO: use Global variables */ + /* TODO: use Global variables */ + unsigned char *AGPCmdBufBase; - DWORD AGPCmdBufAddr; + GLint AGPCmdBufAddr; unsigned int AGPCmdBufSize; - DWORD *pAGPCmdBufNext; + GLint *pAGPCmdBufNext; GLboolean AGPCmdModeEnabled; GLboolean UseAGPCmdMode; /* register 0x89F4 */ - DWORD AGPParseSet; + GLint AGPParseSet; /* register 0x89F8 */ - DWORD dwPrimitiveSet; + GLint dwPrimitiveSet; __GLSiSHardware prev, current; - DWORD chipVer; + GLint chipVer; int Chipset; - DWORD drawableID; + GLint drawableID; /* SGRAM block write */ GLboolean blockWrite; @@ -220,10 +227,10 @@ /* Fast Path */ GLboolean useFastPath; - DWORD GlobalFlag; + GLint GlobalFlag; - DWORD rawLockMask; - DWORD lockMask; + GLint rawLockMask; + GLint lockMask; void (*SwapBuffers)(XMesaBuffer b); @@ -237,10 +244,6 @@ int serialNumber; -#if defined(XFree86Server) && defined(XF86DRI) - void *pDRIContextPriv; -#endif - GLboolean clearTexCache; GLuint TexStates[SIS_MAX_TEXTURES]; @@ -249,8 +252,11 @@ int *CurrentHwcxPtr; int *CurrentQueueLenPtr; unsigned int *FrameCountPtr; -} -__GLSiScontext; + + sisScreenPtr sisScreen; /* Screen private DRI data */ +}; + +#define SIS_CONTEXT(ctx) ((sisContextPtr)(ctx->DriverCtx)) /* Macros */ #define GET_IOBase(x) ((x)->IOBase) @@ -259,8 +265,8 @@ #define GET_DEPTH(x) ((x)->bytesPerPixel) #define GET_WIDTH(x) ((x)->displayWidth) #define GET_PITCH(x) ((x)->pitch) -#define GET_FbPos(hwcx,x,y) (GET_FbBase(hwcx)+(x)*GET_DEPTH(hwcx)\ - +(y)*GET_PITCH(hwcx)) +#define GET_FbPos(smesa,x,y) (GET_FbBase(smesa)+(x)*GET_DEPTH(smesa)\ + +(y)*GET_PITCH(smesa)) #define GET_ColorFormat(x) ((x)->colorFormat) @@ -269,13 +275,24 @@ #define GET_BMASK(x) ((x)->blueMask) #define GET_AMASK(x) ((x)->alphaMask) -/* update to hwcx->prev */ +extern GLboolean sisCreateContext( const __GLcontextModes *glVisual, + __DRIcontextPrivate *driContextPriv, + void *sharedContextPrivate ); +extern void sisDestroyContext( __DRIcontextPrivate * ); + +extern GLboolean sisMakeCurrent( __DRIcontextPrivate *driContextPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv ); + +extern GLboolean sisUnbindContext( __DRIcontextPrivate *driContextPriv ); + +/* update to smesa->prev */ extern void sis_update_drawable_state (GLcontext * ctx); /* update to hw */ -extern void sis_update_texture_state (__GLSiScontext * hwcx); -extern void sis_update_render_state (__GLSiScontext * hwcx, GLuint stateType); -extern void sis_validate_all_state (__GLSiScontext * hwcx); +extern void sis_update_texture_state (sisContextPtr smesa); +extern void sis_update_render_state (sisContextPtr smesa, GLuint stateType); +extern void sis_validate_all_state (sisContextPtr smesa); extern void sis_set_scissor (GLcontext * gc); diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_debug.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_debug.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_debug.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_debug.c Tue Aug 5 21:55:46 2003 @@ -53,7 +53,7 @@ char *prevLockFile = NULL; int prevLockLine = 0; -DWORD _empty[0x10000]; +GLint _empty[0x10000]; void dump_agp (void *addr, int dword_count) @@ -81,14 +81,14 @@ d2f_once (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); static int serialNumber = -1; - if (serialNumber == hwcx->serialNumber) + if (serialNumber == smesa->serialNumber) return; else - serialNumber = hwcx->serialNumber; + serialNumber = smesa->serialNumber; d2f(); } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_fastpath.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_fastpath.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_fastpath.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_fastpath.c Tue Aug 5 21:55:46 2003 @@ -68,14 +68,14 @@ #define WRITE_SMOOTH_W_T2(v) \ do{ \ - DWORD dcSARGB; \ + GLint dcSARGB; \ \ AGP_CurrentPtr[0] = VB->Win.data[v][0] - 0.5; \ AGP_CurrentPtr[1] = Y_FLIP (VB->Win.data[v][1]) + 0.5; \ AGP_CurrentPtr[2] = VB->Win.data[v][2] / 65535.0; \ AGP_CurrentPtr[3] = VB->Win.data[v][3]; \ RGBA8ConvertToBGRA8 (&dcSARGB, VB->ColorPtr->data[v]); \ - ((DWORD *)AGP_CurrentPtr)[4] = dcSARGB; \ + ((GLint *)AGP_CurrentPtr)[4] = dcSARGB; \ AGP_CurrentPtr[5] = VB->TexCoordPtr[0]->data[v][0]; \ AGP_CurrentPtr[6] = VB->TexCoordPtr[0]->data[v][1]; \ AGP_CurrentPtr[7] = VB->TexCoordPtr[1]->data[v][0]; \ @@ -108,9 +108,9 @@ GLuint count = VB->Count; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - if(!hwcx->useFastPath){ + if(!smesa->useFastPath){ gl_render_vb(VB); return; } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_fog.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_fog.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_fog.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_fog.c Tue Aug 5 21:55:46 2003 @@ -35,17 +35,16 @@ #include "sis_ctx.h" #include "sis_mesa.h" -static DWORD convertFtToFogFt (DWORD dwInValue); +static GLint convertFtToFogFt (GLint dwInValue); void sis_Fogfv (GLcontext * ctx, GLenum pname, const GLfloat * params) { - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *current = &smesa->current; GLubyte dwFogColor[4]; - DWORD dwArg; + GLint dwArg; float fArg; switch (pname) @@ -66,18 +65,18 @@ } break; case GL_FOG_DENSITY: - dwArg = *(DWORD *) (&(ctx->Fog.Density)); + dwArg = *(GLint *) (&(ctx->Fog.Density)); current->hwFogDensity = 0; current->hwFogDensity |= convertFtToFogFt (dwArg); break; case GL_FOG_START: case GL_FOG_END: fArg = 1.0 / (ctx->Fog.End - ctx->Fog.Start); - current->hwFogInverse = doFPtoFixedNoRound (*(DWORD *) (&fArg), 10); + current->hwFogInverse = doFPtoFixedNoRound (*(GLint *) (&fArg), 10); if (pname == GL_FOG_END) { - dwArg = *(DWORD *) (&(ctx->Fog.End)); - if (hwcx->Chipset == PCI_CHIP_SIS300) + dwArg = *(GLint *) (&(ctx->Fog.End)); + if (smesa->Chipset == PCI_CHIP_SIS300) { current->hwFogFar = doFPtoFixedNoRound (dwArg, 10); } @@ -91,20 +90,20 @@ /* TODO */ break; case GL_FOG_COLOR: - *((DWORD *) dwFogColor) = 0; + *((GLint *) dwFogColor) = 0; dwFogColor[2] = (GLubyte)((ctx->Fog.Color[0]) * 255.0); dwFogColor[1] = (GLubyte)((ctx->Fog.Color[1]) * 255.0); dwFogColor[0] = (GLubyte)((ctx->Fog.Color[2]) * 255.0); current->hwFog &= 0xff000000; - current->hwFog |= *((DWORD *) dwFogColor); + current->hwFog |= *((GLint *) dwFogColor); break; } } -DWORD -doFPtoFixedNoRound (DWORD dwInValue, int nFraction) +GLint +doFPtoFixedNoRound (GLint dwInValue, int nFraction) { - DWORD dwMantissa; + GLint dwMantissa; int nTemp; if (dwInValue == 0) @@ -132,11 +131,11 @@ } /* s[8].23->s[7].10 */ -static DWORD -convertFtToFogFt (DWORD dwInValue) +static GLint +convertFtToFogFt (GLint dwInValue) { - DWORD dwMantissa, dwExp; - DWORD dwRet; + GLint dwMantissa, dwExp; + GLint dwRet; if (dwInValue == 0) return 0; @@ -153,7 +152,7 @@ dwExp = (dwInValue & 0x7F800000) >> 23; dwExp -= 63; - if ((LONG) dwExp < 0) + if (dwExp < 0) return 0; if (dwExp <= 0x7F) diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_init.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_init.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_init.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_init.h Tue Aug 5 21:55:46 2003 @@ -35,13 +35,7 @@ #ifndef _sis_init_h_ #define _sis_init_h_ -typedef LONG fixed; - -typedef struct _FIXEDCOLOR -{ - fixed r, g, b, a; -} -FIXEDCOLOR; +typedef long fixed; /* XXX should this be a long? */ #define COMMANDMODE_MMIO 1 #define COMMANDMODE_WC 2 @@ -65,7 +59,7 @@ ((GLubyte *)fixedColor)[3] = ((GLubyte *)color)[3] ; \ } -/* Put ARGB into DWORD */ +/* Put ARGB into GLint */ #define setTSARGB(dcSARGB, fixedColor)\ {\ dcSARGB = ((fixedColor.a & 0x00ff0000) << 8 | \ @@ -81,13 +75,13 @@ #define MMIO(reg, value) \ {\ - *(LPDWORD)(GET_IOBase(hwcx) + (reg)) = value; \ + *(GLint *)(GET_IOBase(smesa) + (reg)) = value; \ } #define mEndPrimitive() \ { \ - *(GET_IOBase(hwcx) + REG_3D_EndPrimitiveList) = 0xFF; \ - *(DWORD *)(GET_IOBase(hwcx) + 0x8b60) = (DWORD)(-1); \ + *(GET_IOBase(smesa) + REG_3D_EndPrimitiveList) = 0xFF; \ + *(GLint *)(GET_IOBase(smesa) + 0x8b60) = (GLint)(-1); \ } #define INIT_6327_CapsEnable 0x00000080 @@ -202,13 +196,13 @@ /* Get lock before calling this */ #define mWait3DCmdQueue(wLen)\ do{\ - while ( *(hwcx->CurrentQueueLenPtr) < (int)(wLen))\ + while ( *(smesa->CurrentQueueLenPtr) < (int)(wLen))\ {\ - *(hwcx->CurrentQueueLenPtr) = \ - (int)(*(DWORD *)(GET_IOBase(hwcx) + REG_QUELEN) & MASK_QUELEN) \ + *(smesa->CurrentQueueLenPtr) = \ + (int)(*(GLint *)(GET_IOBase(smesa) + REG_QUELEN) & MASK_QUELEN) \ - (int)20; \ }\ - *(hwcx->CurrentQueueLenPtr) -= (int)(wLen);\ + *(smesa->CurrentQueueLenPtr) -= (int)(wLen);\ }while(0) #if 0 diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_linefunc.h Tue Aug 5 21:55:46 2003 @@ -35,7 +35,7 @@ #define SIS_TRI_FUNC 0 #define SIS_MMIO_WRITE_VERTEX(v, i) \ - if(SIS_STEREO && hwcx->stereoEnabled) \ + if(SIS_STEREO && smesa->stereoEnabled) \ { \ MMIOBase[(REG_3D_TSXa+(i)*0x30)/4] = VB->Win.data[v][0] - 0.5 + STEREO_OFFSET(v); \ MMIOBase[(REG_3D_TSYa+(i)*0x30)/4] = Y_FLIP (VB->Win.data[v][1]) + 0.5; \ @@ -103,29 +103,29 @@ \ if (SIS_STATES & (SIS_SMOOTH)) \ { \ - DWORD dcSARGB; \ + GLint dcSARGB; \ \ RGBA8ConvertToBGRA8 (&dcSARGB, VB->ColorPtr->data[v]); \ \ - ((DWORD *) MMIOBase)[(REG_3D_TSARGBa+(i)*0x30)/4] = dcSARGB; \ + ((GLint *) MMIOBase)[(REG_3D_TSARGBa+(i)*0x30)/4] = dcSARGB; \ } \ else if(LAST_VERTEX) \ { \ - DWORD dcSARGB; \ + GLint dcSARGB; \ \ RGBA8ConvertToBGRA8 (&dcSARGB, VB->ColorPtr->data[pv]); \ \ - ((DWORD *) MMIOBase)[(REG_3D_TSARGBa+(i)*0x30)/4] = dcSARGB; \ + ((GLint *) MMIOBase)[(REG_3D_TSARGBa+(i)*0x30)/4] = dcSARGB; \ } \ static void SIS_TAG (sis_line) (GLcontext * ctx, GLuint vert0, GLuint vert1, GLuint pv) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); struct vertex_buffer *VB = ctx->VB; - float *MMIOBase = (float *) GET_IOBase (hwcx); + float *MMIOBase = (float *) GET_IOBase (smesa); STEREO_SAMPLE(vert0); @@ -133,19 +133,19 @@ if (SIS_STATES & (SIS_SMOOTH)) { - hwcx->dwPrimitiveSet &= ~0x07001f07; - hwcx->dwPrimitiveSet |= + smesa->dwPrimitiveSet &= ~0x07001f07; + smesa->dwPrimitiveSet |= (OP_3D_FIRE_TSARGBb | SHADE_GOURAUD | OP_3D_LINE_DRAW); - ((DWORD *) MMIOBase)[REG_3D_PrimitiveSet / 4] = hwcx->dwPrimitiveSet; + ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet; } else { - hwcx->dwPrimitiveSet &= ~0x07001f07; - hwcx->dwPrimitiveSet |= + smesa->dwPrimitiveSet &= ~0x07001f07; + smesa->dwPrimitiveSet |= (OP_3D_FIRE_TSARGBb | SHADE_FLAT_VertexB | OP_3D_LINE_DRAW); - ((DWORD *) MMIOBase)[REG_3D_PrimitiveSet / 4] = hwcx->dwPrimitiveSet; + ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet; } #define LAST_VERTEX 0 @@ -157,14 +157,14 @@ /* debug mEndPrimitive (); - WaitEngIdle(hwcx); + WaitEngIdle(smesa); d2f_once (ctx); */ } #define SIS_AGP_WRITE_VERTEX(v) \ do{ \ -if(SIS_STEREO && hwcx->stereoEnabled) \ +if(SIS_STEREO && smesa->stereoEnabled) \ { \ AGP_CurrentPtr[0] = VB->Win.data[v][0] - 0.5 + STEREO_OFFSET(v); \ } \ @@ -201,16 +201,16 @@ if (SIS_STATES & (SIS_SMOOTH)) \ { \ RGBA8ConvertToBGRA8 (&dcSARGB, VB->ColorPtr->data[v]); \ - ((DWORD *)AGP_CurrentPtr)[0] = dcSARGB; \ + ((GLint *)AGP_CurrentPtr)[0] = dcSARGB; \ } \ else if(FIRST_VERTEX) \ { \ RGBA8ConvertToBGRA8 (&dcSARGB, VB->ColorPtr->data[pv]); \ - ((DWORD *)AGP_CurrentPtr)[0] = dcSARGB; \ + ((GLint *)AGP_CurrentPtr)[0] = dcSARGB; \ } \ else \ { \ - ((DWORD *)AGP_CurrentPtr)[0] = dcSARGB; \ + ((GLint *)AGP_CurrentPtr)[0] = dcSARGB; \ } \ AGP_CurrentPtr+=1; \ \ @@ -250,16 +250,16 @@ GLuint pv) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); struct vertex_buffer *VB = ctx->VB; - DWORD dcSARGB; + GLint dcSARGB; STEREO_SAMPLE(vert0); #if 0 - if ((DWORD) AGP_CurrentPtr - (DWORD) AGP_StartPtr >= (AGP_ALLOC_SIZE - 0x10)) + if ((GLint) AGP_CurrentPtr - (GLint) AGP_StartPtr >= (AGP_ALLOC_SIZE - 0x10)) { sis_FlushAGP (ctx); sis_StartAGP (ctx); diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_lock.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_lock.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_lock.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_lock.h Tue Aug 5 21:55:46 2003 @@ -71,24 +71,6 @@ #define DEBUG_CHECK_LOCK() #endif -#ifdef XFree86Server - -/* TODO, X-server will inform us if drawable state changed? */ -#define LOCK_HARDWARE() \ - do { \ - mEndPrimitive(); \ - sis_SetDrawBuffer (ctx, ctx->Color.DriverDrawBuffer); \ - if(*(hwcx->CurrentHwcxPtr) != hwcx->serialNumber) \ - sis_validate_all_state(hwcx); \ - } while (0) - -#define UNLOCK_HARDWARE() \ - do { \ - mEndPrimitive(); \ - } while (0) - -#else - #define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \ do { \ DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \ @@ -113,9 +95,9 @@ { \ sis_SetDrawBuffer (ctx, ctx->Color.DriverDrawBuffer); \ } \ - if(__ret && (*(hwcx->CurrentHwcxPtr) != hwcx->serialNumber)) \ + if(__ret && (*(smesa->CurrentHwcxPtr) != smesa->serialNumber)) \ { \ - sis_validate_all_state(hwcx); \ + sis_validate_all_state(smesa); \ } \ } while (0) @@ -126,11 +108,9 @@ __DRIscreenPrivate *sPriv = dPriv->driScreenPriv; \ mEndPrimitive(); \ DEBUG_RESET(); \ - *(hwcx->CurrentHwcxPtr) = hwcx->serialNumber; \ + *(smesa->CurrentHwcxPtr) = smesa->serialNumber; \ DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, \ dPriv->driContextPriv->hHWContext); \ } while (0) - -#endif #endif diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_mesa.c Tue Aug 5 21:55:46 2003 @@ -42,37 +42,37 @@ sis_RenderStart (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); LOCK_HARDWARE (); - if (hwcx->Primitive & hwcx->swRenderFlag) + if (smesa->Primitive & smesa->swRenderFlag) { - WaitEngIdle (hwcx); + WaitEngIdle (smesa); } if (ctx->Texture.ReallyEnabled) { sis_validate_texture (ctx); - if (hwcx->swRenderFlag & SIS_SW_TEXTURE) + if (smesa->swRenderFlag & SIS_SW_TEXTURE) { - hwcx->swForceRender = GL_TRUE; + smesa->swForceRender = GL_TRUE; gl_update_state(ctx); - hwcx->swForceRender = GL_FALSE; + smesa->swForceRender = GL_FALSE; } else { - if (hwcx->GlobalFlag & GFLAG_TEXTURE_STATES) - sis_update_texture_state (hwcx); + if (smesa->GlobalFlag & GFLAG_TEXTURE_STATES) + sis_update_texture_state (smesa); } } - if (hwcx->GlobalFlag & GFLAG_RENDER_STATES) + if (smesa->GlobalFlag & GFLAG_RENDER_STATES) { - sis_update_render_state (hwcx, 0); + sis_update_render_state (smesa, 0); } - if (hwcx->UseAGPCmdMode) + if (smesa->UseAGPCmdMode) { sis_StartAGP (ctx); } @@ -86,9 +86,9 @@ sis_RenderFinish (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - if (hwcx->UseAGPCmdMode) + if (smesa->UseAGPCmdMode) { sis_FlushAGP (ctx); } @@ -100,10 +100,10 @@ sis_ReducedPrimitiveChange (GLcontext * ctx, GLenum primitive) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); /* it is possible several primitive types per VB */ - if (hwcx->UseAGPCmdMode) + if (smesa->UseAGPCmdMode) { sis_FlushAGP (ctx); sis_StartAGP (ctx); @@ -120,22 +120,22 @@ /* TODO: if above rule changes, remember to modify */ } - hwcx->AGPParseSet &= ~0xf; + smesa->AGPParseSet &= ~0xf; switch (primitive) { case GL_POINT: case GL_POINTS: - hwcx->Primitive = SIS_SW_POINT; - hwcx->AGPParseSet |= 0x0; + smesa->Primitive = SIS_SW_POINT; + smesa->AGPParseSet |= 0x0; break; case GL_LINE: case GL_LINES: - hwcx->Primitive = SIS_SW_LINE; - hwcx->AGPParseSet |= 0x4; + smesa->Primitive = SIS_SW_LINE; + smesa->AGPParseSet |= 0x4; break; case GL_POLYGON: - hwcx->Primitive = SIS_SW_TRIANGLE; - hwcx->AGPParseSet |= 0x8; + smesa->Primitive = SIS_SW_TRIANGLE; + smesa->AGPParseSet |= 0x8; break; } } @@ -144,7 +144,7 @@ sis_init_driver (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); ctx->Driver.UpdateState = sis_UpdateState; @@ -216,7 +216,7 @@ ctx->Driver.RegisterPipelineStages = sis_RegisterPipelineStages; /* driver-specific */ - hwcx->SwapBuffers = sis_swap_buffers; + smesa->SwapBuffers = sis_swap_buffers; #ifdef SIS_USE_HW_CULL /* set capability flag */ @@ -228,10 +228,10 @@ sis_UpdateState (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; sis_set_render_func (ctx); @@ -283,7 +283,7 @@ int i; for (i = 0; i < SIS_MAX_TEXTURES; i++) { - hwcx->TexStates[i] |= (NEW_TEXTURING | NEW_TEXTURE_ENV); + smesa->TexStates[i] |= (NEW_TEXTURING | NEW_TEXTURE_ENV); } } #endif @@ -293,14 +293,14 @@ if (current->hwCapEnable ^ prev->hwCapEnable) { prev->hwCapEnable = current->hwCapEnable; - hwcx->GlobalFlag |= GFLAG_ENABLESETTING; + smesa->GlobalFlag |= GFLAG_ENABLESETTING; } /* enable setting 2 */ if (current->hwCapEnable2 ^ prev->hwCapEnable2) { prev->hwCapEnable2 = current->hwCapEnable2; - hwcx->GlobalFlag |= GFLAG_ENABLESETTING2; + smesa->GlobalFlag |= GFLAG_ENABLESETTING2; } /* TODO: if fog disable, don't check */ @@ -310,22 +310,22 @@ if (current->hwFog ^ prev->hwFog) { prev->hwFog = current->hwFog; - hwcx->GlobalFlag |= GFLAG_FOGSETTING; + smesa->GlobalFlag |= GFLAG_FOGSETTING; } if (current->hwFogFar ^ prev->hwFogFar) { prev->hwFogFar = current->hwFogFar; - hwcx->GlobalFlag |= GFLAG_FOGSETTING; + smesa->GlobalFlag |= GFLAG_FOGSETTING; } if (current->hwFogInverse ^ prev->hwFogInverse) { prev->hwFogInverse = current->hwFogInverse; - hwcx->GlobalFlag |= GFLAG_FOGSETTING; + smesa->GlobalFlag |= GFLAG_FOGSETTING; } if (current->hwFogDensity ^ prev->hwFogDensity) { prev->hwFogDensity = current->hwFogDensity; - hwcx->GlobalFlag |= GFLAG_FOGSETTING; + smesa->GlobalFlag |= GFLAG_FOGSETTING; } } @@ -337,16 +337,16 @@ * will be called */ #if SIS_STEREO - if(hwcx->isFullScreen && + if(smesa->isFullScreen && (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT) && - hwcx->useStereo) + smesa->useStereo) { - if(!hwcx->stereoEnabled){ + if(!smesa->stereoEnabled){ sis_init_stereo(ctx); } } else{ - if(hwcx->stereoEnabled){ + if(smesa->stereoEnabled){ sis_final_stereo(ctx); } } @@ -362,18 +362,18 @@ sis_set_buffer_static (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; GLvisual *visual = ctx->Visual; - switch (hwcx->bytesPerPixel) + switch (smesa->bytesPerPixel) { case 2: /* TODO: don't check - if (hwcx->redMask == 0xf800 && hwcx->greenMask == 0x07e0 && - hwcx->blueMask == 0x001f) + if (smesa->redMask == 0xf800 && smesa->greenMask == 0x07e0 && + smesa->blueMask == 0x001f) */ { current->hwDstSet |= DST_FORMAT_RGB_565; @@ -381,8 +381,8 @@ break; case 4: /* - if (hwcx->redMask == 0xff0000 && hwcx->greenMask == 0xff00 && - hwcx->blueMask == 0xff) + if (smesa->redMask == 0xff0000 && smesa->greenMask == 0xff00 && + smesa->blueMask == 0xff) */ { switch (visual->AlphaBits) @@ -407,36 +407,36 @@ case 0: current->hwCapEnable &= ~MASK_ZWriteEnable; case 16: - hwcx->zFormat = Z_16; + smesa->zFormat = Z_16; current->hwCapEnable |= MASK_ZWriteEnable; break; case 32: - hwcx->zFormat = Z_32; + smesa->zFormat = Z_32; current->hwCapEnable |= MASK_ZWriteEnable; break; case 24: assert (visual->StencilBits); - hwcx->zFormat = S_8_Z_24; + smesa->zFormat = S_8_Z_24; current->hwCapEnable |= MASK_StencilBufferEnable; current->hwCapEnable |= MASK_ZWriteEnable; break; } current->hwZ &= ~MASK_ZBufferFormat; - current->hwZ |= hwcx->zFormat; + current->hwZ |= smesa->zFormat; /* Destination Color Format */ if (current->hwDstSet ^ prev->hwDstSet) { prev->hwDstSet = current->hwDstSet; - hwcx->GlobalFlag |= GFLAG_DESTSETTING; + smesa->GlobalFlag |= GFLAG_DESTSETTING; } /* Z Buffer Data Format */ if (current->hwZ ^ prev->hwZ) { prev->hwZ = current->hwZ; - hwcx->GlobalFlag |= GFLAG_ZSETTING; + smesa->GlobalFlag |= GFLAG_ZSETTING; } sis_sw_set_zfuncs_static (ctx); @@ -446,11 +446,11 @@ sis_Finish (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); sis_Flush (ctx); - WaitEngIdle (hwcx); + WaitEngIdle (smesa); } void @@ -463,10 +463,10 @@ sis_AlphaFunc (GLcontext * ctx, GLenum func, GLclampf ref) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; /* TODO: ref is type GLclampf, but mesa has scaled it to 0 - 255.0 */ current->hwAlpha = ((unsigned char) ref) << 16; @@ -502,7 +502,7 @@ } prev->hwAlpha = current->hwAlpha; - hwcx->GlobalFlag |= GFLAG_ALPHASETTING; + smesa->GlobalFlag |= GFLAG_ALPHASETTING; } void @@ -516,10 +516,10 @@ sis_BlendFunc (GLcontext * ctx, GLenum sfactor, GLenum dfactor) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; /* TODO: in ICD, if no blend, it will reset these value */ /* blending enable */ @@ -587,7 +587,7 @@ if (current->hwDstSrcBlend ^ prev->hwDstSrcBlend) { prev->hwDstSrcBlend = current->hwDstSrcBlend; - hwcx->GlobalFlag |= GFLAG_DSTBLEND; + smesa->GlobalFlag |= GFLAG_DSTBLEND; } } @@ -602,17 +602,17 @@ { #ifdef SIS_USE_HW_CULL XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - hwcx->AGPParseSet &= ~0x00008000; - hwcx->dwPrimitiveSet &= ~0x08000000; + smesa->AGPParseSet &= ~0x00008000; + smesa->dwPrimitiveSet &= ~0x08000000; /* TODO : GL_FRONT_AND_BACK must be handled elsewhere */ if((mode == GL_FRONT && ctx->Polygon.FrontFace == GL_CCW) || (mode == GL_BACK && ctx->Polygon.FrontFace == GL_CW)) { - hwcx->AGPParseSet |= 0x00008000; - hwcx->dwPrimitiveSet |= 0x08000000; + smesa->AGPParseSet |= 0x00008000; + smesa->dwPrimitiveSet |= 0x08000000; } #endif } @@ -629,9 +629,9 @@ sis_DepthFunc (GLcontext * ctx, GLenum func) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; GLuint hwZFunc = 0; @@ -669,7 +669,7 @@ { prev->hwZ = current->hwZ; - hwcx->GlobalFlag |= GFLAG_ZSETTING; + smesa->GlobalFlag |= GFLAG_ZSETTING; } } @@ -677,9 +677,9 @@ sis_DepthMask (GLcontext * ctx, GLboolean flag) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; if (ctx->Visual->StencilBits) { @@ -693,13 +693,13 @@ else { current->hwCapEnable2 |= MASK_ZMaskWriteEnable; - current->hwZMask = ((DWORD) ctx->Stencil.WriteMask << 24) | + current->hwZMask = ((GLint) ctx->Stencil.WriteMask << 24) | ((flag) ? 0x00ffffff : 0); if (current->hwZMask ^ prev->hwZMask) { prev->hwZMask = current->hwZMask; - hwcx->GlobalFlag |= GFLAG_ZSETTING; + smesa->GlobalFlag |= GFLAG_ZSETTING; } } } @@ -732,9 +732,9 @@ sis_Enable (GLcontext * ctx, GLenum cap, GLboolean state) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *current = &smesa->current; switch (cap) { @@ -947,8 +947,8 @@ { #if 0 XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *current = &smesa->current; #endif switch (target) @@ -1022,9 +1022,9 @@ GLubyte blue, GLubyte alpha) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - set_color_pattern (hwcx, red, green, blue, alpha); + set_color_pattern (smesa, red, green, blue, alpha); } @@ -1037,10 +1037,10 @@ void sis_set_render_pos(GLcontext * ctx, GLubyte *base, GLuint pitch) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; assert (base != NULL); @@ -1050,10 +1050,10 @@ } /* software render */ - hwcx->swRenderBase = base; - hwcx->swRenderPitch = pitch; + smesa->swRenderBase = base; + smesa->swRenderPitch = pitch; - current->hwOffsetDest = ((DWORD) base - (DWORD) GET_FbBase (hwcx)) >> 1; + current->hwOffsetDest = ((GLint) base - (GLint) GET_FbBase (smesa)) >> 1; current->hwDstSet &= ~MASK_DstBufferPitch; current->hwDstSet |= pitch >> 2; @@ -1061,13 +1061,13 @@ if (current->hwDstSet ^ prev->hwDstSet) { prev->hwDstSet = current->hwDstSet; - hwcx->GlobalFlag |= GFLAG_DESTSETTING; + smesa->GlobalFlag |= GFLAG_DESTSETTING; } if (current->hwOffsetDest ^ prev->hwOffsetDest) { prev->hwOffsetDest = current->hwOffsetDest; - hwcx->GlobalFlag |= GFLAG_DESTSETTING; + smesa->GlobalFlag |= GFLAG_DESTSETTING; } } @@ -1075,7 +1075,7 @@ sis_SetDrawBuffer (GLcontext * ctx, GLenum mode) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); XMesaBuffer xm_buffer = xmesa->xm_buffer; GLubyte *base; @@ -1093,7 +1093,7 @@ break; case GL_FRONT_LEFT: base = sis_get_drawable_pos (xmesa); - pitch = GET_PITCH (hwcx); + pitch = GET_PITCH (smesa); retval = GL_TRUE; break; case GL_BACK_RIGHT: @@ -1121,10 +1121,10 @@ GLboolean bmask, GLboolean amask) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; if (rmask & gmask & bmask & @@ -1138,16 +1138,16 @@ current->hwCapEnable2 |= (MASK_AlphaMaskWriteEnable | MASK_ColorMaskWriteEnable); - current->hwDstMask = (rmask) ? GET_RMASK (hwcx) : 0 | - (gmask) ? GET_GMASK (hwcx) : 0 | - (bmask) ? GET_BMASK (hwcx) : 0 | - (amask) ? GET_AMASK (hwcx) : 0; + current->hwDstMask = (rmask) ? GET_RMASK (smesa) : 0 | + (gmask) ? GET_GMASK (smesa) : 0 | + (bmask) ? GET_BMASK (smesa) : 0 | + (amask) ? GET_AMASK (smesa) : 0; } if (current->hwDstMask ^ prev->hwDstMask) { prev->hwDstMask = current->hwDstMask; - hwcx->GlobalFlag |= GFLAG_DESTSETTING; + smesa->GlobalFlag |= GFLAG_DESTSETTING; } return GL_TRUE; @@ -1157,10 +1157,10 @@ sis_LogicOp (GLcontext * ctx, GLenum op) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; if (ctx->Color.ColorLogicOpEnabled) { @@ -1220,7 +1220,7 @@ if (current->hwDstSet ^ prev->hwDstSet) { prev->hwDstSet = current->hwDstSet; - hwcx->GlobalFlag |= GFLAG_DESTSETTING; + smesa->GlobalFlag |= GFLAG_DESTSETTING; } } return GL_TRUE; @@ -1230,9 +1230,9 @@ sis_Dither (GLcontext * ctx, GLboolean enable) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *current = &smesa->current; if (enable) { @@ -1273,9 +1273,9 @@ const GLvoid * pixels) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - WaitEngIdle (hwcx); + WaitEngIdle (smesa); return 0; } @@ -1285,11 +1285,11 @@ const GLubyte * bitmap) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); ctx->Driver.RenderStart( ctx ); - WaitEngIdle (hwcx); + WaitEngIdle (smesa); /* TODO: use tdfx's Bitmap */ ctx->Driver.RenderFinish( ctx ); @@ -1298,20 +1298,20 @@ } void -set_color_pattern (__GLSiScontext * hwcx, GLubyte red, GLubyte green, +set_color_pattern (sisContextPtr smesa, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { /* XXX only RGB565 and ARGB8888 */ - switch (GET_ColorFormat (hwcx)) + switch (GET_ColorFormat (smesa)) { case DST_FORMAT_ARGB_8888: - hwcx->clearColorPattern = (alpha << 24) + + smesa->clearColorPattern = (alpha << 24) + (red << 16) + (green << 8) + (blue); break; case DST_FORMAT_RGB_565: - hwcx->clearColorPattern = ((red >> 3) << 11) + + smesa->clearColorPattern = ((red >> 3) << 11) + ((green >> 2) << 5) + (blue >> 3); - hwcx->clearColorPattern |= hwcx->clearColorPattern << 16; + smesa->clearColorPattern |= smesa->clearColorPattern << 16; break; default: assert (0); @@ -1319,7 +1319,7 @@ } void -set_z_stencil_pattern (__GLSiScontext * hwcx, GLclampd z, int stencil) +set_z_stencil_pattern (sisContextPtr smesa, GLclampd z, int stencil) { GLuint zPattern, stencilPattern; GLboolean dword_pattern; @@ -1329,11 +1329,11 @@ else if (z >= (float) 1.0) zPattern = 0xFFFFFFFF; else - zPattern = doFPtoFixedNoRound (*(DWORD *) & z, 32); + zPattern = doFPtoFixedNoRound (*(GLint *) & z, 32); stencilPattern = 0; - switch (hwcx->zFormat) + switch (smesa->zFormat) { case Z_16: zPattern = zPattern >> 16; @@ -1352,20 +1352,20 @@ default: assert (0); } - hwcx->clearZStencilPattern = zPattern | stencilPattern; + smesa->clearZStencilPattern = zPattern | stencilPattern; /* ?? */ if (!dword_pattern) - hwcx->clearZStencilPattern |= (zPattern | stencilPattern) << 16; + smesa->clearZStencilPattern |= (zPattern | stencilPattern) << 16; } void sis_update_drawable_state (GLcontext * ctx) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *current = &hwcx->current; - __GLSiSHardware *prev = &hwcx->prev; + __GLSiSHardware *current = &smesa->current; + __GLSiSHardware *prev = &smesa->prev; XMesaBuffer xm_buffer = xmesa->xm_buffer; GLuint z_depth; @@ -1373,7 +1373,7 @@ sis_SetDrawBuffer (ctx, ctx->Color.DriverDrawBuffer); /* TODO: call sis_SetReadBuffer? */ - switch (hwcx->zFormat) + switch (smesa->zFormat) { case Z_16: z_depth = 2; @@ -1389,8 +1389,8 @@ current->hwZ &= ~MASK_ZBufferPitch; current->hwZ |= xm_buffer->width * z_depth >> 2; /* TODO, in xfree 3.9.18, no ctx->Buffer */ - current->hwOffsetZ = ((DWORD) (xm_buffer->depthbuffer) - - (DWORD) GET_FbBase (hwcx)) >> 2; + current->hwOffsetZ = ((GLint) (xm_buffer->depthbuffer) - + (GLint) GET_FbBase (smesa)) >> 2; if ((current->hwOffsetZ ^ prev->hwOffsetZ) || (current->hwZ ^ prev->hwZ)) @@ -1399,7 +1399,7 @@ prev->hwZ = current->hwZ; /* Z setting */ - hwcx->GlobalFlag |= GFLAG_ZSETTING; + smesa->GlobalFlag |= GFLAG_ZSETTING; } } @@ -1408,19 +1408,17 @@ { GET_CURRENT_CONTEXT(ctx); XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *current = &hwcx->current; - __GLSiSHardware *prev = &hwcx->prev; + __GLSiSHardware *current = &smesa->current; + __GLSiSHardware *prev = &smesa->prev; GLuint winwidth, winheight; XMesaBuffer xm_buffer = xmesa->xm_buffer; -#ifndef XFree86Server SIS_VALIDATE_DRAWABLE_INFO (xmesa->display, xmesa->driContextPriv->driScreenPriv, xmesa->driContextPriv->driDrawablePriv); -#endif sis_get_drawable_size (xmesa, &winwidth, &winheight); *width = winwidth; @@ -1439,15 +1437,15 @@ xm_buffer->width = winwidth; xm_buffer->height = winheight; - /* update hwcx->isFullScreen */ + /* update smesa->isFullScreen */ /* TODO: Does X-server have exclusive-mode? */ /* TODO: physical screen width/height will be changed dynamicly */ #if SIS_STEREO - if((hwcx->virtualX == winwidth) && (hwcx->virtualY == winheight)) - hwcx->isFullScreen = GL_TRUE; + if((smesa->virtualX == winwidth) && (smesa->virtualY == winheight)) + smesa->isFullScreen = GL_TRUE; else - hwcx->isFullScreen = GL_FALSE; + smesa->isFullScreen = GL_FALSE; #endif if (xm_buffer->db_state) @@ -1461,7 +1459,7 @@ if (ctx->Visual->DepthBits) sis_alloc_z_stencil_buffer (ctx); - switch (hwcx->zFormat) + switch (smesa->zFormat) { case Z_16: z_depth = 2; @@ -1480,8 +1478,8 @@ current->hwZ &= ~MASK_ZBufferPitch; current->hwZ |= xm_buffer->width * z_depth >> 2; /* TODO, in xfree 3.9.18, no ctx->Buffer */ - current->hwOffsetZ = ((DWORD) (xm_buffer->depthbuffer) - - (DWORD) GET_FbBase (hwcx)) >> 2; + current->hwOffsetZ = ((GLint) (xm_buffer->depthbuffer) - + (GLint) GET_FbBase (smesa)) >> 2; if ((current->hwOffsetZ ^ prev->hwOffsetZ) || (current->hwZ ^ prev->hwZ)) @@ -1490,7 +1488,7 @@ prev->hwZ = current->hwZ; /* Z setting */ - hwcx->GlobalFlag |= GFLAG_ZSETTING; + smesa->GlobalFlag |= GFLAG_ZSETTING; } } @@ -1508,11 +1506,7 @@ switch (name) { case GL_RENDERER: -#ifdef XFree86Server - return (GLubyte *)"SIS 300/630/530 IR Mode"; -#else return (GLubyte *)"SiS 300/630/530 DR Mode"; -#endif default: return NULL; } @@ -1528,10 +1522,10 @@ sis_set_scissor (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; GLint x1, y1, x2, y2; @@ -1573,6 +1567,6 @@ { prev->clipTopBottom = current->clipTopBottom; prev->clipLeftRight = current->clipLeftRight; - hwcx->GlobalFlag |= GFLAG_CLIPPING; + smesa->GlobalFlag |= GFLAG_CLIPPING; } } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_mesa.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_mesa.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_mesa.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_mesa.h Tue Aug 5 21:55:46 2003 @@ -35,6 +35,8 @@ #ifndef _sis_mesa_h_ #define _sis_mesa_h_ +#include "tnl/t_context.h" + void sis_UpdateState (GLcontext * ctx); void sis_ClearIndex (GLcontext * ctx, GLuint index); void sis_ClearColor (GLcontext * ctx, GLubyte red, GLubyte green, @@ -188,17 +190,17 @@ /* * Local */ -void set_color_pattern (__GLSiScontext * hwcx, GLubyte red, GLubyte green, +void set_color_pattern (sisContextPtr smesa, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -void set_z_stencil_pattern (__GLSiScontext * hwcx, GLclampd z, int stencil); +void set_z_stencil_pattern (sisContextPtr smesa, GLclampd z, int stencil); void sis_init_driver (GLcontext * ctx); void sis_sw_init_driver (GLcontext * ctx); void sis_sw_set_zfuncs_static (GLcontext * ctx); -void WaitEngIdle (__GLSiScontext * hwcx); -void Wait2DEngIdle (__GLSiScontext * hwcx); +void WaitEngIdle (sisContextPtr smesa); +void Wait2DEngIdle (sisContextPtr smesa); void sis_set_buffer_static (GLcontext * ctx); void sis_set_render_pos(GLcontext * ctx, GLubyte *base, GLuint pitch); diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_render.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_render.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_render.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_render.c Tue Aug 5 21:55:47 2003 @@ -46,13 +46,13 @@ #define SIS_DEPTH_SCALE 1.0 /* - * TODO: assert(hwcx->AGPCmdBufSize % AGP_ALLOC_SIZE == 0) + * TODO: assert(smesa->AGPCmdBufSize % AGP_ALLOC_SIZE == 0) * depends on VB_SIZE is better */ #define AGP_ALLOC_SIZE 0x10000 /* #define AGP_ALLOC_SIZE (VB_SIZE/3*4 * 9) */ -static DWORD AGP_EngineOffset; -static DWORD *AGP_StartPtr; +static GLint AGP_EngineOffset; +static GLint *AGP_StartPtr; /* export to sis_fastpath.c */ float *AGP_CurrentPtr; @@ -179,7 +179,7 @@ sis_line_clip (GLcontext * ctx, GLuint vert0, GLuint vert1, GLuint pv) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); BoxPtr pExtents; int count; @@ -190,7 +190,7 @@ while (count--) { - DWORD clipTopBottom, clipLeftRight; + GLint clipTopBottom, clipLeftRight; clipTopBottom = ((pExtents->y1 - y) << 13) | (pExtents->y2 - y - 1); clipLeftRight = ((pExtents->x1 - x) << 13) | (pExtents->x2 - x - 1); @@ -200,12 +200,12 @@ MMIO (REG_3D_ClipTopBottom, clipTopBottom); MMIO (REG_3D_ClipLeftRight, clipLeftRight); - (hwcx->LineFunc) (ctx, vert0, vert1, pv); + (smesa->LineFunc) (ctx, vert0, vert1, pv); mEndPrimitive (); pExtents++; } - hwcx->GlobalFlag |= GFLAG_CLIPPING; + smesa->GlobalFlag |= GFLAG_CLIPPING; } static triangle_func sis_fill_triangle_func[32] = { @@ -254,7 +254,7 @@ #define USE_FLAT 0x0001000 #define USE_SMOOTH 0x0004000 -static DWORD AGPParsingValues[32] = { +static GLint AGPParsingValues[32] = { (4 << 28) | USE_XYZ | USE_RGB | USE_FLAT, (4 << 28) | USE_XYZ | USE_RGB | USE_SMOOTH, (5 << 28) | USE_XYZ | USE_W | USE_RGB | USE_FLAT, @@ -277,7 +277,7 @@ sis_tri_clip (GLcontext * ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); BoxPtr pExtents; int count; @@ -288,7 +288,7 @@ while (count--) { - DWORD clipTopBottom, clipLeftRight; + GLint clipTopBottom, clipLeftRight; clipTopBottom = ((pExtents->y1 - y) << 13) | (pExtents->y2 - y - 1); clipLeftRight = ((pExtents->x1 - x) << 13) | (pExtents->x2 - x - 1); @@ -298,32 +298,32 @@ MMIO (REG_3D_ClipTopBottom, clipTopBottom); MMIO (REG_3D_ClipLeftRight, clipLeftRight); - (hwcx->TriangleFunc) (ctx, v0, v1, v2, pv); + (smesa->TriangleFunc) (ctx, v0, v1, v2, pv); mEndPrimitive (); pExtents++; } - hwcx->GlobalFlag |= GFLAG_CLIPPING; + smesa->GlobalFlag |= GFLAG_CLIPPING; } void sis_set_render_func (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); GLuint caps = ctx->TriangleCaps; int line_index = 0; int tri_index = 0; - if(hwcx->swForceRender){ + if(smesa->swForceRender){ ctx->Driver.LineFunc = NULL; ctx->Driver.TriangleFunc = NULL; return; } ctx->IndirectTriangles &= ~(DD_LINE_SW_RASTERIZE | DD_TRI_SW_RASTERIZE); - hwcx->swRenderFlag &= ~(SIS_SW_POINT | SIS_SW_LINE | SIS_SW_TRIANGLE); + smesa->swRenderFlag &= ~(SIS_SW_POINT | SIS_SW_LINE | SIS_SW_TRIANGLE); /* * TODO: Mesa 3.3 will set ctx->TriangleCaps to DD_SELECT @@ -339,18 +339,18 @@ #endif /* always set */ - hwcx->swRenderFlag |= SIS_SW_POINT; + smesa->swRenderFlag |= SIS_SW_POINT; if ((caps & DD_LINE_STIPPLE) || (caps & DD_LINE_WIDTH)) { line_index |= SIS_FALLBACK; - hwcx->swRenderFlag |= SIS_SW_LINE; + smesa->swRenderFlag |= SIS_SW_LINE; } if ((caps & DD_TRI_STIPPLE)) { tri_index |= SIS_FALLBACK; - hwcx->swRenderFlag |= SIS_SW_TRIANGLE; + smesa->swRenderFlag |= SIS_SW_TRIANGLE; } if (ctx->Light.ShadeModel == GL_SMOOTH) @@ -383,27 +383,27 @@ } /* TODO, use Pick */ - hwcx->UseAGPCmdMode = GL_FALSE; + smesa->UseAGPCmdMode = GL_FALSE; if (line_index & SIS_FALLBACK) { ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE; - hwcx->LineFunc = NULL; + smesa->LineFunc = NULL; } else { if ((ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT) && sis_is_window (xmesa)) { - hwcx->LineFunc = sis_draw_line_func[line_index]; + smesa->LineFunc = sis_draw_line_func[line_index]; ctx->Driver.LineFunc = sis_line_clip; } else { - if (hwcx->AGPCmdModeEnabled) + if (smesa->AGPCmdModeEnabled) { ctx->Driver.LineFunc = sis_agp_draw_line_func[line_index]; - hwcx->UseAGPCmdMode = GL_TRUE; + smesa->UseAGPCmdMode = GL_TRUE; } else { @@ -415,22 +415,22 @@ if (tri_index & SIS_FALLBACK) { ctx->IndirectTriangles |= DD_TRI_SW_RASTERIZE; - hwcx->TriangleFunc = NULL; + smesa->TriangleFunc = NULL; } else { if ((ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT) && sis_is_window (xmesa)) { - hwcx->TriangleFunc = sis_fill_triangle_func[tri_index]; + smesa->TriangleFunc = sis_fill_triangle_func[tri_index]; ctx->Driver.TriangleFunc = sis_tri_clip; } else { - if (hwcx->AGPCmdModeEnabled) + if (smesa->AGPCmdModeEnabled) { ctx->Driver.TriangleFunc = sis_agp_fill_triangle_func[tri_index]; - hwcx->UseAGPCmdMode = GL_TRUE; + smesa->UseAGPCmdMode = GL_TRUE; } else { @@ -443,20 +443,20 @@ if(!(ctx->TriangleCaps & (DD_TRI_UNFILLED | DD_TRI_LIGHT_TWOSIDE)) && (ctx->Driver.TriangleFunc == sis_agp_tri_smooth_w_t2) && (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT)){ - hwcx->useFastPath = GL_TRUE; + smesa->useFastPath = GL_TRUE; } else{ - hwcx->useFastPath = GL_FALSE; + smesa->useFastPath = GL_FALSE; } /* TODO: AGP and MMIO use different sis_set_render_state */ - hwcx->AGPParseSet &= ~0xffff7000; - hwcx->AGPParseSet |= AGPParsingValues[line_index & ~SIS_FALLBACK]; + smesa->AGPParseSet &= ~0xffff7000; + smesa->AGPParseSet |= AGPParsingValues[line_index & ~SIS_FALLBACK]; /* Debug, test sw-render ctx->Driver.LineFunc = NULL; ctx->Driver.TriangleFunc = NULL; - hwcx->swRenderFlag = ~0x0; + smesa->swRenderFlag = ~0x0; ctx->Visual->DepthMax = (sizeof(GLdepth)==2)?0xffff:0xffffffff; ctx->Visual->DepthMaxF = (double)(sizeof(GLdepth)==2)?0xffff:0xffffffff; */ @@ -466,13 +466,13 @@ sis_StartAGP (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - DWORD start, end; + GLint start, end; - start = *(hwcx->pAGPCmdBufNext); + start = *(smesa->pAGPCmdBufNext); end = start + AGP_ALLOC_SIZE; - if (end >= hwcx->AGPCmdBufSize) + if (end >= smesa->AGPCmdBufSize) { start = 0; end = AGP_ALLOC_SIZE; @@ -486,13 +486,13 @@ do { AGP_EngineOffset = - *(DWORD volatile *) (GET_IOBase (hwcx) + REG_3D_AGPCmBase) - - (DWORD) hwcx->AGPCmdBufAddr; + *(GLint volatile *) (GET_IOBase (smesa) + REG_3D_AGPCmBase) - + (GLint) smesa->AGPCmdBufAddr; } while ((AGP_EngineOffset <= end) && (AGP_EngineOffset >= start) - && ((*(GET_IOBase (hwcx) + 0x8243) & 0xe0) != 0xe0)); + && ((*(GET_IOBase (smesa) + 0x8243) & 0xe0) != 0xe0)); - AGP_StartPtr = (DWORD *) (start + hwcx->AGPCmdBufBase); + AGP_StartPtr = (GLint *) (start + smesa->AGPCmdBufBase); AGP_CurrentPtr = (float *) AGP_StartPtr; } @@ -500,27 +500,27 @@ sis_FlushAGP (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); /* TODO: wait queue length */ - if((DWORD *)AGP_CurrentPtr == AGP_StartPtr) + if((GLint *)AGP_CurrentPtr == AGP_StartPtr) { return; } mWait3DCmdQueue (5); mEndPrimitive (); - MMIO (REG_3D_AGPCmBase, ((DWORD) AGP_StartPtr - (DWORD) hwcx->AGPCmdBufBase) - + (DWORD) hwcx->AGPCmdBufAddr); + MMIO (REG_3D_AGPCmBase, ((GLint) AGP_StartPtr - (GLint) smesa->AGPCmdBufBase) + + (GLint) smesa->AGPCmdBufAddr); MMIO (REG_3D_AGPTtDwNum, - (((DWORD) AGP_CurrentPtr - (DWORD) AGP_StartPtr) >> 2) | 0x50000000); - MMIO (REG_3D_ParsingSet, hwcx->AGPParseSet); + (((GLint) AGP_CurrentPtr - (GLint) AGP_StartPtr) >> 2) | 0x50000000); + MMIO (REG_3D_ParsingSet, smesa->AGPParseSet); - MMIO (REG_3D_AGPCmFire, (DWORD) (-1)); + MMIO (REG_3D_AGPCmFire, (GLint) (-1)); mEndPrimitive (); - *(hwcx->pAGPCmdBufNext) = - (DWORD) AGP_CurrentPtr - (DWORD) hwcx->AGPCmdBufBase; - *(hwcx->pAGPCmdBufNext) = (*(hwcx->pAGPCmdBufNext) + 0xf) & ~0xf; + *(smesa->pAGPCmdBufNext) = + (GLint) AGP_CurrentPtr - (GLint) smesa->AGPCmdBufBase; + *(smesa->pAGPCmdBufNext) = (*(smesa->pAGPCmdBufNext) + 0xf) & ~0xf; } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_screen.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_screen.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_screen.c Wed Dec 31 16:00:00 1969 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_screen.c Tue Aug 5 21:55:47 2003 @@ -0,0 +1,302 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2003 Eric Anholt +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Eric Anholt + * + */ + +#include "dri_util.h" + +#include "context.h" +#include "utils.h" +#include "imports.h" + +#include "sis_ctx.h" +#include "sis_dri.h" +#include "sis_lock.h" + +/* Create the device specific screen private data struct. + */ +static sisScreenPtr +sisCreateScreen( __DRIscreenPrivate *sPriv ) +{ + sisScreenPtr sisScreen; + SISDRIPtr sisDRIPriv = (SISDRIPtr)sPriv->pDevPriv; + + if ( ! driCheckDriDdxDrmVersions( sPriv, "SiS", 4, 0, 4, 0, 1, 0 ) ) + return NULL; + + /* Allocate the private area */ + sisScreen = (sisScreenPtr) CALLOC( sizeof(*sisScreen) ); + if ( sisScreen == NULL ) + return NULL; + + /* XXX Should come from the X Server */ + sisScreen->sarea_priv_offset = sizeof(XF86DRISAREARec); + + sisScreen->mmio.handle = sisDRIPriv->regs.handle; + sisScreen->mmio.size = sisDRIPriv->regs.size; + if ( drmMap( sPriv->fd, sisScreen->mmio.handle, sisScreen->mmio.size, + &sisScreen->mmio.map ) ) { + FREE( sisScreen ); + return NULL; + } + + if (sisDRIPriv->agp.size) { + sisScreen->agp.handle = sisDRIPriv->agp.handle; + sisScreen->agp.size = sisDRIPriv->agp.size; + if ( drmMap( sPriv->fd, sisScreen->agp.handle, sisScreen->agp.size, + &sisScreen->agp.map ) ) { + sisScreen->agp.size = 0; + } + } + + sisScreen->driScreen = sPriv; + + return sisScreen; +} + +/* Destroy the device specific screen private data struct. + */ +static void +sisDestroyScreen( __DRIscreenPrivate *sPriv ) +{ + sisScreenPtr sisScreen = (sisScreenPtr)sPriv->private; + + if ( sisScreen == NULL ) + return; + + if (sisScreen->agp.size != 0) + drmUnmap( sisScreen->agp.map, sisScreen->agp.size ); + drmUnmap( sisScreen->mmio.map, sisScreen->mmio.size ); + + FREE( sisScreen ); + sPriv->private = NULL; +} + +/* Create and initialize the Mesa and driver specific pixmap buffer + * data. + */ +static GLboolean +sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, + __DRIdrawablePrivate *driDrawPriv, + const __GLcontextModes *mesaVis, + GLboolean isPixmap ) +{ + if (isPixmap) { + return GL_FALSE; /* not implemented */ + } + else { + driDrawPriv->driverPrivate = (void *) + _mesa_create_framebuffer( mesaVis, + GL_FALSE, /* software depth buffer? */ + mesaVis->stencilBits > 0, + mesaVis->accumRedBits > 0, + mesaVis->alphaBits > 0 ); /* XXX */ + return (driDrawPriv->driverPrivate != NULL); + } +} + + +static void +sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) +{ + _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); +} + +__inline__ static void +sis_bitblt_copy_cmd (sisContextPtr smesa, ENGPACKET * pkt) +{ + GLint *lpdwDest, *lpdwSrc; + int i; + + lpdwSrc = (GLint *) pkt; + lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR); + + mWait3DCmdQueue (10); + + for (i = 0; i < 7; i++) + *lpdwDest++ = *lpdwSrc++; + + MMIO(REG_CMD0, *(GLint *)&pkt->stdwCmd); + MMIO(0x8240, -1); +} + +static void sisCopyBuffer( __DRIdrawablePrivate *dPriv ) +{ + sisContextPtr smesa = (sisContextPtr)dPriv->driContextPriv->driverPrivate; + sisScreenPtr sisScreen = smesa->sisScreen; + int i; + ENGPACKET stEngPacket; + +#if 0 + { + int repeat = 0; + + while(((*smesa->FrameCountPtr) - *(GLint volatile *)(smesa->IOBase+0x8a2c) + > SIS_MAX_FRAME_LENGTH) && + (repeat++ < 10)); + } +#endif + + LOCK_HARDWARE (); + + stEngPacket.dwSrcBaseAddr = sisScreen->backOffset; /* XXX */ + stEngPacket.dwSrcPitch = sisScreen->backPitch | + (smesa->bytesPerPixel == 2) ? 0x80000000 : 0xc0000000; /* XXX */ + stEngPacket.dwDestBaseAddr = sisScreen->frontOffset; /* XXX */ + stEngPacket.wDestPitch = sisScreen->frontPitch; /* XXX */ + /* TODO: set maximum value? */ + stEngPacket.wDestHeight = smesa->virtualY; + + stEngPacket.stdwCmd.cRop = 0xcc; + + if (smesa->blockWrite) { + stEngPacket.stdwCmd.cCmd0 = (BYTE) (CMD0_PAT_FG_COLOR); + stEngPacket.stdwCmd.cCmd1 = (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + } else { + stEngPacket.stdwCmd.cCmd0 = 0; + stEngPacket.stdwCmd.cCmd1 = (BYTE) (CMD1_DIR_X_INC | CMD1_DIR_Y_INC); + } + + if (dPriv->numClipRects == 0) { + stEngPacket.stdwSrcPos.wY = 0; + stEngPacket.stdwSrcPos.wX = 0; + stEngPacket.stdwDestPos.wY = dPriv->y; + stEngPacket.stdwDestPos.wX = dPriv->x; + + stEngPacket.stdwDim.wWidth = dPriv->w; + stEngPacket.stdwDim.wHeight = dPriv->h; + + sis_bitblt_copy_cmd(smesa, &stEngPacket); + } else { + for (i = 0; i < dPriv->numClipRects; i++) { + XF86DRIClipRectPtr box = &dPriv->pClipRects[i]; + stEngPacket.stdwSrcPos.wY = box->y1 - dPriv->y; + stEngPacket.stdwSrcPos.wX = box->x1 - dPriv->x; + stEngPacket.stdwDestPos.wY = box->y1; + stEngPacket.stdwDestPos.wX = box->x1; + + stEngPacket.stdwDim.wWidth = (GLshort) box->x2 - box->x1; + stEngPacket.stdwDim.wHeight = (GLshort) box->y2 - box->y1; + + sis_bitblt_copy_cmd(smesa, &stEngPacket); + } + } + + *(GLint *)(smesa->IOBase+0x8a2c) = *smesa->FrameCountPtr; + (*smesa->FrameCountPtr)++; + + UNLOCK_HARDWARE (); +} + + +/* Copy the back color buffer to the front color buffer */ +static void +sisSwapBuffers(__DRIdrawablePrivate *dPriv) +{ + if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { + sisContextPtr smesa = (sisContextPtr) dPriv->driContextPriv->driverPrivate; + GLcontext *ctx = smesa->glCtx; + + if (ctx->Visual.doubleBufferMode) { + _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ + sisCopyBuffer( dPriv ); + } + } + else { + /* XXX this shouldn't be an error but we can't handle it for now */ + _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__); + } +} + + +/* Initialize the driver specific screen private data. + */ +static GLboolean +sisInitDriver( __DRIscreenPrivate *sPriv ) +{ + sPriv->private = (void *) sisCreateScreen( sPriv ); + + if ( !sPriv->private ) { + sisDestroyScreen( sPriv ); + return GL_FALSE; + } + + return GL_TRUE; +} + +/* Fullscreen mode change stub + */ +static GLboolean +sisOpenCloseFullScreen( __DRIcontextPrivate *driContextPriv ) +{ + return GL_TRUE; +} + +/* This function is called by libGL.so as soon as libGL.so is loaded. + * This is where we'd register new extension functions with the dispatcher. + */ +void __driRegisterExtensions(void) +{ + /* No extra extensions */ +} + +static struct __DriverAPIRec sisAPI = { + .InitDriver = sisInitDriver, + .DestroyScreen = sisDestroyScreen, + .CreateContext = sisCreateContext, + .DestroyContext = sisDestroyContext, + .CreateBuffer = sisCreateBuffer, + .DestroyBuffer = sisDestroyBuffer, + .SwapBuffers = sisSwapBuffers, + .MakeCurrent = sisMakeCurrent, + .UnbindContext = sisUnbindContext, + .OpenFullScreen = sisOpenCloseFullScreen, + .CloseFullScreen = sisOpenCloseFullScreen, + .GetSwapInfo = NULL, + /*.GetMSC = driGetMSC32, + .WaitForMSC = driWaitForMSC32, + .WaitForSBC = NULL,*/ /* XXX */ + .SwapBuffersMSC = NULL + +}; + +/* + * This is the bootstrap function for the driver. + * The __driCreateScreen name is the symbol that libGL.so fetches. + * Return: pointer to a __DRIscreenPrivate. + */ +void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, + int numConfigs, __GLXvisualConfig *config) +{ + __DRIscreenPrivate *psp; + psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &sisAPI); + return (void *) psp; +} diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_screen.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_screen.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_screen.h Wed Dec 31 16:00:00 1969 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_screen.h Tue Aug 5 21:55:47 2003 @@ -0,0 +1,52 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2003 Eric Anholt +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Eric Anholt + * + */ + +#ifndef __SIS_SCREEN_H +#define __SIS_SCREEN_H + +typedef struct { + drmHandle handle; /* Handle to the DRM region */ + drmSize size; /* Size of the DRM region */ + drmAddress map; /* Mapping of the DRM region */ +} sisRegionRec2, *sisRegionPtr2; + +typedef struct { + sisRegionRec2 mmio; + sisRegionRec2 agp; + + __DRIscreenPrivate *driScreen; + unsigned int sarea_priv_offset; + +} sisScreenRec, *sisScreenPtr; + +#endif diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_span.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_span.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_span.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_span.c Tue Aug 5 21:55:47 2003 @@ -44,9 +44,9 @@ #define LOCAL_VARS \ XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; \ - GLuint pitch = hwcx->swRenderPitch; \ - char *buf = (char *)hwcx->swRenderBase + sisContextPtr smesa = SIS_CONTEXT(ctx); \ + GLuint pitch = smesa->swRenderPitch; \ + char *buf = (char *)smesa->swRenderBase #define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ _y >= miny && _y < maxy) @@ -85,7 +85,7 @@ /* RGB565 */ #define INIT_MONO_PIXEL(p) \ - GLushort p = hwcx->pixelValue; + GLushort p = smesa->pixelValue; #define WRITE_RGBA( _x, _y, r, g, b, a ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0xf8) << 8) | \ @@ -110,9 +110,9 @@ GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - hwcx->pixelValue = ((red & 0xf8) << 8) | + smesa->pixelValue = ((red & 0xf8) << 8) | ((green & 0xfc) << 3) | (blue >> 3); } @@ -121,7 +121,7 @@ /* ARGB8888 */ #undef INIT_MONO_PIXEL #define INIT_MONO_PIXEL(p) \ - GLuint p = hwcx->pixelValue; + GLuint p = smesa->pixelValue; #define WRITE_RGBA( _x, _y, r, g, b, a ) \ *(GLuint *)(buf + _x*4 + _y*pitch) = ( ((a) << 24) | \ @@ -147,9 +147,9 @@ GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - hwcx->pixelValue = (red << 16) | + smesa->pixelValue = (red << 16) | (green << 8) | (blue) | (alpha << 24); @@ -158,9 +158,9 @@ void sis_sw_init_driver( GLcontext *ctx ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - if (hwcx->colorFormat == DST_FORMAT_RGB_565) { + if (smesa->colorFormat == DST_FORMAT_RGB_565) { ctx->Driver.Color = sis_Color_565; ctx->Driver.WriteRGBASpan = sis_WriteRGBASpan_565; ctx->Driver.WriteRGBSpan = sis_WriteRGBSpan_565; @@ -170,7 +170,7 @@ ctx->Driver.ReadRGBASpan = sis_ReadRGBASpan_565; ctx->Driver.ReadRGBAPixels = sis_ReadRGBAPixels_565; } - else if(hwcx->colorFormat == DST_FORMAT_ARGB_8888){ + else if(smesa->colorFormat == DST_FORMAT_ARGB_8888){ ctx->Driver.Color = sis_Color_8888; ctx->Driver.WriteRGBASpan = sis_WriteRGBASpan_8888; ctx->Driver.WriteRGBSpan = sis_WriteRGBSpan_8888; @@ -198,8 +198,8 @@ * 0 ~ 2^16-1 or 0 ~ 2^32-1 */ #define SIS_SW_Z_BASE(x,y) \ - ((SIS_SW_DTYPE *)(hwcx->swZBase + (x)*sizeof(SIS_SW_DTYPE) + \ - (y)*hwcx->swZPitch)) + ((SIS_SW_DTYPE *)(smesa->swZBase + (x)*sizeof(SIS_SW_DTYPE) + \ + (y)*smesa->swZPitch)) /* Z16 */ #define SIS_TAG(x) x##_Z16 @@ -279,9 +279,9 @@ sis_sw_set_zfuncs_static (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - switch (hwcx->zFormat) + switch (smesa->zFormat) { case Z_16: ctx->Driver.ReadDepthSpan = sis_ReadDepthSpan_Z16; diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_stencil.c Tue Aug 5 21:55:47 2003 @@ -39,12 +39,12 @@ sis_StencilFunc (GLcontext * ctx, GLenum func, GLint ref, GLuint mask) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; /* set reference */ - current->hwStSetting = ((DWORD) ref << 8) | mask; + current->hwStSetting = ((GLint) ref << 8) | mask; current->hwStSetting &= ~0x07000000; switch (func) @@ -81,7 +81,7 @@ prev->hwStSetting = current->hwStSetting; prev->hwStSetting2 = current->hwStSetting2; - hwcx->GlobalFlag |= GFLAG_STENCILSETTING; + smesa->GlobalFlag |= GFLAG_STENCILSETTING; } } @@ -99,9 +99,9 @@ sis_StencilOp (GLcontext * ctx, GLenum fail, GLenum zfail, GLenum zpass) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + sisContextPtr smesa = SIS_CONTEXT(ctx); + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; current->hwStSetting2 &= ~0x00777000; @@ -177,7 +177,7 @@ prev->hwStSetting = current->hwStSetting; prev->hwStSetting2 = current->hwStSetting2; - hwcx->GlobalFlag |= GFLAG_STENCILSETTING; + smesa->GlobalFlag |= GFLAG_STENCILSETTING; } } diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_swzfunc.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_swzfunc.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_swzfunc.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_swzfunc.h Tue Aug 5 21:55:47 2003 @@ -37,7 +37,7 @@ const GLubyte mask[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base = SIS_SW_Z_BASE (x, Y_FLIP (y)); @@ -53,7 +53,7 @@ GLint y, GLdepth depth[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base = SIS_SW_Z_BASE (x, Y_FLIP (y)); @@ -70,7 +70,7 @@ const GLubyte mask[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base; @@ -90,7 +90,7 @@ GLdepth depth[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base; @@ -110,7 +110,7 @@ const GLubyte mask[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base = SIS_SW_Z_BASE (x, Y_FLIP (y)); @@ -126,7 +126,7 @@ GLint y, GLstencil depth[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base = SIS_SW_Z_BASE (x, Y_FLIP (y)); @@ -144,7 +144,7 @@ const GLubyte mask[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base; @@ -164,7 +164,7 @@ GLstencil depth[]) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIS_SW_DTYPE *base; diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_texture.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_texture.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_texture.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_texture.c Tue Aug 5 21:55:47 2003 @@ -46,13 +46,13 @@ static void sis_reset_texture_env (GLcontext * ctx, int hw_unit); -static DWORD TransferTexturePitch (DWORD dwPitch); +static GLint TransferTexturePitch (GLint dwPitch); void sis_validate_texture (GLcontext * ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); struct gl_texture_unit *tex_unit; struct gl_texture_object *tObj; @@ -60,12 +60,12 @@ if(ctx->Texture.ReallyEnabled & (TEXTURE0_3D | TEXTURE1_3D)) { - hwcx->swRenderFlag |= SIS_SW_TEXTURE_DIM; + smesa->swRenderFlag |= SIS_SW_TEXTURE_DIM; return; } else { - hwcx->swRenderFlag &= ~SIS_SW_TEXTURE_DIM; + smesa->swRenderFlag &= ~SIS_SW_TEXTURE_DIM; } if ((ctx->Texture.ReallyEnabled & TEXTURE0_ANY) && @@ -79,22 +79,22 @@ tObj = tex_unit->Current; texObjArea = (sisTexobjInfo *) tObj->DriverData; - if (hwcx->TexStates[unit] & NEW_TEXTURING) + if (smesa->TexStates[unit] & NEW_TEXTURING) { - hwcx->swRenderFlag &= ~(SIS_SW_TEXTURE_OBJ << unit); + smesa->swRenderFlag &= ~(SIS_SW_TEXTURE_OBJ << unit); sis_set_texobj_parm (ctx, tObj, unit); } - if (hwcx->TexStates[unit] & NEW_TEXTURE_ENV) + if (smesa->TexStates[unit] & NEW_TEXTURE_ENV) { - hwcx->swRenderFlag &= ~(SIS_SW_TEXTURE_ENV << unit); + smesa->swRenderFlag &= ~(SIS_SW_TEXTURE_ENV << unit); if (unit == 0) sis_set_texture_env0 (ctx, tObj, unit); else sis_set_texture_env1 (ctx, tObj, unit); } - hwcx->TexStates[unit] = 0; + smesa->TexStates[unit] = 0; } } else @@ -105,10 +105,10 @@ tObj = tex_unit->Current; texObjArea = (sisTexobjInfo *) tObj->DriverData; - if (hwcx->TexStates[unit] & NEW_TEXTURING) + if (smesa->TexStates[unit] & NEW_TEXTURING) sis_set_texobj_parm (ctx, tObj, unit); - if (hwcx->TexStates[unit] & NEW_TEXTURE_ENV) + if (smesa->TexStates[unit] & NEW_TEXTURE_ENV) { if(unit == 0){ sis_set_texture_env0 (ctx, tObj, unit); @@ -120,7 +120,7 @@ } } - hwcx->TexStates[unit] = 0; + smesa->TexStates[unit] = 0; } } @@ -129,9 +129,9 @@ const GLfloat *param ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - hwcx->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; + smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; } void @@ -140,7 +140,7 @@ GLint internalFormat, const struct gl_texture_image *image) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIStextureArea *area; @@ -187,7 +187,7 @@ for (i = 0; i < area->Size / 4; i++) { - *(DWORD *)dst = *(DWORD *)src & 0x00ffffff; + *(GLint *)dst = *(GLint *)src & 0x00ffffff; src += 3; dst += 4; } @@ -197,12 +197,12 @@ memcpy (area->Data, image->Data, area->Size); } - if (hwcx->PrevTexFormat[ctx->Texture.CurrentUnit] != area->Format) + if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != area->Format) { - hwcx->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; - hwcx->PrevTexFormat[ctx->Texture.CurrentUnit] = area->Format; + smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; + smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = area->Format; } - hwcx->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; + smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } void @@ -212,7 +212,7 @@ internalFormat, const struct gl_texture_image *image) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIStextureArea *area; int i, j; @@ -221,13 +221,13 @@ area = (SIStextureArea *) image->DriverData; - hwcx->clearTexCache = GL_TRUE; + smesa->clearTexCache = GL_TRUE; { /* * Optimize */ - WaitEngIdle (hwcx); + WaitEngIdle (smesa); } if (area->Format == GL_RGB8) @@ -240,7 +240,7 @@ { for (i = xoffset; i < xoffset + width; i++) { - *(DWORD *)dst = *(DWORD *)src & 0x00ffffff; + *(GLint *)dst = *(GLint *)src & 0x00ffffff; src += 3; dst += 4; } @@ -273,12 +273,12 @@ GLfloat * params) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); if (tObj->DriverData) ((sisTexobjInfo *) tObj->DriverData)->dirtyFlag |= SIS_TEX_PARAMETER; - hwcx->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; + smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } void @@ -286,7 +286,7 @@ struct gl_texture_object *tObj) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); SIStextureArea *area; if (!tObj->Image[0]) @@ -295,19 +295,19 @@ if (!(area = (SIStextureArea *) tObj->Image[0]->DriverData)) return; - if (hwcx->PrevTexFormat[ctx->Texture.CurrentUnit] != area->Format) + if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != area->Format) { - hwcx->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; - hwcx->PrevTexFormat[ctx->Texture.CurrentUnit] = area->Format; + smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; + smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = area->Format; } - hwcx->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; + smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING; } void sis_DeleteTexture (GLcontext * ctx, struct gl_texture_object *tObj) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); int i; @@ -330,7 +330,7 @@ */ } - hwcx->clearTexCache = GL_TRUE; + smesa->clearTexCache = GL_TRUE; } void @@ -365,10 +365,10 @@ sis_set_texture_env0 (GLcontext * ctx, GLtextureObject * object, int unit) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; struct gl_texture_unit *texture_unit = &ctx->Texture.Unit[unit]; @@ -440,10 +440,10 @@ case GL_BLEND: current->hwTexEnvColor = - ((DWORD) (texture_unit->EnvColor[3])) << 24 | - ((DWORD) (texture_unit->EnvColor[0])) << 16 | - ((DWORD) (texture_unit->EnvColor[1])) << 8 | - ((DWORD) (texture_unit->EnvColor[2])); + ((GLint) (texture_unit->EnvColor[3])) << 24 | + ((GLint) (texture_unit->EnvColor[0])) << 16 | + ((GLint) (texture_unit->EnvColor[1])) << 8 | + ((GLint) (texture_unit->EnvColor[2])); switch (area->Format) { case GL_ALPHA8: @@ -475,7 +475,7 @@ prev->hwTexEnvColor = current->hwTexEnvColor; prev->hwTexBlendClr0 = current->hwTexBlendClr0; prev->hwTexBlendAlpha0 = current->hwTexBlendAlpha0; - hwcx->GlobalFlag |= GFLAG_TEXTUREENV; + smesa->GlobalFlag |= GFLAG_TEXTUREENV; } } @@ -483,10 +483,10 @@ sis_set_texture_env1 (GLcontext * ctx, GLtextureObject * object, int unit) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; struct gl_texture_unit *texture_unit = &ctx->Texture.Unit[unit]; GLtextureImage *image = object->Image[0]; @@ -558,10 +558,10 @@ case GL_BLEND: current->hwTexEnvColor = - ((DWORD) (texture_unit->EnvColor[3])) << 24 | - ((DWORD) (texture_unit->EnvColor[0])) << 16 | - ((DWORD) (texture_unit->EnvColor[1])) << 8 | - ((DWORD) (texture_unit->EnvColor[2])); + ((GLint) (texture_unit->EnvColor[3])) << 24 | + ((GLint) (texture_unit->EnvColor[0])) << 16 | + ((GLint) (texture_unit->EnvColor[1])) << 8 | + ((GLint) (texture_unit->EnvColor[2])); switch (area->Format) { case GL_ALPHA8: @@ -593,7 +593,7 @@ prev->hwTexBlendClr1 = current->hwTexBlendClr1; prev->hwTexBlendAlpha1 = current->hwTexBlendAlpha1; prev->hwTexEnvColor = current->hwTexEnvColor; - hwcx->GlobalFlag |= GFLAG_TEXTUREENV_1; + smesa->GlobalFlag |= GFLAG_TEXTUREENV_1; } } @@ -601,10 +601,10 @@ sis_set_texobj_parm (GLcontext * ctx, GLtextureObject * object, int hw_unit) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; GLtextureImage *image = object->Image[0]; SIStextureArea *area = (SIStextureArea *) image->DriverData; @@ -636,7 +636,7 @@ current->texture[hw_unit].hwTextureSet |= TEXEL_ABGR_0888_32; break; default: - hwcx->swRenderFlag |= SIS_SW_TEXTURE_OBJ; + smesa->swRenderFlag |= SIS_SW_TEXTURE_OBJ; } if ((object->MinFilter == GL_NEAREST) || (object->MinFilter == GL_LINEAR)) @@ -655,7 +655,7 @@ else { /* can i limit capacity */ - hwcx->swRenderFlag |= SIS_SW_TEXTURE_OBJ; + smesa->swRenderFlag |= SIS_SW_TEXTURE_OBJ; } switch (object->MagFilter) @@ -753,9 +753,9 @@ prev->texture[hw_unit].hwTextureBorderColor = current->texture[hw_unit].hwTextureBorderColor; if (hw_unit == 1) - hwcx->GlobalFlag |= GFLAG_TEXBORDERCOLOR_1; + smesa->GlobalFlag |= GFLAG_TEXBORDERCOLOR_1; else - hwcx->GlobalFlag |= GFLAG_TEXBORDERCOLOR; + smesa->GlobalFlag |= GFLAG_TEXBORDERCOLOR; } current->texture[hw_unit].hwTextureSet |= (image->WidthLog2 << 4); @@ -763,9 +763,9 @@ { if (hw_unit == 0) - hwcx->GlobalFlag |= GFLAG_TEXTUREADDRESS; + smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS; else - hwcx->GlobalFlag |= GFLAG_TEXTUREADDRESS_1; + smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS_1; for (i = 0; i < TxLevel + 1; i++) { @@ -775,11 +775,11 @@ switch(area->memType){ case VIDEO_TYPE: - texOffset = ((char *) area->Data - (char *) GET_FbBase (hwcx)); + texOffset = ((char *) area->Data - (char *) GET_FbBase (smesa)); break; case AGP_TYPE: - texOffset = ((char *) area->Data - (char *) GET_AGPBase (hwcx)) + - (unsigned long) hwcx->AGPAddr; + texOffset = ((char *) area->Data - (char *) GET_AGPBase (smesa)) + + (unsigned long) smesa->AGPAddr; current->texture[hw_unit].hwTextureMip |= (0x40000 << i); break; default: @@ -846,9 +846,9 @@ prev->texture[hw_unit].hwTextureSet = current->texture[hw_unit].hwTextureSet; if (hw_unit == 1) - hwcx->GlobalFlag |= CFLAG_TEXTURERESET_1; + smesa->GlobalFlag |= CFLAG_TEXTURERESET_1; else - hwcx->GlobalFlag |= CFLAG_TEXTURERESET; + smesa->GlobalFlag |= CFLAG_TEXTURERESET; } if (current->texture[hw_unit].hwTextureMip ^ prev->texture[hw_unit].hwTextureMip) @@ -856,9 +856,9 @@ prev->texture[hw_unit].hwTextureMip = current->texture[hw_unit].hwTextureMip; if (hw_unit == 1) - hwcx->GlobalFlag |= GFLAG_TEXTUREMIPMAP_1; + smesa->GlobalFlag |= GFLAG_TEXTUREMIPMAP_1; else - hwcx->GlobalFlag |= GFLAG_TEXTUREMIPMAP; + smesa->GlobalFlag |= GFLAG_TEXTUREMIPMAP; } } @@ -866,10 +866,10 @@ sis_reset_texture_env (GLcontext * ctx, int hw_unit) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); - __GLSiSHardware *prev = &hwcx->prev; - __GLSiSHardware *current = &hwcx->current; + __GLSiSHardware *prev = &smesa->prev; + __GLSiSHardware *current = &smesa->current; if (hw_unit == 1) { @@ -883,7 +883,7 @@ prev->hwTexBlendClr1 = current->hwTexBlendClr1; prev->hwTexBlendAlpha1 = current->hwTexBlendAlpha1; prev->hwTexEnvColor = current->hwTexEnvColor; - hwcx->GlobalFlag |= GFLAG_TEXTUREENV_1; + smesa->GlobalFlag |= GFLAG_TEXTUREENV_1; } } else @@ -898,15 +898,15 @@ prev->hwTexBlendClr0 = current->hwTexBlendClr0; prev->hwTexBlendAlpha0 = current->hwTexBlendAlpha0; prev->hwTexEnvColor = current->hwTexEnvColor; - hwcx->GlobalFlag |= GFLAG_TEXTUREENV; + smesa->GlobalFlag |= GFLAG_TEXTUREENV; } } } -static DWORD -BitScanForward (WORD w) +static GLint +BitScanForward (GLshort w) { - DWORD i; + GLint i; for (i = 0; i < 16; i++) { @@ -916,12 +916,12 @@ return (i); } -static DWORD -TransferTexturePitch (DWORD dwPitch) +static GLint +TransferTexturePitch (GLint dwPitch) { - DWORD dwRet, i; + GLint dwRet, i; - i = BitScanForward ((WORD) dwPitch); + i = BitScanForward ((GLshort) dwPitch); dwRet = dwPitch >> i; dwRet |= i << 9; return (dwRet); diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_trifunc.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_trifunc.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_trifunc.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_trifunc.h Tue Aug 5 21:55:47 2003 @@ -39,10 +39,10 @@ GLuint pv) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); struct vertex_buffer *VB = ctx->VB; - float *MMIOBase = (float *) GET_IOBase (hwcx); + float *MMIOBase = (float *) GET_IOBase (smesa); STEREO_SAMPLE(v0); @@ -55,19 +55,19 @@ * not move it to UpdateState because maybe optimization can be done * according to FAN and STRIP */ - hwcx->dwPrimitiveSet &= ~0x07001f07; - hwcx->dwPrimitiveSet |= + smesa->dwPrimitiveSet &= ~0x07001f07; + smesa->dwPrimitiveSet |= (OP_3D_FIRE_TSARGBc | SHADE_GOURAUD | OP_3D_TRIANGLE_DRAW); } else { - hwcx->dwPrimitiveSet &= ~0x07001f07; - hwcx->dwPrimitiveSet |= + smesa->dwPrimitiveSet &= ~0x07001f07; + smesa->dwPrimitiveSet |= (OP_3D_FIRE_TSARGBc | SHADE_FLAT_VertexC | OP_3D_TRIANGLE_DRAW); } { - ((DWORD *) MMIOBase)[REG_3D_PrimitiveSet / 4] = hwcx->dwPrimitiveSet; + ((GLint *) MMIOBase)[REG_3D_PrimitiveSet / 4] = smesa->dwPrimitiveSet; } #define LAST_VERTEX 0 @@ -80,7 +80,7 @@ /* debug mEndPrimitive (); - WaitEngIdle(hwcx); + WaitEngIdle(smesa); d2f_once (ctx); */ } @@ -90,17 +90,17 @@ GLuint v2, GLuint pv) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); struct vertex_buffer *VB = ctx->VB; - DWORD dcSARGB; + GLint dcSARGB; STEREO_SAMPLE(v0); /* delete if VB size <= AGP_ALLOC_SIZE */ #if 0 - if ((DWORD) AGP_CurrentPtr - (DWORD) AGP_StartPtr >= (AGP_ALLOC_SIZE - 0x10)) + if ((GLint) AGP_CurrentPtr - (GLint) AGP_StartPtr >= (AGP_ALLOC_SIZE - 0x10)) { sis_FlushAGP (ctx); sis_StartAGP (ctx); diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c Tue Aug 5 21:55:47 2003 @@ -299,7 +299,7 @@ if (SIS_VERBOSE&VERBOSE_SIS_BUFFER){ fprintf(stderr, "SISCreateWindowBuffer: drawable ID=%lu\n", - (DWORD)driDrawPriv); + (GLint)driDrawPriv); } if (!b) @@ -363,7 +363,7 @@ static void SISDestroyBuffer (XMesaBuffer b) { if (SIS_VERBOSE&VERBOSE_SIS_BUFFER){ - fprintf(stderr, "SISDestroyBuffer: b=%lu\n", (DWORD)b); + fprintf(stderr, "SISDestroyBuffer: b=%lu\n", (GLint)b); } if (b->backimage && b->backimage->data) @@ -374,12 +374,12 @@ #if SIS_STEREO { XMesaContext xmesa = (XMesaContext) b->xm_context; - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); GLcontext *ctx = xmesa->gl_ctx; - if(hwcx->stereoEnabled){ + if(smesa->stereoEnabled){ sis_final_stereo(ctx); - hwcx->stereoEnabled = GL_FALSE; + smesa->stereoEnabled = GL_FALSE; } } #endif @@ -410,15 +410,15 @@ void XMesaSwapBuffers(__DRIdrawablePrivate *driDrawPriv) { - __GLSiScontext *hwcx; + sisContextPtr smesa; if(!XMesa) return; FLUSH_VB( XMesa->gl_ctx, "swap buffers" ); - hwcx = (__GLSiScontext *) XMesa->private; - (hwcx->SwapBuffers)(XMesa->xm_buffer); + smesa = (sisContextPtr) XMesa->private; + (smesa->SwapBuffers)(XMesa->xm_buffer); } GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv) @@ -457,8 +457,8 @@ } if (SIS_VERBOSE&VERBOSE_SIS_BUFFER){ - fprintf(stderr, "XMesaMakeCurrent: c=%lu, b=%lu\n", (DWORD)c, (DWORD)b); - fprintf(stderr, "XMesaMakeCurrent: drawable ID=%lu\n", (DWORD)b->frontbuffer); + fprintf(stderr, "XMesaMakeCurrent: c=%lu, b=%lu\n", (GLint)c, (GLint)b); + fprintf(stderr, "XMesaMakeCurrent: drawable ID=%lu\n", (GLint)b->frontbuffer); fprintf(stderr, "XMesaMakeCurrent: width=%d, height=%d\n", b->width, b->height); { diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h --- xc/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_xmesaP.h Tue Aug 5 21:55:47 2003 @@ -26,37 +26,16 @@ #ifndef XMESAP_H #define XMESAP_H +#include +#include +#include "GL/xmesa_x.h" +#include "GL/gl.h" -#ifdef XFree86Server -# include "GL/xf86glx.h" -# include "xf86glx_util.h" -#else -# ifdef GLX_DIRECT_RENDERING -# include "dri_mesa.h" -# endif -#endif +#include "dri_util.h" -#ifdef XFree86Server -# include "GL/xmesa.h" -#else -# include -# include -# include "GL/xmesa_x.h" -# include "GL/gl.h" typedef struct xmesa_context *XMesaContext; typedef struct xmesa_visual *XMesaVisual; typedef struct xmesa_buffer *XMesaBuffer; -#endif - -#include "types.h" - -#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) -# include "xdriP.h" -#else -# define DRI_DRAWABLE_ARG -# define DRI_DRAWABLE_PARM -# define DRI_CTX_ARG -#endif struct xmesa_visual { GLvisual *gl_visual; /* Device independent visual parameters */ @@ -73,7 +52,7 @@ XMesaDisplay *display; /* == xm_visual->display */ -#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) +#if defined(GLX_DIRECT_RENDERING) __DRIcontextPrivate *driContextPriv; /* back pointer to DRI context * used for locking */ @@ -100,7 +79,7 @@ GLint bottom; /* used for FLIP macro below */ -#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) +#if defined(GLX_DIRECT_RENDERING) __DRIdrawablePrivate *driDrawPriv; /* back pointer to DRI drawable * used for direct access to framebuffer */ diff -ruN xc/xc/lib/GL/mesa/src/drv/sis/sis_xwin.c xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_xwin.c --- xc/xc/lib/GL/mesa/src/drv/sis/sis_xwin.c Tue Aug 5 21:57:37 2003 +++ xc-sis-0-1/xc/lib/GL/mesa/src/drv/sis/sis_xwin.c Tue Aug 5 21:55:47 2003 @@ -35,84 +35,6 @@ #include "sis_ctx.h" #include "sis_mesa.h" -#ifdef XFree86Server - -GLboolean -sis_get_clip_rects (XMesaContext xmesa, BoxPtr *ppExtents, int *pCount) -{ - XMesaDrawable d = xmesa->xm_buffer->frontbuffer; - - if (d->type == DRAWABLE_WINDOW) - { - RegionPtr pClipList = &((WindowPtr) d)->clipList; - RegDataPtr data = pClipList->data; - - if (data) - { - *ppExtents = - (BoxPtr) ((GLubyte *) (pClipList->data) + sizeof (RegDataRec)); - *pCount = data->numRects; - } - else - { - *ppExtents = &(pClipList->extents); - *pCount = 1; - } - } - else{ - /* Pixmap */ - /* - * TODO : sis_clear_color_buffer, sis_line_clip, sis_tri_clip don't - * consider this situation and result in page fault - */ - *ppExtents = NULL; - *pCount = 0; - return GL_FALSE; - } - - return GL_TRUE; -} - -void * -sis_get_drawable_pos (XMesaContext xmesa) -{ - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; - XMesaDrawable d = xmesa->xm_buffer->frontbuffer; - - return GET_FbBase (hwcx) + - (d->x) * GET_DEPTH (hwcx) + (d->y) * GET_PITCH (hwcx); -} - -void -sis_get_drawable_origin (XMesaContext xmesa, GLuint * x, GLuint * y) -{ - XMesaDrawable d = xmesa->xm_buffer->frontbuffer; - - *x = d->x; - *y = d->y; -} - -void -sis_get_drawable_size (XMesaContext xmesa, GLuint * w, GLuint * h) -{ - XMesaDrawable d = xmesa->xm_buffer->frontbuffer; - - *w = d->width; - *h = d->height; -} - -void -sis_get_drawable_box (XMesaContext xmesa, BoxPtr pBox) -{ - XMesaDrawable d = xmesa->xm_buffer->frontbuffer; - - pBox->x1 = d->x; - pBox->y1 = d->y; - pBox->x2 = d->x + d->width; - pBox->y2 = d->y + d->height; -} - -#else GLboolean sis_get_clip_rects (XMesaContext xmesa, BoxPtr * ppExtents, int *pCount) @@ -141,7 +63,7 @@ void * sis_get_drawable_pos (XMesaContext xmesa) { - __GLSiScontext *hwcx = (__GLSiScontext *) xmesa->private; + sisContextPtr smesa = SIS_CONTEXT(ctx); __DRIdrawablePrivate *dPriv = xmesa->driContextPriv->driDrawablePriv; @@ -151,8 +73,8 @@ dPriv); */ - return GET_FbBase (hwcx) + (dPriv->x) * GET_DEPTH (hwcx) + - (dPriv->y) * GET_PITCH (hwcx); + return GET_FbBase (smesa) + (dPriv->x) * GET_DEPTH (smesa) + + (dPriv->y) * GET_PITCH (smesa); } void @@ -201,5 +123,3 @@ pBox->x2 = dPriv->x + dPriv->w; pBox->y2 = dPriv->y + dPriv->h; } - -#endif diff -ruN xc/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h xc-sis-0-1/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h --- xc/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h Wed Dec 31 16:00:00 1969 +++ xc-sis-0-1/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h Tue Aug 5 21:56:30 2003 @@ -0,0 +1,60 @@ +/* sis_common.h -- common header definitions for SiS 2D/3D/DRM suite + * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com + * + * Copyright 2003 Eric Anholt + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Eric Anholt + * + * $XFree86$ + * + */ + +#ifndef _SIS_COMMON_H_ +#define _SIS_COMMON_H_ + +#define DRM_SIS_FB_ALLOC 0x04 +#define DRM_SIS_FB_FREE 0x05 +#define DRM_SIS_FLIP 0x08 +#define DRM_SIS_FLIP_INIT 0x09 +#define DRM_SIS_FLIP_FINAL 0x10 +#define DRM_SIS_AGP_INIT 0x13 +#define DRM_SIS_AGP_ALLOC 0x14 +#define DRM_SIS_AGP_FREE 0x15 + +typedef struct { + int context; + unsigned long offset; + unsigned long size; + void *free; +} drm_sis_mem_t; + +typedef struct { + unsigned long offset, size; +} drm_sis_agp_t; + +typedef struct { + unsigned int left, right; +} drm_sis_flip_t; + +#endif /* _SIS_COMMON_H_ */