|
@@ -25,8 +25,6 @@
|
|
|
|
|
|
#include "reg_helper.h"
|
|
#include "reg_helper.h"
|
|
#include "dcn10_mpc.h"
|
|
#include "dcn10_mpc.h"
|
|
-#include "dc.h"
|
|
|
|
-#include "mem_input.h"
|
|
|
|
|
|
|
|
#define REG(reg)\
|
|
#define REG(reg)\
|
|
mpc10->mpc_regs->reg
|
|
mpc10->mpc_regs->reg
|
|
@@ -38,17 +36,13 @@
|
|
#define FN(reg_name, field_name) \
|
|
#define FN(reg_name, field_name) \
|
|
mpc10->mpc_shift->field_name, mpc10->mpc_mask->field_name
|
|
mpc10->mpc_shift->field_name, mpc10->mpc_mask->field_name
|
|
|
|
|
|
-#define MODE_TOP_ONLY 1
|
|
|
|
-#define MODE_BLEND 3
|
|
|
|
-#define BLND_PP_ALPHA 0
|
|
|
|
-#define BLND_GLOBAL_ALPHA 2
|
|
|
|
|
|
|
|
-
|
|
|
|
-static void mpc10_set_bg_color(
|
|
|
|
- struct dcn10_mpc *mpc10,
|
|
|
|
|
|
+void mpc1_set_bg_color(struct mpc *mpc,
|
|
struct tg_color *bg_color,
|
|
struct tg_color *bg_color,
|
|
- int id)
|
|
|
|
|
|
+ int mpcc_id)
|
|
{
|
|
{
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
+
|
|
/* mpc color is 12 bit. tg_color is 10 bit */
|
|
/* mpc color is 12 bit. tg_color is 10 bit */
|
|
/* todo: might want to use 16 bit to represent color and have each
|
|
/* todo: might want to use 16 bit to represent color and have each
|
|
* hw block translate to correct color depth.
|
|
* hw block translate to correct color depth.
|
|
@@ -57,15 +51,47 @@ static void mpc10_set_bg_color(
|
|
uint32_t bg_g_y = bg_color->color_g_y << 2;
|
|
uint32_t bg_g_y = bg_color->color_g_y << 2;
|
|
uint32_t bg_b_cb = bg_color->color_b_cb << 2;
|
|
uint32_t bg_b_cb = bg_color->color_b_cb << 2;
|
|
|
|
|
|
- REG_SET(MPCC_BG_R_CR[id], 0,
|
|
|
|
|
|
+ REG_SET(MPCC_BG_R_CR[mpcc_id], 0,
|
|
MPCC_BG_R_CR, bg_r_cr);
|
|
MPCC_BG_R_CR, bg_r_cr);
|
|
- REG_SET(MPCC_BG_G_Y[id], 0,
|
|
|
|
|
|
+ REG_SET(MPCC_BG_G_Y[mpcc_id], 0,
|
|
MPCC_BG_G_Y, bg_g_y);
|
|
MPCC_BG_G_Y, bg_g_y);
|
|
- REG_SET(MPCC_BG_B_CB[id], 0,
|
|
|
|
|
|
+ REG_SET(MPCC_BG_B_CB[mpcc_id], 0,
|
|
MPCC_BG_B_CB, bg_b_cb);
|
|
MPCC_BG_B_CB, bg_b_cb);
|
|
}
|
|
}
|
|
|
|
|
|
-void mpc10_assert_idle_mpcc(struct mpc *mpc, int id)
|
|
|
|
|
|
+static void mpc1_update_blending(
|
|
|
|
+ struct mpc *mpc,
|
|
|
|
+ struct mpcc_blnd_cfg *blnd_cfg,
|
|
|
|
+ int mpcc_id)
|
|
|
|
+{
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
+
|
|
|
|
+ REG_UPDATE_5(MPCC_CONTROL[mpcc_id],
|
|
|
|
+ MPCC_ALPHA_BLND_MODE, blnd_cfg->alpha_mode,
|
|
|
|
+ MPCC_ALPHA_MULTIPLIED_MODE, blnd_cfg->pre_multiplied_alpha,
|
|
|
|
+ MPCC_BLND_ACTIVE_OVERLAP_ONLY, blnd_cfg->overlap_only,
|
|
|
|
+ MPCC_GLOBAL_ALPHA, blnd_cfg->global_alpha,
|
|
|
|
+ MPCC_GLOBAL_GAIN, blnd_cfg->global_gain);
|
|
|
|
+
|
|
|
|
+ mpc1_set_bg_color(mpc, &blnd_cfg->black_color, mpcc_id);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void mpc1_update_stereo_mix(
|
|
|
|
+ struct mpc *mpc,
|
|
|
|
+ struct mpcc_sm_cfg *sm_cfg,
|
|
|
|
+ int mpcc_id)
|
|
|
|
+{
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
+
|
|
|
|
+ REG_UPDATE_6(MPCC_SM_CONTROL[mpcc_id],
|
|
|
|
+ MPCC_SM_EN, sm_cfg->enable,
|
|
|
|
+ MPCC_SM_MODE, sm_cfg->sm_mode,
|
|
|
|
+ MPCC_SM_FRAME_ALT, sm_cfg->frame_alt,
|
|
|
|
+ MPCC_SM_FIELD_ALT, sm_cfg->field_alt,
|
|
|
|
+ MPCC_SM_FORCE_NEXT_FRAME_POL, sm_cfg->force_next_frame_porlarity,
|
|
|
|
+ MPCC_SM_FORCE_NEXT_TOP_POL, sm_cfg->force_next_field_polarity);
|
|
|
|
+}
|
|
|
|
+void mpc1_assert_idle_mpcc(struct mpc *mpc, int id)
|
|
{
|
|
{
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
|
|
@@ -75,39 +101,62 @@ void mpc10_assert_idle_mpcc(struct mpc *mpc, int id)
|
|
1, 100000);
|
|
1, 100000);
|
|
}
|
|
}
|
|
|
|
|
|
-static int mpc10_get_idle_mpcc_id(struct dcn10_mpc *mpc10)
|
|
|
|
|
|
+static int mpc1_get_opp_id(struct mpc *mpc, int mpcc_id)
|
|
{
|
|
{
|
|
- int i;
|
|
|
|
- int last_free_mpcc_id = -1;
|
|
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
+ unsigned int opp_id = 0xF;
|
|
|
|
|
|
- for (i = 0; i < mpc10->num_mpcc; i++) {
|
|
|
|
- uint32_t is_idle = 0;
|
|
|
|
|
|
+ REG_GET(MPCC_OPP_ID[mpcc_id], MPCC_OPP_ID, &opp_id);
|
|
|
|
|
|
- if (mpc10->mpcc_in_use_mask & 1 << i)
|
|
|
|
- continue;
|
|
|
|
|
|
+ return opp_id;
|
|
|
|
+}
|
|
|
|
|
|
- last_free_mpcc_id = i;
|
|
|
|
- REG_GET(MPCC_STATUS[i], MPCC_IDLE, &is_idle);
|
|
|
|
- if (is_idle)
|
|
|
|
- return i;
|
|
|
|
- }
|
|
|
|
|
|
+struct mpcc *mpc1_get_mpcc(struct mpc *mpc, int mpcc_id)
|
|
|
|
+{
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
|
|
- /* This assert should never trigger, we have mpcc leak if it does */
|
|
|
|
- ASSERT(last_free_mpcc_id != -1);
|
|
|
|
|
|
+ ASSERT(mpcc_id < mpc10->num_mpcc);
|
|
|
|
+ return &(mpc->mpcc_array[mpcc_id]);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+struct mpcc *mpc1_get_mpcc_for_dpp(struct mpc_tree *tree, int dpp_id)
|
|
|
|
+{
|
|
|
|
+ struct mpcc *tmp_mpcc = tree->opp_list;
|
|
|
|
+
|
|
|
|
+ while (tmp_mpcc != NULL) {
|
|
|
|
+ if (tmp_mpcc->dpp_id == dpp_id)
|
|
|
|
+ return tmp_mpcc;
|
|
|
|
+ tmp_mpcc = tmp_mpcc->mpcc_bot;
|
|
|
|
+ }
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
|
|
|
|
- mpc10_assert_idle_mpcc(&mpc10->base, last_free_mpcc_id);
|
|
|
|
- return last_free_mpcc_id;
|
|
|
|
|
|
+bool mpc1_is_mpcc_idle(struct mpc *mpc, int mpcc_id)
|
|
|
|
+{
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
+ unsigned int top_sel;
|
|
|
|
+ unsigned int opp_id;
|
|
|
|
+ unsigned int idle;
|
|
|
|
+
|
|
|
|
+ REG_GET(MPCC_TOP_SEL[mpcc_id], MPCC_TOP_SEL, &top_sel);
|
|
|
|
+ REG_GET(MPCC_OPP_ID[mpcc_id], MPCC_OPP_ID, &opp_id);
|
|
|
|
+ REG_GET(MPCC_STATUS[mpcc_id], MPCC_IDLE, &idle);
|
|
|
|
+ if (top_sel == 0xf && opp_id == 0xf && idle)
|
|
|
|
+ return true;
|
|
|
|
+ else
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
-static void mpc10_assert_mpcc_idle_before_connect(struct dcn10_mpc *mpc10, int id)
|
|
|
|
|
|
+void mpc1_assert_mpcc_idle_before_connect(struct mpc *mpc, int mpcc_id)
|
|
{
|
|
{
|
|
|
|
+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
unsigned int top_sel, mpc_busy, mpc_idle;
|
|
unsigned int top_sel, mpc_busy, mpc_idle;
|
|
|
|
|
|
- REG_GET(MPCC_TOP_SEL[id],
|
|
|
|
|
|
+ REG_GET(MPCC_TOP_SEL[mpcc_id],
|
|
MPCC_TOP_SEL, &top_sel);
|
|
MPCC_TOP_SEL, &top_sel);
|
|
|
|
|
|
if (top_sel == 0xf) {
|
|
if (top_sel == 0xf) {
|
|
- REG_GET_2(MPCC_STATUS[id],
|
|
|
|
|
|
+ REG_GET_2(MPCC_STATUS[mpcc_id],
|
|
MPCC_BUSY, &mpc_busy,
|
|
MPCC_BUSY, &mpc_busy,
|
|
MPCC_IDLE, &mpc_idle);
|
|
MPCC_IDLE, &mpc_idle);
|
|
|
|
|
|
@@ -116,241 +165,258 @@ static void mpc10_assert_mpcc_idle_before_connect(struct dcn10_mpc *mpc10, int i
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void mpc10_mpcc_remove(
|
|
|
|
- struct mpc *mpc,
|
|
|
|
- struct mpc_tree_cfg *tree_cfg,
|
|
|
|
- int opp_id,
|
|
|
|
- int dpp_id)
|
|
|
|
-{
|
|
|
|
- struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
|
|
- int mpcc_id, z_idx;
|
|
|
|
-
|
|
|
|
- /* find z_idx for the dpp to be removed */
|
|
|
|
- for (z_idx = 0; z_idx < tree_cfg->num_pipes; z_idx++)
|
|
|
|
- if (tree_cfg->dpp[z_idx] == dpp_id)
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- if (z_idx == tree_cfg->num_pipes) {
|
|
|
|
- /* In case of resume from S3/S4, remove mpcc from bios left over */
|
|
|
|
- REG_SET(MPCC_OPP_ID[dpp_id], 0,
|
|
|
|
- MPCC_OPP_ID, 0xf);
|
|
|
|
- REG_SET(MPCC_TOP_SEL[dpp_id], 0,
|
|
|
|
- MPCC_TOP_SEL, 0xf);
|
|
|
|
- REG_SET(MPCC_BOT_SEL[dpp_id], 0,
|
|
|
|
- MPCC_BOT_SEL, 0xf);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- mpcc_id = tree_cfg->mpcc[z_idx];
|
|
|
|
-
|
|
|
|
- REG_SET(MPCC_OPP_ID[mpcc_id], 0,
|
|
|
|
- MPCC_OPP_ID, 0xf);
|
|
|
|
- REG_SET(MPCC_TOP_SEL[mpcc_id], 0,
|
|
|
|
- MPCC_TOP_SEL, 0xf);
|
|
|
|
- REG_SET(MPCC_BOT_SEL[mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, 0xf);
|
|
|
|
-
|
|
|
|
- if (z_idx > 0) {
|
|
|
|
- int top_mpcc_id = tree_cfg->mpcc[z_idx - 1];
|
|
|
|
-
|
|
|
|
- if (z_idx + 1 < tree_cfg->num_pipes)
|
|
|
|
- /* mpcc to be removed is in the middle of the tree */
|
|
|
|
- REG_SET(MPCC_BOT_SEL[top_mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, tree_cfg->mpcc[z_idx + 1]);
|
|
|
|
- else {
|
|
|
|
- /* mpcc to be removed is at the bottom of the tree */
|
|
|
|
- REG_SET(MPCC_BOT_SEL[top_mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, 0xf);
|
|
|
|
- REG_UPDATE(MPCC_CONTROL[top_mpcc_id],
|
|
|
|
- MPCC_MODE, MODE_TOP_ONLY);
|
|
|
|
- }
|
|
|
|
- } else if (tree_cfg->num_pipes > 1)
|
|
|
|
- /* mpcc to be removed is at the top of the tree */
|
|
|
|
- REG_SET(MUX[opp_id], 0,
|
|
|
|
- MPC_OUT_MUX, tree_cfg->mpcc[z_idx + 1]);
|
|
|
|
- else
|
|
|
|
- /* mpcc to be removed is the only one in the tree */
|
|
|
|
- REG_SET(MUX[opp_id], 0, MPC_OUT_MUX, 0xf);
|
|
|
|
-
|
|
|
|
- /* mark this mpcc as not in use */
|
|
|
|
- mpc10->mpcc_in_use_mask &= ~(1 << mpcc_id);
|
|
|
|
- tree_cfg->num_pipes--;
|
|
|
|
- for (; z_idx < tree_cfg->num_pipes; z_idx++) {
|
|
|
|
- tree_cfg->dpp[z_idx] = tree_cfg->dpp[z_idx + 1];
|
|
|
|
- tree_cfg->mpcc[z_idx] = tree_cfg->mpcc[z_idx + 1];
|
|
|
|
- }
|
|
|
|
- tree_cfg->dpp[tree_cfg->num_pipes] = 0xdeadbeef;
|
|
|
|
- tree_cfg->mpcc[tree_cfg->num_pipes] = 0xdeadbeef;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void mpc10_add_to_tree_cfg(
|
|
|
|
|
|
+/*
|
|
|
|
+ * Insert DPP into MPC tree based on specified blending position.
|
|
|
|
+ * Only used for planes that are part of blending chain for OPP output
|
|
|
|
+ *
|
|
|
|
+ * Parameters:
|
|
|
|
+ * [in/out] mpc - MPC context.
|
|
|
|
+ * [in/out] tree - MPC tree structure that plane will be added to.
|
|
|
|
+ * [in] blnd_cfg - MPCC blending configuration for the new blending layer.
|
|
|
|
+ * [in] sm_cfg - MPCC stereo mix configuration for the new blending layer.
|
|
|
|
+ * stereo mix must disable for the very bottom layer of the tree config.
|
|
|
|
+ * [in] insert_above_mpcc - Insert new plane above this MPCC. If NULL, insert as bottom plane.
|
|
|
|
+ * [in] dpp_id - DPP instance for the plane to be added.
|
|
|
|
+ * [in] mpcc_id - The MPCC physical instance to use for blending.
|
|
|
|
+ *
|
|
|
|
+ * Return: struct mpcc* - MPCC that was added.
|
|
|
|
+ */
|
|
|
|
+struct mpcc *mpc1_insert_plane(
|
|
struct mpc *mpc,
|
|
struct mpc *mpc,
|
|
- struct mpcc_cfg *cfg,
|
|
|
|
|
|
+ struct mpc_tree *tree,
|
|
|
|
+ struct mpcc_blnd_cfg *blnd_cfg,
|
|
|
|
+ struct mpcc_sm_cfg *sm_cfg,
|
|
|
|
+ struct mpcc *insert_above_mpcc,
|
|
|
|
+ int dpp_id,
|
|
int mpcc_id)
|
|
int mpcc_id)
|
|
{
|
|
{
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
- int mpcc_mode = MODE_TOP_ONLY;
|
|
|
|
- int position = cfg->z_index;
|
|
|
|
- struct mpc_tree_cfg *tree_cfg = cfg->tree_cfg;
|
|
|
|
- int alpha_blnd_mode = cfg->per_pixel_alpha ?
|
|
|
|
- BLND_PP_ALPHA : BLND_GLOBAL_ALPHA;
|
|
|
|
- int z_idx;
|
|
|
|
|
|
+ struct mpcc *new_mpcc = NULL;
|
|
|
|
|
|
- REG_SET(MPCC_OPP_ID[mpcc_id], 0,
|
|
|
|
- MPCC_OPP_ID, cfg->opp_id);
|
|
|
|
|
|
+ /* sanity check parameters */
|
|
|
|
+ ASSERT(mpcc_id < mpc10->num_mpcc);
|
|
|
|
+ ASSERT(!(mpc10->mpcc_in_use_mask & 1 << mpcc_id));
|
|
|
|
|
|
- REG_SET(MPCC_TOP_SEL[mpcc_id], 0,
|
|
|
|
- MPCC_TOP_SEL, cfg->dpp_id);
|
|
|
|
|
|
+ if (insert_above_mpcc) {
|
|
|
|
+ /* check insert_above_mpcc exist in tree->opp_list */
|
|
|
|
+ struct mpcc *temp_mpcc = tree->opp_list;
|
|
|
|
|
|
- if (position == 0) {
|
|
|
|
- /* idle dpp/mpcc is added to the top layer of tree */
|
|
|
|
|
|
+ while (temp_mpcc && temp_mpcc->mpcc_bot != insert_above_mpcc)
|
|
|
|
+ temp_mpcc = temp_mpcc->mpcc_bot;
|
|
|
|
+ if (temp_mpcc == NULL)
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
|
|
- if (tree_cfg->num_pipes > 0) {
|
|
|
|
- /* get instance of previous top mpcc */
|
|
|
|
- int prev_top_mpcc_id = tree_cfg->mpcc[0];
|
|
|
|
|
|
+ /* Get and update MPCC struct parameters */
|
|
|
|
+ new_mpcc = mpc1_get_mpcc(mpc, mpcc_id);
|
|
|
|
+ new_mpcc->dpp_id = dpp_id;
|
|
|
|
|
|
- REG_SET(MPCC_BOT_SEL[mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, prev_top_mpcc_id);
|
|
|
|
- mpcc_mode = MODE_BLEND;
|
|
|
|
|
|
+ /* program mux and MPCC_MODE */
|
|
|
|
+ if (insert_above_mpcc) {
|
|
|
|
+ new_mpcc->mpcc_bot = insert_above_mpcc;
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, insert_above_mpcc->mpcc_id);
|
|
|
|
+ REG_UPDATE(MPCC_CONTROL[mpcc_id], MPCC_MODE, MPCC_BLEND_MODE_TOP_BOT_BLENDING);
|
|
|
|
+ } else {
|
|
|
|
+ new_mpcc->mpcc_bot = NULL;
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
|
|
|
|
+ REG_UPDATE(MPCC_CONTROL[mpcc_id], MPCC_MODE, MPCC_BLEND_MODE_TOP_LAYER_PASSTHROUGH);
|
|
|
|
+ }
|
|
|
|
+ REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, dpp_id);
|
|
|
|
+ REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, tree->opp_id);
|
|
|
|
+
|
|
|
|
+ /* update mpc tree mux setting */
|
|
|
|
+ if (tree->opp_list == insert_above_mpcc) {
|
|
|
|
+ /* insert the toppest mpcc */
|
|
|
|
+ tree->opp_list = new_mpcc;
|
|
|
|
+ REG_SET(MUX[tree->opp_id], 0, MPC_OUT_MUX, mpcc_id);
|
|
|
|
+ } else {
|
|
|
|
+ /* find insert position */
|
|
|
|
+ struct mpcc *temp_mpcc = tree->opp_list;
|
|
|
|
+
|
|
|
|
+ while (temp_mpcc && temp_mpcc->mpcc_bot != insert_above_mpcc)
|
|
|
|
+ temp_mpcc = temp_mpcc->mpcc_bot;
|
|
|
|
+ if (temp_mpcc && temp_mpcc->mpcc_bot == insert_above_mpcc) {
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[temp_mpcc->mpcc_id], 0, MPCC_BOT_SEL, mpcc_id);
|
|
|
|
+ temp_mpcc->mpcc_bot = new_mpcc;
|
|
|
|
+ if (!insert_above_mpcc)
|
|
|
|
+ REG_UPDATE(MPCC_CONTROL[temp_mpcc->mpcc_id],
|
|
|
|
+ MPCC_MODE, MPCC_BLEND_MODE_TOP_BOT_BLENDING);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- /* opp will get new output. from new added mpcc */
|
|
|
|
- REG_SET(MUX[cfg->opp_id], 0, MPC_OUT_MUX, mpcc_id);
|
|
|
|
-
|
|
|
|
- } else if (position == tree_cfg->num_pipes) {
|
|
|
|
- /* idle dpp/mpcc is added to the bottom layer of tree */
|
|
|
|
-
|
|
|
|
- /* get instance of previous bottom mpcc, set to middle layer */
|
|
|
|
- int prev_bot_mpcc_id = tree_cfg->mpcc[tree_cfg->num_pipes - 1];
|
|
|
|
-
|
|
|
|
- REG_SET(MPCC_BOT_SEL[prev_bot_mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, mpcc_id);
|
|
|
|
- REG_UPDATE(MPCC_CONTROL[prev_bot_mpcc_id],
|
|
|
|
- MPCC_MODE, MODE_BLEND);
|
|
|
|
-
|
|
|
|
- /* mpcc_id become new bottom mpcc*/
|
|
|
|
- REG_SET(MPCC_BOT_SEL[mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, 0xf);
|
|
|
|
|
|
+ /* update the blending configuration */
|
|
|
|
+ new_mpcc->blnd_cfg = *blnd_cfg;
|
|
|
|
+ mpc->funcs->update_blending(mpc, &new_mpcc->blnd_cfg, mpcc_id);
|
|
|
|
|
|
- } else {
|
|
|
|
- /* idle dpp/mpcc is added to middle of tree */
|
|
|
|
- int above_mpcc_id = tree_cfg->mpcc[position - 1];
|
|
|
|
- int below_mpcc_id = tree_cfg->mpcc[position];
|
|
|
|
-
|
|
|
|
- /* mpcc above new mpcc_id has new bottom mux*/
|
|
|
|
- REG_SET(MPCC_BOT_SEL[above_mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, mpcc_id);
|
|
|
|
- REG_UPDATE(MPCC_CONTROL[above_mpcc_id],
|
|
|
|
- MPCC_MODE, MODE_BLEND);
|
|
|
|
-
|
|
|
|
- /* mpcc_id bottom mux is from below mpcc*/
|
|
|
|
- REG_SET(MPCC_BOT_SEL[mpcc_id], 0,
|
|
|
|
- MPCC_BOT_SEL, below_mpcc_id);
|
|
|
|
- mpcc_mode = MODE_BLEND;
|
|
|
|
|
|
+ /* update the stereo mix settings, if provided */
|
|
|
|
+ if (sm_cfg != NULL) {
|
|
|
|
+ new_mpcc->sm_cfg = *sm_cfg;
|
|
|
|
+ mpc1_update_stereo_mix(mpc, sm_cfg, mpcc_id);
|
|
}
|
|
}
|
|
|
|
|
|
- REG_SET_4(MPCC_CONTROL[mpcc_id], 0xffffffff,
|
|
|
|
- MPCC_MODE, mpcc_mode,
|
|
|
|
- MPCC_ALPHA_BLND_MODE, alpha_blnd_mode,
|
|
|
|
- MPCC_ALPHA_MULTIPLIED_MODE, cfg->pre_multiplied_alpha,
|
|
|
|
- MPCC_BLND_ACTIVE_OVERLAP_ONLY, false);
|
|
|
|
|
|
+ /* mark this mpcc as in use */
|
|
|
|
+ mpc10->mpcc_in_use_mask |= 1 << mpcc_id;
|
|
|
|
|
|
- /* update mpc_tree_cfg with new mpcc */
|
|
|
|
- for (z_idx = tree_cfg->num_pipes; z_idx > position; z_idx--) {
|
|
|
|
- tree_cfg->dpp[z_idx] = tree_cfg->dpp[z_idx - 1];
|
|
|
|
- tree_cfg->mpcc[z_idx] = tree_cfg->mpcc[z_idx - 1];
|
|
|
|
- }
|
|
|
|
- tree_cfg->dpp[position] = cfg->dpp_id;
|
|
|
|
- tree_cfg->mpcc[position] = mpcc_id;
|
|
|
|
- tree_cfg->num_pipes++;
|
|
|
|
|
|
+ return new_mpcc;
|
|
}
|
|
}
|
|
|
|
|
|
-int mpc10_mpcc_add(struct mpc *mpc, struct mpcc_cfg *cfg)
|
|
|
|
|
|
+/*
|
|
|
|
+ * Remove a specified MPCC from the MPC tree.
|
|
|
|
+ *
|
|
|
|
+ * Parameters:
|
|
|
|
+ * [in/out] mpc - MPC context.
|
|
|
|
+ * [in/out] tree - MPC tree structure that plane will be removed from.
|
|
|
|
+ * [in/out] mpcc - MPCC to be removed from tree.
|
|
|
|
+ *
|
|
|
|
+ * Return: void
|
|
|
|
+ */
|
|
|
|
+void mpc1_remove_mpcc(
|
|
|
|
+ struct mpc *mpc,
|
|
|
|
+ struct mpc_tree *tree,
|
|
|
|
+ struct mpcc *mpcc_to_remove)
|
|
{
|
|
{
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
- int mpcc_id, z_idx;
|
|
|
|
-
|
|
|
|
- ASSERT(cfg->z_index < mpc10->num_mpcc);
|
|
|
|
-
|
|
|
|
- /* check in dpp already exists in mpc tree */
|
|
|
|
- for (z_idx = 0; z_idx < cfg->tree_cfg->num_pipes; z_idx++)
|
|
|
|
- if (cfg->tree_cfg->dpp[z_idx] == cfg->dpp_id)
|
|
|
|
- break;
|
|
|
|
- if (z_idx == cfg->tree_cfg->num_pipes) {
|
|
|
|
- ASSERT(cfg->z_index <= cfg->tree_cfg->num_pipes);
|
|
|
|
- mpcc_id = mpc10_get_idle_mpcc_id(mpc10);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * TODO: remove hack
|
|
|
|
- * Note: currently there is a bug in init_hw such that
|
|
|
|
- * on resume from hibernate, BIOS sets up MPCC0, and
|
|
|
|
- * we do mpcc_remove but the mpcc cannot go to idle
|
|
|
|
- * after remove. This cause us to pick mpcc1 here,
|
|
|
|
- * which causes a pstate hang for yet unknown reason.
|
|
|
|
- */
|
|
|
|
- mpcc_id = cfg->dpp_id;
|
|
|
|
- /* end hack*/
|
|
|
|
-
|
|
|
|
- ASSERT(!(mpc10->mpcc_in_use_mask & 1 << mpcc_id));
|
|
|
|
-
|
|
|
|
- if (mpc->ctx->dc->debug.sanity_checks)
|
|
|
|
- mpc10_assert_mpcc_idle_before_connect(mpc10, mpcc_id);
|
|
|
|
|
|
+ bool found = false;
|
|
|
|
+ int mpcc_id = mpcc_to_remove->mpcc_id;
|
|
|
|
+
|
|
|
|
+ if (tree->opp_list == mpcc_to_remove) {
|
|
|
|
+ found = true;
|
|
|
|
+ /* remove MPCC from top of tree */
|
|
|
|
+ if (mpcc_to_remove->mpcc_bot) {
|
|
|
|
+ /* set the next MPCC in list to be the top MPCC */
|
|
|
|
+ tree->opp_list = mpcc_to_remove->mpcc_bot;
|
|
|
|
+ REG_SET(MUX[tree->opp_id], 0, MPC_OUT_MUX, tree->opp_list->mpcc_id);
|
|
|
|
+ } else {
|
|
|
|
+ /* there are no other MPCC is list */
|
|
|
|
+ tree->opp_list = NULL;
|
|
|
|
+ REG_SET(MUX[tree->opp_id], 0, MPC_OUT_MUX, 0xf);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- ASSERT(cfg->z_index < cfg->tree_cfg->num_pipes);
|
|
|
|
- mpcc_id = cfg->tree_cfg->mpcc[z_idx];
|
|
|
|
- mpc10_mpcc_remove(mpc, cfg->tree_cfg, cfg->opp_id, cfg->dpp_id);
|
|
|
|
|
|
+ /* find mpcc to remove MPCC list */
|
|
|
|
+ struct mpcc *temp_mpcc = tree->opp_list;
|
|
|
|
+
|
|
|
|
+ while (temp_mpcc && temp_mpcc->mpcc_bot != mpcc_to_remove)
|
|
|
|
+ temp_mpcc = temp_mpcc->mpcc_bot;
|
|
|
|
+
|
|
|
|
+ if (temp_mpcc && temp_mpcc->mpcc_bot == mpcc_to_remove) {
|
|
|
|
+ found = true;
|
|
|
|
+ if (mpcc_to_remove->mpcc_bot) {
|
|
|
|
+ /* remove MPCC in middle of list */
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[temp_mpcc->mpcc_id], 0,
|
|
|
|
+ MPCC_BOT_SEL, mpcc_to_remove->mpcc_bot->mpcc_id);
|
|
|
|
+ temp_mpcc->mpcc_bot = mpcc_to_remove->mpcc_bot;
|
|
|
|
+ } else {
|
|
|
|
+ /* remove MPCC from bottom of list */
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[temp_mpcc->mpcc_id], 0,
|
|
|
|
+ MPCC_BOT_SEL, 0xf);
|
|
|
|
+ REG_UPDATE(MPCC_CONTROL[temp_mpcc->mpcc_id],
|
|
|
|
+ MPCC_MODE, MPCC_BLEND_MODE_TOP_LAYER_PASSTHROUGH);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- /* add dpp/mpcc pair to mpc_tree_cfg and update mpcc registers */
|
|
|
|
- mpc10_add_to_tree_cfg(mpc, cfg, mpcc_id);
|
|
|
|
-
|
|
|
|
- /* set background color */
|
|
|
|
- mpc10_set_bg_color(mpc10, &cfg->black_color, mpcc_id);
|
|
|
|
-
|
|
|
|
- /* mark this mpcc as in use */
|
|
|
|
- mpc10->mpcc_in_use_mask |= 1 << mpcc_id;
|
|
|
|
|
|
+ if (found) {
|
|
|
|
+ /* turn off MPCC mux registers */
|
|
|
|
+ REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
|
|
|
|
+ REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
|
|
|
|
|
|
- return mpcc_id;
|
|
|
|
|
|
+ /* mark this mpcc as not in use */
|
|
|
|
+ mpc10->mpcc_in_use_mask &= ~(1 << mpcc_id);
|
|
|
|
+ mpcc_to_remove->dpp_id = 0xf;
|
|
|
|
+ mpcc_to_remove->mpcc_bot = NULL;
|
|
|
|
+ } else {
|
|
|
|
+ /* In case of resume from S3/S4, remove mpcc from bios left over */
|
|
|
|
+ REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
|
|
|
|
+ REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
-void mpc10_update_blend_mode(
|
|
|
|
- struct mpc *mpc,
|
|
|
|
- struct mpcc_cfg *cfg)
|
|
|
|
|
|
+/*
|
|
|
|
+ * Reset the MPCC HW status by disconnecting all muxes.
|
|
|
|
+ *
|
|
|
|
+ * Parameters:
|
|
|
|
+ * [in/out] mpc - MPC context.
|
|
|
|
+ * [in] mpcc_id - The MPCC physical instance to reset.
|
|
|
|
+ *
|
|
|
|
+ * Return: void
|
|
|
|
+ */
|
|
|
|
+void mpc1_reset_mpcc(
|
|
|
|
+ struct mpc *mpc,
|
|
|
|
+ int mpcc_id)
|
|
{
|
|
{
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
- int mpcc_id, z_idx;
|
|
|
|
- int alpha_blnd_mode = cfg->per_pixel_alpha ?
|
|
|
|
- BLND_PP_ALPHA : BLND_GLOBAL_ALPHA;
|
|
|
|
-
|
|
|
|
- /* find z_idx for the dpp that requires blending mode update*/
|
|
|
|
- for (z_idx = 0; z_idx < cfg->tree_cfg->num_pipes; z_idx++)
|
|
|
|
- if (cfg->tree_cfg->dpp[z_idx] == cfg->dpp_id)
|
|
|
|
- break;
|
|
|
|
|
|
|
|
- ASSERT(z_idx < cfg->tree_cfg->num_pipes);
|
|
|
|
- mpcc_id = cfg->tree_cfg->mpcc[z_idx];
|
|
|
|
-
|
|
|
|
- REG_UPDATE_2(MPCC_CONTROL[mpcc_id],
|
|
|
|
- MPCC_ALPHA_BLND_MODE, alpha_blnd_mode,
|
|
|
|
- MPCC_ALPHA_MULTIPLIED_MODE, cfg->pre_multiplied_alpha);
|
|
|
|
|
|
+ REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
|
|
|
|
+ REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
|
|
|
|
+ REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
|
|
}
|
|
}
|
|
|
|
|
|
-int mpc10_get_opp_id(struct mpc *mpc, int mpcc_id)
|
|
|
|
|
|
+void mpc1_init_mpcc_list_from_hw(
|
|
|
|
+ struct mpc *mpc,
|
|
|
|
+ struct mpc_tree *tree)
|
|
{
|
|
{
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
|
|
- int opp_id = 0xF;
|
|
|
|
-
|
|
|
|
- REG_GET(MPCC_OPP_ID[mpcc_id], MPCC_OPP_ID, &opp_id);
|
|
|
|
|
|
+ unsigned int opp_id;
|
|
|
|
+ unsigned int top_sel;
|
|
|
|
+ unsigned int bot_sel;
|
|
|
|
+ unsigned int out_mux;
|
|
|
|
+ struct mpcc *mpcc;
|
|
|
|
+ int mpcc_id;
|
|
|
|
+ int bot_mpcc_id;
|
|
|
|
+
|
|
|
|
+ REG_GET(MUX[tree->opp_id], MPC_OUT_MUX, &out_mux);
|
|
|
|
+
|
|
|
|
+ if (out_mux != 0xf) {
|
|
|
|
+ for (mpcc_id = 0; mpcc_id < mpc10->num_mpcc; mpcc_id++) {
|
|
|
|
+ REG_GET(MPCC_OPP_ID[mpcc_id], MPCC_OPP_ID, &opp_id);
|
|
|
|
+ REG_GET(MPCC_TOP_SEL[mpcc_id], MPCC_TOP_SEL, &top_sel);
|
|
|
|
+ REG_GET(MPCC_STATUS[mpcc_id], MPCC_BOT_SEL, &bot_sel);
|
|
|
|
+
|
|
|
|
+ if ((opp_id == tree->opp_id) && (top_sel != 0xf)) {
|
|
|
|
+ mpcc = mpc1_get_mpcc(mpc, mpcc_id);
|
|
|
|
+ mpcc->dpp_id = top_sel;
|
|
|
|
+ mpc10->mpcc_in_use_mask |= 1 << mpcc_id;
|
|
|
|
+
|
|
|
|
+ if (out_mux == mpcc_id)
|
|
|
|
+ tree->opp_list = mpcc;
|
|
|
|
+ if (bot_sel != 0xf && bot_sel < mpc10->num_mpcc) {
|
|
|
|
+ bot_mpcc_id = bot_sel;
|
|
|
|
+ REG_GET(MPCC_OPP_ID[bot_mpcc_id], MPCC_OPP_ID, &opp_id);
|
|
|
|
+ REG_GET(MPCC_TOP_SEL[bot_mpcc_id], MPCC_TOP_SEL, &top_sel);
|
|
|
|
+ if ((opp_id == tree->opp_id) && (top_sel != 0xf)) {
|
|
|
|
+ struct mpcc *mpcc_bottom = mpc1_get_mpcc(mpc, bot_mpcc_id);
|
|
|
|
+
|
|
|
|
+ mpcc->mpcc_bot = mpcc_bottom;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
- return opp_id;
|
|
|
|
|
|
+static void mpc1_init_mpcc(struct mpcc *mpcc, int mpcc_inst)
|
|
|
|
+{
|
|
|
|
+ mpcc->mpcc_id = mpcc_inst;
|
|
|
|
+ mpcc->dpp_id = 0xf;
|
|
|
|
+ mpcc->mpcc_bot = NULL;
|
|
|
|
+ mpcc->blnd_cfg.overlap_only = false;
|
|
|
|
+ mpcc->blnd_cfg.global_alpha = 0xff;
|
|
|
|
+ mpcc->blnd_cfg.global_gain = 0xff;
|
|
|
|
+ mpcc->sm_cfg.enable = false;
|
|
}
|
|
}
|
|
|
|
|
|
const struct mpc_funcs dcn10_mpc_funcs = {
|
|
const struct mpc_funcs dcn10_mpc_funcs = {
|
|
- .add = mpc10_mpcc_add,
|
|
|
|
- .remove = mpc10_mpcc_remove,
|
|
|
|
- .wait_for_idle = mpc10_assert_idle_mpcc,
|
|
|
|
- .update_blend_mode = mpc10_update_blend_mode,
|
|
|
|
- .get_opp_id = mpc10_get_opp_id,
|
|
|
|
|
|
+ .insert_plane = mpc1_insert_plane,
|
|
|
|
+ .remove_mpcc = mpc1_remove_mpcc,
|
|
|
|
+ .reset_mpcc = mpc1_reset_mpcc,
|
|
|
|
+ .get_mpcc_for_dpp = mpc1_get_mpcc_for_dpp,
|
|
|
|
+ .wait_for_idle = mpc1_assert_idle_mpcc,
|
|
|
|
+ .assert_mpcc_idle_before_connect = mpc1_assert_mpcc_idle_before_connect,
|
|
|
|
+ .init_mpcc_list_from_hw = mpc1_init_mpcc_list_from_hw,
|
|
|
|
+ .update_blending = mpc1_update_blending,
|
|
|
|
+ .get_opp_id = mpc1_get_opp_id,
|
|
};
|
|
};
|
|
|
|
|
|
void dcn10_mpc_construct(struct dcn10_mpc *mpc10,
|
|
void dcn10_mpc_construct(struct dcn10_mpc *mpc10,
|
|
@@ -360,6 +426,8 @@ void dcn10_mpc_construct(struct dcn10_mpc *mpc10,
|
|
const struct dcn_mpc_mask *mpc_mask,
|
|
const struct dcn_mpc_mask *mpc_mask,
|
|
int num_mpcc)
|
|
int num_mpcc)
|
|
{
|
|
{
|
|
|
|
+ int i;
|
|
|
|
+
|
|
mpc10->base.ctx = ctx;
|
|
mpc10->base.ctx = ctx;
|
|
|
|
|
|
mpc10->base.funcs = &dcn10_mpc_funcs;
|
|
mpc10->base.funcs = &dcn10_mpc_funcs;
|
|
@@ -370,5 +438,8 @@ void dcn10_mpc_construct(struct dcn10_mpc *mpc10,
|
|
|
|
|
|
mpc10->mpcc_in_use_mask = 0;
|
|
mpc10->mpcc_in_use_mask = 0;
|
|
mpc10->num_mpcc = num_mpcc;
|
|
mpc10->num_mpcc = num_mpcc;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < MAX_MPCC; i++)
|
|
|
|
+ mpc1_init_mpcc(&mpc10->base.mpcc_array[i], i);
|
|
}
|
|
}
|
|
|
|
|