r600: align to r300 changes in the blit code
authorMaciej Cencora <m.cencora@gmail.com>
Mon, 18 Jan 2010 22:00:36 +0000 (23:00 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Tue, 19 Jan 2010 22:38:34 +0000 (23:38 +0100)
Pitch here means aligned width, not aligned width * bpp.

src/mesa/drivers/dri/r600/r600_blit.c
src/mesa/drivers/dri/r600/r600_texcopy.c

index 58eb91ec615c4536e50971e3b70303c5841cd841..0205a438cc7f038b3b284d7a55683de521e1940f 100644 (file)
@@ -90,16 +90,15 @@ static unsigned is_blit_supported(gl_format mesa_format)
 
 static inline void
 set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_format,
-                  int pitch, int w, int h, intptr_t dst_offset)
+                  int nPitchInPixel, int w, int h, intptr_t dst_offset)
 {
     uint32_t cb_color0_base, cb_color0_size = 0, cb_color0_info = 0, cb_color0_view = 0;
-    int nPitchInPixel, id = 0;
-    uint32_t comp_swap, format, bpp = _mesa_get_format_bytes(mesa_format);
+    int id = 0;
+    uint32_t comp_swap, format;
     BATCH_LOCALS(&context->radeon);
 
     cb_color0_base = dst_offset / 256;
 
-    nPitchInPixel = pitch/bpp;
     SETfield(cb_color0_size, (nPitchInPixel / 8) - 1,
              PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask);
     SETfield(cb_color0_size, ((nPitchInPixel * h) / 64) - 1,
@@ -556,11 +555,9 @@ set_vtx_resource(context_t *context)
 static inline void
 set_tex_resource(context_t * context,
                 gl_format mesa_format, struct radeon_bo *bo, int w, int h,
-                int pitch, intptr_t src_offset)
+                int TexelPitch, intptr_t src_offset)
 {
     uint32_t sq_tex_resource0, sq_tex_resource1, sq_tex_resource2, sq_tex_resource4, sq_tex_resource6;
-    int bpp = _mesa_get_format_bytes(mesa_format);
-    int TexelPitch = pitch/bpp;
 
     sq_tex_resource0 = sq_tex_resource1 = sq_tex_resource2 = sq_tex_resource4 = sq_tex_resource6 = 0;
     BATCH_LOCALS(&context->radeon);
index 12b34030512424133a61c1535bfb5ef69d552aa3..21bf840e86f17e5e8ca4cf16ff8831d9837a8391 100644 (file)
@@ -81,10 +81,11 @@ do_copy_texsubimage(GLcontext *ctx,
 
 
     /* blit from src buffer to texture */
-    return r600_blit(ctx, rrb->bo, src_offset, rrb->base.Format, rrb->pitch,
+    return r600_blit(ctx, rrb->bo, src_offset, rrb->base.Format, rrb->pitch/rrb->cpp,
                      rrb->base.Width, rrb->base.Height, x, y,
                      timg->mt->bo, dst_offset, timg->base.TexFormat,
-                     timg->mt->levels[level].rowstride, timg->base.Width, timg->base.Height,
+                     timg->mt->levels[level].rowstride / _mesa_get_format_bytes(timg->base.TexFormat),
+                     timg->base.Width, timg->base.Height,
                      dstx, dsty, width, height, 1);
 }