[Mesa-dev] [PATCH 5/5] [v2] gbm: Export a per plane getter for offset

Daniel Stone daniel at fooishbar.org
Thu Mar 23 14:52:57 UTC 2017


Hi,

On 23 March 2017 at 14:47, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Thu, Mar 23, 2017 at 6:16 AM, Daniel Stone <daniel at fooishbar.org> wrote:
>> Returning int64_t is annoying because the relevant interface demands
>> we need uint32_t, so we need to do casts in users. Given that the
>> offset is useless without the handle/fd, and we have real error values
>> for those (0 for handle, -1 for fd) which don't require casts, I'd
>> much rather this was just a uint32_t returning 0 on failure.
>>
>> Oh well. If it's too late to change then fine, but if we could change
>> it, it would make life a little easier.
>
> I'm ok with changing it given that we know there are zero users and it's
> been in-tree for all of a week.
>
> The only problem is that 0 is a perfectly valid offset.  I think we could
> use (uint32_t)-1 and that would probably be safe.

0 is a valid offset, but you need to query the handle or fd for the
plane first, so you have something to offset into. Both of the checks
which would cause the offset query to fail, would also fail for the
handle lookup. So returning 0 is harmless, because without a
handle/fd, you won't be able to create a FB anyway.

Anyway, GCC was less violent with warnings than I expected, so it's a
minor quibble really.

Cheers,
Daniel


More information about the mesa-dev mailing list