Commit e76c1a04 authored by Lucas Stach's avatar Lucas Stach Committed by Khalid Elmously

gpu: ipu-v3: dp: fix CSC handling

BugLink: https://bugs.launchpad.net/bugs/1830176

[ Upstream commit d4fad0a4 ]

Initialize the flow input colorspaces to unknown and reset to that value
when the channel gets disabled. This avoids the state getting mixed up
with a previous mode.

Also keep the CSC settings for the background flow intact when disabling
the foreground flow.
Root-caused-by: default avatarJonathan Marek <jonathan@marek.ca>
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 6b0d4fed
...@@ -195,7 +195,8 @@ int ipu_dp_setup_channel(struct ipu_dp *dp, ...@@ -195,7 +195,8 @@ int ipu_dp_setup_channel(struct ipu_dp *dp,
ipu_dp_csc_init(flow, flow->foreground.in_cs, flow->out_cs, ipu_dp_csc_init(flow, flow->foreground.in_cs, flow->out_cs,
DP_COM_CONF_CSC_DEF_BOTH); DP_COM_CONF_CSC_DEF_BOTH);
} else { } else {
if (flow->foreground.in_cs == flow->out_cs) if (flow->foreground.in_cs == IPUV3_COLORSPACE_UNKNOWN ||
flow->foreground.in_cs == flow->out_cs)
/* /*
* foreground identical to output, apply color * foreground identical to output, apply color
* conversion on background * conversion on background
...@@ -261,6 +262,8 @@ void ipu_dp_disable_channel(struct ipu_dp *dp) ...@@ -261,6 +262,8 @@ void ipu_dp_disable_channel(struct ipu_dp *dp)
struct ipu_dp_priv *priv = flow->priv; struct ipu_dp_priv *priv = flow->priv;
u32 reg, csc; u32 reg, csc;
dp->in_cs = IPUV3_COLORSPACE_UNKNOWN;
if (!dp->foreground) if (!dp->foreground)
return; return;
...@@ -268,8 +271,9 @@ void ipu_dp_disable_channel(struct ipu_dp *dp) ...@@ -268,8 +271,9 @@ void ipu_dp_disable_channel(struct ipu_dp *dp)
reg = readl(flow->base + DP_COM_CONF); reg = readl(flow->base + DP_COM_CONF);
csc = reg & DP_COM_CONF_CSC_DEF_MASK; csc = reg & DP_COM_CONF_CSC_DEF_MASK;
if (csc == DP_COM_CONF_CSC_DEF_FG) reg &= ~DP_COM_CONF_CSC_DEF_MASK;
reg &= ~DP_COM_CONF_CSC_DEF_MASK; if (csc == DP_COM_CONF_CSC_DEF_BOTH || csc == DP_COM_CONF_CSC_DEF_BG)
reg |= DP_COM_CONF_CSC_DEF_BG;
reg &= ~DP_COM_CONF_FG_EN; reg &= ~DP_COM_CONF_FG_EN;
writel(reg, flow->base + DP_COM_CONF); writel(reg, flow->base + DP_COM_CONF);
...@@ -350,6 +354,8 @@ int ipu_dp_init(struct ipu_soc *ipu, struct device *dev, unsigned long base) ...@@ -350,6 +354,8 @@ int ipu_dp_init(struct ipu_soc *ipu, struct device *dev, unsigned long base)
mutex_init(&priv->mutex); mutex_init(&priv->mutex);
for (i = 0; i < IPUV3_NUM_FLOWS; i++) { for (i = 0; i < IPUV3_NUM_FLOWS; i++) {
priv->flow[i].background.in_cs = IPUV3_COLORSPACE_UNKNOWN;
priv->flow[i].foreground.in_cs = IPUV3_COLORSPACE_UNKNOWN;
priv->flow[i].foreground.foreground = true; priv->flow[i].foreground.foreground = true;
priv->flow[i].base = priv->base + ipu_dp_flow_base[i]; priv->flow[i].base = priv->base + ipu_dp_flow_base[i];
priv->flow[i].priv = priv; priv->flow[i].priv = priv;
......
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