isl: Rework the get_intratile_offset function

The old function tried to work in elements which isn't, strictly speaking,
a valid thing to do.  In the case of a non-power-of-two format, there is no
guarantee that the x offset into the tile is a multiple of the format
block size.  This commit refactors it to work entirely in terms of a tiling
(not a surface) and bytes/rows.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
This commit is contained in:
Jason Ekstrand
2016-03-30 16:15:54 -07:00
parent 4caba94086
commit b37502b983
3 changed files with 60 additions and 38 deletions

View File

@@ -145,12 +145,15 @@ create_iview(struct anv_cmd_buffer *cmd_buffer,
/* Create a VkImageView that starts at the tile aligned offset closest
* to the provided x/y offset into the surface.
*/
struct isl_surf *isl_surf = &anv_image_from_handle(*img)->color_surface.isl;
uint32_t img_o = 0;
isl_surf_get_image_intratile_offset_el_xy(&cmd_buffer->device->isl_dev,
&anv_image_from_handle(*img)->
color_surface.isl,
*rect_x, *rect_y,
&img_o, rect_x, rect_y);
isl_tiling_get_intratile_offset_el(&cmd_buffer->device->isl_dev,
isl_surf->tiling, surf->bs,
isl_surf->row_pitch,
*rect_x * surf->bs, *rect_y,
&img_o, rect_x, rect_y);
anv_image_view_init(iview, cmd_buffer->device,
&(VkImageViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,