i965: use _mesa_align_malloc in intel_miptree_map_movntdqa
authorTapani Pälli <tapani.palli@intel.com>
Thu, 5 Jun 2014 04:48:09 +0000 (07:48 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Thu, 5 Jun 2014 06:00:17 +0000 (09:00 +0300)
This fixes case where we have 1x1 size buffer and misalignment is 0.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79616

src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index b7d86a30ed4a553e20f654638f8a994a2c42cadb..dd7e57aea84f77a7c9ad143eda80b6c92d4c45cd 100644 (file)
@@ -1874,7 +1874,7 @@ intel_miptree_map_movntdqa(struct brw_context *brw,
 
    map->stride = ALIGN(misalignment + width_bytes, 16);
 
-   map->buffer = malloc(map->stride * map->h);
+   map->buffer = _mesa_align_malloc(map->stride * map->h, 16);
    /* Offset the destination so it has the same misalignment as src. */
    map->ptr = map->buffer + misalignment;
 
@@ -1897,7 +1897,7 @@ intel_miptree_unmap_movntdqa(struct brw_context *brw,
                              unsigned int level,
                              unsigned int slice)
 {
-   free(map->buffer);
+   _mesa_align_free(map->buffer);
    map->buffer = NULL;
    map->ptr = NULL;
 }