|
@@ -2441,16 +2441,17 @@ static void _sde_crtc_clear_dim_layers_v1(struct sde_crtc_state *cstate)
|
|
* @cstate: Pointer to sde crtc state
|
|
* @cstate: Pointer to sde crtc state
|
|
* @user_ptr: User ptr for sde_drm_dim_layer_v1 struct
|
|
* @user_ptr: User ptr for sde_drm_dim_layer_v1 struct
|
|
*/
|
|
*/
|
|
-static void _sde_crtc_set_dim_layer_v1(struct sde_crtc_state *cstate,
|
|
|
|
- void __user *usr_ptr)
|
|
|
|
|
|
+static void _sde_crtc_set_dim_layer_v1(struct drm_crtc *crtc,
|
|
|
|
+ struct sde_crtc_state *cstate, void __user *usr_ptr)
|
|
{
|
|
{
|
|
struct sde_drm_dim_layer_v1 dim_layer_v1;
|
|
struct sde_drm_dim_layer_v1 dim_layer_v1;
|
|
struct sde_drm_dim_layer_cfg *user_cfg;
|
|
struct sde_drm_dim_layer_cfg *user_cfg;
|
|
struct sde_hw_dim_layer *dim_layer;
|
|
struct sde_hw_dim_layer *dim_layer;
|
|
u32 count, i;
|
|
u32 count, i;
|
|
|
|
+ struct sde_kms *kms;
|
|
|
|
|
|
- if (!cstate) {
|
|
|
|
- SDE_ERROR("invalid cstate\n");
|
|
|
|
|
|
+ if (!crtc || !cstate) {
|
|
|
|
+ SDE_ERROR("invalid crtc or cstate\n");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
dim_layer = cstate->dim_layer;
|
|
dim_layer = cstate->dim_layer;
|
|
@@ -2462,6 +2463,12 @@ static void _sde_crtc_set_dim_layer_v1(struct sde_crtc_state *cstate,
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ kms = _sde_crtc_get_kms(crtc);
|
|
|
|
+ if (!kms || !kms->catalog) {
|
|
|
|
+ SDE_ERROR("invalid kms\n");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (copy_from_user(&dim_layer_v1, usr_ptr, sizeof(dim_layer_v1))) {
|
|
if (copy_from_user(&dim_layer_v1, usr_ptr, sizeof(dim_layer_v1))) {
|
|
SDE_ERROR("failed to copy dim_layer data\n");
|
|
SDE_ERROR("failed to copy dim_layer data\n");
|
|
return;
|
|
return;
|
|
@@ -2479,7 +2486,9 @@ static void _sde_crtc_set_dim_layer_v1(struct sde_crtc_state *cstate,
|
|
user_cfg = &dim_layer_v1.layer_cfg[i];
|
|
user_cfg = &dim_layer_v1.layer_cfg[i];
|
|
|
|
|
|
dim_layer[i].flags = user_cfg->flags;
|
|
dim_layer[i].flags = user_cfg->flags;
|
|
- dim_layer[i].stage = user_cfg->stage;
|
|
|
|
|
|
+ dim_layer[i].stage = (kms->catalog->has_base_layer) ?
|
|
|
|
+ user_cfg->stage : user_cfg->stage +
|
|
|
|
+ SDE_STAGE_0;
|
|
|
|
|
|
dim_layer[i].rect.x = user_cfg->rect.x1;
|
|
dim_layer[i].rect.x = user_cfg->rect.x1;
|
|
dim_layer[i].rect.y = user_cfg->rect.y1;
|
|
dim_layer[i].rect.y = user_cfg->rect.y1;
|
|
@@ -4122,7 +4131,7 @@ static void sde_crtc_enable(struct drm_crtc *crtc,
|
|
|
|
|
|
/* no input validation - caller API has all the checks */
|
|
/* no input validation - caller API has all the checks */
|
|
static int _sde_crtc_excl_dim_layer_check(struct drm_crtc_state *state,
|
|
static int _sde_crtc_excl_dim_layer_check(struct drm_crtc_state *state,
|
|
- struct plane_state pstates[], int cnt, bool base_layer_staged)
|
|
|
|
|
|
+ struct plane_state pstates[], int cnt)
|
|
{
|
|
{
|
|
struct sde_crtc_state *cstate = to_sde_crtc_state(state);
|
|
struct sde_crtc_state *cstate = to_sde_crtc_state(state);
|
|
struct drm_display_mode *mode = &state->adjusted_mode;
|
|
struct drm_display_mode *mode = &state->adjusted_mode;
|
|
@@ -4149,8 +4158,6 @@ static int _sde_crtc_excl_dim_layer_check(struct drm_crtc_state *state,
|
|
mode->vdisplay);
|
|
mode->vdisplay);
|
|
rc = -E2BIG;
|
|
rc = -E2BIG;
|
|
goto end;
|
|
goto end;
|
|
- } else if (!base_layer_staged) {
|
|
|
|
- cstate->dim_layer[i].stage += SDE_STAGE_0;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4402,10 +4409,18 @@ static int _sde_crtc_check_get_pstates(struct drm_crtc *crtc,
|
|
const struct drm_plane_state *pstate;
|
|
const struct drm_plane_state *pstate;
|
|
const struct drm_plane_state *pipe_staged[SSPP_MAX];
|
|
const struct drm_plane_state *pipe_staged[SSPP_MAX];
|
|
int rc = 0, multirect_count = 0, i, mixer_width, mixer_height;
|
|
int rc = 0, multirect_count = 0, i, mixer_width, mixer_height;
|
|
|
|
+ int inc_sde_stage = 0;
|
|
|
|
+ struct sde_kms *kms;
|
|
|
|
|
|
sde_crtc = to_sde_crtc(crtc);
|
|
sde_crtc = to_sde_crtc(crtc);
|
|
cstate = to_sde_crtc_state(state);
|
|
cstate = to_sde_crtc_state(state);
|
|
|
|
|
|
|
|
+ kms = _sde_crtc_get_kms(crtc);
|
|
|
|
+ if (!kms || !kms->catalog) {
|
|
|
|
+ SDE_ERROR("invalid kms\n");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
memset(pipe_staged, 0, sizeof(pipe_staged));
|
|
memset(pipe_staged, 0, sizeof(pipe_staged));
|
|
|
|
|
|
mixer_width = sde_crtc_get_mixer_width(sde_crtc, cstate, mode);
|
|
mixer_width = sde_crtc_get_mixer_width(sde_crtc, cstate, mode);
|
|
@@ -4431,10 +4446,13 @@ static int _sde_crtc_check_get_pstates(struct drm_crtc *crtc,
|
|
pstates[*cnt].sde_pstate, PLANE_PROP_ZPOS);
|
|
pstates[*cnt].sde_pstate, PLANE_PROP_ZPOS);
|
|
pstates[*cnt].pipe_id = sde_plane_pipe(plane);
|
|
pstates[*cnt].pipe_id = sde_plane_pipe(plane);
|
|
|
|
|
|
|
|
+ if (!kms->catalog->has_base_layer)
|
|
|
|
+ inc_sde_stage = SDE_STAGE_0;
|
|
|
|
+
|
|
/* check dim layer stage with every plane */
|
|
/* check dim layer stage with every plane */
|
|
for (i = 0; i < cstate->num_dim_layers; i++) {
|
|
for (i = 0; i < cstate->num_dim_layers; i++) {
|
|
if (cstate->dim_layer[i].stage ==
|
|
if (cstate->dim_layer[i].stage ==
|
|
- pstates[*cnt].stage) {
|
|
|
|
|
|
+ (pstates[*cnt].stage + inc_sde_stage)) {
|
|
SDE_ERROR(
|
|
SDE_ERROR(
|
|
"plane:%d/dim_layer:%i-same stage:%d\n",
|
|
"plane:%d/dim_layer:%i-same stage:%d\n",
|
|
plane->base.id, i,
|
|
plane->base.id, i,
|
|
@@ -4523,8 +4541,7 @@ static int _sde_crtc_check_zpos(struct drm_crtc_state *state,
|
|
|
|
|
|
sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL);
|
|
sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL);
|
|
|
|
|
|
- rc = _sde_crtc_excl_dim_layer_check(state, pstates, cnt,
|
|
|
|
- kms->catalog->has_base_layer);
|
|
|
|
|
|
+ rc = _sde_crtc_excl_dim_layer_check(state, pstates, cnt);
|
|
if (rc)
|
|
if (rc)
|
|
return rc;
|
|
return rc;
|
|
|
|
|
|
@@ -5171,7 +5188,7 @@ static int sde_crtc_atomic_set_property(struct drm_crtc *crtc,
|
|
_sde_crtc_set_input_fence_timeout(cstate);
|
|
_sde_crtc_set_input_fence_timeout(cstate);
|
|
break;
|
|
break;
|
|
case CRTC_PROP_DIM_LAYER_V1:
|
|
case CRTC_PROP_DIM_LAYER_V1:
|
|
- _sde_crtc_set_dim_layer_v1(cstate,
|
|
|
|
|
|
+ _sde_crtc_set_dim_layer_v1(crtc, cstate,
|
|
(void __user *)(uintptr_t)val);
|
|
(void __user *)(uintptr_t)val);
|
|
break;
|
|
break;
|
|
case CRTC_PROP_ROI_V1:
|
|
case CRTC_PROP_ROI_V1:
|