On to, 2016-12-22 at 10:56 +0000, Chris Wilson wrote:
> Save a lot of characters by making the union anonymous, with the
> side-effect of ignoring unset bits when comparing views.
> 
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

Daniel could A-b, as he specifically wanted all the bits initialized.

<SNIP>

> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -202,9 +202,18 @@ i915_vma_compare(struct i915_vma *vma,
>       if (vma->ggtt_view.type != view->type)
>               return vma->ggtt_view.type - view->type;
>  
> -     return memcmp(&vma->ggtt_view.params,
> -                   &view->params,
> -                   sizeof(view->params));
> +     switch (view->type) {
> +     case I915_GGTT_VIEW_ROTATED:
> +             return memcmp(&vma->ggtt_view.rotated,
> +                           &view->rotated,
> +                           sizeof(view->rotated));
> +     case I915_GGTT_VIEW_PARTIAL:
> +             return memcmp(&vma->ggtt_view.partial,
> +                           &view->partial,
> +                           sizeof(view->partial));

We can decide the amount of bytes to compare in switch and use one
memcmp for everything.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to