<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 25, 2017 at 10:36 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@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 Mon, Jan 23, 2017 at 10:21:46PM -0800, Ben Widawsky wrote:<br>
> This patch provides the support (and comments) for allocating the BO<br>
> with space for the CCS buffer just underneath it.<br>
><br>
> This patch was originally titled:<br>
> "i965: Create correctly sized mcs for an image"<br>
><br>
> In order to make things more bisectable, reviewable, and to have the<br>
> CCS_MODIFIER token saved for the last patch, this patch now does less so<br>
> it was renamed.<br>
><br>
> v2: Leave "image+mod" (Topi)<br>
><br>
> Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
> Acked-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
> Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/<wbr>intel_screen.c | 34 ++++++++++++++++++++++++++++--<wbr>--<br>
> 1 file changed, 30 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
> index 8ec33ce5df..971013f2dd 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
> @@ -607,6 +607,7 @@ create_image_with_modifier(<wbr>struct intel_screen *screen,<br>
> uint32_t requested_tiling = 0, tiling = I915_TILING_X;<br>
> unsigned long pitch;<br>
> unsigned tiled_height = 0;<br>
> + unsigned ccs_height = 0;<br>
><br>
> switch (modifier) {<br>
> case I915_FORMAT_MOD_Y_TILED:<br>
> @@ -628,9 +629,33 @@ create_image_with_modifier(<wbr>struct intel_screen *screen,<br>
> break;<br>
> }<br>
><br>
> - image->bo = drm_intel_bo_alloc_tiled(<wbr>screen->bufmgr, "image+mod",<br>
> - width, tiled_height, cpp, &tiling,<br>
> - &pitch, 0);<br>
> + /*<br>
> + * CCS width is always going to be less than or equal to the image's width.<br>
> + * All we need to do is make sure we add extra rows (height) for the CCS.<br>
> + *<br>
> + * A pair of CCS bits correspond to 8x4 pixels, and must be cacheline<br>
> + * granularity. Each CCS tile is laid out in 8b strips, which corresponds to<br>
> + * 1024x512 pixel region. In memory, it looks like the following:<br>
> + *<br>
</div></div>> + * ??????????????????????????????<wbr>???????????????????????????<br>
> + * ??? ???<br>
> + * ??? ???<br>
> + * ??? ???<br>
> + * ??? Image ???<br>
> + * ??? ???<br>
> + * ??? ???<br>
> + * ???xxxxxxxxxxxxxxxxx???<br>
> + * ??????????????????????????????<wbr>???????????????????????????<br>
> + * ??? ??? |<br>
> + * ???ccs ??? unused |<br>
> + * ?????????????????????---------<wbr>--???<br>
<span class="">> + * <------pitch------><br>
> + */<br>
> + cpp = _mesa_get_format_bytes(image-><wbr>format);<br>
> + image->bo = drm_intel_bo_alloc_tiled(<wbr>screen->bufmgr,<br>
> + ccs_height ? "image+ccs" : "image+mod",<br>
> + width, tiled_height + ccs_height,<br>
> + cpp, &tiling, &pitch, 0);<br>
> if (image->bo == NULL)<br>
> return false;<br>
><br>
> @@ -647,7 +672,8 @@ create_image_with_modifier(<wbr>struct intel_screen *screen,<br>
> if (image->planar_format)<br>
> assert(image->planar_format-><wbr>nplanes == 1);<br>
><br>
> - image->aux_offset = 0; /* y_tiled_height * pitch; */<br>
> + if (ccs_height)<br>
> + image->aux_offset = tiled_height * pitch /* + mt->offset */;<br>
<br>
</span>I think it would be clearer to drop the comment about mt->offset and<br>
assert here also. How do you feel?<br>
<br>
if (ccs_height) {<br>
assert(mt->offset == 0);<br>
image->aux_offset = tiled_height * pitch;<br>
<div class="HOEnZb"><div class="h5"> }<br></div></div></blockquote><div><br></div><div>That's nicer. <br></div></div><br></div></div>