summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-10-21 13:27:07 +1000
committerDave Airlie <[email protected]>2010-10-21 13:32:08 +1000
commit388ce31baa860a0d7535c852d768c6e243c8133c (patch)
tree8d3143e46013df8429373228a81a3893837040f2 /src/gallium
parentea5aab85fd195074189832c2d6870dd78f0f8966 (diff)
r600g: start adding hooks for aligning width/height for tiles.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/r600_texture.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index b36f8236081..a90fc0382f1 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -92,6 +92,19 @@ static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
}
}
+static unsigned r600_get_pixel_alignment(struct pipe_screen *screen,
+ enum pipe_format format,
+ unsigned array_mode)
+{
+ return 64;
+}
+
+static unsigned r600_get_height_alignment(struct pipe_screen *screen,
+ unsigned array_mode)
+{
+ return 1;
+}
+
static unsigned mip_minify(unsigned size, unsigned level)
{
unsigned val;
@@ -108,14 +121,18 @@ static unsigned r600_texture_get_stride(struct pipe_screen *screen,
struct pipe_resource *ptex = &rtex->resource.base.b;
struct radeon *radeon = (struct radeon *)screen->winsys;
enum chip_class chipc = r600_get_family_class(radeon);
- unsigned width, stride;
+ unsigned width, stride, tile_width;
if (rtex->pitch_override)
return rtex->pitch_override;
width = mip_minify(ptex->width0, level);
-
- stride = util_format_get_stride(ptex->format, align(width, 64));
+ if (util_format_is_plain(ptex->format)) {
+ tile_width = r600_get_pixel_alignment(screen, ptex->format,
+ rtex->array_mode[level]);
+ width = align(width, tile_width);
+ }
+ stride = util_format_get_stride(ptex->format, width);
if (chipc == EVERGREEN)
stride = align(stride, 512);
else
@@ -128,9 +145,14 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen,
unsigned level)
{
struct pipe_resource *ptex = &rtex->resource.base.b;
- unsigned height;
+ unsigned height, tile_height;
height = mip_minify(ptex->height0, level);
+ if (util_format_is_plain(ptex->format)) {
+ tile_height = r600_get_height_alignment(screen,
+ rtex->array_mode[level]);
+ height = align(height, tile_height);
+ }
return util_format_get_nblocksy(ptex->format, height);
}