Mesa (lp-binning): llvmpipe: align display target size to multiple of tile size

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 21 16:08:21 UTC 2010


Module: Mesa
Branch: lp-binning
Commit: 0706dae088e5b46c4cad1a5ee41038e05c7f363b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0706dae088e5b46c4cad1a5ee41038e05c7f363b

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan 20 17:44:12 2010 -0700

llvmpipe: align display target size to multiple of tile size

This will allow us to skip clipping tiles to surface bounds.

---

 src/gallium/drivers/llvmpipe/lp_texture.c |   20 +++++++++++++-------
 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 1c92d7f..36e2ebb 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;




More information about the mesa-commit mailing list