--- /dev/null
+# src/mesa/drivers/dri/s3v/Makefile
+
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = s3v_dri.so
+
+# Doesn't exist yet.
+#MINIGLX_SOURCES = server/savage_dri.c
+
+COMMON_SOURCES = \
+ ../../common/driverfuncs.c \
+ ../common/mm.c \
+ ../common/utils.c \
+ ../common/texmem.c \
+ ../common/vblank.c \
+ ../common/xmlconfig.c \
+ ../common/dri_util.c \
+ ../common/glcontextmodes.c
+
+DRIVER_SOURCES = \
+ s3v_context.c \
+ s3v_dd.c \
+ s3v_inithw.c \
+ s3v_lock.c \
+ s3v_render.c \
+ s3v_screen.c \
+ s3v_span.c \
+ s3v_state.c \
+ s3v_tex.c \
+ s3v_texmem.c \
+ s3v_texstate.c \
+ s3v_tris.c \
+ s3v_vb.c \
+ s3v_xmesa.c
+
+C_SOURCES = \
+ $(COMMON_SOURCES) \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+
+include ../Makefile.template
+
+symlinks:
--- /dev/null
+/*
+ * Author: Max Lingua <sunmax@libero.it>
+ */
+
+/* WARNING: If you change any of these defines, make sure to change
+ * the kernel include file as well (s3v_drm.h)
+ */
+
+#ifndef _XF86DRI_S3V_H_
+#define _XF86DRI_S3V_H_
+
+#ifndef _S3V_DEFINES_
+#define _S3V_DEFINES_
+#define S3V_USE_BATCH 1
+
+/* #define S3V_BUF_4K 1 */
+
+#ifdef S3V_BUF_4K
+ #define S3V_DMA_BUF_ORDER 12
+ #define S3V_DMA_BUF_NR 256
+#else
+ #define S3V_DMA_BUF_ORDER 16 /* -much- better */
+ #define S3V_DMA_BUF_NR 16
+#endif
+/* on s3virge you can only choose between *
+ * 4k (2^12) and 64k (2^16) dma bufs */
+#define S3V_DMA_BUF_SZ (1<<S3V_DMA_BUF_ORDER)
+
+#define S3V_NR_SAREA_CLIPRECTS 8
+
+/* Each region is a minimum of 16k (64*64@4bpp)
+ * and there are at most 40 of them.
+ */
+#define S3V_NR_TEX_REGIONS 64 /* was 40 */
+#define S3V_LOG_TEX_GRANULARITY 16 /* was 4 */
+/* 40 * (2 ^ 4) = 640k, that's all we have for tex on 4mb gfx card */
+/* FIXME: will it work with card with less than 4mb? */
+/* FIXME: we should set this at run time */
+
+#endif /* _S3V_DEFINES */
+
+/*
+ * WARNING: If you change any of these defines, make sure to change
+ * the kernel include file as well (gamma_drm.h)
+ */
+
+/* Driver specific DRM command indices
+ * NOTE: these are not OS specific, but they are driver specific
+ */
+#define DRM_S3V_INIT_DMA 0x00
+#define DRM_S3V_CLEANUP_DMA 0x01
+
+typedef struct _drmS3VInit {
+ enum {
+ S3V_INIT_DMA = 0x01,
+ S3V_CLEANUP_DMA = 0x02
+ } func;
+
+ unsigned int pcimode; /* bool: 1=pci 0=agp */
+
+ unsigned int mmio_offset;
+ unsigned int buffers_offset;
+ unsigned int sarea_priv_offset;
+
+ unsigned int front_offset;
+ unsigned int front_width;
+ unsigned int front_height;
+ unsigned int front_pitch;
+
+ unsigned int back_offset;
+ unsigned int back_width;
+ unsigned int back_height;
+ unsigned int back_pitch;
+
+ unsigned int depth_offset;
+ unsigned int depth_width;
+ unsigned int depth_height;
+ unsigned int depth_pitch;
+
+ unsigned int texture_offset;
+} drmS3VInit;
+
+#endif
#include "context.h"
#include "simple_list.h"
-#include "mem.h"
#include "matrix.h"
#include "extensions.h"
#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
#endif
#include "simple_list.h"
-#include "mem.h"
#include "mm.h"
-
+#include "drivers/common/driverfuncs.h"
#include "s3v_vb.h"
#include "s3v_tris.h"
#if 0
-extern const struct gl_pipeline_stage _s3v_render_stage;
+extern const struct tnl_pipeline_stage _s3v_render_stage;
-static const struct gl_pipeline_stage *s3v_pipeline[] = {
+static const struct tnl_pipeline_stage *s3v_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
};
#endif
-GLboolean s3vCreateContext( Display *dpy, const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
+GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
+ __DRIcontextPrivate *driContextPriv,
+ void *sharedContextPrivate)
{
GLcontext *ctx, *shareCtx;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
s3vContextPtr vmesa;
s3vScreenPtr s3vScrn;
- S3VSAREAPtr saPriv=(S3VSAREAPtr)(((char*)sPriv->pSAREA)+
- sizeof(XF86DRISAREARec));
+ S3VSAREAPtr saPriv=(S3VSAREAPtr)(((char*)sPriv->pSAREA) +
+ sizeof(drm_sarea_t));
+ struct dd_function_table functions;
DEBUG_WHERE(("*** s3vCreateContext ***\n"));
else
shareCtx = NULL;
- vmesa->glCtx = _mesa_create_context(glVisual, shareCtx, vmesa, GL_TRUE);
+ _mesa_init_driver_functions(&functions);
+
+ vmesa->glCtx = _mesa_create_context(glVisual, shareCtx, &functions,
+ (void *)vmesa);
if (!vmesa->glCtx) {
FREE(vmesa);
return GL_FALSE;
}
- vmesa->display = dpy;
-
vmesa->driContext = driContextPriv;
vmesa->driScreen = sPriv;
vmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
vmesa->hHWContext = driContextPriv->hHWContext;
- vmesa->driHwLock = &sPriv->pSAREA->lock;
+ vmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock;
vmesa->driFd = sPriv->fd;
vmesa->sarea = saPriv;
#include "s3v_regs.h"
#include "s3v_macros.h"
#include "s3v_screen.h"
+#include "colormac.h"
#include "macros.h"
#include "mtypes.h"
#include "drm.h"
extern void s3vDDUpdateHWState(GLcontext *ctx);
extern s3vScreenPtr s3vCreateScreen(__DRIscreenPrivate *sPriv);
extern void s3vDestroyScreen(__DRIscreenPrivate *sPriv);
-extern GLboolean s3vCreateContext( Display *dpy,
- const __GLcontextModes *glVisual,
+extern GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
__DRIcontextPrivate *driContextPriv,
void *sharedContextPrivate);
int internalFormat;
} image[S3V_TEX_MAXLEVELS];
- CARD32 TextureCMD;
+ GLuint TextureCMD;
- CARD32 TextureColorMode;
- CARD32 TextureFilterMode;
- CARD32 TextureBorderColor;
- CARD32 TextureWrap;
- CARD32 TextureMipSize;
+ GLuint TextureColorMode;
+ GLuint TextureFilterMode;
+ GLuint TextureBorderColor;
+ GLuint TextureWrap;
+ GLuint TextureMipSize;
- CARD32 TextureBaseAddr[S3V_TEX_MAXLEVELS];
- CARD32 TextureFormat;
- CARD32 TextureReadMode;
+ GLuint TextureBaseAddr[S3V_TEX_MAXLEVELS];
+ GLuint TextureFormat;
+ GLuint TextureReadMode;
};
#define S3V_NO_PALETTE 0x0
/* Mirrors of some DRI state
*/
- Display *display; /* X server display */
- drmContext hHWContext;
+ drm_context_t hHWContext;
drmLock *driHwLock;
int driFd;
GLuint numClipRects; /* Cliprects for the draw buffer */
- XF86DRIClipRectPtr pClipRects;
+ drm_clip_rect_t *pClipRects;
- CARD32* buf; /* FIXME */
- CARD32* _buf[2];
+ GLuint* buf; /* FIXME */
+ GLuint* _buf[2];
int _bufNum;
int bufIndex[2];
int bufSize;
unsigned int S3V_REG[S3V_REGS_NUM];
- CARD32 texMode;
- CARD32 alphaMode;
- CARD32 lightMode;
-
- CARD32 SrcBase;
- CARD32 DestBase;
- CARD32 DestBlit;
- CARD32 ScissorLR;
- CARD32 ScissorTB;
- CARD32 ScissorWH; /* SubScissorWH */ /* RectWH */
- CARD32 FrontStride;
- CARD32 BackStride;
- CARD32 SrcStride;
- CARD32 DestStride;
- CARD32 SrcXY;
- CARD32 DestXY;
-
- CARD32 ClearColor;
- CARD32 Color;
- CARD32 DitherMode;
- CARD32 ClearDepth;
-
- CARD32 TextureBorderColor;
- CARD32 TexOffset;
- CARD32 TexStride;
-
- CARD32 CMD;
- CARD32 prim_cmd;
- CARD32 _tri[2]; /* 0 = gouraud; 1 = tex (lit or unlit) */
- CARD32 alpha_cmd; /* actual alpha cmd */
- CARD32 _alpha[2];
- CARD32 _alpha_tex; /* tex alpha type */
+ GLuint texMode;
+ GLuint alphaMode;
+ GLuint lightMode;
+
+ GLuint SrcBase;
+ GLuint DestBase;
+ GLuint DestBlit;
+ GLuint ScissorLR;
+ GLuint ScissorTB;
+ GLuint ScissorWH; /* SubScissorWH */ /* RectWH */
+ GLuint FrontStride;
+ GLuint BackStride;
+ GLuint SrcStride;
+ GLuint DestStride;
+ GLuint SrcXY;
+ GLuint DestXY;
+
+ GLuint ClearColor;
+ GLuint Color;
+ GLuint DitherMode;
+ GLuint ClearDepth;
+
+ GLuint TextureBorderColor;
+ GLuint TexOffset;
+ GLuint TexStride;
+
+ GLuint CMD;
+ GLuint prim_cmd;
+ GLuint _tri[2]; /* 0 = gouraud; 1 = tex (lit or unlit) */
+ GLuint alpha_cmd; /* actual alpha cmd */
+ GLuint _alpha[2];
+ GLuint _alpha_tex; /* tex alpha type */
/* (3d_mode) 0 = 3d line/gourad tri; 1 = 3d tex tri */
- CARD32 _3d_mode;
+ GLuint _3d_mode;
GLfloat backface_sign;
GLfloat cull_zero;
/* *** 2check *** */
- CARD32 FogMode;
- CARD32 AreaStippleMode;
- CARD32 LBReadFormat;
- CARD32 LBWriteFormat;
- CARD32 LineMode;
- CARD32 PointMode;
- CARD32 TriangleMode;
- CARD32 AntialiasMode;
+ GLuint FogMode;
+ GLuint AreaStippleMode;
+ GLuint LBReadFormat;
+ GLuint LBWriteFormat;
+ GLuint LineMode;
+ GLuint PointMode;
+ GLuint TriangleMode;
+ GLuint AntialiasMode;
GLfloat ViewportScaleX;
GLfloat ViewportScaleY;
GLfloat ViewportScaleZ;
--- /dev/null
+/*
+ * Author: Max Lingua <sunmax@libero.it>
+ */
+
+#ifndef _S3V_DRI
+#define _S3V_DRI
+
+#include "s3v_common.h"
+
+#define S3V_MAX_DRAWABLES (S3V_DMA_BUF_NR/2) /* 32 */ /* 256 */ /* FIXME */
+
+typedef struct
+{
+ int deviceID;
+ int width;
+ int height;
+ int mem;
+ int cpp;
+ int bitsPerPixel;
+
+ int fbOffset;
+ int fbStride;
+
+ int logTextureGranularity;
+ int textureOffset;
+
+ drm_handle_t regs;
+ drmSize regsSize;
+
+ unsigned int sarea_priv_offset;
+/*
+ drmAddress regsMap;
+
+ drmSize textureSize;
+ drm_handle_t textures;
+*/
+
+#if 0
+ drm_handle_t agp_buffers;
+ drmSize agp_buf_size;
+#endif
+
+/*
+ drmBufMapPtr drmBufs;
+ int irq;
+ unsigned int sarea_priv_offset;
+*/
+
+/* FIXME: cleanup ! */
+
+ drmSize registerSize; /* == S3V_MMIO_REGSIZE */
+ drm_handle_t registerHandle;
+
+ drmSize pciSize;
+ drm_handle_t pciMemHandle;
+
+ drmSize frontSize; /* == videoRambytes */
+/* drm_handle_t frontHandle; */
+ unsigned long frontOffset; /* == fbOffset */
+ int frontPitch;
+/* unsigned char *front; */
+
+ unsigned int bufferSize; /* size of depth/back buffer */
+
+ drmSize backSize;
+/* drm_handle_t backHandle; */
+ unsigned long backOffset;
+ int backPitch;
+/* unsigned char *back; */
+
+ drmSize depthSize;
+/* drm_handle_t depthHandle; */
+ unsigned long depthOffset;
+ int depthPitch;
+/* unsigned char *depth; */
+
+ drmSize texSize;
+/* drm_handle_t texHandle; */
+ unsigned long texOffset;
+ int texPitch;
+/* unsigned char *tex; */
+
+ drmSize dmaBufSize; /* Size of buffers (in bytes) */
+ drm_handle_t dmaBufHandle; /* Handle from drmAddMap */
+ unsigned long dmaBufOffset; /* Offset/Start */
+ int dmaBufPitch; /* Pitch */
+ unsigned char *dmaBuf; /* Map */
+ int bufNumBufs; /* Number of buffers */
+ drmBufMapPtr buffers; /* Buffer map */
+
+} S3VDRIRec, *S3VDRIPtr;
+
+/* WARNING: Do not change the SAREA structure without changing the kernel
+ * as well */
+
+typedef struct {
+ unsigned char next, prev; /* indices to form a circular LRU */
+ unsigned char in_use; /* owned by a client, or free? */
+ int age; /* tracked by clients to update local LRU's */
+} S3VTexRegionRec, *S3VTexRegionPtr;
+
+typedef struct {
+ unsigned int nbox;
+ drm_clip_rect_t boxes[S3V_NR_SAREA_CLIPRECTS];
+
+ /* Maintain an LRU of contiguous regions of texture space. If
+ * you think you own a region of texture memory, and it has an
+ * age different to the one you set, then you are mistaken and
+ * it has been stolen by another client. If global texAge
+ * hasn't changed, there is no need to walk the list.
+ *
+ * These regions can be used as a proxy for the fine-grained
+ * texture information of other clients - by maintaining them
+ * in the same lru which is used to age their own textures,
+ * clients have an approximate lru for the whole of global
+ * texture space, and can make informed decisions as to which
+ * areas to kick out. There is no need to choose whether to
+ * kick out your own texture or someone else's - simply eject
+ * them all in LRU order.
+ */
+ S3VTexRegionRec texList[S3V_NR_TEX_REGIONS+1]; /* Last elt is sentinal */
+
+ int texAge; /* last time texture was uploaded */
+
+ int last_enqueue; /* last time a buffer was enqueued */
+ int last_dispatch; /* age of the most recently dispatched buffer */
+ int last_quiescent; /* */
+
+ int ctxOwner; /* last context to upload state */
+} S3VSAREARec, *S3VSAREAPtr;
+
+typedef struct {
+ /* Nothing here yet */
+ int dummy;
+} S3VConfigPrivRec, *S3VConfigPrivPtr;
+
+typedef struct {
+ /* Nothing here yet */
+ int dummy;
+} S3VDRIContextRec, *S3VDRIContextPtr;
+
+
+#endif
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
#include "mtypes.h"
-#include "mmath.h"
#include "tnl/t_context.h"
#define HAVE_ELTS 0
+#if 0
static void VERT_FALLBACK( GLcontext *ctx,
GLuint start,
GLuint count,
_flags = flags & PRIM_MODE_MASK;
tnl->Driver.Render.PrimTabVerts[_flags]( ctx, start, count, flags );
- S3V_CONTEXT(ctx)->SetupNewInputs = VERT_CLIP;
+ S3V_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
}
+#endif
static const GLuint hw_prim[GL_POLYGON+1] = {
PrimType_Points,
(vmesa->bufSize - vmesa->bufCount) / 2
#define GET_SUBSEQUENT_VB_MAX_VERTS() \
S3V_DMA_BUF_SZ / 2
-#define EMIT_VERTS( ctx, j, nr ) \
-do { \
- printf("Alas, emit...\n"); \
- /* s3v_emit(ctx, j, (j)+(nr)) */ \
- /* we don't need emit on s3v */ \
-} while (0)
+/* XXX */
+#define ALLOC_VERTS(nr) NULL
+#define EMIT_VERTS(ctx, start, count, buf) NULL
+#define FLUSH() s3vEndPrimitive( vmesa )
#define TAG(x) s3v_##x
static GLboolean s3v_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
- render_func *tab;
+ GLuint i;
+ tnl_render_func *tab;
DEBUG(("s3v_run_render\n"));
tnl->Driver.Render.Start( ctx );
- for (i = 0 ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++ )
{
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
DEBUG(("s3v_run_render (loop=%i) (lenght=%i)\n", i, length));
if (length) {
- tnl->Driver.Render.BuildVertices( ctx, i, i+length,
- ~0 /*stage->inputs*/);
- tnl->Driver.Render.PrimTabVerts[flags & PRIM_MODE_MASK]
- ( ctx, i, i + length, flags );
- vmesa->SetupNewInputs = VERT_CLIP;
+ tnl->Driver.Render.BuildVertices( ctx, start,
+ start+length, ~0 /*stage->inputs*/); /* XXX */
+ tnl->Driver.Render.PrimTabVerts[prim & PRIM_MODE_MASK]
+ ( ctx, start, start + length, prim );
+ vmesa->SetupNewInputs = VERT_BIT_POS;
}
}
static void s3v_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLuint inputs = VERT_CLIP | VERT_RGBA;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
DEBUG(("s3v_check_render\n"));
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
DEBUG(("DD_SEPARATE_SPECULAR\n"));
- inputs |= VERT_SPEC_RGB;
+ inputs |= VERT_BIT_COLOR1;
}
if (ctx->Texture.Unit[0]._ReallyEnabled) {
DEBUG(("ctx->Texture.Unit[0]._ReallyEnabled\n"));
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX(0);
}
if (ctx->Texture.Unit[1]._ReallyEnabled) {
DEBUG(("ctx->Texture.Unit[1]._ReallyEnabled\n"));
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX(1);
}
if (ctx->Fog.Enabled) {
DEBUG(("ctx->Fog.Enabled\n"));
- inputs |= VERT_FOG_COORD;
+ inputs |= VERT_BIT_FOG;
}
}
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
+ /* hack to silence a compiler warning */
+ (void) &s3v_validate_render;
}
-const struct gl_pipeline_stage _s3v_render_stage =
+const struct tnl_pipeline_stage _s3v_render_stage =
{
"s3v render",
(_DD_NEW_SEPARATE_SPECULAR |
#include "s3v_vb.h"
#include "s3v_dri.h"
-#include "mem.h"
-
s3vScreenPtr s3vCreateScreen( __DRIscreenPrivate *sPriv )
{
s3vScreenPtr s3vScreen;
s3vScreen->regionCount = 4; /* Magic number. Can we fix this? */
- s3vScreen->regions = Xmalloc(s3vScreen->regionCount *
+ s3vScreen->regions = _mesa_malloc(s3vScreen->regionCount *
sizeof(s3vRegion));
DEBUG(("sPriv->fd = %i\nvDRIPriv->dmaBufHandle = %x\n",
sPriv->fd, vDRIPriv->dmaBufHandle));
*/
typedef struct _s3vRegion {
- drmHandle handle;
+ drm_handle_t handle;
drmSize size;
drmAddress map;
} s3vRegion, *s3vRegionPtr;
#endif
-static void s3vSetReadBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLenum mode )
+static void s3vSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLuint bufferBit )
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- switch ( mode ) {
- case GL_FRONT_LEFT:
- vmesa->readOffset = 0;
+ switch ( bufferBit ) {
+ case DD_FRONT_LEFT_BIT:
+ vmesa->drawOffset = vmesa->readOffset = 0;
break;
- case GL_BACK_LEFT:
- vmesa->readOffset = vmesa->driScreen->fbHeight * vmesa->driScreen->fbWidth * vmesa->s3vScreen->cpp;
+ case DD_BACK_LEFT_BIT:
+ vmesa->drawOffset = vmesa->readOffset = vmesa->driScreen->fbHeight *
+ vmesa->driScreen->fbWidth *
+ vmesa->s3vScreen->cpp;
break;
}
}
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetReadBuffer = s3vSetReadBuffer;
+ swdd->SetBuffer = s3vSetBuffer;
switch ( vmesa->s3vScreen->cpp ) {
case 2:
}
-static void s3vDDAlphaFunc( GLcontext *ctx, GLenum func, GLchan ref )
+static void s3vDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
* Miscellaneous
*/
-static void s3vDDClearColor( GLcontext *ctx, const GLchan color[4])
+static void s3vDDClearColor( GLcontext *ctx, const GLfloat color[4])
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
ctx->Driver.Clear = s3vDDClear;
ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = s3vDDClearColor;
- ctx->Driver.SetDrawBuffer = s3vDDSetDrawBuffer;
+ ctx->Driver.DrawBuffer = s3vDDSetDrawBuffer;
+ ctx->Driver.ReadBuffer = NULL; /* XXX */
ctx->Driver.IndexMask = NULL;
ctx->Driver.ColorMask = NULL; /* s3vDDColorMask; */ /* FIXME */
ctx->Driver.AlphaFunc = s3vDDAlphaFunc; /* FIXME */
+#if 0
ctx->Driver.BlendEquation = NULL; /* s3vDDBlendEquation; */
ctx->Driver.BlendFunc = s3vDDBlendFunc; /* FIXME */
+#endif
ctx->Driver.BlendFuncSeparate = NULL; /* s3vDDBlendFuncSeparate; */
ctx->Driver.ClearDepth = s3vDDClearDepth;
ctx->Driver.CullFace = s3vDDCullFace;
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
#include "simple_list.h"
#include "enums.h"
#include "texstore.h"
#include "texformat.h"
+#include "teximage.h"
#include "swrast/swrast.h"
#include "mm.h"
-#include "mmath.h"
#include "s3v_context.h"
#include "s3v_tex.h"
s3vTextureObjectPtr t,
GLenum wraps, GLenum wrapt)
{
- CARD32 t0 = t->TextureCMD;
- CARD32 cmd = vmesa->CMD;
+ GLuint t0 = t->TextureCMD;
+ GLuint cmd = vmesa->CMD;
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vSetTexWrapping: #%i ***\n", ++times));
s3vTextureObjectPtr t,
GLenum minf, GLenum magf)
{
- CARD32 t0 = t->TextureCMD;
- CARD32 cmd = vmesa->CMD;
+ GLuint t0 = t->TextureCMD;
+ GLuint cmd = vmesa->CMD;
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vSetTexFilter: #%i ***\n", ++times));
break;
case GL_TEXTURE_BORDER_COLOR:
- s3vSetTexBorderColor( vmesa, t, tObj->BorderColor );
+ s3vSetTexBorderColor( vmesa, t, tObj->_BorderChan );
break;
case GL_TEXTURE_BASE_LEVEL:
{
s3vContextPtr vmesa = S3V_CONTEXT( ctx );
s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
- CARD32 cmd = vmesa->CMD;
+ GLuint cmd = vmesa->CMD;
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vBindTexture: #%i ***\n", ++times));
#endif
}
- if (!ctx->Texture._ReallyEnabled) {
- DEBUG_TEX(("!ctx->Texture._ReallyEnabled\n"));
- return;
- }
-
cmd = vmesa->CMD & ~MIP_MASK;
vmesa->dirty |= S3V_UPLOAD_TEX0;
vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel];
#define TEX_DEBUG_ON 0
+extern void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t );
+
#if TEX_DEBUG_ON
#define DEBUG_TEX(str) printf str
#else
#include "enums.h"
#include "mm.h"
-#include "mem.h"
#include "s3v_context.h"
#include "s3v_lock.h"
#include "s3v_tex.h"
int l2d;
/* int offset = 0; */
int words;
- CARD32* dest;
+ GLuint* dest;
#if TEX_DEBUG_ON
static unsigned int times=0;
#endif
DEBUG_TEX(("t->image[%i].offset = 0x%x\n",
level, t->image[level].offset));
- t->TextureBaseAddr[level] = (CARD32)(t->BufAddr + t->image[level].offset
- + _TEXALIGN) & (CARD32)(~_TEXALIGN);
- dest = (CARD32*)(sPriv->pFB + t->TextureBaseAddr[level]);
+ t->TextureBaseAddr[level] = (GLuint)(t->BufAddr + t->image[level].offset
+ + _TEXALIGN) & (GLuint)(~_TEXALIGN);
+ dest = (GLuint*)(sPriv->pFB + t->TextureBaseAddr[level]);
DEBUG_TEX(("sPriv->pFB = 0x%x\n", sPriv->pFB));
DEBUG_TEX(("dest = 0x%x\n", dest));
{
GLuint height, width, pitch, i, /*textureFormat,*/ log_pitch;
s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
+ const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
GLint firstLevel, lastLevel, numLevels;
GLint log2Width, log2Height;
#if TEX_DEBUG_ON
numLevels = lastLevel - firstLevel + 1;
- log2Width = tObj->Image[firstLevel]->WidthLog2;
- log2Height = tObj->Image[firstLevel]->HeightLog2;
+ log2Width = tObj->Image[0][firstLevel]->WidthLog2;
+ log2Height = tObj->Image[0][firstLevel]->HeightLog2;
/* Figure out the amount of memory required to hold all the mipmap
* levels. Choose the smallest pitch to accomodate the largest
* mipmap:
*/
- width = tObj->Image[firstLevel]->Width * t->texelBytes;
+ width = tObj->Image[0][firstLevel]->Width * t->texelBytes;
for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 )
log_pitch++;
* lines required:
*/
for ( height = i = 0 ; i < numLevels ; i++ ) {
- t->image[i].image = tObj->Image[firstLevel + i];
+ t->image[i].image = tObj->Image[0][firstLevel + i];
t->image[i].offset = height * pitch;
t->image[i].internalFormat = baseImage->Format;
height += t->image[i].image->Height;
t->TextureBaseAddr[i] = (t->BufAddr + t->image[i].offset +
- _TEXALIGN) & (CARD32)(~_TEXALIGN);
+ _TEXALIGN) & (GLuint)(~_TEXALIGN);
}
t->Pitch = pitch;
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const struct gl_texture_object *tObj = texUnit->_Current;
- const GLuint format = tObj->Image[tObj->BaseLevel]->Format;
+ const GLuint format = tObj->Image[0][tObj->BaseLevel]->Format;
/*
s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
GLuint tc;
*/
GLuint alpha = 0;
- CARD32 cmd = vmesa->CMD;
+ GLuint cmd = vmesa->CMD;
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vUpdateTexEnv: %i ***\n", ++times));
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- CARD32 cmd = vmesa->CMD;
+ GLuint cmd = vmesa->CMD;
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vUpdateTexUnit: %i ***\n", ++times));
DEBUG_TEX(("and vmesa->CMD was 0x%x\n", vmesa->CMD));
#endif
- if (texUnit->_ReallyEnabled == TEXTURE0_2D)
+ if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
{
struct gl_texture_object *tObj = texUnit->_Current;
s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
/* Update texture environment if texture object image format or
* texture environment state has changed.
*/
- if (tObj->Image[tObj->BaseLevel]->Format != vmesa->TexEnvImageFmt[unit]) {
- vmesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format;
+ if (tObj->Image[0][tObj->BaseLevel]->Format !=
+ vmesa->TexEnvImageFmt[unit]) {
+ vmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format;
s3vUpdateTexEnv( ctx, unit );
}
#if 1
void s3vUpdateTextureState( GLcontext *ctx )
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
+ (void) vmesa;
#if TEX_DEBUG_ON
static unsigned int times=0;
DEBUG_TEX(("*** s3vUpdateTextureState: #%i ***\n", ++times));
#endif
- if (!ctx->Texture._ReallyEnabled) {
- DEBUG_TEX(("!ctx->Texture._ReallyEnabled\n"));
- return;
- }
-
#if _TEXFALLBACK
FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_FALSE );
#endif
#define HAVE_BACK_COLORS 0
#define HAVE_HW_FLATSHADE 1
#define VERTEX s3vVertex
-#define TAB rast_tab
+#define TAB rast_tab
#define VERT_SET_RGBA( v, c ) \
do { \
static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
+ tnl_points_func points;
+ tnl_line_func line;
+ tnl_triangle_func triangle;
+ tnl_quad_func quad;
} rast_tab[S3V_MAX_TRIFUNC];
#define S3V_RAST_CULL_BIT 0x01
if ( flags & DD_FLATSHADE )
ind |= S3V_RAST_FLAT_BIT;
- if ( ctx->Texture._ReallyEnabled ) {
+ if ( ctx->Texture.Unit[0]._ReallyEnabled ) {
ind |= S3V_RAST_TEX_BIT;
}
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
/* __DRIdrawablePrivate *dPriv = vmesa->driDrawable; */
- CARD32 cmd = vmesa->CMD;
+ GLuint cmd = vmesa->CMD;
unsigned int _hw_prim = hwprim;
{
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- CARD32 cmd = vmesa->CMD;
+ GLuint cmd = vmesa->CMD;
unsigned int _hw_prim = hw_prim[prim];
int start02, end01; \
int ystart, y01y12; \
int i, tmp, tmp2, tmp3; \
- GLfloat ydiff, fy[3]
+ GLfloat ydiff, fy[3]; \
+ (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \
+ (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \
+ (void) zstart; (void) start02; (void) ystart; (void) y01y12; \
+ (void) i; (void) tmp; (void) tmp2; (void) tmp3; (void) ydiff; (void) fy
#define LINE_FLAT_VARS \
int arstart, gbstart; \
int deltarx, deltgbx, deltary, deltgby; \
- GLubyte *(col)[3]
+ GLubyte *(col)[3]; \
+ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
+ (void) deltary; (void) deltgby; (void) col
#define LINE_GOURAUD_VARS \
int arstart, gbstart; \
int deltary, deltgby; \
int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *(col)[3]
+ GLubyte *(col)[3]; \
+ (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \
+ (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col
#define SORT_LINE_VERT() \
do { \
int start02, end01, end12; \
int ystart, y01y12; \
int i, tmp, lr; \
- GLfloat ydiff, fy[3]
+ GLfloat ydiff, fy[3]; \
+ (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \
+ (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \
+ (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \
+ (void) deltzy; (void) zstart; (void) start02; (void) end01; \
+ (void) end12; (void) ystart; (void) y01y12; (void) i; (void) tmp; \
+ (void) lr; (void) ydiff; (void) fy
#define GOURAUD_VARS \
int arstart, gbstart; \
int deltarx, deltgbx, deltary, deltgby; \
int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *(col)[3]
+ GLubyte *(col)[3]; \
+ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
+ (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \
+ (void) ctmp3; (void) ctmp4; (void) col
#define FLAT_VARS \
int arstart, gbstart; \
int deltarx, deltgbx, deltary, deltgby; \
- GLubyte *(col)[3]
+ GLubyte *(col)[3]; \
+ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
+ (void) deltary; (void) deltgby; (void) col
#define TEX_VARS \
int u0, u1, u2; \
int rbaseu, rbasev; \
int dstart, ustart, wstart, vstart; \
static int stmp = 0; \
- s3vTextureObjectPtr t
+ s3vTextureObjectPtr t; \
+ (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \
+ (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \
+ (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \
+ (void) baseu; (void) basev; (void) d0; (void) d1; (void) d2; \
+ (void) deltdx; (void) deltvx; (void) deltux; (void) deltdy; \
+ (void) deltuy; (void) deltwx; (void) deltwy; (void) rbaseu; \
+ (void) rbasev; (void) dstart; (void) ustart; (void) wstart; \
+ (void) vstart; (void) stmp; (void) t
#define SORT_VERT() \
do { \
u0 = (v[idx[0]].texcoord[0][0] \
* (GLfloat)(t->image[0].image->Width) * 256.0); \
u1 = (v[idx[1]].texcoord[0][0] \
- * (GLfloat)(t->globj->Image[0]->Width) * 256.0); \
+ * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
u2 = (v[idx[2]].texcoord[0][0] \
- * (GLfloat)(t->globj->Image[0]->Width) * 256.0); \
+ * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
v0 = (v[idx[0]].texcoord[0][1] \
- * (GLfloat)(t->globj->Image[0]->Height) * 256.0); \
+ * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
v1 = (v[idx[1]].texcoord[0][1] \
- * (GLfloat)(t->globj->Image[0]->Height) * 256.0); \
+ * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
v2 = (v[idx[2]].texcoord[0][1] \
- * (GLfloat)(t->globj->Image[0]->Height) * 256.0); \
+ * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
\
w0 = (v[idx[0]].win[3]); \
w1 = (v[idx[1]].win[3]); \
rv1 = (((v1 - basev) * rw1)); \
rv2 = (((v2 - basev) * rw2)); \
\
- while (baseu < 0) { baseu += (t->globj->Image[0]->Width << 8); } \
- while (basev < 0) { basev += (t->globj->Image[0]->Height << 8); } \
+ while (baseu < 0) { baseu += (t->globj->Image[0][0]->Width << 8); } \
+ while (basev < 0) { basev += (t->globj->Image[0][0]->Height << 8); } \
\
if (!(baseu & 0xFF)) \
{ baseu = (baseu >> 8); } \
else \
{ basev = (basev >> 8) - 1; } \
\
- rbaseu = (baseu) << (16 - t->globj->Image[0]->WidthLog2); \
- rbasev = (basev) << (16 - t->globj->Image[0]->WidthLog2); \
+ rbaseu = (baseu) << (16 - t->globj->Image[0][0]->WidthLog2); \
+ rbasev = (basev) << (16 - t->globj->Image[0][0]->WidthLog2); \
deltuy = (((ru2 - ru0) / dy02)); \
deltvy = (((rv2 - rv0) / dy02)); \
rw0 *= (1024.0 * 512.0); \
#endif
#if (IND & S3V_RAST_CULL_BIT)
GLfloat cull;
+ (void) cull;
#endif
DEBUG(("*** s3v_line: "));
#include "glheader.h"
#include "mtypes.h"
-#include "mem.h"
#include "macros.h"
#include "colormac.h"
-#include "mmath.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_context.h"
static struct {
void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
- interp_func interp;
- copy_pv_func copy_pv;
+ tnl_interp_func interp;
+ tnl_copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
GLuint vertex_stride_shift;
#define GET_VIEWPORT_MAT() 0 /* vmesa->hw_viewport */
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() 0
+#define GET_VERTEX_SIZE() S3V_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
#define GET_VERTEX_STORE() S3V_CONTEXT(ctx)->verts
#define GET_VERTEX_STRIDE_SHIFT() S3V_CONTEXT(ctx)->vertex_stride_shift
#define INVALIDATE_STORED_VERTICES()
#define HAVE_HW_DIVIDE 1
#define HAVE_RGBA_COLOR 0 /* we're BGRA */
#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
+#define HAVE_NOTEX_VERTICES 0
+#define HAVE_TEX0_VERTICES 0
#define HAVE_TEX1_VERTICES 0
#define HAVE_TEX2_VERTICES 0
#define HAVE_TEX3_VERTICES 0
GLubyte *v = ((GLubyte *)vmesa->verts +
(start<<vmesa->vertex_stride_shift));
GLuint stride = 1<<vmesa->vertex_stride_shift;
- GLuint ind = 0;
DEBUG(("*** s3vBuildVertices ***\n"));
DEBUG(("vmesa->SetupNewInputs = 0x%x\n", vmesa->SetupNewInputs));
*/
- if (ctx->Texture._ReallyEnabled) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled) {
_tnl_need_projected_coords( ctx, GL_FALSE );
ind |= S3V_TEX0_BIT;
} else {
}
if (vmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(vmesa->UbyteSecondaryColor.Ptr);
+ ALIGN_FREE((void *)vmesa->UbyteSecondaryColor.Ptr);
vmesa->UbyteSecondaryColor.Ptr = 0;
}
if (vmesa->UbyteColor.Ptr) {
- ALIGN_FREE(vmesa->UbyteColor.Ptr);
+ ALIGN_FREE((void *)vmesa->UbyteColor.Ptr);
vmesa->UbyteColor.Ptr = 0;
}
}
#include "s3v_context.h"
#include "s3v_vb.h"
#include "context.h"
-#include "mmath.h"
#include "matrix.h"
#include "s3v_dri.h"
vmesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context(vmesa->glCtx);
- Xfree(vmesa);
+ _mesa_free(vmesa);
driContextPriv->driverPrivate = NULL;
}
}
static GLboolean
-s3vCreateBuffer( Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
+s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap )
}
static void
-s3vSwapBuffers(Display *dpy, void *drawablePrivate)
+s3vSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
__DRIscreenPrivate *sPriv;
/* DMAFLUSH(); */
- _mesa_swapbuffers( ctx );
+ _mesa_notifySwapBuffers( ctx );
vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
/* driScrnPriv = vmesa->driScreen; */
/* if (vmesa->EnabledFlags & S3V_BACK_BUFFER) */
-/* _mesa_swapbuffers( ctx ); */
+/* _mesa_notifySwapBuffers( ctx ); */
#if 1
{
int x0, y0, x1, y1;
return GL_TRUE;
}
-static GLboolean
-s3vOpenFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static GLboolean
-s3vCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
static struct __DriverAPIRec s3vAPI = {
s3vInitDriver,
s3vSwapBuffers,
s3vMakeCurrent,
s3vUnbindContext,
- s3vOpenFullScreen,
- s3vCloseFullScreen
};
-
+#if 0
/*
* This is the bootstrap function for the driver.
* The __driCreateScreen name is the symbol that libGL.so fetches.
DEBUG(("__driCreateScreen: psp = %p\n", psp));
return (void *) psp;
}
+#endif
void __driRegisterExtensions(void)
{