Commit 4fd17f2a authored by Roman Li's avatar Roman Li Committed by Alex Deucher

drm/amd/display: Cap OLED brightness per max frame-average luminance

[Why]
For OLED eDP the Display Manager uses max_cll value as a limit
for brightness control.
max_cll defines the content light luminance for individual pixel.
Whereas max_fall defines frame-average level luminance.
The user may not observe the difference in brightness in between
max_fall and max_cll.
That negatively impacts the user experience.

[How]
Use max_fall value instead of max_cll as a limit for brightness control.
Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: default avatarRoman Li <roman.li@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent c904e3ac
...@@ -2812,7 +2812,7 @@ static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = { ...@@ -2812,7 +2812,7 @@ static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
{ {
u32 max_cll, min_cll, max, min, q, r; u32 max_avg, min_cll, max, min, q, r;
struct amdgpu_dm_backlight_caps *caps; struct amdgpu_dm_backlight_caps *caps;
struct amdgpu_display_manager *dm; struct amdgpu_display_manager *dm;
struct drm_connector *conn_base; struct drm_connector *conn_base;
...@@ -2842,7 +2842,7 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) ...@@ -2842,7 +2842,7 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
caps = &dm->backlight_caps[i]; caps = &dm->backlight_caps[i];
caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps; caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;
caps->aux_support = false; caps->aux_support = false;
max_cll = conn_base->hdr_sink_metadata.hdmi_type1.max_cll; max_avg = conn_base->hdr_sink_metadata.hdmi_type1.max_fall;
min_cll = conn_base->hdr_sink_metadata.hdmi_type1.min_cll; min_cll = conn_base->hdr_sink_metadata.hdmi_type1.min_cll;
if (caps->ext_caps->bits.oled == 1 /*|| if (caps->ext_caps->bits.oled == 1 /*||
...@@ -2870,8 +2870,8 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) ...@@ -2870,8 +2870,8 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
* The results of the above expressions can be verified at * The results of the above expressions can be verified at
* pre_computed_values. * pre_computed_values.
*/ */
q = max_cll >> 5; q = max_avg >> 5;
r = max_cll % 32; r = max_avg % 32;
max = (1 << q) * pre_computed_values[r]; max = (1 << q) * pre_computed_values[r];
// min luminance: maxLum * (CV/255)^2 / 100 // min luminance: maxLum * (CV/255)^2 / 100
......
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