r300g: set correct pitch in libdrm
authorMarek Olšák <maraeo@gmail.com>
Mon, 31 May 2010 02:01:56 +0000 (04:01 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 31 May 2010 02:16:24 +0000 (04:16 +0200)
to match what DDX sets. This prevents some flushes from occuring.

src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_texture.c

index d68f4039ca4647ef47b48f3b4b5565fae44389c5..cfec8ac2b7ea587c8a29a7c504baf1aee94ffc7d 100644 (file)
@@ -540,18 +540,18 @@ static void r300_fb_set_tiling_flags(struct r300_context *r300,
         level = new_state->cbufs[i]->level;
 
         r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
-                                        tex->pitch[0],
-                                        tex->microtile,
-                                        tex->mip_macrotile[level]);
+                tex->pitch[0] * util_format_get_blocksize(tex->b.b.format),
+                tex->microtile,
+                tex->mip_macrotile[level]);
     }
     if (new_state->zsbuf) {
         tex = r300_texture(new_state->zsbuf->texture);
         level = new_state->zsbuf->level;
 
         r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
-                                        tex->pitch[0],
-                                        tex->microtile,
-                                        tex->mip_macrotile[level]);
+                tex->pitch[0] * util_format_get_blocksize(tex->b.b.format),
+                tex->microtile,
+                tex->mip_macrotile[level]);
     }
 }
 
index 4a5c932b7e864ca8984912598c48240854773815..a4b5d34ce1f8765b2ba8511a24e254b168b18e9c 100644 (file)
@@ -963,9 +963,9 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
                                      base->bind,
                                     tex->size);
     rws->buffer_set_tiling(rws, tex->buffer,
-                          tex->pitch[0],
-                          tex->microtile,
-                          tex->macrotile);
+            tex->pitch[0] * util_format_get_blocksize(tex->b.b.format),
+            tex->microtile,
+            tex->macrotile);
 
     if (!tex->buffer) {
         FREE(tex);
@@ -1093,9 +1093,9 @@ r300_texture_from_handle(struct pipe_screen* screen,
 
     if (override_zb_flags) {
         rws->buffer_set_tiling(rws, tex->buffer,
-                               tex->pitch[0],
-                               tex->microtile,
-                               tex->macrotile);
+                tex->pitch[0] * util_format_get_blocksize(tex->b.b.format),
+                tex->microtile,
+                tex->macrotile);
     }
     return (struct pipe_resource*)tex;
 }