Skip to content

Commit

Permalink
disp: msm: sde: translate zpos property to fod property
Browse files Browse the repository at this point in the history
Change-Id: I7e8562ed3eda675d160d6dabee7e568a1a72e849
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
  • Loading branch information
Demon000 authored and ngxson committed Mar 14, 2022
1 parent d4a9190 commit 382b0c5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/msm/msm_drv.h
Expand Up @@ -103,6 +103,7 @@ enum msm_mdp_plane_property {

/* range properties */
PLANE_PROP_ZPOS = PLANE_PROP_BLOBCOUNT,
PLANE_PROP_FOD,
PLANE_PROP_ALPHA,
PLANE_PROP_COLOR_FILL,
PLANE_PROP_H_DECIMATE,
Expand Down
44 changes: 23 additions & 21 deletions drivers/gpu/drm/msm/sde/sde_plane.c
Expand Up @@ -3976,6 +3976,7 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane,
case PLANE_PROP_ALPHA:
case PLANE_PROP_INPUT_FENCE:
case PLANE_PROP_BLEND_OP:
case PLANE_PROP_FOD:
/* no special action required */
break;
case PLANE_PROP_FB_TRANSLATION_MODE:
Expand Down Expand Up @@ -4381,8 +4382,6 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
const struct sde_format_extended *format_list;
struct sde_kms_info *info;
struct sde_plane *psde = to_sde_plane(plane);
int zpos_max = 255;
int zpos_def = 0;
char feature_name[256];

if (!plane || !psde) {
Expand All @@ -4399,24 +4398,11 @@ static void _sde_plane_install_properties(struct drm_plane *plane,

psde->catalog = catalog;

if (sde_is_custom_client()) {
if (catalog->mixer_count &&
catalog->mixer[0].sblk->maxblendstages) {
zpos_max = catalog->mixer[0].sblk->maxblendstages - 1;

if (catalog->has_base_layer &&
(zpos_max > SDE_STAGE_MAX - 1))
zpos_max = SDE_STAGE_MAX - 1;
else if (zpos_max > SDE_STAGE_MAX - SDE_STAGE_0 - 1)
zpos_max = SDE_STAGE_MAX - SDE_STAGE_0 - 1;
}
} else if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
/* reserve zpos == 0 for primary planes */
zpos_def = drm_plane_index(plane) + 1;
}

msm_property_install_range(&psde->property_info, "zpos",
0x0, 0, zpos_max, zpos_def, PLANE_PROP_ZPOS);
0x0, 0, INT_MAX, 0, PLANE_PROP_ZPOS);

msm_property_install_range(&psde->property_info, "fod",
0x0, 0, INT_MAX, 0, PLANE_PROP_FOD);

msm_property_install_range(&psde->property_info, "alpha",
0x0, 0, 255, 255, PLANE_PROP_ALPHA);
Expand Down Expand Up @@ -4855,6 +4841,8 @@ static int sde_plane_atomic_set_property(struct drm_plane *plane,
{
struct sde_plane *psde = plane ? to_sde_plane(plane) : NULL;
struct sde_plane_state *pstate;
struct drm_property *fod_property;
uint64_t fod_val = 0;
int idx, ret = -EINVAL;

SDE_DEBUG_PLANE(psde, "\n");
Expand All @@ -4865,11 +4853,25 @@ static int sde_plane_atomic_set_property(struct drm_plane *plane,
SDE_ERROR_PLANE(psde, "invalid state\n");
} else {
pstate = to_sde_plane_state(state);
idx = msm_property_index(&psde->property_info,
property);
if (idx == PLANE_PROP_ZPOS) {
if (val & 0x20000000u) {
val &= ~0x20000000u;
fod_val = 1;
}

fod_property = psde->property_info.
property_array[PLANE_PROP_FOD];
ret = msm_property_atomic_set(&psde->property_info,
&pstate->property_state,
fod_property, fod_val);
if (ret)
SDE_ERROR("failed to set fod prop");
}
ret = msm_property_atomic_set(&psde->property_info,
&pstate->property_state, property, val);
if (!ret) {
idx = msm_property_index(&psde->property_info,
property);
switch (idx) {
case PLANE_PROP_INPUT_FENCE:
_sde_plane_set_input_fence(psde, pstate, val);
Expand Down

0 comments on commit 382b0c5

Please sign in to comment.