[Mesa-dev] [PATCH] gallium/drivers: initialize pipe_resource::next to NULL
Roland Scheidegger
sroland at vmware.com
Tue Oct 4 01:40:16 UTC 2016
Am 04.10.2016 um 03:16 schrieb Michel Dänzer:
> On 04/10/16 01:53 AM, Roland Scheidegger wrote:
>> In an ideal world everybody would zero-intialize the template I suppose
>> - then it would easily survive such interface changes.
>
> As long as there are no fields where 0 isn't a safe value...
That's true, but for interface additions you can usually design them
around 0 being a safe value. (Of course, how this usually works is these
fields are interpreted by the drivers, and in this case just about
anything is usually safe, as long as the driver actually doesn't
implement a new feature.)
>
> What's needed is an explicit definition of whether it's the caller's or
> callee's responsibility to initialize the next field (in particular, and
> any other fields in general). Are there any cases where the
> resource_create caller needs to pass in a non-NULL next field value?
>
> Note that with the original problem I fixed in radeon, the caller wasn't
> in state tracker code but in driver internal code.
>
I suppose it's never necessary to pass a non-NULL value there (there
isn't really a definition how a driver should create such a resource).
Still, passing explicitly bogus values there in the template just irks
me. But if it's easier, doing it in the driver ought to be ok...
Roland
More information about the mesa-dev
mailing list