aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0894-drm-amd-dal-allocate-structures-in-temp_params-separ.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/files/0894-drm-amd-dal-allocate-structures-in-temp_params-separ.patch')
-rw-r--r--common/recipes-kernel/linux/files/0894-drm-amd-dal-allocate-structures-in-temp_params-separ.patch183
1 files changed, 183 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0894-drm-amd-dal-allocate-structures-in-temp_params-separ.patch b/common/recipes-kernel/linux/files/0894-drm-amd-dal-allocate-structures-in-temp_params-separ.patch
new file mode 100644
index 00000000..0ceb1fee
--- /dev/null
+++ b/common/recipes-kernel/linux/files/0894-drm-amd-dal-allocate-structures-in-temp_params-separ.patch
@@ -0,0 +1,183 @@
+From 79ec3f43623e99119beb903e1e4214744dc25f6d Mon Sep 17 00:00:00 2001
+From: Eric Yang <eric.yang2@amd.com>
+Date: Wed, 9 Mar 2016 17:09:53 -0500
+Subject: [PATCH 0894/1110] drm/amd/dal: allocate structures in temp_params
+ separately
+
+The temp_params structure was very big (117648 bytes) and fails
+to allocate on some systems in suspend/resume. This causes gamma
+to not be programmed and color corruption seen on resume.
+
+Signed-off-by: Eric Yang <eric.yang2@amd.com>
+Acked-by: Harry Wentland <harry.wentland@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/dal/dc/calcs/gamma_calcs.c | 62 ++++++++++++++++++----
+ .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c | 15 ++----
+ drivers/gpu/drm/amd/dal/dc/inc/gamma_calcs.h | 14 +----
+ 3 files changed, 57 insertions(+), 34 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/dal/dc/calcs/gamma_calcs.c b/drivers/gpu/drm/amd/dal/dc/calcs/gamma_calcs.c
+index 9c18bda..0ddd961 100644
+--- a/drivers/gpu/drm/amd/dal/dc/calcs/gamma_calcs.c
++++ b/drivers/gpu/drm/amd/dal/dc/calcs/gamma_calcs.c
+@@ -1284,22 +1284,47 @@ static bool convert_to_custom_float(
+ return true;
+ }
+
+-void calculate_regamma_params(struct pwl_params *params,
+- struct temp_params *temp_params,
++bool calculate_regamma_params(struct pwl_params *params,
+ const struct core_gamma *ramp,
+ const struct core_surface *surface)
+ {
+ struct gamma_curve *arr_curve_points = params->arr_curve_points;
+ struct curve_points *arr_points = params->arr_points;
+- struct hw_x_point *coordinates_x = temp_params->coordinates_x;
+- struct pwl_float_data *rgb_user = temp_params->rgb_user;
+- struct pwl_float_data_ex *rgb_regamma = temp_params->rgb_regamma;
+- struct pwl_float_data *rgb_oem = temp_params->rgb_oem;
+ struct pwl_result_data *rgb_resulted = params->rgb_resulted;
+ struct dividers dividers;
+- struct gamma_pixel *axix_x_256 = temp_params->axix_x_256;
+- struct pixel_gamma_point *coeff128_oem = temp_params->coeff128_oem;
+- struct pixel_gamma_point *coeff128 = temp_params->coeff128;
++
++ struct hw_x_point *coordinates_x = NULL;
++ struct pwl_float_data *rgb_user = NULL ;
++ struct pwl_float_data_ex *rgb_regamma = NULL;
++ struct pwl_float_data *rgb_oem = NULL;
++ struct gamma_pixel *axix_x_256 = NULL;
++ struct pixel_gamma_point *coeff128_oem = NULL;
++ struct pixel_gamma_point *coeff128 = NULL;
++
++
++ bool ret = false;
++
++ coordinates_x = dm_alloc(sizeof(*coordinates_x)*(256 + 3));
++ if (!coordinates_x)
++ goto coordinates_x_alloc_fail;
++ rgb_user = dm_alloc(sizeof(*rgb_user) * (FLOAT_GAMMA_RAMP_MAX + 3));
++ if (!rgb_user)
++ goto rgb_user_alloc_fail;
++ rgb_regamma = dm_alloc(sizeof(*rgb_regamma) * (256 + 3));
++ if (!rgb_regamma)
++ goto rgb_regamma_alloc_fail;
++ rgb_oem = dm_alloc(sizeof(*rgb_oem) * (FLOAT_GAMMA_RAMP_MAX + 3));
++ if (!rgb_oem)
++ goto rgb_oem_alloc_fail;
++ axix_x_256 = dm_alloc(sizeof(*axix_x_256) * 256);
++ if (!axix_x_256)
++ goto axix_x_256_alloc_fail;
++ coeff128_oem = dm_alloc(sizeof(*coeff128_oem) * (256 + 3));
++ if (!coeff128_oem)
++ goto coeff128_oem_alloc_fail;
++ coeff128 = dm_alloc(sizeof(*coeff128) * (256 + 3));
++ if (!coeff128)
++ goto coeff128_alloc_fail;
+
+ dividers.divider1 = dal_fixed31_32_from_fraction(3, 2);
+ dividers.divider2 = dal_fixed31_32_from_int(2);
+@@ -1334,5 +1359,24 @@ void calculate_regamma_params(struct pwl_params *params,
+
+ convert_to_custom_float(rgb_resulted, arr_points,
+ params->hw_points_num);
++
++ ret = true;
++
++ dm_free(coeff128);
++coeff128_alloc_fail:
++ dm_free(coeff128_oem);
++coeff128_oem_alloc_fail:
++ dm_free(axix_x_256);
++axix_x_256_alloc_fail:
++ dm_free(rgb_oem);
++rgb_oem_alloc_fail:
++ dm_free(rgb_regamma);
++rgb_regamma_alloc_fail:
++ dm_free(rgb_user);
++rgb_user_alloc_fail:
++ dm_free(coordinates_x);
++coordinates_x_alloc_fail:
++ return ret;
++
+ }
+
+diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
+index 80faa98..fae2f8a 100644
+--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
++++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
+@@ -512,7 +512,6 @@ static bool set_gamma_ramp(
+ {
+ struct ipp_prescale_params *prescale_params;
+ struct pwl_params *regamma_params;
+- struct temp_params *temp_params;
+ bool result = false;
+
+ prescale_params = dm_alloc(sizeof(struct ipp_prescale_params));
+@@ -524,11 +523,6 @@ static bool set_gamma_ramp(
+ if (regamma_params == NULL)
+ goto regamma_alloc_fail;
+
+- temp_params = dm_alloc(sizeof(struct temp_params));
+-
+- if (temp_params == NULL)
+- goto temp_alloc_fail;
+-
+ regamma_params->hw_points_num = GAMMA_HW_POINTS_NUM;
+
+ opp->funcs->opp_power_on_regamma_lut(opp, true);
+@@ -538,9 +532,8 @@ static bool set_gamma_ramp(
+ ipp->funcs->ipp_program_prescale(ipp, prescale_params);
+ }
+
+- if (ramp) {
+- calculate_regamma_params(regamma_params,
+- temp_params, ramp, surface);
++ if (ramp && calculate_regamma_params(regamma_params, ramp, surface)) {
++
+ opp->funcs->opp_program_regamma_pwl(opp, regamma_params);
+ if (ipp)
+ ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_HW_sRGB);
+@@ -553,12 +546,10 @@ static bool set_gamma_ramp(
+
+ opp->funcs->opp_power_on_regamma_lut(opp, false);
+
+- dm_free(temp_params);
+-
+ result = true;
+
+-temp_alloc_fail:
+ dm_free(regamma_params);
++
+ regamma_alloc_fail:
+ dm_free(prescale_params);
+ prescale_alloc_fail:
+diff --git a/drivers/gpu/drm/amd/dal/dc/inc/gamma_calcs.h b/drivers/gpu/drm/amd/dal/dc/inc/gamma_calcs.h
+index baab77a..2064f28 100644
+--- a/drivers/gpu/drm/amd/dal/dc/inc/gamma_calcs.h
++++ b/drivers/gpu/drm/amd/dal/dc/inc/gamma_calcs.h
+@@ -12,19 +12,7 @@
+ #include "core_types.h"
+ #include "dc.h"
+
+-struct temp_params {
+- struct hw_x_point coordinates_x[256 + 3];
+- struct pwl_float_data rgb_user[FLOAT_GAMMA_RAMP_MAX + 3];
+- struct pwl_float_data_ex rgb_regamma[256 + 3];
+- struct pwl_float_data rgb_oem[FLOAT_GAMMA_RAMP_MAX + 3];
+- struct gamma_pixel axix_x_256[256];
+- struct pixel_gamma_point coeff128_oem[256 + 3];
+- struct pixel_gamma_point coeff128[256 + 3];
+-
+-};
+-
+-void calculate_regamma_params(struct pwl_params *params,
+- struct temp_params *temp_params,
++bool calculate_regamma_params(struct pwl_params *params,
+ const struct core_gamma *ramp,
+ const struct core_surface *surface);
+
+--
+2.7.4
+