[Intel-gfx] [PATCH 3/5] drm/i915: Add common fixed16_16 values
Michal Wajdeczko
michal.wajdeczko at intel.com
Fri Dec 22 15:51:49 UTC 2017
On Fri, 22 Dec 2017 13:34:58 +0100, Chris Wilson
<chris at chris-wilson.co.uk> wrote:
> Quoting Michal Wajdeczko (2017-12-22 12:25:54)
>> Zero and One are additional commonly used values that
>> can have its own definitions.
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
>> Cc: Chris Wilson <chris at chris-wilson.co.uk>
>> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
>> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
>> ---
>> drivers/gpu/drm/i915/fixed16_16.h | 15 ++++++++++++---
>> drivers/gpu/drm/i915/intel_pm.c | 22 +++++++++++-----------
>> 2 files changed, 23 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/fixed16_16.h
>> b/drivers/gpu/drm/i915/fixed16_16.h
>> index ec859c0..af23997 100644
>> --- a/drivers/gpu/drm/i915/fixed16_16.h
>> +++ b/drivers/gpu/drm/i915/fixed16_16.h
>> @@ -31,9 +31,18 @@
>> u32 val;
>> } fixed16_16_t;
>>
>> -#define FP_16_16_MAX ({ \
>> - fixed16_16_t fp; \
>> - fp.val = UINT_MAX; \
>> +#define FIXED16_16_ZERO ({ \
>> + fixed16_16_t fp = { .val = 0 }; \
>> + fp; \
>> +})
>
> #define TO_FIXED16_16(x) (fixed16_16_t){ .val = (x) }
Earlier I was thinking about __FIXED16_16_INITIALIZER(v)
but decided to not introduce it due potential abuse ;)
> #define FIXED16_16_ZERO TO_FIXED16_16(0)
> #define FIXED16_16_ONE TO_FIXED16_16(1)
Gotcha! It should be 1 << 16
> #define FIXED16_16_MAX TO_FIXED16_16(U32_MAX)
>
> ?
> -Chris
More information about the Intel-gfx
mailing list