dri: Add DRI entrypoints to create a context for a given API
[mesa.git] / src / mesa / drivers / dri / r128 / r128_context.h
index 9c93012eb0f55c13ea6c056d2ab3c8934eb4c436..65ddb3bd23bcff540afb4a68c966f1d0d43d02bb 100644 (file)
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.12 2002/12/16 16:18:52 dawes Exp $ */
 /**************************************************************************
 
 Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -36,14 +35,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifndef __R128_CONTEXT_H__
 #define __R128_CONTEXT_H__
 
-#ifdef GLX_DIRECT_RENDERING
-
 #include "dri_util.h"
+#include "drm.h"
+#include "r128_drm.h"
 
-#include "xf86drm.h"
-#include "r128_common.h"
-
-#include "mtypes.h"
+#include "main/mtypes.h"
+#include "tnl/t_vertex.h"
 
 #include "r128_reg.h"
 
@@ -77,11 +74,12 @@ typedef struct r128_context *r128ContextPtr;
 #define R128_FALLBACK_READ_BUFFER      0x0004
 #define R128_FALLBACK_STENCIL          0x0008
 #define R128_FALLBACK_RENDER_MODE      0x0010
-#define R128_FALLBACK_MULTIDRAW                0x0020
-#define R128_FALLBACK_LOGICOP          0x0040
-#define R128_FALLBACK_SEP_SPECULAR     0x0080
-#define R128_FALLBACK_BLEND_EQ         0x0100
-#define R128_FALLBACK_BLEND_FUNC       0x0200
+#define R128_FALLBACK_LOGICOP          0x0020
+#define R128_FALLBACK_SEP_SPECULAR     0x0040
+#define R128_FALLBACK_BLEND_EQ         0x0080
+#define R128_FALLBACK_BLEND_FUNC       0x0100
+#define R128_FALLBACK_PROJTEX          0x0200
+#define R128_FALLBACK_DISABLE          0x0400
 
 
 /* Use the templated vertex format:
@@ -121,29 +119,27 @@ struct r128_context {
     */
    GLuint new_state;
    GLuint dirty;                       /* Hardware state to be updated */
-   r128_context_regs_t setup;
+   drm_r128_context_regs_t setup;
 
-   /* Temporaries for translating away float colors:
-    */
-   struct gl_client_array UbyteColor;
-   struct gl_client_array UbyteSecondaryColor;
+   /* Vertex state */
+   GLuint vertex_size;
+   GLuint vertex_format;
+   struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
+   GLuint vertex_attr_count;
+   char *verts;                        /* points to tnl->clipspace.vertex_buf */
+   GLuint num_verts;
+   int coloroffset, specoffset;
+   DECLARE_RENDERINPUTS(tnl_state_bitset);     /* tnl->render_inputs for this _tnl_install_attrs */
 
    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;             
 
-   CARD32 ClearColor;                  /* Color used to clear color buffer */
-   CARD32 ClearDepth;                  /* Value used to clear depth buffer */
-   CARD32 ClearStencil;                        /* Value used to clear stencil */
+   uint32_t ClearColor;                        /* Color used to clear color buffer */
+   uint32_t ClearDepth;                        /* Value used to clear depth buffer */
+   uint32_t ClearStencil;              /* Value used to clear stencil */
 
    /* Map GL texture units onto hardware
     */
@@ -160,6 +156,8 @@ struct r128_context {
    driTextureObject      swapped;
 
    r128TexObjPtr CurrentTexObj[2];
+
+   int texture_depth;
  
    /* Fallback rasterization functions 
     */
@@ -178,35 +176,28 @@ struct r128_context {
     */
    GLuint doPageFlip;
 
-   /* Busy waiting
+   /* Cliprect and scissor information
     */
-   GLuint do_irqs;
-
-   /* Drawable, cliprect and scissor information
-    */
-   GLint drawOffset, drawPitch;
-   GLint readOffset, readPitch;
-
    GLuint numClipRects;                        /* Cliprects for the draw buffer */
-   XF86DRIClipRectPtr pClipRects;
+   drm_clip_rect_t *pClipRects;
 
    GLuint scissor;
-   XF86DRIClipRectRec ScissorRect;     /* Current software scissor */
+   drm_clip_rect_t ScissorRect;        /* Current software scissor */
 
    /* 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;
-   drmLock *driHwLock;
+   drm_context_t hHWContext;
+   drm_hw_lock_t *driHwLock;
    int driFd;
 
    r128ScreenPtr r128Screen;           /* Screen private DRI data */
-   R128SAREAPrivPtr sarea;             /* Private SAREA data */
+   drm_r128_sarea_t *sarea;            /* Private SAREA data */
 
    /* Performance counters
     */
@@ -218,10 +209,9 @@ struct r128_context {
    GLuint c_textureBytes;
    GLuint c_vertexBuffers;
 
-   /* VBI
+   /* Configuration cache
     */
-   GLuint vbl_seq;
-   GLuint vblank_flags;
+   driOptionCache optionCache;
 };
 
 #define R128_CONTEXT(ctx)              ((r128ContextPtr)(ctx->DriverCtx))
@@ -234,22 +224,23 @@ struct r128_context {
                (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY)
 
 
-extern GLboolean r128CreateContext( const __GLcontextModes *glVisual,
-                                   __DRIcontextPrivate *driContextPriv,
+extern GLboolean r128CreateContext( gl_api api,
+                                   const __GLcontextModes *glVisual,
+                                   __DRIcontext *driContextPriv,
                                     void *sharedContextPrivate );
 
-extern void r128DestroyContext( __DRIcontextPrivate * );
+extern void r128DestroyContext( __DRIcontext * );
 
-extern GLboolean r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
-                                  __DRIdrawablePrivate *driDrawPriv,
-                                  __DRIdrawablePrivate *driReadPriv );
+extern GLboolean r128MakeCurrent( __DRIcontext *driContextPriv,
+                                  __DRIdrawable *driDrawPriv,
+                                  __DRIdrawable *driReadPriv );
 
-extern GLboolean r128UnbindContext( __DRIcontextPrivate *driContextPriv );
+extern GLboolean r128UnbindContext( __DRIcontext *driContextPriv );
 
 /* ================================================================
  * Debugging:
  */
-#define DO_DEBUG               0
+#define DO_DEBUG               1
 #define ENABLE_PERF_BOXES      0
 
 #if DO_DEBUG
@@ -265,6 +256,6 @@ extern int R128_DEBUG;
 #define DEBUG_VERBOSE_DRI      0x10
 #define DEBUG_VERBOSE_IOCTL    0x20
 #define DEBUG_VERBOSE_2D       0x40
+#define DEBUG_VERBOSE_FALL     0x80
 
-#endif
 #endif /* __R128_CONTEXT_H__ */