All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 2/7] drm/i915: Mark the ggtt_view structs as packed
Date: Fri, 13 Jan 2017 08:47:57 +0000	[thread overview]
Message-ID: <20170113084757.GE28328@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <5e936630-fb00-0e2f-2280-d40ed84849ba@linux.intel.com>

On Fri, Jan 13, 2017 at 08:44:34AM +0000, Tvrtko Ursulin wrote:
> 
> On 12/01/2017 21:35, Chris Wilson wrote:
> >In the next few patches, we will depend upon there being no
> >uninitialised bits inside the ggtt_view. To ensure this we add the
> >__packed attribute and double check with a build on that gcc hasn't
> >expanded the struct to include some padding bytes.
> >
> >Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >---
> > drivers/gpu/drm/i915/i915_gem_gtt.h | 14 ++++++++++++--
> > 1 file changed, 12 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> >index 5dd3755a5a45..57cbd532dae1 100644
> >--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> >+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> >@@ -156,12 +156,22 @@ struct intel_rotation_info {
> > 		/* tiles */
> > 		unsigned int width, height, stride, offset;
> > 	} plane[2];
> 
> Isn't packed theoretically needed on the intel_rotation_plane_info
> name in the previous patch as well? Otherwise there could be a hole
> between the array elements if the structure got changed in the
> future.

Possibly, not too sure on the inner details of __packed. The assert
below will catch accidental holes in future (and if they change the
struct without changing the assert, a nuisance).

> >+static inline void assert_intel_rotation_info_is_packed(void)
> >+{
> >+	BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 8*sizeof(unsigned int));
> >+}

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-01-13  8:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 21:35 Anonymouse ggtt_view params Chris Wilson
2017-01-12 21:35 ` [PATCH v2 1/7] drm/i915: Name the anonymous structs inside i915_ggtt_view Chris Wilson
2017-01-12 21:35 ` [PATCH v2 2/7] drm/i915: Mark the ggtt_view structs as packed Chris Wilson
2017-01-13  8:44   ` Tvrtko Ursulin
2017-01-13  8:47     ` Chris Wilson [this message]
2017-01-13  8:54       ` Tvrtko Ursulin
2017-01-12 21:35 ` [PATCH v2 3/7] drm/i915: Compact memcmp in i915_vma_compare() Chris Wilson
2017-01-13  8:57   ` Tvrtko Ursulin
2017-01-12 21:35 ` [PATCH v2 4/7] drm/i915: Stop clearing i915_ggtt_view Chris Wilson
2017-01-13  8:58   ` Tvrtko Ursulin
2017-01-12 21:35 ` [PATCH v2 5/7] drm/i915: Convert i915_ggtt_view to use an anonymous union Chris Wilson
2017-01-13  9:04   ` Tvrtko Ursulin
2017-01-13  9:16     ` Chris Wilson
2017-01-12 21:35 ` [PATCH v2 6/7] drm/i915: Eliminate superfluous i915_ggtt_view_rotated Chris Wilson
2017-01-12 21:35 ` [PATCH v2 7/7] drm/i915: Eliminate superfluous i915_ggtt_view_normal Chris Wilson
2017-01-12 22:23 ` ✓ Fi.CI.BAT: success for series starting with [v2,1/7] drm/i915: Name the anonymous structs inside i915_ggtt_view 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=20170113084757.GE28328@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.