Skip to content

Commit

Permalink
drm/amd/display: Add structs for Freesync Panel Replay
Browse files Browse the repository at this point in the history
In some instances, the GPU is transmitting repeated frame to the sink
without any updates or changes in the content. These repeat transmission
are wasteful, resulting in power draw in different aspects of the system

1. DCN is fetching the frame of data from DF/UMC/DRAM. This memory traffic
prevents power down of parts of this HW path.

2. GPU is transmitting pixel data to the display through the main link of
the DisplayPort interface. This prevents power down of both the Source
transmitter (TX) and the Sink receiver (RX)
�
The concepts of utilizing replay is similar to PSR, but there is a benefit of:
	Source and Sink remaining synchronized which allows for
        	- lower latency when switching from replay to live frames
	        - enable the possibility of more use cases
		- easy control of the sink's refresh rate during replay

Due to Source and Sink remaining timing synchronized, Replay can be activated
in more UI scenarios.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Bhawanpreet Lakha authored and Alex Deucher committed Aug 7, 2023
1 parent e2e42ed commit e013864
Show file tree
Hide file tree
Showing 14 changed files with 516 additions and 1 deletion.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dc.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ enum visual_confirm {
VISUAL_CONFIRM_SWAPCHAIN = 6,
VISUAL_CONFIRM_FAMS = 7,
VISUAL_CONFIRM_SWIZZLE = 9,
VISUAL_CONFIRM_REPLAY = 12,
VISUAL_CONFIRM_SUBVP = 14,
VISUAL_CONFIRM_MCLK_SWITCH = 16,
};
Expand Down Expand Up @@ -905,6 +906,7 @@ struct dc_debug_options {
uint32_t fpo_vactive_max_blank_us;
bool enable_legacy_fast_update;
bool disable_dc_mode_overwrite;
bool replay_skip_crtc_disabled;
};

struct gpu_info_soc_bounding_box_v1_0;
Expand Down Expand Up @@ -1524,6 +1526,8 @@ struct dc_link {
struct backlight_settings backlight_settings;
struct psr_settings psr_settings;

struct replay_settings replay_settings;

/* Drive settings read from integrated info table */
struct dc_lane_settings bios_forced_drive_settings;

Expand Down
29 changes: 29 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dc_dp_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,11 @@ struct edp_psr_info {
uint8_t force_psrsu_cap;
};

struct replay_info {
uint8_t pixel_deviation_per_line;
uint8_t max_deviation_line;
};

struct dprx_states {
bool cable_id_written;
};
Expand Down Expand Up @@ -1236,6 +1241,8 @@ struct dpcd_caps {
uint8_t edp_rev;
union edp_alpm_caps alpm_caps;
struct edp_psr_info psr_info;

struct replay_info pr_info;
};

union dpcd_sink_ext_caps {
Expand Down Expand Up @@ -1276,6 +1283,28 @@ union dpcd_psr_configuration {
unsigned char raw;
};

union replay_enable_and_configuration {
struct {
unsigned char FREESYNC_PANEL_REPLAY_MODE :1;
unsigned char TIMING_DESYNC_ERROR_VERIFICATION :1;
unsigned char STATE_TRANSITION_ERROR_DETECTION :1;
unsigned char RESERVED0 :1;
unsigned char RESERVED1 :4;
} bits;
unsigned char raw;
};

union dpcd_replay_configuration {
struct {
unsigned char STATE_TRANSITION_ERROR_STATUS : 1;
unsigned char DESYNC_ERROR_STATUS : 1;
unsigned char SINK_DEVICE_REPLAY_STATUS : 3;
unsigned char SINK_FRAME_LOCKED : 2;
unsigned char RESERVED : 1;
} bits;
unsigned char raw;
};

union dpcd_alpm_configuration {
struct {
unsigned char ENABLE : 1;
Expand Down
41 changes: 41 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,45 @@ struct psr_settings {
unsigned int psr_power_opt;
};

enum replay_coasting_vtotal_type {
PR_COASTING_TYPE_NOM = 0,
PR_COASTING_TYPE_STATIC,
PR_COASTING_TYPE_FULL_SCREEN_VIDEO,
PR_COASTING_TYPE_TEST_HARNESS,
PR_COASTING_TYPE_NUM,
};

union replay_error_status {
struct {
unsigned char STATE_TRANSITION_ERROR :1;
unsigned char LINK_CRC_ERROR :1;
unsigned char DESYNC_ERROR :1;
unsigned char RESERVED :5;
} bits;
unsigned char raw;
};

struct replay_config {
bool replay_supported; // Replay feature is supported
unsigned int replay_power_opt_supported; // Power opt flags that are supported
bool replay_smu_opt_supported; // SMU optimization is supported
unsigned int replay_enable_option; // Replay enablement option
uint32_t debug_flags; // Replay debug flags
bool replay_timing_sync_supported; // Replay desync is supported
union replay_error_status replay_error_status; // Replay error status
};

/* Replay feature flags */
struct replay_settings {
struct replay_config config; // Replay configuration
bool replay_feature_enabled; // Replay feature is ready for activating
bool replay_allow_active; // Replay is currently active
unsigned int replay_power_opt_active; // Power opt flags that are activated currently
bool replay_smu_opt_enable; // SMU optimization is enabled
uint16_t coasting_vtotal; // Current Coasting vtotal
uint16_t coasting_vtotal_table[PR_COASTING_TYPE_NUM]; // Coasting vtotal table
};

/* To split out "global" and "per-panel" config settings.
* Add a struct dc_panel_config under dc_link
*/
Expand All @@ -1051,9 +1090,11 @@ struct dc_panel_config {
struct psr {
bool disable_psr;
bool disallow_psrsu;
bool disallow_replay;
bool rc_disable;
bool rc_allow_static_screen;
bool rc_allow_fullscreen_VPB;
unsigned int replay_enable_option;
} psr;
/* ABM */
struct varib {
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
.ilr = {
.optimize_edp_link_rate = true,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
};

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
};

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
};

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
.ilr = {
.optimize_edp_link_rate = true,
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ static const struct dc_debug_options debug_defaults_drv = {
.enable_z9_disable_interface = true,
.minimum_z8_residency_time = 2000,
.psr_skip_crtc_disable = true,
.replay_skip_crtc_disabled = true,
.disable_dmcu = true,
.force_abm_enable = false,
.timing_trace = false,
Expand Down Expand Up @@ -945,6 +946,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
.ilr = {
.optimize_edp_link_rate = true,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
.ilr = {
.optimize_edp_link_rate = true,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ static const struct dc_panel_config panel_config_defaults = {
.psr = {
.disable_psr = false,
.disallow_psrsu = false,
.disallow_replay = false,
},
.ilr = {
.optimize_edp_link_rate = true,
Expand Down
19 changes: 19 additions & 0 deletions drivers/gpu/drm/amd/display/dc/inc/core_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ struct resource_pool {
struct dmcu *dmcu;
struct dmub_psr *psr;

struct dmub_replay *replay;

struct abm *multiple_abms[MAX_PIPES];

const struct resource_funcs *funcs;
Expand Down Expand Up @@ -572,6 +574,23 @@ struct dc_state {
} perf_params;
};

struct replay_context {
/* ddc line */
enum channel_id aux_inst;
/* Transmitter id */
enum transmitter digbe_inst;
/* Engine Id is used for Dig Be source select */
enum engine_id digfe_inst;
/* Controller Id used for Dig Fe source select */
enum controller_id controllerId;
unsigned int line_time_in_ns;
};

enum dc_replay_enable {
DC_REPLAY_DISABLE = 0,
DC_REPLAY_ENABLE = 1,
};

struct dc_bounding_box_max_clk {
int max_dcfclk_mhz;
int max_dispclk_mhz;
Expand Down
Loading

0 comments on commit e013864

Please sign in to comment.