anv/image: Enlarge the image level 0 extent
authorNanley Chery <nanley.g.chery@intel.com>
Wed, 27 Jan 2016 20:08:56 +0000 (12:08 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 27 Jan 2016 23:12:42 +0000 (15:12 -0800)
The extent previously was supposed to match the mip at a given level
under the assumption that the base address would be that of the mip
as well.

Now however, the base address only matches the offset of the
containing tile. Therefore, enlarge the extent to match that of
phys_slice0, so that we don't draw/fetch in out of bounds territory.

This solution isn't perfect because the base adress isn't always at
the first tile, therefore the assumed valid memory region by the HW
contains some number of invalid tiles on two edges.

src/vulkan/anv_image.c

index 2622b11b89e511f2d883ebcb37a2383c8e5f3352..889a9e87d79282fa7970fa1ffd5414a816033d33 100644 (file)
@@ -544,12 +544,12 @@ anv_image_view_init(struct anv_image_view *iview,
        * data from a source Image to a destination Image.
        */
       const struct isl_format_layout * isl_layout = image->format->isl_layout;
-      iview->level_0_extent.width  = anv_minify(image->extent.width, range->baseMipLevel);
-      iview->level_0_extent.height = anv_minify(image->extent.height, range->baseMipLevel);
+
       iview->level_0_extent.depth  = anv_minify(image->extent.depth, range->baseMipLevel);
-      iview->level_0_extent.width  = DIV_ROUND_UP(iview->level_0_extent.width, isl_layout->bw);
-      iview->level_0_extent.height = DIV_ROUND_UP(iview->level_0_extent.height, isl_layout->bh);
       iview->level_0_extent.depth  = DIV_ROUND_UP(iview->level_0_extent.depth, isl_layout->bd);
+
+      iview->level_0_extent.height = isl_surf_get_array_pitch_el_rows(&surface->isl);
+      iview->level_0_extent.width  = isl_surf_get_row_pitch_el(&surface->isl);
       mCreateInfo.subresourceRange.baseMipLevel = 0;
       mCreateInfo.subresourceRange.baseArrayLayer = 0;
    } else {