Re: [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <chris@xxxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux