DRI2: Drop sarea, implement swap buffers in the X server.
[mesa.git] / src / mesa / drivers / dri / intel / intel_regions.h
index 42d7b177117147512f4a360865463721b199413c..1285f250a779234a7d62e37bb57039bb3d38fbfd 100644 (file)
 #ifndef INTEL_REGIONS_H
 #define INTEL_REGIONS_H
 
+/** @file intel_regions.h
+ *
+ * Structure definitions and prototypes for intel_region handling, which is
+ * the basic structure for rectangular collections of pixels stored in a dri_bo.
+ */
+
 #include "mtypes.h"
-#include "intel_screen.h"
+#include "dri_bufmgr.h"
 
 struct intel_context;
 struct intel_buffer_object;
@@ -53,7 +59,9 @@ struct intel_region
    GLuint map_refcount;  /**< Reference count for mapping */
 
    GLuint draw_offset; /**< Offset of drawing address within the region */
-
+   uint32_t tiling; /**< Which tiling mode the region is in */
+   uint32_t bit_6_swizzle; /**< GEM flag for address swizzling requirement */
+   drmAddress classic_map; /**< drmMap of the region when not in GEM mode */
    struct intel_buffer_object *pbo;     /* zero-copy uploads */
 };
 
@@ -61,47 +69,33 @@ struct intel_region
 /* Allocate a refcounted region.  Pointers to regions should only be
  * copied by calling intel_reference_region().
  */
-struct intel_region *intel_region_alloc(intelScreenPrivate *intelScreen,
+struct intel_region *intel_region_alloc(struct intel_context *intel,
                                         GLuint cpp,
                                         GLuint pitch, GLuint height);
 
+struct intel_region *
+intel_region_alloc_for_handle(struct intel_context *intel,
+                             GLuint cpp, GLuint pitch, GLuint height,
+                             unsigned int handle, const char *name);
+
 void intel_region_reference(struct intel_region **dst,
                             struct intel_region *src);
 
 void intel_region_release(struct intel_region **ib);
 
-extern struct intel_region 
-*intel_region_create_static(intelScreenPrivate *intelScreen,
-                           GLuint mem_type,
-                           unsigned int bo_handle,
-                           GLuint offset,
-                           void *virtual,
-                           GLuint cpp,
-                           GLuint pitch, GLuint height);
-extern void 
-intel_region_update_static(intelScreenPrivate *intelScreen,
-                          struct intel_region *region,
-                          GLuint mem_type,
-                          unsigned int bo_handle,
-                          GLuint offset,
-                          void *virtual,
-                          GLuint cpp, GLuint pitch, GLuint height);
-
-
-void intel_region_idle(intelScreenPrivate *intelScreen,
-                      struct intel_region *ib);
+void intel_recreate_static_regions(struct intel_context *intel);
 
 /* Map/unmap regions.  This is refcounted also: 
  */
-GLubyte *intel_region_map(intelScreenPrivate *intelScreen,
+GLubyte *intel_region_map(struct intel_context *intel,
                           struct intel_region *ib);
 
-void intel_region_unmap(intelScreenPrivate *intelScreen, struct intel_region *ib);
+void intel_region_unmap(struct intel_context *intel, struct intel_region *ib);
 
 
 /* Upload data to a rectangular sub-region
  */
-void intel_region_data(intelScreenPrivate *intelScreen,
+void intel_region_data(struct intel_context *intel,
                        struct intel_region *dest,
                        GLuint dest_offset,
                        GLuint destx, GLuint desty,
@@ -110,7 +104,7 @@ void intel_region_data(intelScreenPrivate *intelScreen,
 
 /* Copy rectangular sub-regions
  */
-void intel_region_copy(intelScreenPrivate *intelScreen,
+void intel_region_copy(struct intel_context *intel,
                        struct intel_region *dest,
                        GLuint dest_offset,
                        GLuint destx, GLuint desty,
@@ -120,7 +114,7 @@ void intel_region_copy(intelScreenPrivate *intelScreen,
 
 /* Fill a rectangular sub-region
  */
-void intel_region_fill(intelScreenPrivate *intelScreen,
+void intel_region_fill(struct intel_context *intel,
                        struct intel_region *dest,
                        GLuint dest_offset,
                        GLuint destx, GLuint desty,
@@ -128,16 +122,26 @@ void intel_region_fill(intelScreenPrivate *intelScreen,
 
 /* Helpers for zerocopy uploads, particularly texture image uploads:
  */
-void intel_region_attach_pbo(intelScreenPrivate *intelScreen,
+void intel_region_attach_pbo(struct intel_context *intel,
                              struct intel_region *region,
                              struct intel_buffer_object *pbo);
-void intel_region_release_pbo(intelScreenPrivate *intelScreen,
+void intel_region_release_pbo(struct intel_context *intel,
                               struct intel_region *region);
-void intel_region_cow(intelScreenPrivate *intelScreen,
+void intel_region_cow(struct intel_context *intel,
                       struct intel_region *region);
 
-dri_bo *intel_region_buffer(intelScreenPrivate *intelScreen,
+dri_bo *intel_region_buffer(struct intel_context *intel,
                            struct intel_region *region,
                            GLuint flag);
 
+void _mesa_copy_rect(GLubyte * dst,
+                GLuint cpp,
+                GLuint dst_pitch,
+                GLuint dst_x,
+                GLuint dst_y,
+                GLuint width,
+                GLuint height,
+                const GLubyte * src,
+                GLuint src_pitch, GLuint src_x, GLuint src_y);
+
 #endif