aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0515-drm-amd-dal-Use-fixed-types-instead-of-int-long-long.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0515-drm-amd-dal-Use-fixed-types-instead-of-int-long-long.patch')
-rw-r--r--common/recipes-kernel/linux/files/0515-drm-amd-dal-Use-fixed-types-instead-of-int-long-long.patch206
1 files changed, 206 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0515-drm-amd-dal-Use-fixed-types-instead-of-int-long-long.patch b/common/recipes-kernel/linux/files/0515-drm-amd-dal-Use-fixed-types-instead-of-int-long-long.patch
new file mode 100644
index 00000000..92035617
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0515-drm-amd-dal-Use-fixed-types-instead-of-int-long-long.patch
@@ -0,0 +1,206 @@
+From c2e2413d4fcb76a00edca5fe7c9ae5121240af31 Mon Sep 17 00:00:00 2001
+From: Jordan Lazare <Jordan.Lazare@amd.com>
+Date: Mon, 30 Nov 2015 13:59:48 -0500
+Subject: [PATCH 0515/1110] drm/amd/dal: Use fixed types instead of
+ int/long/long long
+
+To keep code consistent and particularly with fixed point calcs, we want
+to use uint32_t and uint64_t instead of the common int/long/long long
+types.
+
+Signed-off-by: Jordan Lazare <Jordan.Lazare@amd.com>
+Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
+---
+ drivers/gpu/drm/amd/dal/dc/calcs/bw_fixed.c | 56 ++++++++++++++---------------
+ drivers/gpu/drm/amd/dal/dc/inc/bw_fixed.h | 8 ++---
+ 2 files changed, 32 insertions(+), 32 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/dal/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/dal/dc/calcs/bw_fixed.c
+index 1716808..8bdd0fb 100644
+--- a/drivers/gpu/drm/amd/dal/dc/calcs/bw_fixed.c
++++ b/drivers/gpu/drm/amd/dal/dc/calcs/bw_fixed.c
+@@ -29,16 +29,16 @@
+ #define BITS_PER_FRACTIONAL_PART 24
+
+ #define MIN_I32 \
+- (long long)(-(1LL << (63 - BITS_PER_FRACTIONAL_PART)))
++ (int64_t)(-(1LL << (63 - BITS_PER_FRACTIONAL_PART)))
+
+ #define MAX_I32 \
+- (long long)((1ULL << (63 - BITS_PER_FRACTIONAL_PART)) - 1)
++ (int64_t)((1ULL << (63 - BITS_PER_FRACTIONAL_PART)) - 1)
+
+ #define MIN_I64 \
+- (long long)(-(1LL << 63))
++ (int64_t)(-(1LL << 63))
+
+ #define MAX_I64 \
+- (long long)((1ULL << 63) - 1)
++ (int64_t)((1ULL << 63) - 1)
+
+
+ #define FRACTIONAL_PART_MASK \
+@@ -50,12 +50,12 @@
+ #define GET_FRACTIONAL_PART(x) \
+ (FRACTIONAL_PART_MASK & (x))
+
+-static unsigned long long abs_i64(long long arg)
++static uint64_t abs_i64(int64_t arg)
+ {
+ if (arg >= 0)
+- return (unsigned long long)(arg);
++ return (uint64_t)(arg);
+ else
+- return (unsigned long long)(-arg);
++ return (uint64_t)(-arg);
+ }
+
+ struct bw_fixed bw_min3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3)
+@@ -68,7 +68,7 @@ struct bw_fixed bw_max3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed
+ return bw_max(bw_max(v1, v2), v3);
+ }
+
+-struct bw_fixed int_to_fixed(long long value)
++struct bw_fixed int_to_fixed(int64_t value)
+ {
+ struct bw_fixed res;
+ ASSERT(value < MAX_I32 && value > MIN_I32);
+@@ -76,17 +76,17 @@ struct bw_fixed int_to_fixed(long long value)
+ return res;
+ }
+
+-struct bw_fixed frc_to_fixed(long long numerator, long long denominator)
++struct bw_fixed frc_to_fixed(int64_t numerator, int64_t denominator)
+ {
+ struct bw_fixed res;
+ bool arg1_negative = numerator < 0;
+ bool arg2_negative = denominator < 0;
+- unsigned long long arg1_value;
+- unsigned long long arg2_value;
+- unsigned long long remainder;
++ uint64_t arg1_value;
++ uint64_t arg2_value;
++ uint64_t remainder;
+
+ /* determine integer part */
+- unsigned long long res_value;
++ uint64_t res_value;
+
+ ASSERT(denominator != 0);
+
+@@ -98,7 +98,7 @@ struct bw_fixed frc_to_fixed(long long numerator, long long denominator)
+
+ /* determine fractional part */
+ {
+- unsigned int i = BITS_PER_FRACTIONAL_PART;
++ uint32_t i = BITS_PER_FRACTIONAL_PART;
+
+ do
+ {
+@@ -116,14 +116,14 @@ struct bw_fixed frc_to_fixed(long long numerator, long long denominator)
+
+ /* round up LSB */
+ {
+- unsigned long long summand = (remainder << 1) >= arg2_value;
++ uint64_t summand = (remainder << 1) >= arg2_value;
+
+ ASSERT(res_value <= MAX_I64 - summand);
+
+ res_value += summand;
+ }
+
+- res.value = (signed long long)(res_value);
++ res.value = (int64_t)(res_value);
+
+ if (arg1_negative ^ arg2_negative)
+ res.value = -res.value;
+@@ -185,16 +185,16 @@ struct bw_fixed mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
+ bool arg1_negative = arg1.value < 0;
+ bool arg2_negative = arg2.value < 0;
+
+- unsigned long long arg1_value = abs_i64(arg1.value);
+- unsigned long long arg2_value = abs_i64(arg2.value);
++ uint64_t arg1_value = abs_i64(arg1.value);
++ uint64_t arg2_value = abs_i64(arg2.value);
+
+- unsigned long long arg1_int = GET_INTEGER_PART(arg1_value);
+- unsigned long long arg2_int = GET_INTEGER_PART(arg2_value);
++ uint64_t arg1_int = GET_INTEGER_PART(arg1_value);
++ uint64_t arg2_int = GET_INTEGER_PART(arg2_value);
+
+- unsigned long long arg1_fra = GET_FRACTIONAL_PART(arg1_value);
+- unsigned long long arg2_fra = GET_FRACTIONAL_PART(arg2_value);
++ uint64_t arg1_fra = GET_FRACTIONAL_PART(arg1_value);
++ uint64_t arg2_fra = GET_FRACTIONAL_PART(arg2_value);
+
+- unsigned long long tmp;
++ uint64_t tmp;
+
+ res.value = arg1_int * arg2_int;
+
+@@ -204,22 +204,22 @@ struct bw_fixed mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
+
+ tmp = arg1_int * arg2_fra;
+
+- ASSERT(tmp <= (unsigned long long)(MAX_I64 - res.value));
++ ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
+
+ res.value += tmp;
+
+ tmp = arg2_int * arg1_fra;
+
+- ASSERT(tmp <= (unsigned long long)(MAX_I64 - res.value));
++ ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
+
+ res.value += tmp;
+
+ tmp = arg1_fra * arg2_fra;
+
+ tmp = (tmp >> BITS_PER_FRACTIONAL_PART) +
+- (tmp >= (unsigned long long)(frc_to_fixed(1, 2).value));
++ (tmp >= (uint64_t)(frc_to_fixed(1, 2).value));
+
+- ASSERT(tmp <= (unsigned long long)(MAX_I64 - res.value));
++ ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
+
+ res.value += tmp;
+
+@@ -234,7 +234,7 @@ struct bw_fixed bw_div(const struct bw_fixed arg1, const struct bw_fixed arg2)
+ return res;
+ }
+
+-struct bw_fixed fixed31_32_to_bw_fixed(long long raw)
++struct bw_fixed fixed31_32_to_bw_fixed(int64_t raw)
+ {
+ struct bw_fixed result = { 0 };
+
+diff --git a/drivers/gpu/drm/amd/dal/dc/inc/bw_fixed.h b/drivers/gpu/drm/amd/dal/dc/inc/bw_fixed.h
+index f9e267b..254cf76 100644
+--- a/drivers/gpu/drm/amd/dal/dc/inc/bw_fixed.h
++++ b/drivers/gpu/drm/amd/dal/dc/inc/bw_fixed.h
+@@ -27,18 +27,18 @@
+ #define BW_FIXED_H_
+
+ struct bw_fixed {
+- signed long long value;
++ int64_t value;
+ };
+
+ struct bw_fixed bw_min3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3);
+
+ struct bw_fixed bw_max3(struct bw_fixed v1, struct bw_fixed v2, struct bw_fixed v3);
+
+-struct bw_fixed int_to_fixed(long long value);
++struct bw_fixed int_to_fixed(int64_t value);
+
+-struct bw_fixed frc_to_fixed(long long num, long long denum);
++struct bw_fixed frc_to_fixed(int64_t num, int64_t denum);
+
+-struct bw_fixed fixed31_32_to_bw_fixed(long long raw);
++struct bw_fixed fixed31_32_to_bw_fixed(int64_t raw);
+
+ struct bw_fixed add(const struct bw_fixed arg1, const struct bw_fixed arg2);
+ struct bw_fixed sub(const struct bw_fixed arg1, const struct bw_fixed arg2);
+--
+2.7.4
+