USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86$ */
/*
* Authors:
#ifndef _sis_ctx_h_
#define _sis_ctx_h_
-#include "context.h"
+#include "main/context.h"
#include "dri_util.h"
+#include "drm.h"
+#include "drm_sarea.h"
#include "xmlconfig.h"
+#include "tnl/t_vertex.h"
#include "sis_screen.h"
-#include "sis_common2.h"
+#include "sis_reg.h"
+#include "sis6326_reg.h"
#include "sis_dri.h"
/* for GLboolean */
#define SIS_FALLBACK_TEXENV1 0x0010
#define SIS_FALLBACK_DRAW_BUFFER 0x0020
#define SIS_FALLBACK_STENCIL 0x0040
-#define SIS_FALLBACK_FORCE 0x8000
+#define SIS_FALLBACK_WRITEMASK 0x0080
+#define SIS_FALLBACK_DISABLE 0x0100
/* Flags for hardware state that needs to be updated */
#define GFLAG_ENABLESETTING 0x00000001
#define SUBPIXEL_X (-0.5F)
#define SUBPIXEL_Y (-0.5F)
+#define SIS_MAX_TEXTURE_SIZE 2048
+#define SIS_MAX_TEXTURES 2
#define SIS_MAX_TEXTURE_LEVELS 11
+#define SIS_MAX_FRAME_LENGTH 3
typedef struct {
GLubyte *Data; /* Pointer to texture in offscreen */
sisTexImage image[SIS_MAX_TEXTURE_LEVELS]; /* Image data for each mipmap
* level */
GLenum format; /* One of GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
- * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA */
+ * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA
+ * MESA_YCBCR */
GLint hwformat; /* One of the TEXEL_ defines */
GLint numImages; /* Number of images loaded into .image */
} sisTexObj, *sisTexObjPtr;
GLint hwTextureMip;
GLint hwTextureClrHigh;
GLint hwTextureClrLow;
+ GLint hwTexWidthHeight; /* 6326: Texture Blending Setting */
GLint hwTextureBorderColor;
GLint texOffset0;
GLint hwTexEnvColor; /* Texture Blending Setting */
+ GLint hwTexBlendSet; /* 6326 */
GLint hwTexBlendColor0;
GLint hwTexBlendColor1;
GLint hwTexBlendAlpha0;
typedef void (*sis_point_func)( sisContextPtr,
sisVertex * );
+/**
+ * Derived from gl_renderbuffer.
+ */
+struct sis_renderbuffer {
+ struct gl_renderbuffer Base; /* must be first! */
+ drmSize size;
+ GLuint offset;
+ void *handle;
+ GLuint pitch;
+ GLuint bpp;
+ char *map;
+};
+
/* Device dependent context state */
struct sis_context
/* This must be first in this structure */
GLcontext *glCtx;
+ /* Vertex state */
+ GLuint vertex_size;
+ struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
+ GLuint vertex_attr_count;
+ char *verts; /* points to tnl->clipspace.vertex_buf */
+
+ /* Vertex buffer (in system memory or AGP) state. */
+ unsigned char *vb; /* Beginning of vertex buffer */
+ unsigned char *vb_cur; /* Current write location in vertex buffer */
+ unsigned char *vb_last; /* Last written location in vertex buffer */
+ unsigned char *vb_end; /* End of vertex buffer */
+ void *vb_agp_handle;
+ GLuint vb_agp_offset;
+ GLboolean using_agp;
+ GLint coloroffset; /* Offset in vertex format of current color */
+ GLint specoffset; /* Offset in vertex format of specular color */
+
GLuint NewGLState;
GLuint Fallback;
- GLuint SetupIndex;
- GLuint SetupNewInputs;
GLuint RenderIndex;
GLfloat hw_viewport[16];
GLfloat depth_scale;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
- GLuint num_verts;
- GLubyte *verts;
unsigned int virtualX, virtualY;
unsigned int bytesPerPixel;
unsigned char *IOBase;
unsigned char *FbBase;
unsigned int displayWidth;
- unsigned int frontOffset;
- unsigned int frontPitch;
/* HW RGBA layout */
unsigned int redMask, greenMask, blueMask, alphaMask;
unsigned char *AGPBase;
unsigned int AGPAddr;
- /* AGP Command Buffer */
- /* TODO: use Global variables */
-
- unsigned char *AGPCmdBufBase;
- GLint AGPCmdBufAddr;
- unsigned int AGPCmdBufSize;
- GLint *pAGPCmdBufNext;
- GLboolean AGPCmdModeEnabled;
-
/* register 0x89F4 */
GLint AGPParseSet;
__GLSiSHardware prev, current;
int Chipset;
+ GLboolean is6326;
GLint drawableID;
- /* SGRAM block write */
- GLboolean blockWrite;
-
GLint GlobalFlag;
+ DECLARE_RENDERINPUTS(last_tcl_state_bitset);
/* Stereo */
- GLboolean isFullScreen;
GLboolean useStereo;
GLboolean stereoEnabled;
int stereo_drawIndex;
/* Front/back/depth buffer info */
GLuint width, height; /* size of buffers */
GLint bottom; /* used for FLIP macro */
- GLvoid *backbuffer;
- unsigned int backOffset;
- unsigned int backPitch;
- GLvoid *depthbuffer;
- unsigned int depthOffset;
- unsigned int depthPitch;
- void *zbFree, *bbFree; /* Cookies for freeing buffers */
- ENGPACKET zClearPacket, cbClearPacket;
-
- /* Drawable, cliprect and scissor information
- */
- GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
+ /* XXX These don't belong here. They should be per-drawable state. */
+ struct sis_renderbuffer front;
+ struct sis_renderbuffer back;
+ struct sis_renderbuffer depth;
+ struct sis_renderbuffer stencil; /* mirrors depth */
/* Mirrors of some DRI state
*/
- __DRIcontextPrivate *driContext; /* DRI context */
- __DRIscreenPrivate *driScreen; /* DRI screen */
- __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
+ __DRIcontext *driContext; /* DRI context */
+ __DRIscreen *driScreen; /* DRI screen */
+ __DRIdrawable *driDrawable; /* DRI drawable bound to this ctx */
unsigned int lastStamp; /* mirror driDrawable->lastStamp */
- drmContext hHWContext;
+ drm_context_t hHWContext;
drm_hw_lock_t *driHwLock;
sisScreenPtr sisScreen; /* Screen private DRI data */
/* Configuration cache */
driOptionCache optionCache;
+ GLint texture_depth;
};
#define SIS_CONTEXT(ctx) ((sisContextPtr)(ctx->DriverCtx))
#define MMIO(reg, value) \
{\
- *(GLint *)(GET_IOBase(smesa) + (reg)) = value; \
+ *(volatile GLint *)(smesa->IOBase + (reg)) = value; \
}
#define MMIO_READ(reg) *(volatile GLint *)(smesa->IOBase + (reg))
#define MMIO_READf(reg) *(volatile GLfloat *)(smesa->IOBase + (reg))
+#if defined(__i386__) || defined(__x86_64__)
+#define MMIO_WMB() __asm __volatile("" : : : "memory")
+#elif defined(__ia64__)
+#define MMIO_WMB() __asm __volatile("mf" : : : "memory")
+#else
+#error platform needs WMB
+#endif
+
#define mEndPrimitive() \
{ \
- *(GET_IOBase(smesa) + REG_3D_EndPrimitiveList) = 0xFF; \
- *(GLint *)(GET_IOBase(smesa) + 0x8b60) = (GLint)(-1); \
+ *(volatile GLubyte *)(smesa->IOBase + REG_3D_EndPrimitiveList) = 0xff; \
+ *(volatile GLuint *)(smesa->IOBase + 0x8b60) = 0xffffffff; \
}
+#define sis_fatal_error(...) \
+do { \
+ fprintf(stderr, "[%s:%d]:", __FILE__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ exit(-1); \
+} while (0)
+
/* Lock required */
#define mWait3DCmdQueue(wLen) \
/* Update the mirrored queue pointer if it doesn't indicate enough space */ \
};
extern GLboolean sisCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
+ __DRIcontext *driContextPriv,
void *sharedContextPrivate );
-extern void sisDestroyContext( __DRIcontextPrivate * );
+extern void sisDestroyContext( __DRIcontext * );
-extern GLboolean sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
+void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
+ GLuint width, GLuint height);
-extern GLboolean sisUnbindContext( __DRIcontextPrivate *driContextPriv );
+extern GLboolean sisMakeCurrent( __DRIcontext *driContextPriv,
+ __DRIdrawable *driDrawPriv,
+ __DRIdrawable *driReadPriv );
+
+extern GLboolean sisUnbindContext( __DRIcontext *driContextPriv );
void WaitEngIdle (sisContextPtr smesa);
void Wait2DEngIdle (sisContextPtr smesa);
/* update to hw */
extern void sis_update_texture_state( sisContextPtr smesa );
extern void sis_update_render_state( sisContextPtr smesa );
+extern void sis6326_update_texture_state( sisContextPtr smesa );
+extern void sis6326_update_render_state( sisContextPtr smesa );
-void sis_fatal_error (void);
+/* ================================================================
+ * Debugging:
+ */
+#define DO_DEBUG 1
+#if DO_DEBUG
+extern int SIS_DEBUG;
+#else
+#define SIS_DEBUG 0
#endif
+
+#define DEBUG_FALLBACKS 0x01
+
+#endif /* _sis_ctx_h_ */