<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 8, 2018 at 3:06 AM, Nicolai Hähnle <span dir="ltr"><<a href="mailto:nhaehnle@gmail.com" target="_blank">nhaehnle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 02.05.2018 06:00, Marek Olšák wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>><br>
<br>
---<br>
src/amd/common/ac_surface.c | 9 +++++++--<br>
1 file changed, 7 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c<br>
index b2af1f70b69..341a7854fe5 100644<br>
--- a/src/amd/common/ac_surface.c<br>
+++ b/src/amd/common/ac_surface.c<br>
@@ -841,22 +841,27 @@ static int gfx6_compute_surface(ADDR_HAND<wbr>LE addrlib,<br>
*<br>
* "dcc_alignment * 4" was determined by trial and error.<br>
*/<br>
surf->dcc_size = align64(surf->surf_size >> 8,<br>
surf->dcc_alignment * 4);<br>
}<br>
/* Make sure HTILE covers the whole miptree, because the shader reads<br>
* TC-compatible HTILE even for levels where it's disabled by DB.<br>
*/<br>
- if (surf->htile_size && config->info.levels > 1)<br>
- surf->htile_size *= 2;<br>
+ if (surf->htile_size && config->info.levels > 1 &&<br>
+ surf->flags & RADEON_SURF_TC_COMPATIBLE_HTIL<wbr>E) {<br>
+ surf->htile_size =<br>
+ surf->surf_size * 4 / (8 * 8 * surf->bpe *<br>
+ MAX2(1, config->info.samples));<br>
</blockquote>
<br></div></div>
Can you explain this formula? In particular where the 4 comes from?<br></blockquote><div><br></div><div>Sure.<br><br></div><div>Definitions (for the whole miptree):<br>1) surf_size = bpe * samples * num_pixels<br>2) htile_size = num_pixels * 4 / (8 * 8)<br></div><div><br></div><div>Therefore:<br></div><div>num_pixels = surf_size / (bpe * samples), so:<br></div><div>htile_size = (surf_size / (bpe * samples)) * 4 / (8 * 8)<br></div><div><br></div><div>Marek<br></div></div></div></div>