disp: msm: sde: correct noise and attenuation layers blend stages
Use blend stage to get blend offset instead of z order. Change-Id: I7924325d19dfbace0fadf4551f696fe222d17115 Signed-off-by: Anjaneya Prasad Musunuri <aprasad@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
bf67f9d761
commit
163b57e6a8
@@ -7505,16 +7505,28 @@ static void sde_cp_crtc_apply_noise(struct drm_crtc *crtc,
|
|||||||
struct sde_hw_mixer *lm;
|
struct sde_hw_mixer *lm;
|
||||||
int i;
|
int i;
|
||||||
struct sde_hw_noise_layer_cfg cfg;
|
struct sde_hw_noise_layer_cfg cfg;
|
||||||
|
struct sde_kms *kms;
|
||||||
|
|
||||||
if (!test_bit(SDE_CRTC_NOISE_LAYER, cstate->dirty))
|
if (!test_bit(SDE_CRTC_NOISE_LAYER, cstate->dirty))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
kms = _sde_crtc_get_kms(crtc);
|
||||||
|
if (!kms || !kms->catalog) {
|
||||||
|
SDE_ERROR("Invalid kms\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cfg.flags = cstate->layer_cfg.flags;
|
cfg.flags = cstate->layer_cfg.flags;
|
||||||
cfg.alpha_noise = cstate->layer_cfg.alpha_noise;
|
cfg.alpha_noise = cstate->layer_cfg.alpha_noise;
|
||||||
cfg.attn_factor = cstate->layer_cfg.attn_factor;
|
cfg.attn_factor = cstate->layer_cfg.attn_factor;
|
||||||
cfg.strength = cstate->layer_cfg.strength;
|
cfg.strength = cstate->layer_cfg.strength;
|
||||||
cfg.zposn = cstate->layer_cfg.zposn;
|
if (!kms->catalog->has_base_layer) {
|
||||||
cfg.zposattn = cstate->layer_cfg.zposattn;
|
cfg.noise_blend_stage = cstate->layer_cfg.zposn + SDE_STAGE_0;
|
||||||
|
cfg.attn_blend_stage = cstate->layer_cfg.zposattn + SDE_STAGE_0;
|
||||||
|
} else {
|
||||||
|
cfg.noise_blend_stage = cstate->layer_cfg.zposn;
|
||||||
|
cfg.attn_blend_stage = cstate->layer_cfg.zposattn;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < scrtc->num_mixers; i++) {
|
for (i = 0; i < scrtc->num_mixers; i++) {
|
||||||
lm = scrtc->mixers[i].hw_lm;
|
lm = scrtc->mixers[i].hw_lm;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/iopoll.h>
|
#include <linux/iopoll.h>
|
||||||
@@ -316,16 +316,18 @@ static int sde_hw_lm_setup_noise_layer(struct sde_hw_mixer *ctx,
|
|||||||
if (!cfg)
|
if (!cfg)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (cfg->zposn == SDE_STAGE_BASE || cfg->zposn + 1 != cfg->zposattn ||
|
if (cfg->noise_blend_stage == SDE_STAGE_BASE ||
|
||||||
cfg->zposattn >= sblk->maxblendstages) {
|
cfg->noise_blend_stage + 1 != cfg->attn_blend_stage ||
|
||||||
SDE_ERROR("invalid zposn %d zposattn %d max stage %d\n",
|
cfg->attn_blend_stage >= sblk->maxblendstages) {
|
||||||
cfg->zposn, cfg->zposattn, sblk->maxblendstages);
|
SDE_ERROR("invalid noise_blend_stage %d attn_blend_stage %d max stage %d\n",
|
||||||
|
cfg->noise_blend_stage, cfg->attn_blend_stage, sblk->maxblendstages);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
stage_off = _stage_offset(ctx, cfg->zposn);
|
|
||||||
|
stage_off = _stage_offset(ctx, cfg->noise_blend_stage);
|
||||||
if (stage_off < 0) {
|
if (stage_off < 0) {
|
||||||
SDE_ERROR("invalid stage_off:%d for noise layer stage_off %d\n",
|
SDE_ERROR("invalid stage_off:%d for noise layer blend stage:%d\n",
|
||||||
cfg->zposn, stage_off);
|
stage_off, cfg->noise_blend_stage);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
val = BIT(18) | BIT(31);
|
val = BIT(18) | BIT(31);
|
||||||
@@ -336,13 +338,13 @@ static int sde_hw_lm_setup_noise_layer(struct sde_hw_mixer *ctx,
|
|||||||
val = ctx->cfg.out_width | (ctx->cfg.out_height << 16);
|
val = ctx->cfg.out_width | (ctx->cfg.out_height << 16);
|
||||||
SDE_REG_WRITE(c, LM_FG_COLOR_FILL_SIZE + stage_off, val);
|
SDE_REG_WRITE(c, LM_FG_COLOR_FILL_SIZE + stage_off, val);
|
||||||
val = SDE_REG_READ(c, LM_OP_MODE);
|
val = SDE_REG_READ(c, LM_OP_MODE);
|
||||||
val = (1 << cfg->zposn) | val;
|
val = (1 << cfg->noise_blend_stage) | val;
|
||||||
SDE_REG_WRITE(c, LM_OP_MODE, val);
|
SDE_REG_WRITE(c, LM_OP_MODE, val);
|
||||||
|
|
||||||
stage_off = _stage_offset(ctx, cfg->zposattn);
|
stage_off = _stage_offset(ctx, cfg->attn_blend_stage);
|
||||||
if (stage_off < 0) {
|
if (stage_off < 0) {
|
||||||
SDE_ERROR("invalid stage_off:%d for noise layer\n",
|
SDE_ERROR("invalid stage_off:%d for atten layer blend stage:%d\n",
|
||||||
cfg->zposattn);
|
stage_off, cfg->attn_blend_stage);
|
||||||
sde_hw_clear_noise_layer(ctx);
|
sde_hw_clear_noise_layer(ctx);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -353,7 +355,7 @@ static int sde_hw_lm_setup_noise_layer(struct sde_hw_mixer *ctx,
|
|||||||
SDE_REG_WRITE(c, LM_BLEND0_OP + stage_off, val);
|
SDE_REG_WRITE(c, LM_BLEND0_OP + stage_off, val);
|
||||||
SDE_REG_WRITE(c, LM_BLEND0_CONST_ALPHA + stage_off, alpha);
|
SDE_REG_WRITE(c, LM_BLEND0_CONST_ALPHA + stage_off, alpha);
|
||||||
val = SDE_REG_READ(c, LM_OP_MODE);
|
val = SDE_REG_READ(c, LM_OP_MODE);
|
||||||
val = (1 << cfg->zposattn) | val;
|
val = (1 << cfg->attn_blend_stage) | val;
|
||||||
SDE_REG_WRITE(c, LM_OP_MODE, val);
|
SDE_REG_WRITE(c, LM_OP_MODE, val);
|
||||||
val = ctx->cfg.out_width | (ctx->cfg.out_height << 16);
|
val = ctx->cfg.out_width | (ctx->cfg.out_height << 16);
|
||||||
SDE_REG_WRITE(c, LM_FG_COLOR_FILL_SIZE + stage_off, val);
|
SDE_REG_WRITE(c, LM_FG_COLOR_FILL_SIZE + stage_off, val);
|
||||||
|
@@ -771,16 +771,16 @@ struct sde_hw_pp_vsync_info {
|
|||||||
/**
|
/**
|
||||||
* struct sde_hw_noise_layer_cfg: Payload to enable/disable noise blend
|
* struct sde_hw_noise_layer_cfg: Payload to enable/disable noise blend
|
||||||
* @flags: operation control flags, for future use
|
* @flags: operation control flags, for future use
|
||||||
* @zposn: zorder required for noise
|
* @noise_blend_stage: blend stage required for noise layer
|
||||||
* @zposattn: zorder required for noise
|
* @attn_blend_stage: blend stage required for attn layer
|
||||||
* @attn_factor: factor in range of 1 to 255
|
* @attn_factor: factor in range of 1 to 255
|
||||||
* @stength: strength in range of 0 to 6
|
* @stength: strength in range of 0 to 6
|
||||||
* @alpha_noise: factor in range of 1 to 255
|
* @alpha_noise: factor in range of 1 to 255
|
||||||
*/
|
*/
|
||||||
struct sde_hw_noise_layer_cfg {
|
struct sde_hw_noise_layer_cfg {
|
||||||
u64 flags;
|
u64 flags;
|
||||||
u32 zposn;
|
u32 noise_blend_stage;
|
||||||
u32 zposattn;
|
u32 attn_blend_stage;
|
||||||
u32 attn_factor;
|
u32 attn_factor;
|
||||||
u32 strength;
|
u32 strength;
|
||||||
u32 alpha_noise;
|
u32 alpha_noise;
|
||||||
|
Reference in New Issue
Block a user