intel: Add support for ARB_copy_buffer.
[mesa.git] / src / mesa / drivers / dri / intel / intel_blit.c
index e0596a5531c7d47702f2dc8eef54cf9ef2072e8c..979f2025842f5f2bd845db987d50dbed8c003cde 100644 (file)
@@ -225,10 +225,18 @@ intelEmitCopyBlit(struct intel_context *intel,
    dri_bo *aper_array[3];
    BATCH_LOCALS;
 
-   if (dst_tiling == I915_TILING_Y)
-      return GL_FALSE;
-   if (src_tiling == I915_TILING_Y)
-      return GL_FALSE;
+   if (dst_tiling != I915_TILING_NONE) {
+      if (dst_offset & 4095)
+        return GL_FALSE;
+      if (dst_tiling == I915_TILING_Y)
+        return GL_FALSE;
+   }
+   if (src_tiling != I915_TILING_NONE) {
+      if (src_offset & 4095)
+        return GL_FALSE;
+      if (src_tiling == I915_TILING_Y)
+        return GL_FALSE;
+   }
 
    /* do space/cliprects check before going any further */
    do {
@@ -244,12 +252,7 @@ intelEmitCopyBlit(struct intel_context *intel,
    } while (pass < 2);
 
    if (pass >= 2) {
-       GLboolean locked = GL_FALSE;       
-       if (!intel->locked) {
-           LOCK_HARDWARE(intel);
-           locked = GL_TRUE;
-       }
-
+       LOCK_HARDWARE(intel);
        dri_bo_map(dst_buffer, GL_TRUE);
        dri_bo_map(src_buffer, GL_FALSE);
        _mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset,
@@ -263,9 +266,7 @@ intelEmitCopyBlit(struct intel_context *intel,
        
        dri_bo_unmap(src_buffer);
        dri_bo_unmap(dst_buffer);
-       
-       if (locked)
-           UNLOCK_HARDWARE(intel);
+       UNLOCK_HARDWARE(intel);
 
        return GL_TRUE;
    }
@@ -476,6 +477,8 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
                   BR13 |= BR13_565;
                }
 
+              assert(irb->region->tiling != I915_TILING_Y);
+
 #ifndef I915
               if (irb->region->tiling != I915_TILING_NONE) {
                  CMD |= XY_DST_TILED;
@@ -561,11 +564,16 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
    int dwords = ALIGN(src_size, 8) / 4;
    uint32_t opcode, br13, blit_cmd;
 
-   if (dst_tiling == I915_TILING_Y)
-      return GL_FALSE;
+   if (dst_tiling != I915_TILING_NONE) {
+      if (dst_offset & 4095)
+        return GL_FALSE;
+      if (dst_tiling == I915_TILING_Y)
+        return GL_FALSE;
+   }
 
    assert( logic_op - GL_CLEAR >= 0 );
    assert( logic_op - GL_CLEAR < 0x10 );
+   assert(dst_pitch > 0);
 
    if (w < 0 || h < 0)
       return GL_TRUE;