intel: Remove unneded pthread mutex in LOCK_HARDWARE.
[mesa.git] / src / mesa / drivers / dri / intel / intel_regions.h
index 1975d729e473b4d15dee4c0ddbb3b75e1e878a73..0d379bdc6e273c2483c3cb279fb668fbcefbfe6d 100644 (file)
 #ifndef INTEL_REGIONS_H
 #define INTEL_REGIONS_H
 
-#include "mtypes.h"
-#include "dri_bufmgr.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 <xf86drm.h>
+
+#include "main/mtypes.h"
+#include "intel_bufmgr.h"
 
 struct intel_context;
 struct intel_buffer_object;
@@ -47,14 +55,16 @@ struct intel_region
    dri_bo *buffer;  /**< buffer manager's buffer */
    GLuint refcount; /**< Reference count for region */
    GLuint cpp;      /**< bytes per pixel */
-   GLuint pitch;    /**< in pixels */
+   GLuint width;    /**< in pixels */
    GLuint height;   /**< in pixels */
+   GLuint pitch;    /**< in pixels */
    GLubyte *map;    /**< only non-NULL when region is actually mapped */
    GLuint map_refcount;  /**< Reference count for mapping */
 
    GLuint draw_offset; /**< Offset of drawing address within the region */
-   GLboolean tiled; /**< True if the region is X or Y-tiled.  Used on 965. */
-
+   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 */
 };
 
@@ -63,8 +73,16 @@ struct intel_region
  * copied by calling intel_reference_region().
  */
 struct intel_region *intel_region_alloc(struct intel_context *intel,
-                                        GLuint cpp,
-                                        GLuint pitch, GLuint height);
+                                        uint32_t tiling,
+                                       GLuint cpp, GLuint width,
+                                        GLuint height, GLuint pitch,
+                                       GLboolean expect_accelerated_upload);
+
+struct intel_region *
+intel_region_alloc_for_handle(struct intel_context *intel,
+                             GLuint cpp,
+                             GLuint width, GLuint height, GLuint pitch,
+                             unsigned int handle, const char *name);
 
 void intel_region_reference(struct intel_region **dst,
                             struct intel_region *src);
@@ -73,9 +91,6 @@ void intel_region_release(struct intel_region **ib);
 
 void intel_recreate_static_regions(struct intel_context *intel);
 
-void intel_region_idle(struct intel_context *intel,
-                      struct intel_region *ib);
-
 /* Map/unmap regions.  This is refcounted also: 
  */
 GLubyte *intel_region_map(struct intel_context *intel,
@@ -95,21 +110,15 @@ void intel_region_data(struct intel_context *intel,
 
 /* Copy rectangular sub-regions
  */
-void intel_region_copy(struct intel_context *intel,
-                       struct intel_region *dest,
-                       GLuint dest_offset,
-                       GLuint destx, GLuint desty,
-                       struct intel_region *src,
-                       GLuint src_offset,
-                       GLuint srcx, GLuint srcy, GLuint width, GLuint height);
-
-/* Fill a rectangular sub-region
- */
-void intel_region_fill(struct intel_context *intel,
-                       struct intel_region *dest,
-                       GLuint dest_offset,
-                       GLuint destx, GLuint desty,
-                       GLuint width, GLuint height, GLuint color);
+GLboolean
+intel_region_copy(struct intel_context *intel,
+                 struct intel_region *dest,
+                 GLuint dest_offset,
+                 GLuint destx, GLuint desty,
+                 struct intel_region *src,
+                 GLuint src_offset,
+                 GLuint srcx, GLuint srcy, GLuint width, GLuint height,
+                 GLenum logicop);
 
 /* Helpers for zerocopy uploads, particularly texture image uploads:
  */
@@ -125,4 +134,14 @@ 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