[965] Move to using shared texture management code.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_context.h
index 65898caaa75ea67a6d6e275e18931ed2d41905a1..583ef42166ed39f889729603010efd9ed57f1e8d 100644 (file)
@@ -35,6 +35,7 @@
 #include "texmem.h"
 
 #include "intel_screen.h"
+#include "intel_tex_obj.h"
 #include "i830_common.h"
 #include "tnl/t_vertex.h"
 
@@ -63,28 +64,9 @@ typedef void (*intel_point_func)(struct intel_context *, intelVertex *);
 extern void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode );
 #define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode )
 
-
-
-struct intel_texture_object
-{
-   struct gl_texture_object base; /* The "parent" object */
-
-   /* The mipmap tree must include at least these levels once
-    * validated:
-    */
-   GLuint firstLevel;
-   GLuint lastLevel;
-
-   GLuint dirty_images[6];
-   GLuint dirty;
-
-   /* On validation any active images held in main memory or in other
-    * regions will be copied to this region and the old storage freed.
-    */
-   struct intel_mipmap_tree *mt;
-};
-
-
+#define INTEL_WRITE_PART  0x1
+#define INTEL_WRITE_FULL  0x2
+#define INTEL_READ        0x4
 
 struct intel_context
 {
@@ -151,20 +133,34 @@ struct intel_context
                             GLfloat s0, GLfloat s1,
                             GLfloat t0, GLfloat t1);
 
-
-
+      void (*debug_batch)(struct intel_context *intel);
    } vtbl;
 
    GLint refcount;   
    GLuint Fallback;
    GLuint NewGLState;
-   
-   GLuint last_swap_fence;
-   GLuint second_last_swap_fence;
-   
+
+   dri_bufmgr *bufmgr;
+   unsigned int maxBatchSize;
+
+   struct intel_region *front_region;
+   struct intel_region *back_region;
+   struct intel_region *third_region;
+   struct intel_region *depth_region;
+
+   /**
+    * This value indicates that the kernel memory manager is being used
+    * instead of the fake client-side memory manager.
+    */
+   GLboolean ttm;
+
+   dri_fence *first_swap_fence;
+   dri_fence *last_swap_fence;
+
    GLuint stats_wm;
 
    struct intel_batchbuffer *batch;
+   unsigned batch_id;
 
    GLubyte clear_chan[4];
    GLuint ClearColor;
@@ -178,29 +174,17 @@ struct intel_context
    GLboolean hw_stencil;
    GLboolean hw_stipple;
    GLboolean depth_buffer_is_float;
-   GLboolean no_hw;
    GLboolean no_rast;
-   GLboolean thrashing;
    GLboolean locked;
    GLboolean strict_conformance;
    GLboolean need_flush;
 
-
-   
-   /* AGP memory buffer manager:
-    */
-   struct bufmgr *bm;
-
-
    /* State for intelvb.c and inteltris.c.
     */
    GLenum render_primitive;
    GLenum reduced_primitive;
 
-   struct intel_region *front_region;
-   struct intel_region *back_region;
    struct intel_region *draw_region;
-   struct intel_region *depth_region;
 
    /* These refer to the current draw (front vs. back) buffer:
     */
@@ -226,16 +210,13 @@ struct intel_context
 
    GLuint lastStamp;
 
+   GLboolean no_hw;
+
    /**
     * Configuration cache
     */
    driOptionCache optionCache;
 
-   /* VBI
-    */
-   GLuint vbl_seq;
-   GLuint vblank_flags;
-
    int64_t swap_ust;
    int64_t swap_missed_ust;
 
@@ -307,32 +288,6 @@ static inline void * __memcpy(void * to, const void * from, size_t n)
 #endif
 
 
-/* The system memcpy (at least on ubuntu 5.10) has problems copying
- * to agp (writecombined) memory from a source which isn't 64-byte
- * aligned - there is a 4x performance falloff.
- *
- * The x86 __memcpy is immune to this but is slightly slower
- * (10%-ish) than the system memcpy.
- *
- * The sse_memcpy seems to have a slight cliff at 64/32 bytes, but
- * isn't much faster than x86_memcpy for agp copies.
- * 
- * TODO: switch dynamically.
- */
-static inline void *do_memcpy( void *dest, const void *src, size_t n )
-{
-   if ( (((unsigned long)src) & 63) ||
-       (((unsigned long)dest) & 63)) {
-      return  __memcpy(dest, src, n);  
-   }
-   else
-      return memcpy(dest, src, n);
-}
-
-
-
-
-
 /* ================================================================
  * Debugging:
  */
@@ -358,6 +313,15 @@ extern int INTEL_DEBUG;
 #define DEBUG_URB       0x20000
 #define DEBUG_VS        0x40000
 #define DEBUG_BATCH    0x80000
+#define DEBUG_BUFMGR   0x100000
+#define DEBUG_BLIT     0x200000
+#define DEBUG_REGION   0x400000
+#define DEBUG_MIPTREE  0x800000
+
+#define DBG(...) do {                                          \
+       if (INTEL_DEBUG & FILE_DEBUG_FLAG)                      \
+               _mesa_printf(__VA_ARGS__);                      \
+} while(0)
 
 /* ================================================================
  * intel_context.c:
@@ -485,15 +449,5 @@ static inline struct intel_context *intel_context( GLcontext *ctx )
    return (struct intel_context *)ctx;
 }
 
-static inline struct intel_texture_object *intel_texture_object( struct gl_texture_object *obj )
-{
-   return (struct intel_texture_object *)obj;
-}
-
-static inline struct intel_texture_image *intel_texture_image( struct gl_texture_image *img )
-{
-   return (struct intel_texture_image *)img;
-}
-
 #endif