Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drm: msm: sde: Translate zpos property to cust property #1

Open
wants to merge 1 commit into
base: xs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions drivers/gpu/drm/msm/sde/sde_plane.c
Original file line number Diff line number Diff line change
Expand Up @@ -4393,7 +4393,7 @@ 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_max = INT_MAX;
int zpos_def = 0;
char feature_name[256];

Expand All @@ -4411,22 +4411,6 @@ 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);

Expand Down Expand Up @@ -4869,6 +4853,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;
int fod_val = 0;
int idx, ret = -EINVAL;

SDE_DEBUG_PLANE(psde, "\n");
Expand All @@ -4879,11 +4865,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 & FOD_PRESSED_LAYER_ZORDER) {
val &= ~FOD_PRESSED_LAYER_ZORDER;
fod_val = 2; // pressed
}

fod_property = psde->property_info.
property_array[PLANE_PROP_CUSTOM];
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
5 changes: 5 additions & 0 deletions include/uapi/drm/sde_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,9 @@ struct sde_drm_roi_misr_v1 {
#define SDE_RECOVERY_CAPTURE 1
#define SDE_RECOVERY_HARD_RESET 2

/**
* sde fod dim layer
*/
#define FOD_PRESSED_LAYER_ZORDER 0x20000000u

#endif /* _SDE_DRM_H_ */