* [PATCH] drm/imx: ipuv3-plane: add zpos property @ 2018-12-03 9:49 Philipp Zabel 2019-02-15 10:17 ` Philipp Zabel 0 siblings, 1 reply; 3+ messages in thread From: Philipp Zabel @ 2018-12-03 9:49 UTC (permalink / raw) To: dri-devel; +Cc: kernel Add a zpos property to planes. Call drm_atomic_helper_check() instead of calling drm_atomic_helper_check_modeset() and drm_atomic_check_planes() manually. This effectively adds a call to drm_atoimic_normalize_zpos() before checking planes. Reorder atomic update to allow changing plane zpos without modeset. Note that the initial zpos is set in ipu_plane_state_reset(). The initial value set in ipu_plane_init() is just for show. The zpos parameter of drm_plane_create_zpos_property() is ignored because the newly created plane do not have state yet. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> --- drivers/gpu/drm/imx/imx-drm-core.c | 7 ++-- drivers/gpu/drm/imx/ipuv3-plane.c | 56 +++++++++++++++++------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 820c7e3878f0..687cfb9d410e 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -49,11 +49,7 @@ static int imx_drm_atomic_check(struct drm_device *dev, { int ret; - ret = drm_atomic_helper_check_modeset(dev, state); - if (ret) - return ret; - - ret = drm_atomic_helper_check_planes(dev, state); + ret = drm_atomic_helper_check(dev, state); if (ret) return ret; @@ -229,6 +225,7 @@ static int imx_drm_bind(struct device *dev) drm->mode_config.funcs = &imx_drm_mode_config_funcs; drm->mode_config.helper_private = &imx_drm_mode_config_helpers; drm->mode_config.allow_fb_modifiers = true; + drm->mode_config.normalize_zpos = true; drm_mode_config_init(drm); diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index d6d9ab5b33db..508ce655d638 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -273,6 +273,7 @@ static void ipu_plane_destroy(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; if (plane->state) { @@ -284,8 +285,11 @@ static void ipu_plane_state_reset(struct drm_plane *plane) ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL); - if (ipu_state) + if (ipu_state) { __drm_atomic_helper_plane_reset(plane, &ipu_state->base); + ipu_state->base.zpos = zpos; + ipu_state->base.normalized_zpos = zpos; + } } static struct drm_plane_state * @@ -560,6 +564,25 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG) 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); /* @@ -596,34 +619,11 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, switch (ipu_plane->dp_flow) { case IPU_DP_FLOW_SYNC_BG: ipu_dp_setup_channel(ipu_plane->dp, ics, IPUV3_COLORSPACE_RGB); - ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true); break; case IPU_DP_FLOW_SYNC_FG: ipu_dp_setup_channel(ipu_plane->dp, ics, IPUV3_COLORSPACE_UNKNOWN); - /* Enable local alpha on partial plane */ - 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; - } + break; } ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst)); @@ -826,6 +826,7 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, { struct ipu_plane *ipu_plane; const uint64_t *modifiers = ipu_format_modifiers; + unsigned int zpos = (type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1; int ret; DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n", @@ -856,5 +857,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); + 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; } -- 2.19.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/imx: ipuv3-plane: add zpos property 2018-12-03 9:49 [PATCH] drm/imx: ipuv3-plane: add zpos property Philipp Zabel @ 2019-02-15 10:17 ` Philipp Zabel 2019-02-16 13:56 ` Marius Vlad via dri-devel 0 siblings, 1 reply; 3+ messages in thread From: Philipp Zabel @ 2019-02-15 10:17 UTC (permalink / raw) To: dri-devel, Daniel Vetter Cc: Jernej Skrabec, kernel, Tomeu Vizoso, Maxime Ripard, Peter Ujfalusi, Chris Healy, Gustavo Padovan, Marius Vlad, Marek Szyprowski Hi, I have added (most of) you to Cc: because I think you have either recently or significantly touched zpos property code. Could I ask for a review or ack of this patch from zpos point of view? If you have tested this patch, a Tested-by: would be appreciated as well. regards Philipp On Mon, 2018-12-03 at 10:49 +0100, Philipp Zabel wrote: > Add a zpos property to planes. Call drm_atomic_helper_check() instead of > calling drm_atomic_helper_check_modeset() and drm_atomic_check_planes() > manually. This effectively adds a call to drm_atoimic_normalize_zpos() > before checking planes. Reorder atomic update to allow changing plane > zpos without modeset. > > Note that the initial zpos is set in ipu_plane_state_reset(). The > initial value set in ipu_plane_init() is just for show. The zpos > parameter of drm_plane_create_zpos_property() is ignored because > the newly created plane do not have state yet. > > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> > --- > drivers/gpu/drm/imx/imx-drm-core.c | 7 ++-- > drivers/gpu/drm/imx/ipuv3-plane.c | 56 +++++++++++++++++------------- > 2 files changed, 33 insertions(+), 30 deletions(-) > > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c > index 820c7e3878f0..687cfb9d410e 100644 > --- a/drivers/gpu/drm/imx/imx-drm-core.c > +++ b/drivers/gpu/drm/imx/imx-drm-core.c > @@ -49,11 +49,7 @@ static int imx_drm_atomic_check(struct drm_device *dev, > { > int ret; > > - ret = drm_atomic_helper_check_modeset(dev, state); > - if (ret) > - return ret; > - > - ret = drm_atomic_helper_check_planes(dev, state); > + ret = drm_atomic_helper_check(dev, state); > if (ret) > return ret; > > @@ -229,6 +225,7 @@ static int imx_drm_bind(struct device *dev) > drm->mode_config.funcs = &imx_drm_mode_config_funcs; > drm->mode_config.helper_private = &imx_drm_mode_config_helpers; > drm->mode_config.allow_fb_modifiers = true; > + drm->mode_config.normalize_zpos = true; > > drm_mode_config_init(drm); > > diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c > index d6d9ab5b33db..508ce655d638 100644 > --- a/drivers/gpu/drm/imx/ipuv3-plane.c > +++ b/drivers/gpu/drm/imx/ipuv3-plane.c > @@ -273,6 +273,7 @@ static void ipu_plane_destroy(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; > > if (plane->state) { > @@ -284,8 +285,11 @@ static void ipu_plane_state_reset(struct drm_plane *plane) > > ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL); > > - if (ipu_state) > + if (ipu_state) { > __drm_atomic_helper_plane_reset(plane, &ipu_state->base); > + ipu_state->base.zpos = zpos; > + ipu_state->base.normalized_zpos = zpos; > + } > } > > static struct drm_plane_state * > @@ -560,6 +564,25 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, > if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG) > 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); > > /* > @@ -596,34 +619,11 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, > switch (ipu_plane->dp_flow) { > case IPU_DP_FLOW_SYNC_BG: > ipu_dp_setup_channel(ipu_plane->dp, ics, IPUV3_COLORSPACE_RGB); > - ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true); > break; > case IPU_DP_FLOW_SYNC_FG: > ipu_dp_setup_channel(ipu_plane->dp, ics, > IPUV3_COLORSPACE_UNKNOWN); > - /* Enable local alpha on partial plane */ > - 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; > - } > + break; > } > > ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst)); > @@ -826,6 +826,7 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, > { > struct ipu_plane *ipu_plane; > const uint64_t *modifiers = ipu_format_modifiers; > + unsigned int zpos = (type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1; > int ret; > > DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n", > @@ -856,5 +857,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); > > + 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; > } _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/imx: ipuv3-plane: add zpos property 2019-02-15 10:17 ` Philipp Zabel @ 2019-02-16 13:56 ` Marius Vlad via dri-devel 0 siblings, 0 replies; 3+ messages in thread From: Marius Vlad via dri-devel @ 2019-02-16 13:56 UTC (permalink / raw) To: Philipp Zabel Cc: Jernej Skrabec, Tomeu Vizoso, Maxime Ripard, dri-devel, Peter Ujfalusi, Chris Healy, Gustavo Padovan, kernel, Marek Szyprowski [-- Attachment #1.1: Type: text/plain, Size: 6325 bytes --] Hi Philipp, Tested-By: Marius Vlad <marius.vlad@collabora.com> Thanks! On Fri, Feb 15, 2019 at 11:17:59AM +0100, Philipp Zabel wrote: > Hi, > > I have added (most of) you to Cc: because I think you have either > recently or significantly touched zpos property code. Could I ask > for a review or ack of this patch from zpos point of view? > > If you have tested this patch, a Tested-by: would be appreciated > as well. > > regards > Philipp > > On Mon, 2018-12-03 at 10:49 +0100, Philipp Zabel wrote: > > Add a zpos property to planes. Call drm_atomic_helper_check() instead of > > calling drm_atomic_helper_check_modeset() and drm_atomic_check_planes() > > manually. This effectively adds a call to drm_atoimic_normalize_zpos() Small typo. > > before checking planes. Reorder atomic update to allow changing plane > > zpos without modeset. ``, by using global alpha (of the combining unit)''? > > > > Note that the initial zpos is set in ipu_plane_state_reset(). The > > initial value set in ipu_plane_init() is just for show. The zpos > > parameter of drm_plane_create_zpos_property() is ignored because > > the newly created plane do not have state yet. > > > > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> > > --- > > drivers/gpu/drm/imx/imx-drm-core.c | 7 ++-- > > drivers/gpu/drm/imx/ipuv3-plane.c | 56 +++++++++++++++++------------- > > 2 files changed, 33 insertions(+), 30 deletions(-) > > > > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c > > index 820c7e3878f0..687cfb9d410e 100644 > > --- a/drivers/gpu/drm/imx/imx-drm-core.c > > +++ b/drivers/gpu/drm/imx/imx-drm-core.c > > @@ -49,11 +49,7 @@ static int imx_drm_atomic_check(struct drm_device *dev, > > { > > int ret; > > > > - ret = drm_atomic_helper_check_modeset(dev, state); > > - if (ret) > > - return ret; > > - > > - ret = drm_atomic_helper_check_planes(dev, state); > > + ret = drm_atomic_helper_check(dev, state); > > if (ret) > > return ret; > > > > @@ -229,6 +225,7 @@ static int imx_drm_bind(struct device *dev) > > drm->mode_config.funcs = &imx_drm_mode_config_funcs; > > drm->mode_config.helper_private = &imx_drm_mode_config_helpers; > > drm->mode_config.allow_fb_modifiers = true; > > + drm->mode_config.normalize_zpos = true; > > > > drm_mode_config_init(drm); > > > > diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c > > index d6d9ab5b33db..508ce655d638 100644 > > --- a/drivers/gpu/drm/imx/ipuv3-plane.c > > +++ b/drivers/gpu/drm/imx/ipuv3-plane.c > > @@ -273,6 +273,7 @@ static void ipu_plane_destroy(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; > > > > if (plane->state) { > > @@ -284,8 +285,11 @@ static void ipu_plane_state_reset(struct drm_plane *plane) > > > > ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL); > > > > - if (ipu_state) > > + if (ipu_state) { > > __drm_atomic_helper_plane_reset(plane, &ipu_state->base); > > + ipu_state->base.zpos = zpos; > > + ipu_state->base.normalized_zpos = zpos; > > + } > > } > > > > static struct drm_plane_state * > > @@ -560,6 +564,25 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, > > if (ipu_plane->dp_flow == IPU_DP_FLOW_SYNC_FG) > > 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); > > > > /* > > @@ -596,34 +619,11 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, > > switch (ipu_plane->dp_flow) { > > case IPU_DP_FLOW_SYNC_BG: > > ipu_dp_setup_channel(ipu_plane->dp, ics, IPUV3_COLORSPACE_RGB); > > - ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true); > > break; > > case IPU_DP_FLOW_SYNC_FG: > > ipu_dp_setup_channel(ipu_plane->dp, ics, > > IPUV3_COLORSPACE_UNKNOWN); > > - /* Enable local alpha on partial plane */ > > - 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; > > - } > > + break; > > } > > > > ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst)); > > @@ -826,6 +826,7 @@ struct ipu_plane *ipu_plane_init(struct drm_device *dev, struct ipu_soc *ipu, > > { > > struct ipu_plane *ipu_plane; > > const uint64_t *modifiers = ipu_format_modifiers; > > + unsigned int zpos = (type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1; > > int ret; > > > > DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n", > > @@ -856,5 +857,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); > > > > + 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; > > } [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 159 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-16 13:56 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-12-03 9:49 [PATCH] drm/imx: ipuv3-plane: add zpos property Philipp Zabel 2019-02-15 10:17 ` Philipp Zabel 2019-02-16 13:56 ` Marius Vlad via dri-devel
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.