[Intel-gfx] [PATCH 1/3] igt/gem_stolen: Verifying extended gem_create ioctl
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Fri Jul 3 02:38:49 PDT 2015
On 07/03/2015 10:16 AM, Chris Wilson wrote:
> On Fri, Jul 03, 2015 at 10:05:05AM +0100, Tvrtko Ursulin wrote:
>>> +bool gem_create__has_stolen_support(int fd)
>>> +{
>>> + static int has_stolen_support = -1;
>>> +
>>> + if (has_stolen_support < 0) {
>>> + struct drm_i915_getparam gp;
>>> + int val = -1;
>
>>> + memset(&gp, 0, sizeof(gp));
>>> + gp.param = 36; /* CREATE_VERSION */
>>> + gp.value = &val;
>>> +
>>> + /* Do we have the extended gem_create_ioctl? */
>>> + ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
>>> + has_stolen_support = val >= 1;
>>
>> If ioctl fails it will declare stolen support. (val remains -1)
>>
>> I would also suggest "has_stolen_support = val > 1" as clearer.
>
> Tvrtko, -ENOCOFFEE? :)
Ooops don't know why I saw an arithmetic shift there.
Regards,
Tvrtko
More information about the Intel-gfx
mailing list