[Nouveau] Questions on Blocklinear Mipmaps and auto-sizing

Fernando Sahmkow fsahmkow27 at gmail.com
Thu Oct 25 10:30:34 UTC 2018


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>


More information about the Nouveau mailing list