intel/fs: Fix fs_reg::component_size() to handle two-dimensional register regions.

Add code to calculate the size in bytes of arbitrary two-dimensional
regions for FIXED_GRF and ARF registers.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26585>
This commit is contained in:
Francisco Jerez 2022-06-22 16:18:13 -07:00 committed by Marge Bot
parent 83a0252e8d
commit a844c0b185

View file

@ -562,10 +562,16 @@ fs_reg::is_contiguous() const
unsigned
fs_reg::component_size(unsigned width) const
{
const unsigned stride = ((file != ARF && file != FIXED_GRF) ? this->stride :
hstride == 0 ? 0 :
1 << (hstride - 1));
return MAX2(width * stride, 1) * type_sz(type);
if (file == ARF || file == FIXED_GRF) {
const unsigned w = MIN2(width, 1u << this->width);
const unsigned h = width >> this->width;
const unsigned vs = vstride ? 1 << (vstride - 1) : 0;
const unsigned hs = hstride ? 1 << (hstride - 1) : 0;
assert(w > 0);
return ((MAX2(1, h) - 1) * vs + (w - 1) * hs + 1) * type_sz(type);
} else {
return MAX2(width * stride, 1) * type_sz(type);
}
}
void