Fernando Sahmkow
2018-Oct-25 10:30 UTC
[Nouveau] Questions on Blocklinear Mipmaps and auto-sizing
I'm currently implementing mipmaps but I have a set of troubles guessing the block height and block depth of them. According to https://envytools.readthedocs.io/en/latest/hw/memory/g80-surface.html#textures-mipmapping-and-arrays the texture unit auto resizes mipmaps' blocks but how do I know how many blocks each one uses? I'm currently using this algorithm: u32 height = MipHeight(mip_level); u32 gobs_in_y = (height + 7) / 8; u32 bh = block_height; // Magical block resizing algorithm, needs more testing. while (bh > 1 && (gobs_in_y + bh - 1) / bh <= 2) { bh >>= 1; } return bh; it works 95% of the time but doesn't fit the correct block size all the time. Do you guys got any info on the correct algorithm used? -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20181025/f0f9fa16/attachment.html>
Ilia Mirkin
2018-Oct-25 14:14 UTC
[Nouveau] Questions on Blocklinear Mipmaps and auto-sizing
https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c#n190 On Thu, Oct 25, 2018 at 6:30 AM Fernando Sahmkow <fsahmkow27 at gmail.com> wrote:> > I'm currently implementing mipmaps but I have a set of troubles guessing the block height and block depth of them. According to https://envytools.readthedocs.io/en/latest/hw/memory/g80-surface.html#textures-mipmapping-and-arrays the texture unit auto resizes mipmaps' blocks but how do I know how many blocks each one uses? > > I'm currently using this algorithm: > u32 height = MipHeight(mip_level); > u32 gobs_in_y = (height + 7) / 8; > u32 bh = block_height; > // Magical block resizing algorithm, needs more testing. > while (bh > 1 && (gobs_in_y + bh - 1) / bh <= 2) { > bh >>= 1; > } > return bh; > it works 95% of the time but doesn't fit the correct block size all the time. Do you guys got any info on the correct algorithm used? > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau