Skip to content
Snippets Groups Projects
Commit 5bc740ec authored by Philipp Zabel's avatar Philipp Zabel Committed by Tomeu Vizoso
Browse files

drm/imx: ipuv3-plane: add zpos property


Add a zpos property to planes on the DP crtc. Instead of calling
drm_atomic_helper_check_modeset() and drm_atomic_helper_check_planes()
manually, call drm_atomic_helper_check(), to also normalizes zpos in
plane state. Always update plane order and alpha settings during plane
commit, to allow changing the zpos property without modeset.

Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 92164bd9
No related branches found
No related tags found
No related merge requests found
...@@ -61,11 +61,7 @@ static int imx_drm_atomic_check(struct drm_device *dev, ...@@ -61,11 +61,7 @@ static int imx_drm_atomic_check(struct drm_device *dev,
{ {
int ret; int ret;
ret = drm_atomic_helper_check_modeset(dev, state); ret = drm_atomic_helper_check(dev, state);
if (ret)
return ret;
ret = drm_atomic_helper_check_planes(dev, state);
if (ret) if (ret)
return ret; return ret;
...@@ -276,6 +272,7 @@ static int imx_drm_bind(struct device *dev) ...@@ -276,6 +272,7 @@ static int imx_drm_bind(struct device *dev)
drm->mode_config.funcs = &imx_drm_mode_config_funcs; drm->mode_config.funcs = &imx_drm_mode_config_funcs;
drm->mode_config.helper_private = &imx_drm_mode_config_helpers; drm->mode_config.helper_private = &imx_drm_mode_config_helpers;
drm->mode_config.allow_fb_modifiers = true; drm->mode_config.allow_fb_modifiers = true;
drm->mode_config.normalize_zpos = true;
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -281,6 +281,7 @@ static void ipu_plane_destroy(struct drm_plane *plane) ...@@ -281,6 +281,7 @@ static void ipu_plane_destroy(struct drm_plane *plane)
static void ipu_plane_state_reset(struct drm_plane *plane) static void ipu_plane_state_reset(struct drm_plane *plane)
{ {
unsigned int zpos = (plane->type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1;
struct ipu_plane_state *ipu_state; struct ipu_plane_state *ipu_state;
if (plane->state) { if (plane->state) {
...@@ -294,6 +295,8 @@ static void ipu_plane_state_reset(struct drm_plane *plane) ...@@ -294,6 +295,8 @@ static void ipu_plane_state_reset(struct drm_plane *plane)
if (ipu_state) { if (ipu_state) {
ipu_state->base.plane = plane; ipu_state->base.plane = plane;
ipu_state->base.rotation = DRM_MODE_ROTATE_0; ipu_state->base.rotation = DRM_MODE_ROTATE_0;
ipu_state->base.zpos = zpos;
ipu_state->base.normalized_zpos = zpos;
} }
plane->state = &ipu_state->base; plane->state = &ipu_state->base;
...@@ -609,6 +612,25 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, ...@@ -609,6 +612,25 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG) if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG)
ipu_dp_set_window_pos(ipu_plane->dp, dst->x1, dst->y1); ipu_dp_set_window_pos(ipu_plane->dp, dst->x1, dst->y1);
switch (ipu_plane->dp_flow) {
case IPU_DP_FLOW_SYNC_BG:
if (state->normalized_zpos == 1) {
ipu_dp_set_global_alpha(ipu_plane->dp,
!fb->format->has_alpha, 0xff,
true);
} else {
ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
}
break;
case IPU_DP_FLOW_SYNC_FG:
if (state->normalized_zpos == 1) {
ipu_dp_set_global_alpha(ipu_plane->dp,
!fb->format->has_alpha, 0xff,
false);
}
break;
}
eba = drm_plane_state_to_eba(state, 0); eba = drm_plane_state_to_eba(state, 0);
/* /*
...@@ -649,34 +671,11 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, ...@@ -649,34 +671,11 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
ics_out = bus_format ? ipu_bus_format_to_colorspace(bus_format) ics_out = bus_format ? ipu_bus_format_to_colorspace(bus_format)
: IPUV3_COLORSPACE_RGB; : IPUV3_COLORSPACE_RGB;
ipu_dp_setup_channel(ipu_plane->dp, ics, ics_out); ipu_dp_setup_channel(ipu_plane->dp, ics, ics_out);
ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
break; break;
case IPU_DP_FLOW_SYNC_FG: case IPU_DP_FLOW_SYNC_FG:
ipu_dp_setup_channel(ipu_plane->dp, ics, ipu_dp_setup_channel(ipu_plane->dp, ics,
IPUV3_COLORSPACE_UNKNOWN); IPUV3_COLORSPACE_UNKNOWN);
/* Enable local alpha on partial plane */ break;
switch (fb->format->format) {
case DRM_FORMAT_ARGB1555:
case DRM_FORMAT_ABGR1555:
case DRM_FORMAT_RGBA5551:
case DRM_FORMAT_BGRA5551:
case DRM_FORMAT_ARGB4444:
case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_ABGR8888:
case DRM_FORMAT_RGBA8888:
case DRM_FORMAT_BGRA8888:
case DRM_FORMAT_RGB565_A8:
case DRM_FORMAT_BGR565_A8:
case DRM_FORMAT_RGB888_A8:
case DRM_FORMAT_BGR888_A8:
case DRM_FORMAT_RGBX8888_A8:
case DRM_FORMAT_BGRX8888_A8:
ipu_dp_set_global_alpha(ipu_plane->dp, false, 0, false);
break;
default:
ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
break;
}
} }
ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst)); ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst));
...@@ -879,6 +878,7 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, ...@@ -879,6 +878,7 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
{ {
struct ipu_plane *ipu_plane; struct ipu_plane *ipu_plane;
const uint64_t *modifiers = ipu_format_modifiers; const uint64_t *modifiers = ipu_format_modifiers;
unsigned int zpos = (type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1;
int ret; int ret;
DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n", DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n",
...@@ -909,5 +909,10 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, ...@@ -909,5 +909,10 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu,
drm_plane_helper_add(&ipu_plane->base, &ipu_plane_helper_funcs); drm_plane_helper_add(&ipu_plane->base, &ipu_plane_helper_funcs);
if (dp == IPU_DP_FLOW_SYNC_BG || dp == IPU_DP_FLOW_SYNC_FG)
drm_plane_create_zpos_property(&ipu_plane->base, zpos, 0, 1);
else
drm_plane_create_zpos_immutable_property(&ipu_plane->base, 0);
return ipu_plane; return ipu_plane;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment