Skip to content

Commit d9e8658

Browse files
Camille Choalexdeucher
authored andcommitted
drm/amd/display: Simplify brightness initialization
[Why] Remove the brightness cache in DC. It uses a single value to represent the brightness for both SDR and HDR mode. This leads to flash in HDR on/off. It also unconditionally programs brightness as in HDR mode. This may introduce garbage on SDR mode in miniLED panel. [How] Simplify the initialization flow by removing the DC cache and taking what panel has as default. Expand the mechanism for PWM to DPCD Aux to restore cached brightness value generally. Cc: [email protected] # 6.1+ Reviewed-by: Krunoslav Kovac <[email protected]> Acked-by: Hamza Mahfooz <[email protected]> Signed-off-by: Camille Cho <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 67e3887 commit d9e8658

File tree

6 files changed

+5
-22
lines changed

6 files changed

+5
-22
lines changed

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,6 @@ struct dc_link {
16091609
enum edp_revision edp_revision;
16101610
union dpcd_sink_ext_caps dpcd_sink_ext_caps;
16111611

1612-
struct backlight_settings backlight_settings;
16131612
struct psr_settings psr_settings;
16141613

16151614
struct replay_settings replay_settings;

drivers/gpu/drm/amd/display/dc/dc_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,10 +991,6 @@ struct link_mst_stream_allocation_table {
991991
struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
992992
};
993993

994-
struct backlight_settings {
995-
uint32_t backlight_millinits;
996-
};
997-
998994
/* PSR feature flags */
999995
struct psr_settings {
1000996
bool psr_feature_enabled; // PSR is supported by sink

drivers/gpu/drm/amd/display/dc/link/link_detection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,
879879
(link->dpcd_sink_ext_caps.bits.oled == 1)) {
880880
dpcd_set_source_specific_data(link);
881881
msleep(post_oui_delay);
882-
set_cached_brightness_aux(link);
882+
set_default_brightness_aux(link);
883883
}
884884

885885
return true;

drivers/gpu/drm/amd/display/dc/link/link_dpms.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,8 +2142,7 @@ static enum dc_status enable_link_dp(struct dc_state *state,
21422142
if (link->dpcd_sink_ext_caps.bits.oled == 1 ||
21432143
link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1 ||
21442144
link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1) {
2145-
set_cached_brightness_aux(link);
2146-
2145+
set_default_brightness_aux(link);
21472146
if (link->dpcd_sink_ext_caps.bits.oled == 1)
21482147
msleep(bl_oled_enable_delay);
21492148
edp_backlight_enable_aux(link, true);

drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ bool edp_set_backlight_level_nits(struct dc_link *link,
170170
*(uint32_t *)&dpcd_backlight_set.backlight_level_millinits = backlight_millinits;
171171
*(uint16_t *)&dpcd_backlight_set.backlight_transition_time_ms = (uint16_t)transition_time_in_ms;
172172

173-
link->backlight_settings.backlight_millinits = backlight_millinits;
174173

175174
if (!link->dpcd_caps.panel_luminance_control) {
176175
if (core_link_write_dpcd(link, DP_SOURCE_BACKLIGHT_LEVEL,
@@ -288,25 +287,16 @@ bool set_default_brightness_aux(struct dc_link *link)
288287
if (link && link->dpcd_sink_ext_caps.bits.oled == 1) {
289288
if (!read_default_bl_aux(link, &default_backlight))
290289
default_backlight = 150000;
291-
// if < 1 nits or > 5000, it might be wrong readback
292-
if (default_backlight < 1000 || default_backlight > 5000000)
293-
default_backlight = 150000; //
290+
// if > 5000, it might be wrong readback
291+
if (default_backlight > 5000000)
292+
default_backlight = 150000;
294293

295294
return edp_set_backlight_level_nits(link, true,
296295
default_backlight, 0);
297296
}
298297
return false;
299298
}
300299

301-
bool set_cached_brightness_aux(struct dc_link *link)
302-
{
303-
if (link->backlight_settings.backlight_millinits)
304-
return edp_set_backlight_level_nits(link, true,
305-
link->backlight_settings.backlight_millinits, 0);
306-
else
307-
return set_default_brightness_aux(link);
308-
return false;
309-
}
310300
bool edp_is_ilr_optimization_enabled(struct dc_link *link)
311301
{
312302
if (link->dpcd_caps.edp_supported_link_rates_count == 0 || !link->panel_config.ilr.optimize_edp_link_rate)

drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
3131
void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode);
3232
bool set_default_brightness_aux(struct dc_link *link);
33-
bool set_cached_brightness_aux(struct dc_link *link);
3433
void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd);
3534
int edp_get_backlight_level(const struct dc_link *link);
3635
bool edp_get_backlight_level_nits(struct dc_link *link,

0 commit comments

Comments
 (0)