public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mahesh Kumar <mahesh1.kumar@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: paulo.r.zanoni@intel.com, maarten.lankhorst@intel.com
Subject: [PATCH 4/9] drm/i915: Addition wrapper for fixed16.16 operation
Date: Tue, 13 Jun 2017 18:41:57 +0530	[thread overview]
Message-ID: <20170613131202.4492-5-mahesh1.kumar@intel.com> (raw)
In-Reply-To: <20170613131202.4492-1-mahesh1.kumar@intel.com>

This patch introduce addition wrapper for fixed point 16.16 operations.
Which will be used by later patches to avoid direct member variables
access of fixed_16_16_t structure.

add_fixed16 : takes 2 fixed_16_16_t variable & returns fixed_16_16_t
add_fixed16_u32 : takes fixed_16_16_t & u32 variable & returns fixed_16_16_t

Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d0698c290cba..7b95dec9529b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -224,6 +224,25 @@ static inline uint_fixed_16_16_t mul_u32_fixed16(uint32_t val,
 	return clamp_u64_to_fixed16(intermediate_val);
 }
 
+static inline uint_fixed_16_16_t add_fixed16(uint_fixed_16_16_t add1,
+					     uint_fixed_16_16_t add2)
+{
+	uint64_t interm_sum;
+
+	interm_sum = (uint64_t) add1.val + add2.val;
+	return clamp_u64_to_fixed16(interm_sum);
+}
+
+static inline uint_fixed_16_16_t add_fixed16_u32(uint_fixed_16_16_t add1,
+						 uint32_t add2)
+{
+	uint64_t interm_sum;
+	uint_fixed_16_16_t interm_add2 = u32_to_fixed16(add2);
+
+	interm_sum = (uint64_t) add1.val + interm_add2.val;
+	return clamp_u64_to_fixed16(interm_sum);
+}
+
 static inline const char *yesno(bool v)
 {
 	return v ? "yes" : "no";
-- 
2.13.0

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

  parent reply	other threads:[~2017-06-13 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 13:11 [PATCH 0/9] Fixed16.16 wrapper cleanup & wm optimization Mahesh Kumar
2017-06-13 13:11 ` [PATCH 1/9] drm/i915: take-out common clamping code of fixed16 wrappers Mahesh Kumar
2017-06-13 13:11 ` [PATCH 2/9] drm/i915: Always perform internal fixed16 division in 64 bits Mahesh Kumar
2017-06-13 13:11 ` [PATCH 3/9] drm/i915: cleanup fixed-point wrappers naming Mahesh Kumar
2017-06-13 13:11 ` Mahesh Kumar [this message]
2017-06-13 13:11 ` [PATCH 5/9] drm/i915/hsw: use intel_compute_linetime_wm function for linetime wm Mahesh Kumar
2017-06-13 13:11 ` [PATCH 6/9] drm/i915/skl+: WM calculation don't require height Mahesh Kumar
2017-06-13 13:12 ` [PATCH 7/9] drm/i915/skl+: unify cpp value in WM calculation Mahesh Kumar
2017-06-13 13:12 ` [PATCH 8/9] drm/i915/skl+: Optimize " Mahesh Kumar
2017-06-13 13:12 ` [PATCH 9/9] drm/i915/gen10: Calculate and enable transition WM Mahesh Kumar
2017-06-13 13:24 ` ✓ Fi.CI.BAT: success for Fixed16.16 wrapper cleanup & wm optimization (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170613131202.4492-5-mahesh1.kumar@intel.com \
    --to=mahesh1.kumar@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@intel.com \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox