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>,
Daniel Stone <daniels@collabora.com>
Subject: Re: [PATCH 2/3] drm: Create a format/modifier blob
Date: Wed, 3 May 2017 13:39:47 +0100 [thread overview]
Message-ID: <20170503123946.GA20378@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAPj87rP=_S2GeD=ye6otCQBdGzeuw2qjtCjFvBA+gzaLdJkjgg@mail.gmail.com>
Hi Daniel,
On Wed, May 03, 2017 at 12:47:18PM +0100, Daniel Stone wrote:
>Hi Brian,
>
>On 3 May 2017 at 12:00, Brian Starkey <brian.starkey@arm.com> wrote:
>> Having just caught up on IRC I'm sure I'm far too late for this party,
>> but...
>>
>> Wouldn't this whole thing be a whole lot simpler if "IN_FORMATS"
>> stored "pointers" to separate blobs for the format and modifier lists?
>>
>> I've used/written a few interfaces with offsets to
>> variable-length-arrays and IMO the code to handle them is always
>> hideous.
>
>I don't agree ...
>
>The idea is that the header can grow because the offsets allow it to;
>adding a new member slots in between the end of static data and the
>start of variable data, and since all the variable data is accessed by
>an array, userspace doesn't have to be aware of the new members.
This is the same in both approaches.
> The
>code for that is very clean (modulo the casts for pointer maths), cf.
>formats_ptr and modifiers_ptr; I'd expect userspace to copy and use
>those with version guards:
> uint32_t *formats = formats_ptr(blob);
> struct drm_format_modifier *modifiers = modifiers_ptr(blob);
> struct drm_format_unifier *unifiiers = (blob->version >= 2) ?
>unifiers_ptr(blob) : NULL;
I concede the tricky code is all confined to the single implementation
in the kernel (encoding is far harder than decoding) - I just think
create_in_format_blob() is cumbersome, ugly and error-prone.
>
>That's shorter than fetching separate blobs, and doesn't have multiple
>error paths either. What am I missing?
Yes, this is a convincing argument.
>
>> Added bonus: With smart enough helper code the FourCC and modifiers
>> blobs can be shared across planes.
>
>I think this is a serious case of premature optimisation; the memory
>savings might be outweighed by the additional number of objects to
>track, and userspace would have to jump through serious hoops with a
>blob ID cache - something which is a very bad idea regardless - to
>take any advantage of it.
Hey I'm just saying it's an option - not that it should be implemented
in V1.
Where both the formats and the modifiers are the same, Ben's approach
lets the blob be shared anyway.
Thanks,
Brian
>
>Cheers, Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-05-03 12:39 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 [this message]
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
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=20170503123946.GA20378@e106950-lin.cambridge.arm.com \
--to=brian.starkey@arm.com \
--cc=ben@bwidawsk.net \
--cc=daniel@fooishbar.org \
--cc=daniels@collabora.com \
--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