Mesa (master): Revert "llvmpipe: increase number of subpixel bits to eight"

Zack Rusin zack at kemper.freedesktop.org
Tue Sep 24 19:10:25 UTC 2013


Module: Mesa
Branch: master
Commit: 71ecc2cf71e678daca347bb10dd48e037ecd10af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=71ecc2cf71e678daca347bb10dd48e037ecd10af

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Sep 24 15:08:35 2013 -0400

Revert "llvmpipe: increase number of subpixel bits to eight"

This reverts commit 755c11dc5e94f17097c186edaaa39d818396f14c.
We agreed that this is band-aid that's not very useful and
the proper solution is to rewrite the rasterization algo
so that it operates on 64 bit values.

Signed-off-by: Zack Rusin <zackr at vmware.com>

---

 src/gallium/drivers/llvmpipe/lp_rast.h      |   12 +-----------
 src/gallium/drivers/llvmpipe/lp_setup.c     |   14 +++++++++-----
 src/gallium/drivers/llvmpipe/lp_setup_tri.c |    2 +-
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index 39ff6af..c57f2ea 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -46,20 +46,10 @@ struct lp_scene;
 struct lp_fence;
 struct cmd_bin;
 
-#define FIXED_TYPE_WIDTH 32
 /** For sub-pixel positioning */
-#define FIXED_ORDER 8
+#define FIXED_ORDER 4
 #define FIXED_ONE (1<<FIXED_ORDER)
 
-/** Maximum length of an edge in a primitive in pixels.
- *  If the framebuffer is large we have to think about fixed-point
- *  integer overflow.  Coordinates need ((FIXED_TYPE_WIDTH/2) - 1) bits
- *  to be able to fit product of two such coordinates inside
- *  FIXED_TYPE_WIDTH, any larger and we could overflow a
- *  FIXED_TYPE_WIDTH_-bit int.
- */
-#define MAX_FIXED_LENGTH (1 << (((FIXED_TYPE_WIDTH/2) - 1) - FIXED_ORDER))
-
 /* Rasterizer output size going to jit fs, width/height */
 #define LP_RASTER_BLOCK_SIZE 4
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index d686500..5fde01f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -1007,12 +1007,16 @@ try_update_scene_state( struct lp_setup_context *setup )
                                          &setup->draw_regions[i]);
          }
       }
-      /*
-       * Check if subdivision of triangles is needed if the framebuffer
-       * is larger than our MAX_FIXED_LENGTH can accomodate.
+      /* If the framebuffer is large we have to think about fixed-point
+       * integer overflow.  For 2K by 2K images, coordinates need 15 bits
+       * (2^11 + 4 subpixel bits).  The product of two such numbers would
+       * use 30 bits.  Any larger and we could overflow a 32-bit int.
+       *
+       * To cope with this problem we check if triangles are large and
+       * subdivide them if needed.
        */
-      setup->subdivide_large_triangles = (setup->fb.width > MAX_FIXED_LENGTH &&
-                                          setup->fb.height > MAX_FIXED_LENGTH);
+      setup->subdivide_large_triangles = (setup->fb.width > 2048 &&
+                                          setup->fb.height > 2048);
    }
                                       
    setup->dirty = 0;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index cf67f29..da9967a 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -995,7 +995,7 @@ check_subdivide_triangle(struct lp_setup_context *setup,
                          const float (*v2)[4],
                          triangle_func_t tri)
 {
-   const float maxLen = MAX_FIXED_LENGTH;  /* longest permissible edge, in pixels */
+   const float maxLen = 2048.0f;  /* longest permissible edge, in pixels */
    float dx10, dy10, len10;
    float dx21, dy21, len21;
    float dx02, dy02, len02;




More information about the mesa-commit mailing list