[Mesa-dev] [PATCH] i965: Fix bugs in intel_from_planar

Daniel Stone daniel at fooishbar.org
Mon Feb 12 14:36:20 UTC 2018


Hi,

On 10 February 2018 at 06:50, Jason Ekstrand <jason at jlekstrand.net> wrote:
> -    } else if (parent->planar_format == NULL) {
> +
> +    const struct intel_image_format *f = parent->planar_format;
> +    const int nplanes = f ? f->nplanes : 1;
> +
> +    if (plane > nplanes) {
> +       if (parent->modifier == DRM_FORMAT_MOD_INVALID)
> +          return NULL;
> +
>         const bool is_aux =
>            isl_drm_modifier_has_aux(parent->modifier) && plane == 1;
>         if (!is_aux)
> @@ -1332,10 +1338,6 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
>      } else {
>         /* Planar formats don't support aux buffers/images */
>         assert(!isl_drm_modifier_has_aux(parent->modifier));
> -       f = parent->planar_format;
> -
> -       if (plane >= f->nplanes)
> -          return NULL;

On further thought, I don't see how this could work at all. If we call
fromPlanar on plane 0 of a non-planar image with an aux plane, we need
to land in the first branch (due to the assert). But since plane 0 is
strictly less than the number of planes 1, we don't.

I think something like this: https://hastebin.com/axuqorenax

Cheers,
Daniel


More information about the mesa-dev mailing list