From: Brian Starkey <brian.starkey@arm.com>
To: Daniel Stone <daniel@fooishbar.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
"Kristian H . Kristensen" <hoegsberg@gmail.com>,
Intel GFX <intel-gfx@lists.freedesktop.org>,
DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/3] drm: Create a format/modifier blob
Date: Wed, 3 May 2017 15:17:55 +0100 [thread overview]
Message-ID: <20170503141755.GD20378@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAPj87rOAzN8cR154qyayPQrh_pMLQtw_b_=H+MRGeDRdyKJU6Q@mail.gmail.com>
Hi Daniel,
On Wed, May 03, 2017 at 03:07:40PM +0100, Daniel Stone wrote:
>Hi Brian,
>
>On 3 May 2017 at 15:03, Brian Starkey <brian.starkey@arm.com> wrote:
>> On Wed, May 03, 2017 at 02:51:18PM +0100, Daniel Stone wrote:
>>> formats_offset is the end of the fixed-size element, which is
>>> currently aligned to 32 bytes, and practically speaking would always
>>> have to be anyway. As it is an array of uint32_t, this gives natural
>>> alignment.
>>
>> Why must it always be? The __packed attribute means it'll have no
>> padding - so any u16 or u8 added to the end will break it - putting
>> the formats array on a non-aligned boundary.
>>
>> If the assumption is that the struct will always be made of only
>> u32/u64 members (and the implementation will break otherwise) then
>> there had better be a really big comment saying so, and preferably a
>> compile-time assertion too.
>
>Indeed that's the case, for most ioctls at least. A comment would
>definitely be in order.
>
No need for a comment if the code is fixed to do the right thing
irrespective of the value of sizeof(drm_formats_modifier_blob) - which
IMO is mandatory.
>> I'm missing the reason for it being __packed in the first place -
>> perhaps that's just a left over and needs to be removed.
>>
>> Either way, this line aligns to 8:
>>
>> + blob_size = ALIGN(sizeof(struct drm_format_modifier_blob), 8);
>>
>> ...and the rest of the blob_size calculation looks like it assumes the
>> formats array starts at that 8-byte boundary. So, for clarity and
>> consistency I reckon the blob_size code and the code that builds the
>> blob should do the same thing.
>
>All this is correct - the __packed declaration is unnecessary, and so
>is the rounding up when calculating the size. And with that fixed, I
>believe it should be correct, no?
Yes, with those problems fixed it looks correct to me.
Thanks,
-Brian
>
>Cheers,
>Daniel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-05-03 14:17 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 5:14 [PATCH 1/3] drm: Plumb modifiers through plane init Ben Widawsky
2017-05-03 5:14 ` [PATCH 2/3] drm: Create a format/modifier blob Ben Widawsky
2017-05-03 11:00 ` Brian Starkey
2017-05-03 11:47 ` Daniel Stone
2017-05-03 12:39 ` Brian Starkey
2017-05-03 12:51 ` Brian Starkey
2017-05-03 13:51 ` [Intel-gfx] " Daniel Stone
2017-05-03 14:03 ` Brian Starkey
2017-05-03 14:07 ` [Intel-gfx] " Daniel Stone
2017-05-03 14:17 ` Brian Starkey [this message]
2017-05-03 13:15 ` Liviu Dudau
2017-05-11 17:58 ` Ben Widawsky
2017-05-03 13:32 ` Emil Velikov
2017-05-03 15:08 ` Daniel Vetter
2017-05-16 21:19 ` [Intel-gfx] " Ben Widawsky
2017-05-17 11:31 ` Daniel Vetter
2017-05-17 15:12 ` Daniel Vetter
2017-05-18 0:00 ` Ben Widawsky
2017-05-18 0:38 ` Rob Clark
2017-05-18 0:42 ` [Intel-gfx] " Rob Clark
2017-05-04 9:28 ` Daniel Stone
2017-05-03 5:14 ` [PATCH 3/3] drm/i915: Add format modifiers for Intel Ben Widawsky
2017-05-03 5:30 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm: Plumb modifiers through plane init Patchwork
2017-05-03 10:34 ` [PATCH 1/3] " Liviu Dudau
2017-05-03 13:45 ` [Intel-gfx] " Daniel Stone
2017-05-03 14:07 ` Liviu Dudau
2017-05-03 14:14 ` Daniel Stone
2017-05-03 14:52 ` Liviu Dudau
2017-05-03 16:45 ` Daniel Vetter
2017-05-03 17:30 ` [Intel-gfx] " Liviu Dudau
2017-05-10 16:34 ` Ben Widawsky
2017-05-10 17:24 ` Liviu Dudau
2017-05-10 19:33 ` [Intel-gfx] " Ben Widawsky
2017-05-10 20:21 ` Liviu Dudau
2017-05-10 16:33 ` Ben Widawsky
2017-05-03 18:28 ` kbuild test robot
2017-05-03 18:48 ` kbuild test robot
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=20170503141755.GD20378@e106950-lin.cambridge.arm.com \
--to=brian.starkey@arm.com \
--cc=ben@bwidawsk.net \
--cc=daniel@fooishbar.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hoegsberg@gmail.com \
--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