Module: Mesa
Branch: master
Commit: 246d59c29e3e5a57dcf2f60ad429eb1606193ef0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=246d59c29e3e5a57dcf2f60ad429eb1606193ef0

Author: Eric Anholt <[email protected]>
Date:   Mon Jun 22 11:20:18 2009 -0700

intel: Fix some potential writes to zero-copy PBOs when used as regions.

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 |    2 +-
 src/mesa/drivers/dri/intel/intel_pixel_copy.c  |    8 +++-----
 src/mesa/drivers/dri/intel/intel_regions.c     |    5 +++--
 src/mesa/drivers/dri/intel/intel_regions.h     |    3 ++-
 src/mesa/drivers/dri/intel/intel_tex_copy.c    |    5 ++++-
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index fcfed9e..fadcc89 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -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);
    }
 
 }
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c 
b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index d50dd68..1a3e363 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -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);
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c 
b/src/mesa/drivers/dri/intel/intel_regions.c
index 9e5d0dd..9810923 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -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
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h 
b/src/mesa/drivers/dri/intel/intel_regions.h
index 1d0371a..c2d4810 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -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:
  */
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c 
b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 260235b..e1820e3 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -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,

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to