[Intel-gfx] [PATCH 05/18] drm/i915: Move GEM activity tracking into a common struct reservation_object

Jani Nikula jani.nikula at linux.intel.com
Thu Sep 15 09:55:41 UTC 2016


On Thu, 15 Sep 2016, Dave Gordon <david.s.gordon at intel.com> wrote:
> On 14/09/16 18:35, Chris Wilson wrote:
>> On Wed, Sep 14, 2016 at 12:44:04PM +0300, Joonas Lahtinen wrote:
>>> On ke, 2016-09-14 at 07:52 +0100, Chris Wilson wrote:
>>>> -static inline bool
>>>> -i915_gem_object_has_active_engine(const struct drm_i915_gem_object *obj,
>>>> -				  int engine)
>>>> -{
>>>> -	return obj->flags & BIT(engine + I915_BO_ACTIVE_SHIFT);
>>>> +	return obj->active_count;
>>>
>>> our type is bool, so !!obj->active_count;
>>
>> That's the beauty of using bool, !! is implied on the (bool)integer
>> conversion.
>> -Chris
>
> It's a gcc extension, though, so does it work on clang?

It's in the standard.

"When any scalar value is converted to _Bool, the result is 0 if the
value compares equal to 0; otherwise, the result is 1."

BR,
Jani.


>
> .Dave.
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list