summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-01-20 17:44:12 -0700
committerBrian Paul <brianp@vmware.com>2010-01-20 17:44:12 -0700
commit0706dae088e5b46c4cad1a5ee41038e05c7f363b (patch)
tree8f5289eaabefdf7e0d74098bbbc3783ba6eba68f /src/gallium/drivers
parent58903b378188861a6f7a67bbfb07424b73df2a1b (diff)
llvmpipe: align display target size to multiple of tile size
This will allow us to skip clipping tiles to surface bounds.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 1c92d7f722..36e2ebb41a 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -40,9 +40,10 @@
#include "util/u_memory.h"
#include "lp_context.h"
+#include "lp_screen.h"
#include "lp_state.h"
#include "lp_texture.h"
-#include "lp_screen.h"
+#include "lp_tile_size.h"
#include "lp_winsys.h"
@@ -67,8 +68,8 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
/* Allocate storage for whole quads. This is particularly important
* for depth surfaces, which are currently stored in a swizzled format.
*/
- nblocksx = util_format_get_nblocksx(pt->format, align(width, 2));
- nblocksy = util_format_get_nblocksy(pt->format, align(height, 2));
+ nblocksx = util_format_get_nblocksx(pt->format, align(width, TILE_SIZE));
+ nblocksy = util_format_get_nblocksy(pt->format, align(height, TILE_SIZE));
lpt->stride[level] = align(nblocksx * util_format_get_blocksize(pt->format), 16);
@@ -96,10 +97,15 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
{
struct llvmpipe_winsys *winsys = screen->winsys;
+ /* Round up the surface size to a multiple of the tile size to
+ * avoid tile clipping.
+ */
+ unsigned width = align(lpt->base.width0, TILE_SIZE);
+ unsigned height = align(lpt->base.height0, TILE_SIZE);
+
lpt->dt = winsys->displaytarget_create(winsys,
lpt->base.format,
- lpt->base.width0,
- lpt->base.height0,
+ width, height,
16,
&lpt->stride[0] );
@@ -299,8 +305,8 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
pipe_texture_reference(&pt->texture, texture);
pt->x = x;
pt->y = y;
- pt->width = w;
- pt->height = h;
+ pt->width = align(w, TILE_SIZE);
+ pt->height = align(h, TILE_SIZE);
pt->stride = lptex->stride[level];
pt->usage = usage;
pt->face = face;