Re: [PATCH 3/5] drm/i915: Add common fixed16_16 values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Dec 2017 13:34:58 +0100, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxx>
Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
---
 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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux