i965: Move device info initialization to common code
[mesa.git] / src / mesa / drivers / dri / r200 / r200_context.h
index 6267293817d951d67a8987617d99e4f09f606001..8ac39f1c5754a5a0c40c0c837d5eb005ebbbfa18 100644 (file)
@@ -29,26 +29,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /*
  * Authors:
- *   Keith Whitwell <keith@tungstengraphics.com>
+ *   Keith Whitwell <keithw@vmware.com>
  */
 
 #ifndef __R200_CONTEXT_H__
 #define __R200_CONTEXT_H__
 
 #include "tnl/t_vertex.h"
-#include "drm.h"
+#include "drm-uapi/drm.h"
 #include "radeon_drm.h"
 #include "dri_util.h"
-#include "texmem.h"
 
 #include "main/macros.h"
 #include "main/mtypes.h"
-#include "main/colormac.h"
 #include "r200_reg.h"
 #include "r200_vertprog.h"
 
-#define ENABLE_HW_3D_TEXTURE 1  /* XXX this is temporary! */
-
 #ifndef R200_EMIT_VAP_PVS_CNTL
 #error This driver requires a newer libdrm to compile
 #endif
@@ -56,16 +52,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_screen.h"
 #include "radeon_common.h"
 
-#include "radeon_lock.h"
-
 struct r200_context;
 typedef struct r200_context r200ContextRec;
 typedef struct r200_context *r200ContextPtr;
 
-#include "main/mm.h"
 
 struct r200_vertex_program {
-        struct gl_vertex_program mesa_program; /* Must be first */
+        struct gl_program mesa_program; /* Must be first */
         int translated;
         /* need excess instr: 1 for late loop checking, 2 for 
            additional instr due to instr/attr, 3 for fog */
@@ -114,7 +107,6 @@ struct r200_texture_state {
 #define CTX_RB3D_COLOROFFSET  11
 #define CTX_CMD_2             12 /* why */
 #define CTX_RB3D_COLORPITCH   13 /* why */
-#define CTX_STATE_SIZE_OLDDRM 14
 #define CTX_CMD_3             14
 #define CTX_RB3D_BLENDCOLOR   15
 #define CTX_RB3D_ABLENDCNTL   16
@@ -172,9 +164,6 @@ struct r200_texture_state {
 #define TEX_PP_TXSIZE               4  /*2c0c*/
 #define TEX_PP_TXPITCH              5  /*2c10*/
 #define TEX_PP_BORDER_COLOR         6  /*2c14*/
-#define TEX_CMD_1_OLDDRM            7
-#define TEX_PP_TXOFFSET_OLDDRM      8  /*2d00 */
-#define TEX_STATE_SIZE_OLDDRM       9
 #define TEX_PP_CUBIC_FACES          7
 #define TEX_PP_TXMULTI_CTL          8
 #define TEX_CMD_1_NEWDRM            9
@@ -447,19 +436,16 @@ struct r200_texture_state {
 #define CST_RB3D_DEPTHXY_OFFSET               3
 #define CST_CMD_2                             4
 #define CST_RE_AUX_SCISSOR_CNTL               5
-#define CST_CMD_3                             6
-#define CST_RE_SCISSOR_TL_0                   7
-#define CST_RE_SCISSOR_BR_0                   8
-#define CST_CMD_4                             9
-#define CST_SE_VAP_CNTL_STATUS                10
-#define CST_CMD_5                             11
-#define CST_RE_POINTSIZE                      12
-#define CST_CMD_6                             13
-#define CST_SE_TCL_INPUT_VTX_0                14
-#define CST_SE_TCL_INPUT_VTX_1                15
-#define CST_SE_TCL_INPUT_VTX_2                16
-#define CST_SE_TCL_INPUT_VTX_3                17
-#define CST_STATE_SIZE                        18
+#define CST_CMD_4                             6
+#define CST_SE_VAP_CNTL_STATUS                7
+#define CST_CMD_5                             8
+#define CST_RE_POINTSIZE                      9
+#define CST_CMD_6                             10
+#define CST_SE_TCL_INPUT_VTX_0                11
+#define CST_SE_TCL_INPUT_VTX_1                12
+#define CST_SE_TCL_INPUT_VTX_2                13
+#define CST_SE_TCL_INPUT_VTX_3                14
+#define CST_STATE_SIZE                        15
 
 #define PRF_CMD_0         0
 #define PRF_PP_TRI_PERF   1
@@ -467,6 +453,21 @@ struct r200_texture_state {
 #define PRF_STATE_SIZE    3
 
 
+#define SCI_CMD_1         0
+#define SCI_XY_1          1
+#define SCI_CMD_2         2
+#define SCI_XY_2          3
+#define SCI_STATE_SIZE    4
+
+#define R200_QUERYOBJ_CMD_0  0
+#define R200_QUERYOBJ_DATA_0 1
+#define R200_QUERYOBJ_CMDSIZE  2
+
+#define STP_CMD_0 0
+#define STP_DATA_0 1
+#define STP_CMD_1 2
+#define STP_STATE_SIZE 35
+
 struct r200_hw_state {
    /* Hardware state, stored as cmdbuf commands:  
     *   -- Need to doublebuffer for
@@ -475,6 +476,7 @@ struct r200_hw_state {
     */
    struct radeon_state_atom ctx;
    struct radeon_state_atom set;
+   struct radeon_state_atom sci;
    struct radeon_state_atom vte;
    struct radeon_state_atom lin;
    struct radeon_state_atom msk;
@@ -508,12 +510,12 @@ struct r200_hw_state {
    struct radeon_state_atom atf;
    struct radeon_state_atom spr;
    struct radeon_state_atom ptp;
+   struct radeon_state_atom stp;
 };
 
 struct r200_state {
    /* Derived state for internal purposes:
     */
-   struct radeon_stipple_state stipple;
    struct r200_texture_state texture;
    GLuint envneeded;
 };
@@ -526,8 +528,6 @@ struct r200_state {
 struct r200_tcl_info {
    GLuint hw_primitive;
 
-   GLuint *Elts;
-
    int elt_used;
 
 };
@@ -612,22 +612,32 @@ struct r200_context {
    struct r200_swtcl_info swtcl;
 
    GLboolean using_hyperz;
-   GLboolean texmicrotile;
 
   struct ati_fragment_shader *afs_loaded;
 };
 
-#define R200_CONTEXT(ctx)              ((r200ContextPtr)(ctx->DriverCtx))
 
+static inline r200ContextPtr
+R200_CONTEXT(struct gl_context *ctx)
+{
+   return (r200ContextPtr) ctx;
+}
 
-extern void r200DestroyContext( __DRIcontextPrivate *driContextPriv );
-extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
-                                   __DRIcontextPrivate *driContextPriv,
+
+extern void r200DestroyContext( __DRIcontext *driContextPriv );
+extern GLboolean r200CreateContext( gl_api api,
+                                   const struct gl_config *glVisual,
+                                   __DRIcontext *driContextPriv,
+                                   const struct __DriverContextConfig *
+                                      ctx_config,
+                                   unsigned *error,
                                    void *sharedContextPrivate);
-extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
-                                 __DRIdrawablePrivate *driDrawPriv,
-                                 __DRIdrawablePrivate *driReadPriv );
-extern GLboolean r200UnbindContext( __DRIcontextPrivate *driContextPriv );
+extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv,
+                                 __DRIdrawable *driDrawPriv,
+                                 __DRIdrawable *driReadPriv );
+extern GLboolean r200UnbindContext( __DRIcontext *driContextPriv );
+
+extern void r200_init_texcopy_functions(struct dd_function_table *table);
 
 /* ================================================================
  * Debugging: