<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 12, 2018 at 6:36 AM, Daniel Stone <span dir="ltr"><<a href="mailto:daniel@fooishbar.org" target="_blank">daniel@fooishbar.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On 10 February 2018 at 06:50, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
</span><span class="">> -    } else if (parent->planar_format == NULL) {<br>
> +<br>
> +    const struct intel_image_format *f = parent->planar_format;<br>
> +    const int nplanes = f ? f->nplanes : 1;<br>
> +<br>
> +    if (plane > nplanes) {<br>
> +       if (parent->modifier == DRM_FORMAT_MOD_INVALID)<br>
> +          return NULL;<br>
> +<br>
>         const bool is_aux =<br>
>            isl_drm_modifier_has_aux(<wbr>parent->modifier) && plane == 1;<br>
>         if (!is_aux)<br>
> @@ -1332,10 +1338,6 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)<br>
>      } else {<br>
>         /* Planar formats don't support aux buffers/images */<br>
>         assert(!isl_drm_modifier_has_<wbr>aux(parent->modifier));<br>
> -       f = parent->planar_format;<br>
> -<br>
> -       if (plane >= f->nplanes)<br>
> -          return NULL;<br>
<br>
</span>On further thought, I don't see how this could work at all. If we call<br>
fromPlanar on plane 0 of a non-planar image with an aux plane, we need<br>
to land in the first branch (due to the assert). But since plane 0 is<br>
strictly less than the number of planes 1, we don't.<br>
<br>
I think something like this: <a href="https://hastebin.com/axuqorenax" rel="noreferrer" target="_blank">https://hastebin.com/<wbr>axuqorenax</a><br></blockquote><div><br></div><div>I like that.  Mind making a proper patch out of it (not based on this one) and sending to the list?  Between the four of us, maybe we can write this correctly. :-)<br><br></div><div>--Jason<br></div></div></div></div>