public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union
Date: Thu, 22 Dec 2016 13:24:21 +0200	[thread overview]
Message-ID: <1482405861.7292.8.camel@linux.intel.com> (raw)
In-Reply-To: <20161222105625.10832-2-chris@chris-wilson.co.uk>

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@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	other threads:[~2016-12-22 11:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22 10:56 [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Chris Wilson
2016-12-22 10:56 ` [PATCH 2/5] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
2016-12-22 11:24   ` Joonas Lahtinen [this message]
2016-12-22 10:56 ` [PATCH 3/5] drm/i915: Eliminate superfluous i915_ggtt_view_rotated Chris Wilson
2016-12-22 11:20   ` Joonas Lahtinen
2016-12-22 10:56 ` [PATCH 4/5] drm/i915: Eliminate superfluous i915_ggtt_view_normal Chris Wilson
2016-12-22 11:09   ` Joonas Lahtinen
2016-12-22 10:56 ` [PATCH 5/5] drm/i915: Extact compute_partial_view() Chris Wilson
2016-12-22 11:14   ` Joonas Lahtinen
2016-12-22 11:02 ` [PATCH 1/5] drm/i915: Assert that the partial VMA fits within the object Joonas Lahtinen
2016-12-22 11:55 ` kbuild test robot
2016-12-22 18:08 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482405861.7292.8.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox