Commit 9dac88d8 authored by Wyatt Wood's avatar Wyatt Wood Committed by Alex Deucher

drm/amd/display: Add driver support for enabling PSR on DMCUB

[Why]
We want to be able to enable PSR on DMCUB, and fallback to
DMCU when necessary.

[How]
Add infrastructure to enable and disable PSR on DMCUB.
Signed-off-by: default avatarWyatt Wood <wyatt.wood@amd.com>
Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7895303b
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "dpcd_defs.h" #include "dpcd_defs.h"
#include "dmcu.h" #include "dmcu.h"
#include "hw/clk_mgr.h" #include "hw/clk_mgr.h"
#include "../dce/dmub_psr.h" #include "dce/dmub_psr.h"
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
...@@ -2433,7 +2433,7 @@ bool dc_link_set_psr_allow_active(struct dc_link *link, bool allow_active, bool ...@@ -2433,7 +2433,7 @@ bool dc_link_set_psr_allow_active(struct dc_link *link, bool allow_active, bool
struct dmcu *dmcu = dc->res_pool->dmcu; struct dmcu *dmcu = dc->res_pool->dmcu;
struct dmub_psr *psr = dc->res_pool->psr; struct dmub_psr *psr = dc->res_pool->psr;
if ((psr != NULL) && link->psr_feature_enabled) if (psr != NULL && link->psr_feature_enabled)
psr->funcs->psr_enable(psr, allow_active); psr->funcs->psr_enable(psr, allow_active);
else if ((dmcu != NULL && dmcu->funcs->is_dmcu_initialized(dmcu)) && link->psr_feature_enabled) else if ((dmcu != NULL && dmcu->funcs->is_dmcu_initialized(dmcu)) && link->psr_feature_enabled)
dmcu->funcs->set_psr_enable(dmcu, allow_active, wait); dmcu->funcs->set_psr_enable(dmcu, allow_active, wait);
......
...@@ -410,6 +410,7 @@ struct dc_debug_options { ...@@ -410,6 +410,7 @@ struct dc_debug_options {
bool dmub_offload_enabled; bool dmub_offload_enabled;
bool dmcub_emulation; bool dmcub_emulation;
bool dmub_command_table; /* for testing only */ bool dmub_command_table; /* for testing only */
bool psr_on_dmub;
struct dc_bw_validation_profile bw_val_profile; struct dc_bw_validation_profile bw_val_profile;
bool disable_fec; bool disable_fec;
bool disable_48mhz_pwrdwn; bool disable_48mhz_pwrdwn;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#ifndef DC_LINK_H_ #ifndef DC_LINK_H_
#define DC_LINK_H_ #define DC_LINK_H_
#include "dc.h"
#include "dc_types.h" #include "dc_types.h"
#include "grph_object_defs.h" #include "grph_object_defs.h"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \ DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \
dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \ dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \
dce_opp.o dce_dmcu.o dce_abm.o dce_ipp.o dce_aux.o \ dce_opp.o dce_dmcu.o dce_abm.o dce_ipp.o dce_aux.o \
dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o
AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE)) AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "dc.h" #include "dc.h"
#include "dc_dmub_srv.h" #include "dc_dmub_srv.h"
#include "../../dmub/inc/dmub_srv.h" #include "../../dmub/inc/dmub_srv.h"
#include "dmub_fw_state.h" #include "../../dmub/inc/dmub_gpint_cmd.h"
#include "core_types.h" #include "core_types.h"
#define MAX_PIPES 6 #define MAX_PIPES 6
...@@ -131,8 +131,9 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub, ...@@ -131,8 +131,9 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
= &cmd.psr_copy_settings.psr_copy_settings_data; = &cmd.psr_copy_settings.psr_copy_settings_data;
struct pipe_ctx *pipe_ctx = NULL; struct pipe_ctx *pipe_ctx = NULL;
struct resource_context *res_ctx = &link->ctx->dc->current_state->res_ctx; struct resource_context *res_ctx = &link->ctx->dc->current_state->res_ctx;
int i = 0;
for (int i = 0; i < MAX_PIPES; i++) { for (i = 0; i < MAX_PIPES; i++) {
if (res_ctx && if (res_ctx &&
res_ctx->pipe_ctx[i].stream && res_ctx->pipe_ctx[i].stream &&
res_ctx->pipe_ctx[i].stream->link && res_ctx->pipe_ctx[i].stream->link &&
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define _DMUB_PSR_H_ #define _DMUB_PSR_H_
#include "os_types.h" #include "os_types.h"
#include "dc_link.h"
struct dmub_psr { struct dmub_psr {
struct dc_context *ctx; struct dc_context *ctx;
...@@ -44,4 +45,4 @@ struct dmub_psr *dmub_psr_create(struct dc_context *ctx); ...@@ -44,4 +45,4 @@ struct dmub_psr *dmub_psr_create(struct dc_context *ctx);
void dmub_psr_destroy(struct dmub_psr **dmub); void dmub_psr_destroy(struct dmub_psr **dmub);
#endif /* _DCE_DMUB_H_ */ #endif /* _DMUB_PSR_H_ */
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
#include "dcn21_resource.h" #include "dcn21_resource.h"
#include "vm_helper.h" #include "vm_helper.h"
#include "dcn20/dcn20_vmid.h" #include "dcn20/dcn20_vmid.h"
#include "../dce/dmub_psr.h" #include "dce/dmub_psr.h"
#define SOC_BOUNDING_BOX_VALID false #define SOC_BOUNDING_BOX_VALID false
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
...@@ -995,6 +995,9 @@ static void dcn21_resource_destruct(struct dcn21_resource_pool *pool) ...@@ -995,6 +995,9 @@ static void dcn21_resource_destruct(struct dcn21_resource_pool *pool)
if (pool->base.dmcu != NULL) if (pool->base.dmcu != NULL)
dce_dmcu_destroy(&pool->base.dmcu); dce_dmcu_destroy(&pool->base.dmcu);
if (pool->base.psr != NULL)
dmub_psr_destroy(&pool->base.psr);
if (pool->base.dccg != NULL) if (pool->base.dccg != NULL)
dcn_dccg_destroy(&pool->base.dccg); dcn_dccg_destroy(&pool->base.dccg);
...@@ -1843,9 +1846,15 @@ static bool dcn21_resource_construct( ...@@ -1843,9 +1846,15 @@ static bool dcn21_resource_construct(
goto create_fail; goto create_fail;
} }
// Leave as NULL to not affect current dmcu psr programming sequence if (dc->debug.psr_on_dmub) {
// Will be uncommented when functionality is confirmed to be working pool->base.psr = dmub_psr_create(ctx);
pool->base.psr = NULL;
if (pool->base.psr == NULL) {
dm_error("DC: failed to create psr obj!\n");
BREAK_TO_DEBUGGER();
goto create_fail;
}
}
pool->base.abm = dce_abm_create(ctx, pool->base.abm = dce_abm_create(ctx,
&abm_regs, &abm_regs,
......
...@@ -63,6 +63,7 @@ enum dmub_gpint_command { ...@@ -63,6 +63,7 @@ enum dmub_gpint_command {
DMUB_GPINT__INVALID_COMMAND = 0, DMUB_GPINT__INVALID_COMMAND = 0,
DMUB_GPINT__GET_FW_VERSION = 1, DMUB_GPINT__GET_FW_VERSION = 1,
DMUB_GPINT__STOP_FW = 2, DMUB_GPINT__STOP_FW = 2,
DMUB_GPINT__GET_PSR_STATE = 7,
}; };
/** /**
......
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