isl: fix range_B_tile end_tile_B value

Quoting the documentation :

   "The returned range is a half-open interval where all of the
    addresses within the subimage are < end_tile_B."

This is obviously not true with images smaller than a logical tile.
Currently the code return 1.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24276>
(cherry picked from commit bcc820950d)
This commit is contained in:
Lionel Landwerlin 2024-10-10 12:14:54 +03:00 committed by Eric Engestrom
parent 70432dfcfd
commit 3dc3ec9301
2 changed files with 9 additions and 3 deletions

View file

@ -1154,7 +1154,7 @@
"description": "isl: fix range_B_tile end_tile_B value",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -29,6 +29,7 @@
#include "dev/intel_debug.h"
#include "genxml/genX_bits.h"
#include "util/log.h"
#include "util/u_math.h"
#include "isl.h"
#include "isl_gfx4.h"
@ -3797,10 +3798,15 @@ isl_surf_get_image_range_B_tile(const struct isl_surf *surf,
&z_offset_el,
&array_slice);
struct isl_tile_info tile_info;
isl_surf_get_tile_info(surf, &tile_info);
/* We want the range we return to be exclusive but the tile containing the
* last pixel (what we just calculated) is inclusive. Add one.
* last pixel (what we just calculated) is inclusive. Add one and round up
* to the tile size.
*/
(*end_tile_B)++;
*end_tile_B = ALIGN_NPOT(*end_tile_B + 1, tile_info.phys_extent_B.w *
tile_info.phys_extent_B.h);
assert(*end_tile_B <= surf->size_B);
}