<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 26, 2017 at 12:50 PM, 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 Fri, Jun 16, 2017 at 03:41:49PM -0700, Jason Ekstrand wrote:<br>
> ---<br>
>  src/mesa/drivers/dri/i965/<wbr>intel_screen.c | 55 +++++++++++++++++++++++++++++-<wbr>--<br>
>  1 file changed, 50 insertions(+), 5 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 94787ff..7d6adb7 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_screen.c<br>
> @@ -671,7 +671,21 @@ intel_create_image_common(__<wbr>DRIscreen *dri_screen,<br>
>        return NULL;<br>
>     }<br>
><br>
> -   image->bo = brw_bo_alloc_tiled(screen-><wbr>bufmgr, "image", surf.size,<br>
> +   struct isl_surf aux_surf;<br>
> +   if (mod_info->aux_usage == ISL_AUX_USAGE_CCS_E) {<br>
> +      ok = isl_surf_get_ccs_surf(&screen-<wbr>>isl_dev, &surf, &aux_surf, 0);<br>
> +      assert(ok);<br>
> +      if (!ok) {<br>
> +         free(image);<br>
> +         return NULL;<br>
> +      }<br>
> +   } else {<br>
> +      assert(mod_info->aux_usage == ISL_AUX_USAGE_NONE);<br>
> +      aux_surf.size = 0;<br>
> +   }<br>
> +<br>
> +   image->bo = brw_bo_alloc_tiled(screen-><wbr>bufmgr, "image",<br>
> +                                  surf.size + aux_surf.size,<br>
>                                    isl_tiling_to_i915_tiling(mod_<wbr>info->tiling),<br>
>                                    surf.row_pitch, 0);<br>
>     if (image->bo == NULL) {<br>
> @@ -683,6 +697,11 @@ intel_create_image_common(__<wbr>DRIscreen *dri_screen,<br>
>     image->pitch = surf.row_pitch;<br>
>     image->modifier = modifier;<br>
><br>
> +   if (aux_surf.size) {<br>
> +      image->aux_offset = surf.size;<br>
> +      image->aux_pitch = aux_surf.row_pitch;<br>
> +   }<br>
> +<br>
>     return image;<br>
>  }<br>
><br>
> @@ -896,18 +915,18 @@ intel_create_image_from_fds_<wbr>common(__DRIscreen *dri_screen,<br>
>     else<br>
>        image->modifier = tiling_to_modifier(image->bo-><wbr>tiling_mode);<br>
><br>
> +   const struct isl_drm_modifier_info *mod_info =<br>
> +      isl_drm_modifier_get_info(<wbr>image->modifier);<br>
> +<br>
>     int size = 0;<br>
> +   struct isl_surf surf;<br>
>     for (i = 0; i < f->nplanes; i++) {<br>
>        index = f->planes[i].buffer_index;<br>
>        image->offsets[index] = offsets[index];<br>
>        image->strides[index] = strides[index];<br>
><br>
> -      const struct isl_drm_modifier_info *mod_info =<br>
> -         isl_drm_modifier_get_info(<wbr>image->modifier);<br>
> -<br>
>        mesa_format format = driImageFormatToGLFormat(f-><wbr>planes[i].dri_format);<br>
><br>
> -      struct isl_surf surf;<br>
>        ok = isl_surf_init(&screen->isl_<wbr>dev, &surf,<br>
>                           .dim = ISL_SURF_DIM_2D,<br>
>                           .format = brw_isl_format_for_mesa_<wbr>format(format),<br>
> @@ -933,6 +952,32 @@ intel_create_image_from_fds_<wbr>common(__DRIscreen *dri_screen,<br>
>           size = end;<br>
>     }<br>
><br>
> +   if (mod_info->aux_usage == ISL_AUX_USAGE_CCS_E) {<br>
> +      /* Even though we initialize surf in the loop above, we know that<br>
> +       * anything with CCS_E will have exactly one plane so surf is properly<br>
> +       * initialized when we get here.<br>
> +       */<br>
> +      assert(f->nplanes == 1);<br>
> +<br>
> +      image->aux_offset = offsets[1];<br>
> +      image->aux_pitch = strides[1];<br>
> +<br>
> +      struct isl_surf aux_surf;<br>
> +      ok = isl_surf_get_ccs_surf(&screen-<wbr>>isl_dev, &surf, &aux_surf,<br>
> +                                 image->aux_pitch);<br>
> +      if (!ok) {<br>
> +         brw_bo_unreference(image->bo);<br>
> +         free(image);<br>
> +         return NULL;<br>
> +      }<br>
> +<br>
> +      const int end = image->aux_offset + surf.size;<br>
<br>
</div></div>Shouldn't we use 'aux_surf.size' instead of 'surf.size'?<span class=""><br></span></blockquote><div><br></div><div>Yes.  Fixed locally.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> +      if (size < end)<br>
> +         size = end;<br>
> +   } else {<br>
> +      assert(mod_info->aux_usage == ISL_AUX_USAGE_NONE);<br>
> +   }<br>
> +<br>
>     /* Check that the requested image actually fits within the BO. 'size'<br>
>      * is already relative to the offsets, so we don't need to add that. */<br>
>     if (image->bo->size == 0) {<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>