summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2010-01-16 23:11:10 +0100
committerMaciej Cencora <m.cencora@gmail.com>2010-03-07 12:07:36 +0100
commit65faa27aa639e7352708a30105db3318f22f5f93 (patch)
treeab55e196b3b39ca0ba81be612617d644df9774f6 /src/mesa/drivers
parent88a99bb305186fd0eaaae9bd0dbfa4c45f14cac7 (diff)
radeon: add tile size getter
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tile.c40
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tile.h2
2 files changed, 41 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_tile.c b/src/mesa/drivers/dri/radeon/radeon_tile.c
index 56f2fc46d9..b998baf0a2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tile.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tile.c
@@ -243,4 +243,42 @@ void tile_image(const void * src, unsigned src_pitch,
assert(0);
break;
}
-} \ No newline at end of file
+}
+
+void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height)
+{
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ *block_width = 1;
+ *block_height = 1;
+ break;
+ case 8:
+ *block_width = 2;
+ *block_height = 2;
+ break;
+ case 4:
+ *block_width = 4;
+ *block_height = 2;
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ *block_width = 4;
+ *block_height = 4;
+ }
+ else
+ {
+ *block_width = 8;
+ *block_height = 2;
+ }
+ break;
+ case 1:
+ *block_width = 8;
+ *block_height = 4;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tile.h b/src/mesa/drivers/dri/radeon/radeon_tile.h
index 4985e55204..06850b361d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tile.h
+++ b/src/mesa/drivers/dri/radeon/radeon_tile.h
@@ -30,3 +30,5 @@
void tile_image(const void * src, unsigned src_pitch,
void *dst, unsigned dst_pitch,
gl_format format, unsigned width, unsigned height);
+
+void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height);