intel: Unindent the blit call in PBO blit uploads.
authorEric Anholt <eric@anholt.net>
Wed, 21 Sep 2011 16:51:58 +0000 (09:51 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 22 Sep 2011 18:03:26 +0000 (11:03 -0700)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_tex_image.c

index 37704bcca0eaa2dd1415c40c3921ca2aaeffc289..8fd69c3734a5932bea868bf77caaeae61384d8a4 100644 (file)
@@ -181,8 +181,9 @@ try_pbo_upload(struct intel_context *intel,
    }
 
    dst_buffer = intel_region_buffer(intel, intelImage->mt->region, INTEL_WRITE_FULL);
+   src_buffer = intel_bufferobj_source(intel, pbo, 64, &src_offset);
    /* note: potential 64-bit ptr to 32-bit int cast */
-   src_offset = (GLuint) (unsigned long) pixels;
+   src_offset += (GLuint) (unsigned long) pixels;
 
    if (unpack->RowLength > 0)
       src_stride = unpack->RowLength;
@@ -195,22 +196,16 @@ try_pbo_upload(struct intel_context *intel,
 
    dst_stride = intelImage->mt->region->pitch;
 
-   {
-      GLuint offset;
-      drm_intel_bo *src_buffer =
-             intel_bufferobj_source(intel, pbo, 64, &offset);
-
-      if (!intelEmitCopyBlit(intel,
-                            intelImage->mt->cpp,
-                            src_stride, src_buffer,
-                            src_offset + offset, GL_FALSE,
-                            dst_stride, dst_buffer, 0,
-                            intelImage->mt->region->tiling,
-                            0, 0, dst_x, dst_y, width, height,
-                            GL_COPY)) {
-        DBG("%s: blit failed\n", __FUNCTION__);
-        return false;
-      }
+   if (!intelEmitCopyBlit(intel,
+                         intelImage->mt->cpp,
+                         src_stride, src_buffer,
+                         src_offset, GL_FALSE,
+                         dst_stride, dst_buffer, 0,
+                         intelImage->mt->region->tiling,
+                         0, 0, dst_x, dst_y, width, height,
+                         GL_COPY)) {
+      DBG("%s: blit failed\n", __FUNCTION__);
+      return false;
    }
 
    DBG("%s: success\n", __FUNCTION__);