isl: Fix image alignment calculation
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 6 Jan 2016 23:43:11 +0000 (15:43 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 7 Jan 2016 18:37:35 +0000 (10:37 -0800)
The previous code was resulting in an alignment of 0.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
src/isl/isl.c

index 1fd7d01d1c3a863882545fa595f18592f154b331..edc540b7ad25bbccefd8532ea79fd1a958def6d0 100644 (file)
@@ -1071,8 +1071,9 @@ isl_surf_init_s(const struct isl_device *dev,
    const uint32_t size = row_pitch * isl_align(total_h_sa, tile_info.height);
 
    /* Alignment of surface base address, in bytes */
-   uint32_t base_alignment = info->min_alignment;
-   base_alignment = isl_align(base_alignment, tile_info.size);
+   uint32_t base_alignment = MAX(1, info->min_alignment);
+   assert(isl_is_pow2(base_alignment) && isl_is_pow2(tile_info.size));
+   base_alignment = MAX(base_alignment, tile_info.size);
 
    *surf = (struct isl_surf) {
       .dim = info->dim,