Commit eb0e5154 authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: get rid of 32.32 unsigned fixed point

32.32 is redundant, 31.32 does everything we use 32.32 for
Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b79655c3
...@@ -88,9 +88,9 @@ static void __drm_lut_to_dc_gamma(struct drm_color_lut *lut, ...@@ -88,9 +88,9 @@ static void __drm_lut_to_dc_gamma(struct drm_color_lut *lut,
g = drm_color_lut_extract(lut[i].green, 16); g = drm_color_lut_extract(lut[i].green, 16);
b = drm_color_lut_extract(lut[i].blue, 16); b = drm_color_lut_extract(lut[i].blue, 16);
gamma->entries.red[i] = dal_fixed31_32_from_int(r); gamma->entries.red[i] = dc_fixpt_from_int(r);
gamma->entries.green[i] = dal_fixed31_32_from_int(g); gamma->entries.green[i] = dc_fixpt_from_int(g);
gamma->entries.blue[i] = dal_fixed31_32_from_int(b); gamma->entries.blue[i] = dc_fixpt_from_int(b);
} }
return; return;
} }
...@@ -101,9 +101,9 @@ static void __drm_lut_to_dc_gamma(struct drm_color_lut *lut, ...@@ -101,9 +101,9 @@ static void __drm_lut_to_dc_gamma(struct drm_color_lut *lut,
g = drm_color_lut_extract(lut[i].green, 16); g = drm_color_lut_extract(lut[i].green, 16);
b = drm_color_lut_extract(lut[i].blue, 16); b = drm_color_lut_extract(lut[i].blue, 16);
gamma->entries.red[i] = dal_fixed31_32_from_fraction(r, MAX_DRM_LUT_VALUE); gamma->entries.red[i] = dc_fixpt_from_fraction(r, MAX_DRM_LUT_VALUE);
gamma->entries.green[i] = dal_fixed31_32_from_fraction(g, MAX_DRM_LUT_VALUE); gamma->entries.green[i] = dc_fixpt_from_fraction(g, MAX_DRM_LUT_VALUE);
gamma->entries.blue[i] = dal_fixed31_32_from_fraction(b, MAX_DRM_LUT_VALUE); gamma->entries.blue[i] = dc_fixpt_from_fraction(b, MAX_DRM_LUT_VALUE);
} }
} }
...@@ -208,7 +208,7 @@ void amdgpu_dm_set_ctm(struct dm_crtc_state *crtc) ...@@ -208,7 +208,7 @@ void amdgpu_dm_set_ctm(struct dm_crtc_state *crtc)
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++) {
/* Skip 4th element */ /* Skip 4th element */
if (i % 4 == 3) { if (i % 4 == 3) {
stream->gamut_remap_matrix.matrix[i] = dal_fixed31_32_zero; stream->gamut_remap_matrix.matrix[i] = dc_fixpt_zero;
continue; continue;
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
# It provides the general basic services required by other DAL # It provides the general basic services required by other DAL
# subcomponents. # subcomponents.
BASICS = conversion.o fixpt31_32.o fixpt32_32.o \ BASICS = conversion.o fixpt31_32.o \
logger.o log_helpers.o vector.o logger.o log_helpers.o vector.o
AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS)) AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
......
...@@ -41,22 +41,22 @@ uint16_t fixed_point_to_int_frac( ...@@ -41,22 +41,22 @@ uint16_t fixed_point_to_int_frac(
uint16_t result; uint16_t result;
uint16_t d = (uint16_t)dal_fixed31_32_floor( uint16_t d = (uint16_t)dc_fixpt_floor(
dal_fixed31_32_abs( dc_fixpt_abs(
arg)); arg));
if (d <= (uint16_t)(1 << integer_bits) - (1 / (uint16_t)divisor)) if (d <= (uint16_t)(1 << integer_bits) - (1 / (uint16_t)divisor))
numerator = (uint16_t)dal_fixed31_32_round( numerator = (uint16_t)dc_fixpt_round(
dal_fixed31_32_mul_int( dc_fixpt_mul_int(
arg, arg,
divisor)); divisor));
else { else {
numerator = dal_fixed31_32_floor( numerator = dc_fixpt_floor(
dal_fixed31_32_sub( dc_fixpt_sub(
dal_fixed31_32_from_int( dc_fixpt_from_int(
1LL << integer_bits), 1LL << integer_bits),
dal_fixed31_32_recip( dc_fixpt_recip(
dal_fixed31_32_from_int( dc_fixpt_from_int(
divisor)))); divisor))));
} }
...@@ -66,8 +66,8 @@ uint16_t fixed_point_to_int_frac( ...@@ -66,8 +66,8 @@ uint16_t fixed_point_to_int_frac(
result = (uint16_t)( result = (uint16_t)(
(1 << (integer_bits + fractional_bits + 1)) + numerator); (1 << (integer_bits + fractional_bits + 1)) + numerator);
if ((result != 0) && dal_fixed31_32_lt( if ((result != 0) && dc_fixpt_lt(
arg, dal_fixed31_32_zero)) arg, dc_fixpt_zero))
result |= 1 << (integer_bits + fractional_bits); result |= 1 << (integer_bits + fractional_bits);
return result; return result;
...@@ -84,15 +84,15 @@ void convert_float_matrix( ...@@ -84,15 +84,15 @@ void convert_float_matrix(
uint32_t buffer_size) uint32_t buffer_size)
{ {
const struct fixed31_32 min_2_13 = const struct fixed31_32 min_2_13 =
dal_fixed31_32_from_fraction(S2D13_MIN, DIVIDER); dc_fixpt_from_fraction(S2D13_MIN, DIVIDER);
const struct fixed31_32 max_2_13 = const struct fixed31_32 max_2_13 =
dal_fixed31_32_from_fraction(S2D13_MAX, DIVIDER); dc_fixpt_from_fraction(S2D13_MAX, DIVIDER);
uint32_t i; uint32_t i;
for (i = 0; i < buffer_size; ++i) { for (i = 0; i < buffer_size; ++i) {
uint32_t reg_value = uint32_t reg_value =
fixed_point_to_int_frac( fixed_point_to_int_frac(
dal_fixed31_32_clamp( dc_fixpt_clamp(
flt[i], flt[i],
min_2_13, min_2_13,
max_2_13), max_2_13),
......
/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "dm_services.h"
#include "include/fixed32_32.h"
static uint64_t u64_div(uint64_t n, uint64_t d)
{
uint32_t i = 0;
uint64_t r;
uint64_t q = div64_u64_rem(n, d, &r);
for (i = 0; i < 32; ++i) {
uint64_t sbit = q & (1ULL<<63);
r <<= 1;
r |= sbit ? 1 : 0;
q <<= 1;
if (r >= d) {
r -= d;
q |= 1;
}
}
if (2*r >= d)
q += 1;
return q;
}
struct fixed32_32 dal_fixed32_32_from_fraction(uint32_t n, uint32_t d)
{
struct fixed32_32 fx;
fx.value = u64_div((uint64_t)n << 32, (uint64_t)d << 32);
return fx;
}
struct fixed32_32 dal_fixed32_32_add(
struct fixed32_32 lhs,
struct fixed32_32 rhs)
{
struct fixed32_32 fx = {lhs.value + rhs.value};
ASSERT(fx.value >= rhs.value);
return fx;
}
struct fixed32_32 dal_fixed32_32_add_int(struct fixed32_32 lhs, uint32_t rhs)
{
struct fixed32_32 fx = {lhs.value + ((uint64_t)rhs << 32)};
ASSERT(fx.value >= (uint64_t)rhs << 32);
return fx;
}
struct fixed32_32 dal_fixed32_32_sub(
struct fixed32_32 lhs,
struct fixed32_32 rhs)
{
struct fixed32_32 fx;
ASSERT(lhs.value >= rhs.value);
fx.value = lhs.value - rhs.value;
return fx;
}
struct fixed32_32 dal_fixed32_32_sub_int(struct fixed32_32 lhs, uint32_t rhs)
{
struct fixed32_32 fx;
ASSERT(lhs.value >= ((uint64_t)rhs<<32));
fx.value = lhs.value - ((uint64_t)rhs<<32);
return fx;
}
struct fixed32_32 dal_fixed32_32_mul(
struct fixed32_32 lhs,
struct fixed32_32 rhs)
{
struct fixed32_32 fx;
uint64_t lhs_int = lhs.value>>32;
uint64_t lhs_frac = (uint32_t)lhs.value;
uint64_t rhs_int = rhs.value>>32;
uint64_t rhs_frac = (uint32_t)rhs.value;
uint64_t ahbh = lhs_int * rhs_int;
uint64_t ahbl = lhs_int * rhs_frac;
uint64_t albh = lhs_frac * rhs_int;
uint64_t albl = lhs_frac * rhs_frac;
ASSERT((ahbh>>32) == 0);
fx.value = (ahbh<<32) + ahbl + albh + (albl>>32);
return fx;
}
struct fixed32_32 dal_fixed32_32_mul_int(struct fixed32_32 lhs, uint32_t rhs)
{
struct fixed32_32 fx;
uint64_t lhsi = (lhs.value>>32) * (uint64_t)rhs;
uint64_t lhsf;
ASSERT((lhsi>>32) == 0);
lhsf = ((uint32_t)lhs.value) * (uint64_t)rhs;
ASSERT((lhsi<<32) + lhsf >= lhsf);
fx.value = (lhsi<<32) + lhsf;
return fx;
}
struct fixed32_32 dal_fixed32_32_div(
struct fixed32_32 lhs,
struct fixed32_32 rhs)
{
struct fixed32_32 fx;
fx.value = u64_div(lhs.value, rhs.value);
return fx;
}
struct fixed32_32 dal_fixed32_32_div_int(struct fixed32_32 lhs, uint32_t rhs)
{
struct fixed32_32 fx;
fx.value = u64_div(lhs.value, (uint64_t)rhs << 32);
return fx;
}
uint32_t dal_fixed32_32_ceil(struct fixed32_32 v)
{
ASSERT((uint32_t)v.value ? (v.value >> 32) + 1 >= 1 : true);
return (v.value>>32) + ((uint32_t)v.value ? 1 : 0);
}
uint32_t dal_fixed32_32_round(struct fixed32_32 v)
{
ASSERT(v.value + (1ULL<<31) >= (1ULL<<31));
return (v.value + (1ULL<<31))>>32;
}
...@@ -36,41 +36,41 @@ static bool build_custom_float( ...@@ -36,41 +36,41 @@ static bool build_custom_float(
uint32_t exp_offset = (1 << (format->exponenta_bits - 1)) - 1; uint32_t exp_offset = (1 << (format->exponenta_bits - 1)) - 1;
const struct fixed31_32 mantissa_constant_plus_max_fraction = const struct fixed31_32 mantissa_constant_plus_max_fraction =
dal_fixed31_32_from_fraction( dc_fixpt_from_fraction(
(1LL << (format->mantissa_bits + 1)) - 1, (1LL << (format->mantissa_bits + 1)) - 1,
1LL << format->mantissa_bits); 1LL << format->mantissa_bits);
struct fixed31_32 mantiss; struct fixed31_32 mantiss;
if (dal_fixed31_32_eq( if (dc_fixpt_eq(
value, value,
dal_fixed31_32_zero)) { dc_fixpt_zero)) {
*negative = false; *negative = false;
*mantissa = 0; *mantissa = 0;
*exponenta = 0; *exponenta = 0;
return true; return true;
} }
if (dal_fixed31_32_lt( if (dc_fixpt_lt(
value, value,
dal_fixed31_32_zero)) { dc_fixpt_zero)) {
*negative = format->sign; *negative = format->sign;
value = dal_fixed31_32_neg(value); value = dc_fixpt_neg(value);
} else { } else {
*negative = false; *negative = false;
} }
if (dal_fixed31_32_lt( if (dc_fixpt_lt(
value, value,
dal_fixed31_32_one)) { dc_fixpt_one)) {
uint32_t i = 1; uint32_t i = 1;
do { do {
value = dal_fixed31_32_shl(value, 1); value = dc_fixpt_shl(value, 1);
++i; ++i;
} while (dal_fixed31_32_lt( } while (dc_fixpt_lt(
value, value,
dal_fixed31_32_one)); dc_fixpt_one));
--i; --i;
...@@ -81,15 +81,15 @@ static bool build_custom_float( ...@@ -81,15 +81,15 @@ static bool build_custom_float(
} }
*exponenta = exp_offset - i; *exponenta = exp_offset - i;
} else if (dal_fixed31_32_le( } else if (dc_fixpt_le(
mantissa_constant_plus_max_fraction, mantissa_constant_plus_max_fraction,
value)) { value)) {
uint32_t i = 1; uint32_t i = 1;
do { do {
value = dal_fixed31_32_shr(value, 1); value = dc_fixpt_shr(value, 1);
++i; ++i;
} while (dal_fixed31_32_lt( } while (dc_fixpt_lt(
mantissa_constant_plus_max_fraction, mantissa_constant_plus_max_fraction,
value)); value));
...@@ -98,23 +98,23 @@ static bool build_custom_float( ...@@ -98,23 +98,23 @@ static bool build_custom_float(
*exponenta = exp_offset; *exponenta = exp_offset;
} }
mantiss = dal_fixed31_32_sub( mantiss = dc_fixpt_sub(
value, value,
dal_fixed31_32_one); dc_fixpt_one);
if (dal_fixed31_32_lt( if (dc_fixpt_lt(
mantiss, mantiss,
dal_fixed31_32_zero) || dc_fixpt_zero) ||
dal_fixed31_32_lt( dc_fixpt_lt(
dal_fixed31_32_one, dc_fixpt_one,
mantiss)) mantiss))
mantiss = dal_fixed31_32_zero; mantiss = dc_fixpt_zero;
else else
mantiss = dal_fixed31_32_shl( mantiss = dc_fixpt_shl(
mantiss, mantiss,
format->mantissa_bits); format->mantissa_bits);
*mantissa = dal_fixed31_32_floor(mantiss); *mantissa = dc_fixpt_floor(mantiss);
return true; return true;
} }
......
...@@ -873,14 +873,14 @@ bool dcn_validate_bandwidth( ...@@ -873,14 +873,14 @@ bool dcn_validate_bandwidth(
} }
if (pipe->plane_state->rotation % 2 == 0) { if (pipe->plane_state->rotation % 2 == 0) {
ASSERT(pipe->plane_res.scl_data.ratios.horz.value != dal_fixed31_32_one.value ASSERT(pipe->plane_res.scl_data.ratios.horz.value != dc_fixpt_one.value
|| v->scaler_rec_out_width[input_idx] == v->viewport_width[input_idx]); || v->scaler_rec_out_width[input_idx] == v->viewport_width[input_idx]);
ASSERT(pipe->plane_res.scl_data.ratios.vert.value != dal_fixed31_32_one.value ASSERT(pipe->plane_res.scl_data.ratios.vert.value != dc_fixpt_one.value
|| v->scaler_recout_height[input_idx] == v->viewport_height[input_idx]); || v->scaler_recout_height[input_idx] == v->viewport_height[input_idx]);
} else { } else {
ASSERT(pipe->plane_res.scl_data.ratios.horz.value != dal_fixed31_32_one.value ASSERT(pipe->plane_res.scl_data.ratios.horz.value != dc_fixpt_one.value
|| v->scaler_recout_height[input_idx] == v->viewport_width[input_idx]); || v->scaler_recout_height[input_idx] == v->viewport_width[input_idx]);
ASSERT(pipe->plane_res.scl_data.ratios.vert.value != dal_fixed31_32_one.value ASSERT(pipe->plane_res.scl_data.ratios.vert.value != dc_fixpt_one.value
|| v->scaler_rec_out_width[input_idx] == v->viewport_height[input_idx]); || v->scaler_rec_out_width[input_idx] == v->viewport_height[input_idx]);
} }
v->dcc_enable[input_idx] = pipe->plane_state->dcc.enable ? dcn_bw_yes : dcn_bw_no; v->dcc_enable[input_idx] = pipe->plane_state->dcc.enable ? dcn_bw_yes : dcn_bw_no;
......
...@@ -631,7 +631,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) ...@@ -631,7 +631,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
/* Need to setup mst link_cap struct here /* Need to setup mst link_cap struct here
* otherwise dc_link_detect() will leave mst link_cap * otherwise dc_link_detect() will leave mst link_cap
* empty which leads to allocate_mst_payload() has "0" * empty which leads to allocate_mst_payload() has "0"
* pbn_per_slot value leading to exception on dal_fixed31_32_div() * pbn_per_slot value leading to exception on dc_fixpt_div()
*/ */
link->verified_link_cap = link->reported_link_cap; link->verified_link_cap = link->reported_link_cap;
return false; return false;
...@@ -2059,10 +2059,10 @@ static struct fixed31_32 get_pbn_per_slot(struct dc_stream_state *stream) ...@@ -2059,10 +2059,10 @@ static struct fixed31_32 get_pbn_per_slot(struct dc_stream_state *stream)
&stream->sink->link->cur_link_settings; &stream->sink->link->cur_link_settings;
uint32_t link_rate_in_mbps = uint32_t link_rate_in_mbps =
link_settings->link_rate * LINK_RATE_REF_FREQ_IN_MHZ; link_settings->link_rate * LINK_RATE_REF_FREQ_IN_MHZ;
struct fixed31_32 mbps = dal_fixed31_32_from_int( struct fixed31_32 mbps = dc_fixpt_from_int(
link_rate_in_mbps * link_settings->lane_count); link_rate_in_mbps * link_settings->lane_count);
return dal_fixed31_32_div_int(mbps, 54); return dc_fixpt_div_int(mbps, 54);
} }
static int get_color_depth(enum dc_color_depth color_depth) static int get_color_depth(enum dc_color_depth color_depth)
...@@ -2103,7 +2103,7 @@ static struct fixed31_32 get_pbn_from_timing(struct pipe_ctx *pipe_ctx) ...@@ -2103,7 +2103,7 @@ static struct fixed31_32 get_pbn_from_timing(struct pipe_ctx *pipe_ctx)
numerator = 64 * PEAK_FACTOR_X1000; numerator = 64 * PEAK_FACTOR_X1000;
denominator = 54 * 8 * 1000 * 1000; denominator = 54 * 8 * 1000 * 1000;
kbps *= numerator; kbps *= numerator;
peak_kbps = dal_fixed31_32_from_fraction(kbps, denominator); peak_kbps = dc_fixpt_from_fraction(kbps, denominator);
return peak_kbps; return peak_kbps;
} }
...@@ -2230,7 +2230,7 @@ static enum dc_status allocate_mst_payload(struct pipe_ctx *pipe_ctx) ...@@ -2230,7 +2230,7 @@ static enum dc_status allocate_mst_payload(struct pipe_ctx *pipe_ctx)
/* slot X.Y for only current stream */ /* slot X.Y for only current stream */
pbn_per_slot = get_pbn_per_slot(stream); pbn_per_slot = get_pbn_per_slot(stream);
pbn = get_pbn_from_timing(pipe_ctx); pbn = get_pbn_from_timing(pipe_ctx);
avg_time_slots_per_mtp = dal_fixed31_32_div(pbn, pbn_per_slot); avg_time_slots_per_mtp = dc_fixpt_div(pbn, pbn_per_slot);
stream_encoder->funcs->set_mst_bandwidth( stream_encoder->funcs->set_mst_bandwidth(
stream_encoder, stream_encoder,
...@@ -2247,7 +2247,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) ...@@ -2247,7 +2247,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
struct link_encoder *link_encoder = link->link_enc; struct link_encoder *link_encoder = link->link_enc;
struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc;
struct dp_mst_stream_allocation_table proposed_table = {0}; struct dp_mst_stream_allocation_table proposed_table = {0};
struct fixed31_32 avg_time_slots_per_mtp = dal_fixed31_32_from_int(0); struct fixed31_32 avg_time_slots_per_mtp = dc_fixpt_from_int(0);
uint8_t i; uint8_t i;
bool mst_mode = (link->type == dc_connection_mst_branch); bool mst_mode = (link->type == dc_connection_mst_branch);
DC_LOGGER_INIT(link->ctx->logger); DC_LOGGER_INIT(link->ctx->logger);
......
...@@ -496,9 +496,9 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) ...@@ -496,9 +496,9 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
data->viewport_c.x = data->viewport.x / vpc_div; data->viewport_c.x = data->viewport.x / vpc_div;
data->viewport_c.y = data->viewport.y / vpc_div; data->viewport_c.y = data->viewport.y / vpc_div;
data->inits.h_c = (data->viewport.x % vpc_div) != 0 ? data->inits.h_c = (data->viewport.x % vpc_div) != 0 ?
dal_fixed31_32_half : dal_fixed31_32_zero; dc_fixpt_half : dc_fixpt_zero;
data->inits.v_c = (data->viewport.y % vpc_div) != 0 ? data->inits.v_c = (data->viewport.y % vpc_div) != 0 ?
dal_fixed31_32_half : dal_fixed31_32_zero; dc_fixpt_half : dc_fixpt_zero;
/* Round up, assume original video size always even dimensions */ /* Round up, assume original video size always even dimensions */
data->viewport_c.width = (data->viewport.width + vpc_div - 1) / vpc_div; data->viewport_c.width = (data->viewport.width + vpc_div - 1) / vpc_div;
data->viewport_c.height = (data->viewport.height + vpc_div - 1) / vpc_div; data->viewport_c.height = (data->viewport.height + vpc_div - 1) / vpc_div;
...@@ -627,10 +627,10 @@ static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx) ...@@ -627,10 +627,10 @@ static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx)
pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270) pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270)
rect_swap_helper(&surf_src); rect_swap_helper(&surf_src);
pipe_ctx->plane_res.scl_data.ratios.horz = dal_fixed31_32_from_fraction( pipe_ctx->plane_res.scl_data.ratios.horz = dc_fixpt_from_fraction(
surf_src.width, surf_src.width,
plane_state->dst_rect.width); plane_state->dst_rect.width);
pipe_ctx->plane_res.scl_data.ratios.vert = dal_fixed31_32_from_fraction( pipe_ctx->plane_res.scl_data.ratios.vert = dc_fixpt_from_fraction(
surf_src.height, surf_src.height,
plane_state->dst_rect.height); plane_state->dst_rect.height);
...@@ -688,32 +688,32 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -688,32 +688,32 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
* init_bot = init + scaling_ratio * init_bot = init + scaling_ratio
* init_c = init + truncated_vp_c_offset(from calculate viewport) * init_c = init + truncated_vp_c_offset(from calculate viewport)
*/ */
data->inits.h = dal_fixed31_32_div_int( data->inits.h = dc_fixpt_div_int(
dal_fixed31_32_add_int(data->ratios.horz, data->taps.h_taps + 1), 2); dc_fixpt_add_int(data->ratios.horz, data->taps.h_taps + 1), 2);
data->inits.h_c = dal_fixed31_32_add(data->inits.h_c, dal_fixed31_32_div_int( data->inits.h_c = dc_fixpt_add(data->inits.h_c, dc_fixpt_div_int(
dal_fixed31_32_add_int(data->ratios.horz_c, data->taps.h_taps_c + 1), 2)); dc_fixpt_add_int(data->ratios.horz_c, data->taps.h_taps_c + 1), 2));
data->inits.v = dal_fixed31_32_div_int( data->inits.v = dc_fixpt_div_int(
dal_fixed31_32_add_int(data->ratios.vert, data->taps.v_taps + 1), 2); dc_fixpt_add_int(data->ratios.vert, data->taps.v_taps + 1), 2);
data->inits.v_c = dal_fixed31_32_add(data->inits.v_c, dal_fixed31_32_div_int( data->inits.v_c = dc_fixpt_add(data->inits.v_c, dc_fixpt_div_int(
dal_fixed31_32_add_int(data->ratios.vert_c, data->taps.v_taps_c + 1), 2)); dc_fixpt_add_int(data->ratios.vert_c, data->taps.v_taps_c + 1), 2));
/* Adjust for viewport end clip-off */ /* Adjust for viewport end clip-off */
if ((data->viewport.x + data->viewport.width) < (src.x + src.width) && !flip_horz_scan_dir) { if ((data->viewport.x + data->viewport.width) < (src.x + src.width) && !flip_horz_scan_dir) {
int vp_clip = src.x + src.width - data->viewport.width - data->viewport.x; int vp_clip = src.x + src.width - data->viewport.width - data->viewport.x;
int int_part = dal_fixed31_32_floor( int int_part = dc_fixpt_floor(
dal_fixed31_32_sub(data->inits.h, data->ratios.horz)); dc_fixpt_sub(data->inits.h, data->ratios.horz));
int_part = int_part > 0 ? int_part : 0; int_part = int_part > 0 ? int_part : 0;
data->viewport.width += int_part < vp_clip ? int_part : vp_clip; data->viewport.width += int_part < vp_clip ? int_part : vp_clip;
} }
if ((data->viewport.y + data->viewport.height) < (src.y + src.height) && !flip_vert_scan_dir) { if ((data->viewport.y + data->viewport.height) < (src.y + src.height) && !flip_vert_scan_dir) {
int vp_clip = src.y + src.height - data->viewport.height - data->viewport.y; int vp_clip = src.y + src.height - data->viewport.height - data->viewport.y;
int int_part = dal_fixed31_32_floor( int int_part = dc_fixpt_floor(
dal_fixed31_32_sub(data->inits.v, data->ratios.vert)); dc_fixpt_sub(data->inits.v, data->ratios.vert));
int_part = int_part > 0 ? int_part : 0; int_part = int_part > 0 ? int_part : 0;
data->viewport.height += int_part < vp_clip ? int_part : vp_clip; data->viewport.height += int_part < vp_clip ? int_part : vp_clip;
...@@ -721,8 +721,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -721,8 +721,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
if ((data->viewport_c.x + data->viewport_c.width) < (src.x + src.width) / vpc_div && !flip_horz_scan_dir) { if ((data->viewport_c.x + data->viewport_c.width) < (src.x + src.width) / vpc_div && !flip_horz_scan_dir) {
int vp_clip = (src.x + src.width) / vpc_div - int vp_clip = (src.x + src.width) / vpc_div -
data->viewport_c.width - data->viewport_c.x; data->viewport_c.width - data->viewport_c.x;
int int_part = dal_fixed31_32_floor( int int_part = dc_fixpt_floor(
dal_fixed31_32_sub(data->inits.h_c, data->ratios.horz_c)); dc_fixpt_sub(data->inits.h_c, data->ratios.horz_c));
int_part = int_part > 0 ? int_part : 0; int_part = int_part > 0 ? int_part : 0;
data->viewport_c.width += int_part < vp_clip ? int_part : vp_clip; data->viewport_c.width += int_part < vp_clip ? int_part : vp_clip;
...@@ -730,8 +730,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -730,8 +730,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
if ((data->viewport_c.y + data->viewport_c.height) < (src.y + src.height) / vpc_div && !flip_vert_scan_dir) { if ((data->viewport_c.y + data->viewport_c.height) < (src.y + src.height) / vpc_div && !flip_vert_scan_dir) {
int vp_clip = (src.y + src.height) / vpc_div - int vp_clip = (src.y + src.height) / vpc_div -
data->viewport_c.height - data->viewport_c.y; data->viewport_c.height - data->viewport_c.y;
int int_part = dal_fixed31_32_floor( int int_part = dc_fixpt_floor(
dal_fixed31_32_sub(data->inits.v_c, data->ratios.vert_c)); dc_fixpt_sub(data->inits.v_c, data->ratios.vert_c));
int_part = int_part > 0 ? int_part : 0; int_part = int_part > 0 ? int_part : 0;
data->viewport_c.height += int_part < vp_clip ? int_part : vp_clip; data->viewport_c.height += int_part < vp_clip ? int_part : vp_clip;
...@@ -741,9 +741,9 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -741,9 +741,9 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
if (data->viewport.x && !flip_horz_scan_dir) { if (data->viewport.x && !flip_horz_scan_dir) {
int int_part; int int_part;
data->inits.h = dal_fixed31_32_add(data->inits.h, dal_fixed31_32_mul_int( data->inits.h = dc_fixpt_add(data->inits.h, dc_fixpt_mul_int(
data->ratios.horz, recout_skip->width)); data->ratios.horz, recout_skip->width));
int_part = dal_fixed31_32_floor(data->inits.h) - data->viewport.x; int_part = dc_fixpt_floor(data->inits.h) - data->viewport.x;
if (int_part < data->taps.h_taps) { if (int_part < data->taps.h_taps) {
int int_adj = data->viewport.x >= (data->taps.h_taps - int_part) ? int int_adj = data->viewport.x >= (data->taps.h_taps - int_part) ?
(data->taps.h_taps - int_part) : data->viewport.x; (data->taps.h_taps - int_part) : data->viewport.x;
...@@ -756,15 +756,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -756,15 +756,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
int_part = data->taps.h_taps; int_part = data->taps.h_taps;
} }
data->inits.h.value &= 0xffffffff; data->inits.h.value &= 0xffffffff;
data->inits.h = dal_fixed31_32_add_int(data->inits.h, int_part); data->inits.h = dc_fixpt_add_int(data->inits.h, int_part);
} }
if (data->viewport_c.x && !flip_horz_scan_dir) { if (data->viewport_c.x && !flip_horz_scan_dir) {
int int_part; int int_part;
data->inits.h_c = dal_fixed31_32_add(data->inits.h_c, dal_fixed31_32_mul_int( data->inits.h_c = dc_fixpt_add(data->inits.h_c, dc_fixpt_mul_int(
data->ratios.horz_c, recout_skip->width)); data->ratios.horz_c, recout_skip->width));
int_part = dal_fixed31_32_floor(data->inits.h_c) - data->viewport_c.x; int_part = dc_fixpt_floor(data->inits.h_c) - data->viewport_c.x;
if (int_part < data->taps.h_taps_c) { if (int_part < data->taps.h_taps_c) {
int int_adj = data->viewport_c.x >= (data->taps.h_taps_c - int_part) ? int int_adj = data->viewport_c.x >= (data->taps.h_taps_c - int_part) ?
(data->taps.h_taps_c - int_part) : data->viewport_c.x; (data->taps.h_taps_c - int_part) : data->viewport_c.x;
...@@ -777,15 +777,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -777,15 +777,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
int_part = data->taps.h_taps_c; int_part = data->taps.h_taps_c;
} }
data->inits.h_c.value &= 0xffffffff; data->inits.h_c.value &= 0xffffffff;
data->inits.h_c = dal_fixed31_32_add_int(data->inits.h_c, int_part); data->inits.h_c = dc_fixpt_add_int(data->inits.h_c, int_part);
} }
if (data->viewport.y && !flip_vert_scan_dir) { if (data->viewport.y && !flip_vert_scan_dir) {
int int_part; int int_part;
data->inits.v = dal_fixed31_32_add(data->inits.v, dal_fixed31_32_mul_int( data->inits.v = dc_fixpt_add(data->inits.v, dc_fixpt_mul_int(
data->ratios.vert, recout_skip->height)); data->ratios.vert, recout_skip->height));
int_part = dal_fixed31_32_floor(data->inits.v) - data->viewport.y; int_part = dc_fixpt_floor(data->inits.v) - data->viewport.y;
if (int_part < data->taps.v_taps) { if (int_part < data->taps.v_taps) {
int int_adj = data->viewport.y >= (data->taps.v_taps - int_part) ? int int_adj = data->viewport.y >= (data->taps.v_taps - int_part) ?
(data->taps.v_taps - int_part) : data->viewport.y; (data->taps.v_taps - int_part) : data->viewport.y;
...@@ -798,15 +798,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -798,15 +798,15 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
int_part = data->taps.v_taps; int_part = data->taps.v_taps;
} }
data->inits.v.value &= 0xffffffff; data->inits.v.value &= 0xffffffff;
data->inits.v = dal_fixed31_32_add_int(data->inits.v, int_part); data->inits.v = dc_fixpt_add_int(data->inits.v, int_part);
} }
if (data->viewport_c.y && !flip_vert_scan_dir) { if (data->viewport_c.y && !flip_vert_scan_dir) {
int int_part; int int_part;
data->inits.v_c = dal_fixed31_32_add(data->inits.v_c, dal_fixed31_32_mul_int( data->inits.v_c = dc_fixpt_add(data->inits.v_c, dc_fixpt_mul_int(
data->ratios.vert_c, recout_skip->height)); data->ratios.vert_c, recout_skip->height));
int_part = dal_fixed31_32_floor(data->inits.v_c) - data->viewport_c.y; int_part = dc_fixpt_floor(data->inits.v_c) - data->viewport_c.y;
if (int_part < data->taps.v_taps_c) { if (int_part < data->taps.v_taps_c) {
int int_adj = data->viewport_c.y >= (data->taps.v_taps_c - int_part) ? int int_adj = data->viewport_c.y >= (data->taps.v_taps_c - int_part) ?
(data->taps.v_taps_c - int_part) : data->viewport_c.y; (data->taps.v_taps_c - int_part) : data->viewport_c.y;
...@@ -819,12 +819,12 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -819,12 +819,12 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
int_part = data->taps.v_taps_c; int_part = data->taps.v_taps_c;
} }
data->inits.v_c.value &= 0xffffffff; data->inits.v_c.value &= 0xffffffff;
data->inits.v_c = dal_fixed31_32_add_int(data->inits.v_c, int_part); data->inits.v_c = dc_fixpt_add_int(data->inits.v_c, int_part);
} }
/* Interlaced inits based on final vert inits */ /* Interlaced inits based on final vert inits */
data->inits.v_bot = dal_fixed31_32_add(data->inits.v, data->ratios.vert); data->inits.v_bot = dc_fixpt_add(data->inits.v, data->ratios.vert);
data->inits.v_c_bot = dal_fixed31_32_add(data->inits.v_c, data->ratios.vert_c); data->inits.v_c_bot = dc_fixpt_add(data->inits.v_c, data->ratios.vert_c);
if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 || if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270) { pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270) {
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#ifndef DC_DP_TYPES_H #ifndef DC_DP_TYPES_H
#define DC_DP_TYPES_H #define DC_DP_TYPES_H
#include "os_types.h"
enum dc_lane_count { enum dc_lane_count {
LANE_COUNT_UNKNOWN = 0, LANE_COUNT_UNKNOWN = 0,
LANE_COUNT_ONE = 1, LANE_COUNT_ONE = 1,
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef DC_TYPES_H_ #ifndef DC_TYPES_H_
#define DC_TYPES_H_ #define DC_TYPES_H_
#include "fixed32_32.h" #include "os_types.h"
#include "fixed31_32.h" #include "fixed31_32.h"
#include "irq_types.h" #include "irq_types.h"
#include "dc_dp_types.h" #include "dc_dp_types.h"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "dce_abm.h" #include "dce_abm.h"
#include "dm_services.h" #include "dm_services.h"
#include "reg_helper.h" #include "reg_helper.h"
#include "fixed32_32.h" #include "fixed31_32.h"
#include "dc.h" #include "dc.h"
#include "atom.h" #include "atom.h"
......
...@@ -657,12 +657,12 @@ static uint32_t dce110_get_d_to_pixel_rate_in_hz( ...@@ -657,12 +657,12 @@ static uint32_t dce110_get_d_to_pixel_rate_in_hz(
return 0; return 0;
} }
pix_rate = dal_fixed31_32_from_int(clk_src->ref_freq_khz); pix_rate = dc_fixpt_from_int(clk_src->ref_freq_khz);
pix_rate = dal_fixed31_32_mul_int(pix_rate, 1000); pix_rate = dc_fixpt_mul_int(pix_rate, 1000);
pix_rate = dal_fixed31_32_mul_int(pix_rate, phase); pix_rate = dc_fixpt_mul_int(pix_rate, phase);
pix_rate = dal_fixed31_32_div_int(pix_rate, modulo); pix_rate = dc_fixpt_div_int(pix_rate, modulo);
return dal_fixed31_32_round(pix_rate); return dc_fixpt_round(pix_rate);
} else { } else {
return dce110_get_dp_pixel_rate_from_combo_phy_pll(cs, pix_clk_params, pll_settings); return dce110_get_dp_pixel_rate_from_combo_phy_pll(cs, pix_clk_params, pll_settings);
} }
...@@ -711,12 +711,12 @@ static bool calculate_ss( ...@@ -711,12 +711,12 @@ static bool calculate_ss(
const struct spread_spectrum_data *ss_data, const struct spread_spectrum_data *ss_data,
struct delta_sigma_data *ds_data) struct delta_sigma_data *ds_data)
{ {
struct fixed32_32 fb_div; struct fixed31_32 fb_div;
struct fixed32_32 ss_amount; struct fixed31_32 ss_amount;
struct fixed32_32 ss_nslip_amount; struct fixed31_32 ss_nslip_amount;
struct fixed32_32 ss_ds_frac_amount; struct fixed31_32 ss_ds_frac_amount;
struct fixed32_32 ss_step_size; struct fixed31_32 ss_step_size;
struct fixed32_32 modulation_time; struct fixed31_32 modulation_time;
if (ds_data == NULL) if (ds_data == NULL)
return false; return false;
...@@ -731,42 +731,42 @@ static bool calculate_ss( ...@@ -731,42 +731,42 @@ static bool calculate_ss(
/* compute SS_AMOUNT_FBDIV & SS_AMOUNT_NFRAC_SLIP & SS_AMOUNT_DSFRAC*/ /* compute SS_AMOUNT_FBDIV & SS_AMOUNT_NFRAC_SLIP & SS_AMOUNT_DSFRAC*/
/* 6 decimal point support in fractional feedback divider */ /* 6 decimal point support in fractional feedback divider */
fb_div = dal_fixed32_32_from_fraction( fb_div = dc_fixpt_from_fraction(
pll_settings->fract_feedback_divider, 1000000); pll_settings->fract_feedback_divider, 1000000);
fb_div = dal_fixed32_32_add_int(fb_div, pll_settings->feedback_divider); fb_div = dc_fixpt_add_int(fb_div, pll_settings->feedback_divider);
ds_data->ds_frac_amount = 0; ds_data->ds_frac_amount = 0;
/*spreadSpectrumPercentage is in the unit of .01%, /*spreadSpectrumPercentage is in the unit of .01%,
* so have to divided by 100 * 100*/ * so have to divided by 100 * 100*/
ss_amount = dal_fixed32_32_mul( ss_amount = dc_fixpt_mul(
fb_div, dal_fixed32_32_from_fraction(ss_data->percentage, fb_div, dc_fixpt_from_fraction(ss_data->percentage,
100 * ss_data->percentage_divider)); 100 * ss_data->percentage_divider));
ds_data->feedback_amount = dal_fixed32_32_floor(ss_amount); ds_data->feedback_amount = dc_fixpt_floor(ss_amount);
ss_nslip_amount = dal_fixed32_32_sub(ss_amount, ss_nslip_amount = dc_fixpt_sub(ss_amount,
dal_fixed32_32_from_int(ds_data->feedback_amount)); dc_fixpt_from_int(ds_data->feedback_amount));
ss_nslip_amount = dal_fixed32_32_mul_int(ss_nslip_amount, 10); ss_nslip_amount = dc_fixpt_mul_int(ss_nslip_amount, 10);
ds_data->nfrac_amount = dal_fixed32_32_floor(ss_nslip_amount); ds_data->nfrac_amount = dc_fixpt_floor(ss_nslip_amount);
ss_ds_frac_amount = dal_fixed32_32_sub(ss_nslip_amount, ss_ds_frac_amount = dc_fixpt_sub(ss_nslip_amount,
dal_fixed32_32_from_int(ds_data->nfrac_amount)); dc_fixpt_from_int(ds_data->nfrac_amount));
ss_ds_frac_amount = dal_fixed32_32_mul_int(ss_ds_frac_amount, 65536); ss_ds_frac_amount = dc_fixpt_mul_int(ss_ds_frac_amount, 65536);
ds_data->ds_frac_amount = dal_fixed32_32_floor(ss_ds_frac_amount); ds_data->ds_frac_amount = dc_fixpt_floor(ss_ds_frac_amount);
/* compute SS_STEP_SIZE_DSFRAC */ /* compute SS_STEP_SIZE_DSFRAC */
modulation_time = dal_fixed32_32_from_fraction( modulation_time = dc_fixpt_from_fraction(
pll_settings->reference_freq * 1000, pll_settings->reference_freq * 1000,
pll_settings->reference_divider * ss_data->modulation_freq_hz); pll_settings->reference_divider * ss_data->modulation_freq_hz);
if (ss_data->flags.CENTER_SPREAD) if (ss_data->flags.CENTER_SPREAD)
modulation_time = dal_fixed32_32_div_int(modulation_time, 4); modulation_time = dc_fixpt_div_int(modulation_time, 4);
else else
modulation_time = dal_fixed32_32_div_int(modulation_time, 2); modulation_time = dc_fixpt_div_int(modulation_time, 2);
ss_step_size = dal_fixed32_32_div(ss_amount, modulation_time); ss_step_size = dc_fixpt_div(ss_amount, modulation_time);
/* SS_STEP_SIZE_DSFRAC_DEC = Int(SS_STEP_SIZE * 2 ^ 16 * 10)*/ /* SS_STEP_SIZE_DSFRAC_DEC = Int(SS_STEP_SIZE * 2 ^ 16 * 10)*/
ss_step_size = dal_fixed32_32_mul_int(ss_step_size, 65536 * 10); ss_step_size = dc_fixpt_mul_int(ss_step_size, 65536 * 10);
ds_data->ds_frac_size = dal_fixed32_32_floor(ss_step_size); ds_data->ds_frac_size = dc_fixpt_floor(ss_step_size);
return true; return true;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "dce_clocks.h" #include "dce_clocks.h"
#include "dm_services.h" #include "dm_services.h"
#include "reg_helper.h" #include "reg_helper.h"
#include "fixed32_32.h" #include "fixed31_32.h"
#include "bios_parser_interface.h" #include "bios_parser_interface.h"
#include "dc.h" #include "dc.h"
#include "dmcu.h" #include "dmcu.h"
...@@ -228,19 +228,19 @@ static int dce_clocks_get_dp_ref_freq(struct display_clock *clk) ...@@ -228,19 +228,19 @@ static int dce_clocks_get_dp_ref_freq(struct display_clock *clk)
generated according to average value (case as with previous ASICs) generated according to average value (case as with previous ASICs)
*/ */
if (clk_dce->ss_on_dprefclk && clk_dce->dprefclk_ss_divider != 0) { if (clk_dce->ss_on_dprefclk && clk_dce->dprefclk_ss_divider != 0) {
struct fixed32_32 ss_percentage = dal_fixed32_32_div_int( struct fixed31_32 ss_percentage = dc_fixpt_div_int(
dal_fixed32_32_from_fraction( dc_fixpt_from_fraction(
clk_dce->dprefclk_ss_percentage, clk_dce->dprefclk_ss_percentage,
clk_dce->dprefclk_ss_divider), 200); clk_dce->dprefclk_ss_divider), 200);
struct fixed32_32 adj_dp_ref_clk_khz; struct fixed31_32 adj_dp_ref_clk_khz;
ss_percentage = dal_fixed32_32_sub(dal_fixed32_32_one, ss_percentage = dc_fixpt_sub(dc_fixpt_one,
ss_percentage); ss_percentage);
adj_dp_ref_clk_khz = adj_dp_ref_clk_khz =
dal_fixed32_32_mul_int( dc_fixpt_mul_int(
ss_percentage, ss_percentage,
dp_ref_clk_khz); dp_ref_clk_khz);
dp_ref_clk_khz = dal_fixed32_32_floor(adj_dp_ref_clk_khz); dp_ref_clk_khz = dc_fixpt_floor(adj_dp_ref_clk_khz);
} }
return dp_ref_clk_khz; return dp_ref_clk_khz;
...@@ -256,19 +256,19 @@ static int dce_clocks_get_dp_ref_freq_wrkaround(struct display_clock *clk) ...@@ -256,19 +256,19 @@ static int dce_clocks_get_dp_ref_freq_wrkaround(struct display_clock *clk)
int dp_ref_clk_khz = 600000; int dp_ref_clk_khz = 600000;
if (clk_dce->ss_on_dprefclk && clk_dce->dprefclk_ss_divider != 0) { if (clk_dce->ss_on_dprefclk && clk_dce->dprefclk_ss_divider != 0) {
struct fixed32_32 ss_percentage = dal_fixed32_32_div_int( struct fixed31_32 ss_percentage = dc_fixpt_div_int(
dal_fixed32_32_from_fraction( dc_fixpt_from_fraction(
clk_dce->dprefclk_ss_percentage, clk_dce->dprefclk_ss_percentage,
clk_dce->dprefclk_ss_divider), 200); clk_dce->dprefclk_ss_divider), 200);
struct fixed32_32 adj_dp_ref_clk_khz; struct fixed31_32 adj_dp_ref_clk_khz;
ss_percentage = dal_fixed32_32_sub(dal_fixed32_32_one, ss_percentage = dc_fixpt_sub(dc_fixpt_one,
ss_percentage); ss_percentage);
adj_dp_ref_clk_khz = adj_dp_ref_clk_khz =
dal_fixed32_32_mul_int( dc_fixpt_mul_int(
ss_percentage, ss_percentage,
dp_ref_clk_khz); dp_ref_clk_khz);
dp_ref_clk_khz = dal_fixed32_32_floor(adj_dp_ref_clk_khz); dp_ref_clk_khz = dc_fixpt_floor(adj_dp_ref_clk_khz);
} }
return dp_ref_clk_khz; return dp_ref_clk_khz;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "dce_dmcu.h" #include "dce_dmcu.h"
#include "dm_services.h" #include "dm_services.h"
#include "reg_helper.h" #include "reg_helper.h"
#include "fixed32_32.h" #include "fixed31_32.h"
#include "dc.h" #include "dc.h"
#define TO_DCE_DMCU(dmcu)\ #define TO_DCE_DMCU(dmcu)\
......
...@@ -195,13 +195,13 @@ static void dce_ipp_program_input_lut( ...@@ -195,13 +195,13 @@ static void dce_ipp_program_input_lut(
for (i = 0; i < gamma->num_entries; i++) { for (i = 0; i < gamma->num_entries; i++) {
REG_SET(DC_LUT_SEQ_COLOR, 0, DC_LUT_SEQ_COLOR, REG_SET(DC_LUT_SEQ_COLOR, 0, DC_LUT_SEQ_COLOR,
dal_fixed31_32_round( dc_fixpt_round(
gamma->entries.red[i])); gamma->entries.red[i]));
REG_SET(DC_LUT_SEQ_COLOR, 0, DC_LUT_SEQ_COLOR, REG_SET(DC_LUT_SEQ_COLOR, 0, DC_LUT_SEQ_COLOR,
dal_fixed31_32_round( dc_fixpt_round(
gamma->entries.green[i])); gamma->entries.green[i]));
REG_SET(DC_LUT_SEQ_COLOR, 0, DC_LUT_SEQ_COLOR, REG_SET(DC_LUT_SEQ_COLOR, 0, DC_LUT_SEQ_COLOR,
dal_fixed31_32_round( dc_fixpt_round(
gamma->entries.blue[i])); gamma->entries.blue[i]));
} }
......
...@@ -1014,11 +1014,11 @@ static const uint16_t filter_8tap_64p_183[264] = { ...@@ -1014,11 +1014,11 @@ static const uint16_t filter_8tap_64p_183[264] = {
const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio) const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_3tap_16p_upscale; return filter_3tap_16p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_3tap_16p_117; return filter_3tap_16p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_3tap_16p_150; return filter_3tap_16p_150;
else else
return filter_3tap_16p_183; return filter_3tap_16p_183;
...@@ -1026,11 +1026,11 @@ const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio) ...@@ -1026,11 +1026,11 @@ const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio)
const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio) const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_3tap_64p_upscale; return filter_3tap_64p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_3tap_64p_117; return filter_3tap_64p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_3tap_64p_150; return filter_3tap_64p_150;
else else
return filter_3tap_64p_183; return filter_3tap_64p_183;
...@@ -1038,11 +1038,11 @@ const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio) ...@@ -1038,11 +1038,11 @@ const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio)
const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio) const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_4tap_16p_upscale; return filter_4tap_16p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_4tap_16p_117; return filter_4tap_16p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_4tap_16p_150; return filter_4tap_16p_150;
else else
return filter_4tap_16p_183; return filter_4tap_16p_183;
...@@ -1050,11 +1050,11 @@ const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio) ...@@ -1050,11 +1050,11 @@ const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio)
const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio) const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_4tap_64p_upscale; return filter_4tap_64p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_4tap_64p_117; return filter_4tap_64p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_4tap_64p_150; return filter_4tap_64p_150;
else else
return filter_4tap_64p_183; return filter_4tap_64p_183;
...@@ -1062,11 +1062,11 @@ const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio) ...@@ -1062,11 +1062,11 @@ const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio)
const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio) const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_5tap_64p_upscale; return filter_5tap_64p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_5tap_64p_117; return filter_5tap_64p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_5tap_64p_150; return filter_5tap_64p_150;
else else
return filter_5tap_64p_183; return filter_5tap_64p_183;
...@@ -1074,11 +1074,11 @@ const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio) ...@@ -1074,11 +1074,11 @@ const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio)
const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio) const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_6tap_64p_upscale; return filter_6tap_64p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_6tap_64p_117; return filter_6tap_64p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_6tap_64p_150; return filter_6tap_64p_150;
else else
return filter_6tap_64p_183; return filter_6tap_64p_183;
...@@ -1086,11 +1086,11 @@ const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio) ...@@ -1086,11 +1086,11 @@ const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio)
const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio) const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_7tap_64p_upscale; return filter_7tap_64p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_7tap_64p_117; return filter_7tap_64p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_7tap_64p_150; return filter_7tap_64p_150;
else else
return filter_7tap_64p_183; return filter_7tap_64p_183;
...@@ -1098,11 +1098,11 @@ const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio) ...@@ -1098,11 +1098,11 @@ const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio)
const uint16_t *get_filter_8tap_64p(struct fixed31_32 ratio) const uint16_t *get_filter_8tap_64p(struct fixed31_32 ratio)
{ {
if (ratio.value < dal_fixed31_32_one.value) if (ratio.value < dc_fixpt_one.value)
return filter_8tap_64p_upscale; return filter_8tap_64p_upscale;
else if (ratio.value < dal_fixed31_32_from_fraction(4, 3).value) else if (ratio.value < dc_fixpt_from_fraction(4, 3).value)
return filter_8tap_64p_117; return filter_8tap_64p_117;
else if (ratio.value < dal_fixed31_32_from_fraction(5, 3).value) else if (ratio.value < dc_fixpt_from_fraction(5, 3).value)
return filter_8tap_64p_150; return filter_8tap_64p_150;
else else
return filter_8tap_64p_183; return filter_8tap_64p_183;
......
...@@ -683,11 +683,11 @@ static void dce110_stream_encoder_set_mst_bandwidth( ...@@ -683,11 +683,11 @@ static void dce110_stream_encoder_set_mst_bandwidth(
struct fixed31_32 avg_time_slots_per_mtp) struct fixed31_32 avg_time_slots_per_mtp)
{ {
struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);
uint32_t x = dal_fixed31_32_floor( uint32_t x = dc_fixpt_floor(
avg_time_slots_per_mtp); avg_time_slots_per_mtp);
uint32_t y = dal_fixed31_32_ceil( uint32_t y = dc_fixpt_ceil(
dal_fixed31_32_shl( dc_fixpt_shl(
dal_fixed31_32_sub_int( dc_fixpt_sub_int(
avg_time_slots_per_mtp, avg_time_slots_per_mtp,
x), x),
26)); 26));
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define DC_LOGGER \ #define DC_LOGGER \
xfm_dce->base.ctx->logger xfm_dce->base.ctx->logger
#define IDENTITY_RATIO(ratio) (dal_fixed31_32_u2d19(ratio) == (1 << 19)) #define IDENTITY_RATIO(ratio) (dc_fixpt_u2d19(ratio) == (1 << 19))
#define GAMUT_MATRIX_SIZE 12 #define GAMUT_MATRIX_SIZE 12
#define SCL_PHASES 16 #define SCL_PHASES 16
...@@ -256,27 +256,27 @@ static void calculate_inits( ...@@ -256,27 +256,27 @@ static void calculate_inits(
struct fixed31_32 v_init; struct fixed31_32 v_init;
inits->h_int_scale_ratio = inits->h_int_scale_ratio =
dal_fixed31_32_u2d19(data->ratios.horz) << 5; dc_fixpt_u2d19(data->ratios.horz) << 5;
inits->v_int_scale_ratio = inits->v_int_scale_ratio =
dal_fixed31_32_u2d19(data->ratios.vert) << 5; dc_fixpt_u2d19(data->ratios.vert) << 5;
h_init = h_init =
dal_fixed31_32_div_int( dc_fixpt_div_int(
dal_fixed31_32_add( dc_fixpt_add(
data->ratios.horz, data->ratios.horz,
dal_fixed31_32_from_int(data->taps.h_taps + 1)), dc_fixpt_from_int(data->taps.h_taps + 1)),
2); 2);
inits->h_init.integer = dal_fixed31_32_floor(h_init); inits->h_init.integer = dc_fixpt_floor(h_init);
inits->h_init.fraction = dal_fixed31_32_u0d19(h_init) << 5; inits->h_init.fraction = dc_fixpt_u0d19(h_init) << 5;
v_init = v_init =
dal_fixed31_32_div_int( dc_fixpt_div_int(
dal_fixed31_32_add( dc_fixpt_add(
data->ratios.vert, data->ratios.vert,
dal_fixed31_32_from_int(data->taps.v_taps + 1)), dc_fixpt_from_int(data->taps.v_taps + 1)),
2); 2);
inits->v_init.integer = dal_fixed31_32_floor(v_init); inits->v_init.integer = dc_fixpt_floor(v_init);
inits->v_init.fraction = dal_fixed31_32_u0d19(v_init) << 5; inits->v_init.fraction = dc_fixpt_u0d19(v_init) << 5;
} }
static void program_scl_ratios_inits( static void program_scl_ratios_inits(
......
...@@ -509,19 +509,19 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf, ...@@ -509,19 +509,19 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
arr_points[0].x = dal_fixed31_32_pow(dal_fixed31_32_from_int(2), arr_points[0].x = dc_fixpt_pow(dc_fixpt_from_int(2),
dal_fixed31_32_from_int(region_start)); dc_fixpt_from_int(region_start));
arr_points[1].x = dal_fixed31_32_pow(dal_fixed31_32_from_int(2), arr_points[1].x = dc_fixpt_pow(dc_fixpt_from_int(2),
dal_fixed31_32_from_int(region_end)); dc_fixpt_from_int(region_end));
y_r = rgb_resulted[0].red; y_r = rgb_resulted[0].red;
y_g = rgb_resulted[0].green; y_g = rgb_resulted[0].green;
y_b = rgb_resulted[0].blue; y_b = rgb_resulted[0].blue;
y1_min = dal_fixed31_32_min(y_r, dal_fixed31_32_min(y_g, y_b)); y1_min = dc_fixpt_min(y_r, dc_fixpt_min(y_g, y_b));
arr_points[0].y = y1_min; arr_points[0].y = y1_min;
arr_points[0].slope = dal_fixed31_32_div(arr_points[0].y, arr_points[0].slope = dc_fixpt_div(arr_points[0].y,
arr_points[0].x); arr_points[0].x);
y_r = rgb_resulted[hw_points - 1].red; y_r = rgb_resulted[hw_points - 1].red;
...@@ -531,21 +531,21 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf, ...@@ -531,21 +531,21 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
/* see comment above, m_arrPoints[1].y should be the Y value for the /* see comment above, m_arrPoints[1].y should be the Y value for the
* region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1) * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1)
*/ */
y3_max = dal_fixed31_32_max(y_r, dal_fixed31_32_max(y_g, y_b)); y3_max = dc_fixpt_max(y_r, dc_fixpt_max(y_g, y_b));
arr_points[1].y = y3_max; arr_points[1].y = y3_max;
arr_points[1].slope = dal_fixed31_32_zero; arr_points[1].slope = dc_fixpt_zero;
if (output_tf->tf == TRANSFER_FUNCTION_PQ) { if (output_tf->tf == TRANSFER_FUNCTION_PQ) {
/* for PQ, we want to have a straight line from last HW X point, /* for PQ, we want to have a straight line from last HW X point,
* and the slope to be such that we hit 1.0 at 10000 nits. * and the slope to be such that we hit 1.0 at 10000 nits.
*/ */
const struct fixed31_32 end_value = dal_fixed31_32_from_int(125); const struct fixed31_32 end_value = dc_fixpt_from_int(125);
arr_points[1].slope = dal_fixed31_32_div( arr_points[1].slope = dc_fixpt_div(
dal_fixed31_32_sub(dal_fixed31_32_one, arr_points[1].y), dc_fixpt_sub(dc_fixpt_one, arr_points[1].y),
dal_fixed31_32_sub(end_value, arr_points[1].x)); dc_fixpt_sub(end_value, arr_points[1].x));
} }
regamma_params->hw_points_num = hw_points; regamma_params->hw_points_num = hw_points;
...@@ -569,16 +569,16 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf, ...@@ -569,16 +569,16 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
i = 1; i = 1;
while (i != hw_points + 1) { while (i != hw_points + 1) {
if (dal_fixed31_32_lt(rgb_plus_1->red, rgb->red)) if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
rgb_plus_1->red = rgb->red; rgb_plus_1->red = rgb->red;
if (dal_fixed31_32_lt(rgb_plus_1->green, rgb->green)) if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
rgb_plus_1->green = rgb->green; rgb_plus_1->green = rgb->green;
if (dal_fixed31_32_lt(rgb_plus_1->blue, rgb->blue)) if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
rgb_plus_1->blue = rgb->blue; rgb_plus_1->blue = rgb->blue;
rgb->delta_red = dal_fixed31_32_sub(rgb_plus_1->red, rgb->red); rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
rgb->delta_green = dal_fixed31_32_sub(rgb_plus_1->green, rgb->green); rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
rgb->delta_blue = dal_fixed31_32_sub(rgb_plus_1->blue, rgb->blue); rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);
++rgb_plus_1; ++rgb_plus_1;
++rgb; ++rgb;
......
...@@ -373,13 +373,13 @@ static void calculate_inits( ...@@ -373,13 +373,13 @@ static void calculate_inits(
struct rect *chroma_viewport) struct rect *chroma_viewport)
{ {
inits->h_int_scale_ratio_luma = inits->h_int_scale_ratio_luma =
dal_fixed31_32_u2d19(data->ratios.horz) << 5; dc_fixpt_u2d19(data->ratios.horz) << 5;
inits->v_int_scale_ratio_luma = inits->v_int_scale_ratio_luma =
dal_fixed31_32_u2d19(data->ratios.vert) << 5; dc_fixpt_u2d19(data->ratios.vert) << 5;
inits->h_int_scale_ratio_chroma = inits->h_int_scale_ratio_chroma =
dal_fixed31_32_u2d19(data->ratios.horz_c) << 5; dc_fixpt_u2d19(data->ratios.horz_c) << 5;
inits->v_int_scale_ratio_chroma = inits->v_int_scale_ratio_chroma =
dal_fixed31_32_u2d19(data->ratios.vert_c) << 5; dc_fixpt_u2d19(data->ratios.vert_c) << 5;
inits->h_init_luma.integer = 1; inits->h_init_luma.integer = 1;
inits->v_init_luma.integer = 1; inits->v_init_luma.integer = 1;
......
...@@ -169,7 +169,7 @@ bool cm_helper_convert_to_custom_float( ...@@ -169,7 +169,7 @@ bool cm_helper_convert_to_custom_float(
} }
if (fixpoint == true) if (fixpoint == true)
arr_points[1].custom_float_y = dal_fixed31_32_clamp_u0d14(arr_points[1].y); arr_points[1].custom_float_y = dc_fixpt_clamp_u0d14(arr_points[1].y);
else if (!convert_to_custom_float_format(arr_points[1].y, &fmt, else if (!convert_to_custom_float_format(arr_points[1].y, &fmt,
&arr_points[1].custom_float_y)) { &arr_points[1].custom_float_y)) {
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
...@@ -327,19 +327,19 @@ bool cm_helper_translate_curve_to_hw_format( ...@@ -327,19 +327,19 @@ bool cm_helper_translate_curve_to_hw_format(
rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
arr_points[0].x = dal_fixed31_32_pow(dal_fixed31_32_from_int(2), arr_points[0].x = dc_fixpt_pow(dc_fixpt_from_int(2),
dal_fixed31_32_from_int(region_start)); dc_fixpt_from_int(region_start));
arr_points[1].x = dal_fixed31_32_pow(dal_fixed31_32_from_int(2), arr_points[1].x = dc_fixpt_pow(dc_fixpt_from_int(2),
dal_fixed31_32_from_int(region_end)); dc_fixpt_from_int(region_end));
y_r = rgb_resulted[0].red; y_r = rgb_resulted[0].red;
y_g = rgb_resulted[0].green; y_g = rgb_resulted[0].green;
y_b = rgb_resulted[0].blue; y_b = rgb_resulted[0].blue;
y1_min = dal_fixed31_32_min(y_r, dal_fixed31_32_min(y_g, y_b)); y1_min = dc_fixpt_min(y_r, dc_fixpt_min(y_g, y_b));
arr_points[0].y = y1_min; arr_points[0].y = y1_min;
arr_points[0].slope = dal_fixed31_32_div(arr_points[0].y, arr_points[0].x); arr_points[0].slope = dc_fixpt_div(arr_points[0].y, arr_points[0].x);
y_r = rgb_resulted[hw_points - 1].red; y_r = rgb_resulted[hw_points - 1].red;
y_g = rgb_resulted[hw_points - 1].green; y_g = rgb_resulted[hw_points - 1].green;
y_b = rgb_resulted[hw_points - 1].blue; y_b = rgb_resulted[hw_points - 1].blue;
...@@ -347,22 +347,22 @@ bool cm_helper_translate_curve_to_hw_format( ...@@ -347,22 +347,22 @@ bool cm_helper_translate_curve_to_hw_format(
/* see comment above, m_arrPoints[1].y should be the Y value for the /* see comment above, m_arrPoints[1].y should be the Y value for the
* region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1) * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1)
*/ */
y3_max = dal_fixed31_32_max(y_r, dal_fixed31_32_max(y_g, y_b)); y3_max = dc_fixpt_max(y_r, dc_fixpt_max(y_g, y_b));
arr_points[1].y = y3_max; arr_points[1].y = y3_max;
arr_points[1].slope = dal_fixed31_32_zero; arr_points[1].slope = dc_fixpt_zero;
if (output_tf->tf == TRANSFER_FUNCTION_PQ) { if (output_tf->tf == TRANSFER_FUNCTION_PQ) {
/* for PQ, we want to have a straight line from last HW X point, /* for PQ, we want to have a straight line from last HW X point,
* and the slope to be such that we hit 1.0 at 10000 nits. * and the slope to be such that we hit 1.0 at 10000 nits.
*/ */
const struct fixed31_32 end_value = const struct fixed31_32 end_value =
dal_fixed31_32_from_int(125); dc_fixpt_from_int(125);
arr_points[1].slope = dal_fixed31_32_div( arr_points[1].slope = dc_fixpt_div(
dal_fixed31_32_sub(dal_fixed31_32_one, arr_points[1].y), dc_fixpt_sub(dc_fixpt_one, arr_points[1].y),
dal_fixed31_32_sub(end_value, arr_points[1].x)); dc_fixpt_sub(end_value, arr_points[1].x));
} }
lut_params->hw_points_num = hw_points; lut_params->hw_points_num = hw_points;
...@@ -386,24 +386,24 @@ bool cm_helper_translate_curve_to_hw_format( ...@@ -386,24 +386,24 @@ bool cm_helper_translate_curve_to_hw_format(
i = 1; i = 1;
while (i != hw_points + 1) { while (i != hw_points + 1) {
if (dal_fixed31_32_lt(rgb_plus_1->red, rgb->red)) if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
rgb_plus_1->red = rgb->red; rgb_plus_1->red = rgb->red;
if (dal_fixed31_32_lt(rgb_plus_1->green, rgb->green)) if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
rgb_plus_1->green = rgb->green; rgb_plus_1->green = rgb->green;
if (dal_fixed31_32_lt(rgb_plus_1->blue, rgb->blue)) if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
rgb_plus_1->blue = rgb->blue; rgb_plus_1->blue = rgb->blue;
rgb->delta_red = dal_fixed31_32_sub(rgb_plus_1->red, rgb->red); rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
rgb->delta_green = dal_fixed31_32_sub(rgb_plus_1->green, rgb->green); rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
rgb->delta_blue = dal_fixed31_32_sub(rgb_plus_1->blue, rgb->blue); rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);
if (fixpoint == true) { if (fixpoint == true) {
rgb->delta_red_reg = dal_fixed31_32_clamp_u0d10(rgb->delta_red); rgb->delta_red_reg = dc_fixpt_clamp_u0d10(rgb->delta_red);
rgb->delta_green_reg = dal_fixed31_32_clamp_u0d10(rgb->delta_green); rgb->delta_green_reg = dc_fixpt_clamp_u0d10(rgb->delta_green);
rgb->delta_blue_reg = dal_fixed31_32_clamp_u0d10(rgb->delta_blue); rgb->delta_blue_reg = dc_fixpt_clamp_u0d10(rgb->delta_blue);
rgb->red_reg = dal_fixed31_32_clamp_u0d14(rgb->red); rgb->red_reg = dc_fixpt_clamp_u0d14(rgb->red);
rgb->green_reg = dal_fixed31_32_clamp_u0d14(rgb->green); rgb->green_reg = dc_fixpt_clamp_u0d14(rgb->green);
rgb->blue_reg = dal_fixed31_32_clamp_u0d14(rgb->blue); rgb->blue_reg = dc_fixpt_clamp_u0d14(rgb->blue);
} }
++rgb_plus_1; ++rgb_plus_1;
...@@ -489,19 +489,19 @@ bool cm_helper_translate_curve_to_degamma_hw_format( ...@@ -489,19 +489,19 @@ bool cm_helper_translate_curve_to_degamma_hw_format(
rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index]; rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index]; rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
arr_points[0].x = dal_fixed31_32_pow(dal_fixed31_32_from_int(2), arr_points[0].x = dc_fixpt_pow(dc_fixpt_from_int(2),
dal_fixed31_32_from_int(region_start)); dc_fixpt_from_int(region_start));
arr_points[1].x = dal_fixed31_32_pow(dal_fixed31_32_from_int(2), arr_points[1].x = dc_fixpt_pow(dc_fixpt_from_int(2),
dal_fixed31_32_from_int(region_end)); dc_fixpt_from_int(region_end));
y_r = rgb_resulted[0].red; y_r = rgb_resulted[0].red;
y_g = rgb_resulted[0].green; y_g = rgb_resulted[0].green;
y_b = rgb_resulted[0].blue; y_b = rgb_resulted[0].blue;
y1_min = dal_fixed31_32_min(y_r, dal_fixed31_32_min(y_g, y_b)); y1_min = dc_fixpt_min(y_r, dc_fixpt_min(y_g, y_b));
arr_points[0].y = y1_min; arr_points[0].y = y1_min;
arr_points[0].slope = dal_fixed31_32_div(arr_points[0].y, arr_points[0].x); arr_points[0].slope = dc_fixpt_div(arr_points[0].y, arr_points[0].x);
y_r = rgb_resulted[hw_points - 1].red; y_r = rgb_resulted[hw_points - 1].red;
y_g = rgb_resulted[hw_points - 1].green; y_g = rgb_resulted[hw_points - 1].green;
y_b = rgb_resulted[hw_points - 1].blue; y_b = rgb_resulted[hw_points - 1].blue;
...@@ -509,22 +509,22 @@ bool cm_helper_translate_curve_to_degamma_hw_format( ...@@ -509,22 +509,22 @@ bool cm_helper_translate_curve_to_degamma_hw_format(
/* see comment above, m_arrPoints[1].y should be the Y value for the /* see comment above, m_arrPoints[1].y should be the Y value for the
* region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1) * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1)
*/ */
y3_max = dal_fixed31_32_max(y_r, dal_fixed31_32_max(y_g, y_b)); y3_max = dc_fixpt_max(y_r, dc_fixpt_max(y_g, y_b));
arr_points[1].y = y3_max; arr_points[1].y = y3_max;
arr_points[1].slope = dal_fixed31_32_zero; arr_points[1].slope = dc_fixpt_zero;
if (output_tf->tf == TRANSFER_FUNCTION_PQ) { if (output_tf->tf == TRANSFER_FUNCTION_PQ) {
/* for PQ, we want to have a straight line from last HW X point, /* for PQ, we want to have a straight line from last HW X point,
* and the slope to be such that we hit 1.0 at 10000 nits. * and the slope to be such that we hit 1.0 at 10000 nits.
*/ */
const struct fixed31_32 end_value = const struct fixed31_32 end_value =
dal_fixed31_32_from_int(125); dc_fixpt_from_int(125);
arr_points[1].slope = dal_fixed31_32_div( arr_points[1].slope = dc_fixpt_div(
dal_fixed31_32_sub(dal_fixed31_32_one, arr_points[1].y), dc_fixpt_sub(dc_fixpt_one, arr_points[1].y),
dal_fixed31_32_sub(end_value, arr_points[1].x)); dc_fixpt_sub(end_value, arr_points[1].x));
} }
lut_params->hw_points_num = hw_points; lut_params->hw_points_num = hw_points;
...@@ -548,16 +548,16 @@ bool cm_helper_translate_curve_to_degamma_hw_format( ...@@ -548,16 +548,16 @@ bool cm_helper_translate_curve_to_degamma_hw_format(
i = 1; i = 1;
while (i != hw_points + 1) { while (i != hw_points + 1) {
if (dal_fixed31_32_lt(rgb_plus_1->red, rgb->red)) if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
rgb_plus_1->red = rgb->red; rgb_plus_1->red = rgb->red;
if (dal_fixed31_32_lt(rgb_plus_1->green, rgb->green)) if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
rgb_plus_1->green = rgb->green; rgb_plus_1->green = rgb->green;
if (dal_fixed31_32_lt(rgb_plus_1->blue, rgb->blue)) if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
rgb_plus_1->blue = rgb->blue; rgb_plus_1->blue = rgb->blue;
rgb->delta_red = dal_fixed31_32_sub(rgb_plus_1->red, rgb->red); rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
rgb->delta_green = dal_fixed31_32_sub(rgb_plus_1->green, rgb->green); rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
rgb->delta_blue = dal_fixed31_32_sub(rgb_plus_1->blue, rgb->blue); rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);
++rgb_plus_1; ++rgb_plus_1;
++rgb; ++rgb;
......
...@@ -130,7 +130,7 @@ void dpp_set_gamut_remap_bypass(struct dcn10_dpp *dpp) ...@@ -130,7 +130,7 @@ void dpp_set_gamut_remap_bypass(struct dcn10_dpp *dpp)
/* Gamut remap in bypass */ /* Gamut remap in bypass */
} }
#define IDENTITY_RATIO(ratio) (dal_fixed31_32_u2d19(ratio) == (1 << 19)) #define IDENTITY_RATIO(ratio) (dc_fixpt_u2d19(ratio) == (1 << 19))
bool dpp_get_optimal_number_of_taps( bool dpp_get_optimal_number_of_taps(
......
...@@ -811,13 +811,13 @@ void dpp1_program_input_lut( ...@@ -811,13 +811,13 @@ void dpp1_program_input_lut(
REG_UPDATE(CM_IGAM_LUT_RW_INDEX, CM_IGAM_LUT_RW_INDEX, 0); REG_UPDATE(CM_IGAM_LUT_RW_INDEX, CM_IGAM_LUT_RW_INDEX, 0);
for (i = 0; i < gamma->num_entries; i++) { for (i = 0; i < gamma->num_entries; i++) {
REG_SET(CM_IGAM_LUT_SEQ_COLOR, 0, CM_IGAM_LUT_SEQ_COLOR, REG_SET(CM_IGAM_LUT_SEQ_COLOR, 0, CM_IGAM_LUT_SEQ_COLOR,
dal_fixed31_32_round( dc_fixpt_round(
gamma->entries.red[i])); gamma->entries.red[i]));
REG_SET(CM_IGAM_LUT_SEQ_COLOR, 0, CM_IGAM_LUT_SEQ_COLOR, REG_SET(CM_IGAM_LUT_SEQ_COLOR, 0, CM_IGAM_LUT_SEQ_COLOR,
dal_fixed31_32_round( dc_fixpt_round(
gamma->entries.green[i])); gamma->entries.green[i]));
REG_SET(CM_IGAM_LUT_SEQ_COLOR, 0, CM_IGAM_LUT_SEQ_COLOR, REG_SET(CM_IGAM_LUT_SEQ_COLOR, 0, CM_IGAM_LUT_SEQ_COLOR,
dal_fixed31_32_round( dc_fixpt_round(
gamma->entries.blue[i])); gamma->entries.blue[i]));
} }
// Power off LUT memory // Power off LUT memory
......
...@@ -169,7 +169,7 @@ static enum dscl_mode_sel dpp1_dscl_get_dscl_mode( ...@@ -169,7 +169,7 @@ static enum dscl_mode_sel dpp1_dscl_get_dscl_mode(
const struct scaler_data *data, const struct scaler_data *data,
bool dbg_always_scale) bool dbg_always_scale)
{ {
const long long one = dal_fixed31_32_one.value; const long long one = dc_fixpt_one.value;
if (dpp_base->caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT) { if (dpp_base->caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT) {
/* DSCL is processing data in fixed format */ /* DSCL is processing data in fixed format */
...@@ -464,8 +464,8 @@ static enum lb_memory_config dpp1_dscl_find_lb_memory_config(struct dcn10_dpp *d ...@@ -464,8 +464,8 @@ static enum lb_memory_config dpp1_dscl_find_lb_memory_config(struct dcn10_dpp *d
int num_part_y, num_part_c; int num_part_y, num_part_c;
int vtaps = scl_data->taps.v_taps; int vtaps = scl_data->taps.v_taps;
int vtaps_c = scl_data->taps.v_taps_c; int vtaps_c = scl_data->taps.v_taps_c;
int ceil_vratio = dal_fixed31_32_ceil(scl_data->ratios.vert); int ceil_vratio = dc_fixpt_ceil(scl_data->ratios.vert);
int ceil_vratio_c = dal_fixed31_32_ceil(scl_data->ratios.vert_c); int ceil_vratio_c = dc_fixpt_ceil(scl_data->ratios.vert_c);
enum lb_memory_config mem_cfg = LB_MEMORY_CONFIG_0; enum lb_memory_config mem_cfg = LB_MEMORY_CONFIG_0;
if (dpp->base.ctx->dc->debug.use_max_lb) if (dpp->base.ctx->dc->debug.use_max_lb)
...@@ -565,52 +565,52 @@ static void dpp1_dscl_set_manual_ratio_init( ...@@ -565,52 +565,52 @@ static void dpp1_dscl_set_manual_ratio_init(
uint32_t init_int = 0; uint32_t init_int = 0;
REG_SET(SCL_HORZ_FILTER_SCALE_RATIO, 0, REG_SET(SCL_HORZ_FILTER_SCALE_RATIO, 0,
SCL_H_SCALE_RATIO, dal_fixed31_32_u2d19(data->ratios.horz) << 5); SCL_H_SCALE_RATIO, dc_fixpt_u2d19(data->ratios.horz) << 5);
REG_SET(SCL_VERT_FILTER_SCALE_RATIO, 0, REG_SET(SCL_VERT_FILTER_SCALE_RATIO, 0,
SCL_V_SCALE_RATIO, dal_fixed31_32_u2d19(data->ratios.vert) << 5); SCL_V_SCALE_RATIO, dc_fixpt_u2d19(data->ratios.vert) << 5);
REG_SET(SCL_HORZ_FILTER_SCALE_RATIO_C, 0, REG_SET(SCL_HORZ_FILTER_SCALE_RATIO_C, 0,
SCL_H_SCALE_RATIO_C, dal_fixed31_32_u2d19(data->ratios.horz_c) << 5); SCL_H_SCALE_RATIO_C, dc_fixpt_u2d19(data->ratios.horz_c) << 5);
REG_SET(SCL_VERT_FILTER_SCALE_RATIO_C, 0, REG_SET(SCL_VERT_FILTER_SCALE_RATIO_C, 0,
SCL_V_SCALE_RATIO_C, dal_fixed31_32_u2d19(data->ratios.vert_c) << 5); SCL_V_SCALE_RATIO_C, dc_fixpt_u2d19(data->ratios.vert_c) << 5);
/* /*
* 0.24 format for fraction, first five bits zeroed * 0.24 format for fraction, first five bits zeroed
*/ */
init_frac = dal_fixed31_32_u0d19(data->inits.h) << 5; init_frac = dc_fixpt_u0d19(data->inits.h) << 5;
init_int = dal_fixed31_32_floor(data->inits.h); init_int = dc_fixpt_floor(data->inits.h);
REG_SET_2(SCL_HORZ_FILTER_INIT, 0, REG_SET_2(SCL_HORZ_FILTER_INIT, 0,
SCL_H_INIT_FRAC, init_frac, SCL_H_INIT_FRAC, init_frac,
SCL_H_INIT_INT, init_int); SCL_H_INIT_INT, init_int);
init_frac = dal_fixed31_32_u0d19(data->inits.h_c) << 5; init_frac = dc_fixpt_u0d19(data->inits.h_c) << 5;
init_int = dal_fixed31_32_floor(data->inits.h_c); init_int = dc_fixpt_floor(data->inits.h_c);
REG_SET_2(SCL_HORZ_FILTER_INIT_C, 0, REG_SET_2(SCL_HORZ_FILTER_INIT_C, 0,
SCL_H_INIT_FRAC_C, init_frac, SCL_H_INIT_FRAC_C, init_frac,
SCL_H_INIT_INT_C, init_int); SCL_H_INIT_INT_C, init_int);
init_frac = dal_fixed31_32_u0d19(data->inits.v) << 5; init_frac = dc_fixpt_u0d19(data->inits.v) << 5;
init_int = dal_fixed31_32_floor(data->inits.v); init_int = dc_fixpt_floor(data->inits.v);
REG_SET_2(SCL_VERT_FILTER_INIT, 0, REG_SET_2(SCL_VERT_FILTER_INIT, 0,
SCL_V_INIT_FRAC, init_frac, SCL_V_INIT_FRAC, init_frac,
SCL_V_INIT_INT, init_int); SCL_V_INIT_INT, init_int);
init_frac = dal_fixed31_32_u0d19(data->inits.v_bot) << 5; init_frac = dc_fixpt_u0d19(data->inits.v_bot) << 5;
init_int = dal_fixed31_32_floor(data->inits.v_bot); init_int = dc_fixpt_floor(data->inits.v_bot);
REG_SET_2(SCL_VERT_FILTER_INIT_BOT, 0, REG_SET_2(SCL_VERT_FILTER_INIT_BOT, 0,
SCL_V_INIT_FRAC_BOT, init_frac, SCL_V_INIT_FRAC_BOT, init_frac,
SCL_V_INIT_INT_BOT, init_int); SCL_V_INIT_INT_BOT, init_int);
init_frac = dal_fixed31_32_u0d19(data->inits.v_c) << 5; init_frac = dc_fixpt_u0d19(data->inits.v_c) << 5;
init_int = dal_fixed31_32_floor(data->inits.v_c); init_int = dc_fixpt_floor(data->inits.v_c);
REG_SET_2(SCL_VERT_FILTER_INIT_C, 0, REG_SET_2(SCL_VERT_FILTER_INIT_C, 0,
SCL_V_INIT_FRAC_C, init_frac, SCL_V_INIT_FRAC_C, init_frac,
SCL_V_INIT_INT_C, init_int); SCL_V_INIT_INT_C, init_int);
init_frac = dal_fixed31_32_u0d19(data->inits.v_c_bot) << 5; init_frac = dc_fixpt_u0d19(data->inits.v_c_bot) << 5;
init_int = dal_fixed31_32_floor(data->inits.v_c_bot); init_int = dc_fixpt_floor(data->inits.v_c_bot);
REG_SET_2(SCL_VERT_FILTER_INIT_BOT_C, 0, REG_SET_2(SCL_VERT_FILTER_INIT_BOT_C, 0,
SCL_V_INIT_FRAC_BOT_C, init_frac, SCL_V_INIT_FRAC_BOT_C, init_frac,
SCL_V_INIT_INT_BOT_C, init_int); SCL_V_INIT_INT_BOT_C, init_int);
......
...@@ -1054,8 +1054,8 @@ void hubp1_cursor_set_position( ...@@ -1054,8 +1054,8 @@ void hubp1_cursor_set_position(
ASSERT(param->h_scale_ratio.value); ASSERT(param->h_scale_ratio.value);
if (param->h_scale_ratio.value) if (param->h_scale_ratio.value)
dst_x_offset = dal_fixed31_32_floor(dal_fixed31_32_div( dst_x_offset = dc_fixpt_floor(dc_fixpt_div(
dal_fixed31_32_from_int(dst_x_offset), dc_fixpt_from_int(dst_x_offset),
param->h_scale_ratio)); param->h_scale_ratio));
if (src_x_offset >= (int)param->viewport_width) if (src_x_offset >= (int)param->viewport_width)
......
...@@ -1685,22 +1685,22 @@ static uint16_t fixed_point_to_int_frac( ...@@ -1685,22 +1685,22 @@ static uint16_t fixed_point_to_int_frac(
uint16_t result; uint16_t result;
uint16_t d = (uint16_t)dal_fixed31_32_floor( uint16_t d = (uint16_t)dc_fixpt_floor(
dal_fixed31_32_abs( dc_fixpt_abs(
arg)); arg));
if (d <= (uint16_t)(1 << integer_bits) - (1 / (uint16_t)divisor)) if (d <= (uint16_t)(1 << integer_bits) - (1 / (uint16_t)divisor))
numerator = (uint16_t)dal_fixed31_32_floor( numerator = (uint16_t)dc_fixpt_floor(
dal_fixed31_32_mul_int( dc_fixpt_mul_int(
arg, arg,
divisor)); divisor));
else { else {
numerator = dal_fixed31_32_floor( numerator = dc_fixpt_floor(
dal_fixed31_32_sub( dc_fixpt_sub(
dal_fixed31_32_from_int( dc_fixpt_from_int(
1LL << integer_bits), 1LL << integer_bits),
dal_fixed31_32_recip( dc_fixpt_recip(
dal_fixed31_32_from_int( dc_fixpt_from_int(
divisor)))); divisor))));
} }
...@@ -1710,8 +1710,8 @@ static uint16_t fixed_point_to_int_frac( ...@@ -1710,8 +1710,8 @@ static uint16_t fixed_point_to_int_frac(
result = (uint16_t)( result = (uint16_t)(
(1 << (integer_bits + fractional_bits + 1)) + numerator); (1 << (integer_bits + fractional_bits + 1)) + numerator);
if ((result != 0) && dal_fixed31_32_lt( if ((result != 0) && dc_fixpt_lt(
arg, dal_fixed31_32_zero)) arg, dc_fixpt_zero))
result |= 1 << (integer_bits + fractional_bits); result |= 1 << (integer_bits + fractional_bits);
return result; return result;
...@@ -1725,8 +1725,8 @@ void build_prescale_params(struct dc_bias_and_scale *bias_and_scale, ...@@ -1725,8 +1725,8 @@ void build_prescale_params(struct dc_bias_and_scale *bias_and_scale,
&& plane_state->input_csc_color_matrix.enable_adjustment && plane_state->input_csc_color_matrix.enable_adjustment
&& plane_state->coeff_reduction_factor.value != 0) { && plane_state->coeff_reduction_factor.value != 0) {
bias_and_scale->scale_blue = fixed_point_to_int_frac( bias_and_scale->scale_blue = fixed_point_to_int_frac(
dal_fixed31_32_mul(plane_state->coeff_reduction_factor, dc_fixpt_mul(plane_state->coeff_reduction_factor,
dal_fixed31_32_from_fraction(256, 255)), dc_fixpt_from_fraction(256, 255)),
2, 2,
13); 13);
bias_and_scale->scale_red = bias_and_scale->scale_blue; bias_and_scale->scale_red = bias_and_scale->scale_blue;
...@@ -1995,7 +1995,7 @@ static void dcn10_blank_pixel_data( ...@@ -1995,7 +1995,7 @@ static void dcn10_blank_pixel_data(
static void set_hdr_multiplier(struct pipe_ctx *pipe_ctx) static void set_hdr_multiplier(struct pipe_ctx *pipe_ctx)
{ {
struct fixed31_32 multiplier = dal_fixed31_32_from_fraction( struct fixed31_32 multiplier = dc_fixpt_from_fraction(
pipe_ctx->plane_state->sdr_white_level, 80); pipe_ctx->plane_state->sdr_white_level, 80);
uint32_t hw_mult = 0x1f000; // 1.0 default multiplier uint32_t hw_mult = 0x1f000; // 1.0 default multiplier
struct custom_float_format fmt; struct custom_float_format fmt;
......
...@@ -603,11 +603,11 @@ void enc1_stream_encoder_set_mst_bandwidth( ...@@ -603,11 +603,11 @@ void enc1_stream_encoder_set_mst_bandwidth(
struct fixed31_32 avg_time_slots_per_mtp) struct fixed31_32 avg_time_slots_per_mtp)
{ {
struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc); struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
uint32_t x = dal_fixed31_32_floor( uint32_t x = dc_fixpt_floor(
avg_time_slots_per_mtp); avg_time_slots_per_mtp);
uint32_t y = dal_fixed31_32_ceil( uint32_t y = dc_fixpt_ceil(
dal_fixed31_32_shl( dc_fixpt_shl(
dal_fixed31_32_sub_int( dc_fixpt_sub_int(
avg_time_slots_per_mtp, avg_time_slots_per_mtp,
x), x),
26)); 26));
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#ifndef __DAL_IRQ_TYPES_H__ #ifndef __DAL_IRQ_TYPES_H__
#define __DAL_IRQ_TYPES_H__ #define __DAL_IRQ_TYPES_H__
#include "os_types.h"
struct dc_context; struct dc_context;
typedef void (*interrupt_handler)(void *); typedef void (*interrupt_handler)(void *);
......
/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DAL_FIXED32_32_H__
#define __DAL_FIXED32_32_H__
#include "os_types.h"
struct fixed32_32 {
uint64_t value;
};
static const struct fixed32_32 dal_fixed32_32_zero = { 0 };
static const struct fixed32_32 dal_fixed32_32_one = { 0x100000000LL };
static const struct fixed32_32 dal_fixed32_32_half = { 0x80000000LL };
struct fixed32_32 dal_fixed32_32_from_fraction(uint32_t n, uint32_t d);
static inline struct fixed32_32 dal_fixed32_32_from_int(uint32_t value)
{
struct fixed32_32 fx;
fx.value = (uint64_t)value<<32;
return fx;
}
struct fixed32_32 dal_fixed32_32_add(
struct fixed32_32 lhs,
struct fixed32_32 rhs);
struct fixed32_32 dal_fixed32_32_add_int(
struct fixed32_32 lhs,
uint32_t rhs);
struct fixed32_32 dal_fixed32_32_sub(
struct fixed32_32 lhs,
struct fixed32_32 rhs);
struct fixed32_32 dal_fixed32_32_sub_int(
struct fixed32_32 lhs,
uint32_t rhs);
struct fixed32_32 dal_fixed32_32_mul(
struct fixed32_32 lhs,
struct fixed32_32 rhs);
struct fixed32_32 dal_fixed32_32_mul_int(
struct fixed32_32 lhs,
uint32_t rhs);
struct fixed32_32 dal_fixed32_32_div(
struct fixed32_32 lhs,
struct fixed32_32 rhs);
struct fixed32_32 dal_fixed32_32_div_int(
struct fixed32_32 lhs,
uint32_t rhs);
static inline struct fixed32_32 dal_fixed32_32_min(struct fixed32_32 lhs,
struct fixed32_32 rhs)
{
return (lhs.value < rhs.value) ? lhs : rhs;
}
static inline struct fixed32_32 dal_fixed32_32_max(struct fixed32_32 lhs,
struct fixed32_32 rhs)
{
return (lhs.value > rhs.value) ? lhs : rhs;
}
static inline bool dal_fixed32_32_gt(struct fixed32_32 lhs, struct fixed32_32 rhs)
{
return lhs.value > rhs.value;
}
static inline bool dal_fixed32_32_gt_int(struct fixed32_32 lhs, uint32_t rhs)
{
return lhs.value > ((uint64_t)rhs<<32);
}
static inline bool dal_fixed32_32_lt(struct fixed32_32 lhs, struct fixed32_32 rhs)
{
return lhs.value < rhs.value;
}
static inline bool dal_fixed32_32_lt_int(struct fixed32_32 lhs, uint32_t rhs)
{
return lhs.value < ((uint64_t)rhs<<32);
}
static inline bool dal_fixed32_32_le(struct fixed32_32 lhs, struct fixed32_32 rhs)
{
return lhs.value <= rhs.value;
}
static inline bool dal_fixed32_32_le_int(struct fixed32_32 lhs, uint32_t rhs)
{
return lhs.value <= ((uint64_t)rhs<<32);
}
static inline bool dal_fixed32_32_eq(struct fixed32_32 lhs, struct fixed32_32 rhs)
{
return lhs.value == rhs.value;
}
uint32_t dal_fixed32_32_ceil(struct fixed32_32 value);
static inline uint32_t dal_fixed32_32_floor(struct fixed32_32 value)
{
return value.value>>32;
}
uint32_t dal_fixed32_32_round(struct fixed32_32 value);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment