intel: Fix some potential writes to zero-copy PBOs when used as regions.
authorEric Anholt <eric@anholt.net>
Mon, 22 Jun 2009 18:20:18 +0000 (11:20 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 24 Jun 2009 02:31:11 +0000 (19:31 -0700)
I was in the midst of fixing some blitting-with-Y-tiled issues when I
noticed this.  Hopefully PBO usage will be a little more robust, as a
result.

src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_pixel_copy.c
src/mesa/drivers/dri/intel/intel_regions.c
src/mesa/drivers/dri/intel/intel_regions.h
src/mesa/drivers/dri/intel/intel_tex_copy.c

index fcfed9e751d35e758a34b451073c207fb8a59fc6..fadcc89b3e429cdabc7f2542200f897bdf219780 100644 (file)
@@ -511,7 +511,7 @@ intel_miptree_image_copy(struct intel_context *intel,
                         0,
                         0,
                         src->region, src_offset + src_depth_offset[i],
-                        0, 0, width, height);
+                        0, 0, width, height, GL_COPY);
    }
 
 }
index d50dd68092d8827fdbf8e6b7676e6f8786c20571..1a3e3638469073103c8f8cab4df3d1bd05933505 100644 (file)
@@ -362,11 +362,9 @@ do_blit_copypixels(GLcontext * ctx,
                                   &clip_x, &clip_y, &clip_w, &clip_h))
             continue;
 
-         intelEmitCopyBlit(intel, dst->cpp,
-                          src->pitch, src->buffer, 0, src->tiling,
-                          dst->pitch, dst->buffer, 0, dst->tiling,
-                          clip_x + delta_x, clip_y + delta_y, /* srcx, srcy */
-                          clip_x, clip_y, /* dstx, dsty */
+        intel_region_copy(intel,
+                          dst, 0, clip_x, clip_y,
+                          src, 0, clip_x + delta_x, clip_y + delta_y,
                           clip_w, clip_h,
                           ctx->Color.ColorLogicOpEnabled ?
                           ctx->Color.LogicOp : GL_COPY);
index 9e5d0dd296816ff92938e14234bf649af22a122b..98109235b74c9b15550944dc2baa245bddb7c17a 100644 (file)
@@ -367,7 +367,8 @@ intel_region_copy(struct intel_context *intel,
                   GLuint dstx, GLuint dsty,
                   struct intel_region *src,
                   GLuint src_offset,
-                  GLuint srcx, GLuint srcy, GLuint width, GLuint height)
+                  GLuint srcx, GLuint srcy, GLuint width, GLuint height,
+                 GLenum logicop)
 {
    _DBG("%s\n", __FUNCTION__);
 
@@ -389,7 +390,7 @@ intel_region_copy(struct intel_context *intel,
                      src->pitch, src->buffer, src_offset, src->tiling,
                      dst->pitch, dst->buffer, dst_offset, dst->tiling,
                      srcx, srcy, dstx, dsty, width, height,
-                    GL_COPY);
+                    logicop);
 }
 
 /* Attach to a pbo, discarding our data.  Effectively zero-copy upload
index 1d0371aa670e8da7c44d567663c3aa00742f346e..c2d4810df2cf620ef68236d69694509073650e7f 100644 (file)
@@ -116,7 +116,8 @@ void intel_region_copy(struct intel_context *intel,
                        GLuint destx, GLuint desty,
                        struct intel_region *src,
                        GLuint src_offset,
-                       GLuint srcx, GLuint srcy, GLuint width, GLuint height);
+                       GLuint srcx, GLuint srcy, GLuint width, GLuint height,
+                      GLenum logicop);
 
 /* Helpers for zerocopy uploads, particularly texture image uploads:
  */
index 260235b1eb10ba01178c5ab46bf4c94449915408..e1820e3fcf590b6794c4c2d5163aa10defd1e1b3 100644 (file)
@@ -107,6 +107,9 @@ do_copy_texsubimage(struct intel_context *intel,
    intelFlush(ctx);
    LOCK_HARDWARE(intel);
    {
+      drm_intel_bo *dst_bo = intel_region_buffer(intel,
+                                                intelImage->mt->region,
+                                                INTEL_WRITE_PART);
       GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
                                                        intelImage->face,
                                                        intelImage->level);
@@ -151,7 +154,7 @@ do_copy_texsubimage(struct intel_context *intel,
                        0,
                        src->tiling,
                        intelImage->mt->pitch,
-                       intelImage->mt->region->buffer,
+                       dst_bo,
                        image_offset,
                        intelImage->mt->region->tiling,
                        x, y, dstx, dsty, width, height,