Bug #9604: Fix a static buffer allocation failure.
authorEric Anholt <eric@anholt.net>
Sun, 21 Jan 2007 02:09:32 +0000 (18:09 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 26 Jan 2007 22:23:29 +0000 (14:23 -0800)
The pool that the static buffer got allocated from was sized by pitch * height,
but the buffer generated from it had its size aligned to a tile boundary, so
allocation failed if pitch * height wasn't aligned.  However, the 2d driver
ensures that the size ends at a tile boundary, so just pass the 2d driver's
buffer size rather than calculating it.

src/mesa/drivers/dri/i965/intel_context.c
src/mesa/drivers/dri/i965/intel_regions.c
src/mesa/drivers/dri/i965/intel_regions.h

index 63809e0aa89fb59260ac7194b57f27f7911d077a..4486a28adc7543f92f354a70853c89e60f8281bd 100644 (file)
@@ -446,8 +446,8 @@ GLboolean intelInitContext( struct intel_context *intel,
                                 intelScreen->cpp,
                                 intelScreen->front.pitch / intelScreen->cpp,
                                 intelScreen->height,
-                                intelScreen->front.tiled != 0); /* 0: LINEAR */
-
+                                intelScreen->front.size,
+                                intelScreen->front.tiled != 0);
 
    intel->back_region = 
       intel_region_create_static(intel,
@@ -457,6 +457,7 @@ GLboolean intelInitContext( struct intel_context *intel,
                                 intelScreen->cpp,
                                 intelScreen->back.pitch / intelScreen->cpp,
                                 intelScreen->height,
+                                intelScreen->back.size,
                                  intelScreen->back.tiled != 0);
 
    /* Still assuming front.cpp == depth.cpp
@@ -473,6 +474,7 @@ GLboolean intelInitContext( struct intel_context *intel,
                                 intelScreen->cpp,
                                 intelScreen->depth.pitch / intelScreen->cpp,
                                 intelScreen->height,
+                                intelScreen->depth.size,
                                  intelScreen->depth.tiled != 0);
    
    intel_bufferobj_init( intel );
index 398b0a0a3b5192be45e36c6d464028d3a0a94ef2..835ecdd725768951858e1462309ed78bbc845953 100644 (file)
@@ -122,10 +122,10 @@ struct intel_region *intel_region_create_static( struct intel_context *intel,
                                                 GLuint cpp,
                                                 GLuint pitch, 
                                                 GLuint height,
+                                                GLuint size,
                                                 GLboolean tiled )
 {
    struct intel_region *region = calloc(sizeof(*region), 1);
-   GLuint size = cpp * pitch * height;
    GLint pool;
 
    DBG("%s\n", __FUNCTION__);
index 2413f0de33c16e8a2988ae185f0bbdcf064ab6b3..d2235f1275bd19ba6f0b18146d2a9a3866aa1f4d 100644 (file)
@@ -78,6 +78,7 @@ struct intel_region *intel_region_create_static( struct intel_context *intel,
                                                 GLuint cpp,
                                                 GLuint pitch,
                                                 GLuint height,
+                                                GLuint size,
                                                 GLboolean tiled );
 
 /* Map/unmap regions.  This is refcounted also: