nv50: use larger tile sizes
authorBen Skeggs <bskeggs@redhat.com>
Fri, 5 Jun 2009 12:04:07 +0000 (22:04 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 5 Jun 2009 12:53:24 +0000 (22:53 +1000)
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_state_validate.c

index 2fbedb6779a0700a7442ced54f70a6173b46bf66..6b605ba416caa12dd18349fc84cbbe9b1df45b90 100644 (file)
@@ -34,7 +34,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
        struct pipe_texture *pt = &mt->base;
        unsigned width = tmp->width[0], height = tmp->height[0];
        unsigned depth = tmp->depth[0];
-       uint32_t tile_mode = 0, tile_flags = 0;
+       uint32_t tile_mode, tile_flags, tile_h;
        int ret, i, l;
 
        mt->base = *tmp;
@@ -51,6 +51,13 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
                break;
        }
 
+       if      (pt->height[0] > 32) tile_mode = 4;
+       else if (pt->height[0] > 16) tile_mode = 3;
+       else if (pt->height[0] >  8) tile_mode = 2;
+       else if (pt->height[0] >  4) tile_mode = 1;
+       else                         tile_mode = 0;
+       tile_h = 1 << (tile_mode + 2);
+
        switch (pt->target) {
        case PIPE_TEXTURE_3D:
                mt->image_nr = pt->depth[0];
@@ -87,7 +94,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
 
                        size  = align(pt->width[l], 8) * pt->block.size;
                        size  = align(size, 64);
-                       size *= align(pt->height[l], 8) * pt->block.size;
+                       size *= align(pt->height[l], tile_h) * pt->block.size;
 
                        lvl->image_offset[i] = mt->total_size;
 
index 1788f764560b7a8e952c1d90bab3d15a2cc35eea..a0106fc3392eb1be9733ace4e63d3da10a8d6dbc 100644 (file)
@@ -66,7 +66,7 @@ nv50_state_validate_fb(struct nv50_context *nv50)
                        so_data(so, 0xe6);
                        break;
                }
-               so_data(so, 0x00000000);
+               so_data(so, bo->tile_mode << 4);
                so_data(so, 0x00000000);
 
                so_method(so, tesla, 0x1224, 1);
@@ -104,7 +104,7 @@ nv50_state_validate_fb(struct nv50_context *nv50)
                        so_data(so, 0x16);
                        break;
                }
-               so_data(so, 0x00000000);
+               so_data(so, bo->tile_mode << 4);
                so_data(so, 0x00000000);
 
                so_method(so, tesla, 0x1538, 1);