Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / drivers / dri / r300 / radeon_context.h
index 0ec6466e441778fd5938a1d4606e46ab990885b4..47cbc22a72596ff64eca6e483ee6ff07591e6fd2 100644 (file)
@@ -1,10 +1,15 @@
-/*
+/**************************************************************************
+
+Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
+                     VA Linux Systems Inc., Fremont, California.
 Copyright (C) The Weather Channel, Inc.  2002.  All Rights Reserved.
 
 The Weather Channel (TM) funded Tungsten Graphics to develop the
 initial release of the Radeon 8500 driver under the XFree86 license.
 This notice must be preserved.
 
+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
@@ -29,57 +34,35 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /*
  * Authors:
+ *   Gareth Hughes <gareth@valinux.com>
  *   Keith Whitwell <keith@tungstengraphics.com>
+ *   Kevin E. Martin <martin@valinux.com>
  *   Nicolai Haehnle <prefect_@gmx.net>
  */
 
 #ifndef __RADEON_CONTEXT_H__
 #define __RADEON_CONTEXT_H__
 
-#include "mtypes.h"
+#include "main/mtypes.h"
+#include "main/colormac.h"
 #include "radeon_screen.h"
 #include "drm.h"
 #include "dri_util.h"
-#include "colormac.h"
 
 struct radeon_context;
 typedef struct radeon_context radeonContextRec;
-typedef struct radeon_context* radeonContextPtr;
-
-static __inline GLuint radeonPackColor(GLuint cpp,
-                                    GLubyte r, GLubyte g, GLubyte b, GLubyte a)
-{
-       switch (cpp) {
-       case 2:
-               return PACK_COLOR_565(r, g, b);
-       case 4:
-               return PACK_COLOR_8888(a, r, g, b);
-       default:
-               return 0;
-       }
-}
-
-#define TEX_0   0x1
-#define TEX_1   0x2
-#define TEX_2  0x4
-#define TEX_3  0x8
-#define TEX_4  0x10
-#define TEX_5  0x20
-#define TEX_6  0x40
-#define TEX_7  0x80
-#define TEX_ALL 0xff
-
+typedef struct radeon_context *radeonContextPtr;
 
 /* Rasterizing fallbacks */
 /* See correponding strings in r200_swtcl.c */
-#define RADEON_FALLBACK_TEXTURE                0x01
-#define RADEON_FALLBACK_DRAW_BUFFER    0x02
-#define RADEON_FALLBACK_STENCIL                0x04
-#define RADEON_FALLBACK_RENDER_MODE    0x08
-#define RADEON_FALLBACK_BLEND_EQ       0x10
-#define RADEON_FALLBACK_BLEND_FUNC     0x20
-#define RADEON_FALLBACK_DISABLE                0x40
-#define RADEON_FALLBACK_BORDER_MODE    0x80
+#define RADEON_FALLBACK_TEXTURE                0x0001
+#define RADEON_FALLBACK_DRAW_BUFFER    0x0002
+#define RADEON_FALLBACK_STENCIL                0x0004
+#define RADEON_FALLBACK_RENDER_MODE    0x0008
+#define RADEON_FALLBACK_BLEND_EQ       0x0010
+#define RADEON_FALLBACK_BLEND_FUNC     0x0020
+#define RADEON_FALLBACK_DISABLE                0x0040
+#define RADEON_FALLBACK_BORDER_MODE    0x0080
 
 #if R200_MERGED
 extern void radeonFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
@@ -116,11 +99,18 @@ extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
 #define TCL_FALLBACK( ctx, bit, mode ) ;
 #endif
 
-
 struct radeon_dri_mirror {
        __DRIcontextPrivate *context;   /* DRI context */
        __DRIscreenPrivate *screen;     /* DRI screen */
-       __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
+       /**
+        * DRI drawable bound to this context for drawing.
+        */
+       __DRIdrawablePrivate *drawable;
+
+       /**
+        * DRI drawable bound to this context for reading.
+        */
+       __DRIdrawablePrivate *readable;
 
        drm_context_t hwContext;
        drm_hw_lock_t *hwLock;
@@ -156,7 +146,7 @@ struct radeon_state {
  * structure.
  */
 struct radeon_context {
-       GLcontext *glCtx;               /* Mesa context */
+       GLcontext *glCtx;       /* Mesa context */
        radeonScreenPtr radeonScreen;   /* Screen private DRI data */
 
        /* Fallback state */
@@ -182,17 +172,13 @@ struct radeon_context {
        GLuint irqsEmitted;
        drm_radeon_irq_wait_t iw;
 
-       /* VBI / buffer swap */
-       GLuint vbl_seq;
-       GLuint vblank_flags;
-
+       /* buffer swap */
        int64_t swap_ust;
        int64_t swap_missed_ust;
 
        GLuint swap_count;
        GLuint swap_missed_count;
 
-
        /* Derived state */
        struct radeon_state state;
 
@@ -207,7 +193,7 @@ extern void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
 extern void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
                                int x, int y, int w, int h);
 extern GLboolean radeonInitContext(radeonContextPtr radeon,
-                                  struct dd_function_tablefunctions,
+                                  struct dd_function_table *functions,
                                   const __GLcontextModes * glVisual,
                                   __DRIcontextPrivate * driContextPriv,
                                   void *sharedContextPrivate);
@@ -244,4 +230,4 @@ extern int RADEON_DEBUG;
 #define DEBUG_PIXEL     0x2000
 #define DEBUG_MEMORY    0x4000
 
-#endif /* __RADEON_CONTEXT_H__ */
+#endif                         /* __RADEON_CONTEXT_H__ */