mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel@collabora.com" <kernel@collabora.com>,
	"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>
Subject: Re: [PATCH] drm/mediatek: Declare Z Position for all planes
Date: Mon, 12 Aug 2024 01:37:37 +0000	[thread overview]
Message-ID: <75717fec36cdb4691723dfe90c406c1072462454.camel@mediatek.com> (raw)
In-Reply-To: <20240718082507.216764-1-angelogioacchino.delregno@collabora.com>

Hi, Angelo:

On Thu, 2024-07-18 at 10:25 +0200, AngeloGioacchino Del Regno wrote:
> MediaTek SoCs support multiple planes, one of which is the primary
> and all the others are overlays (and CURSOR is the last overlay).
> 
> In all currently supported SoCs, the Z order of the overlays can't
> be changed with any fast muxing action, and can only be changed by
> swapping the contents of the entire register set of one overlay
> with the other to internally reorder the layer properties, which
> is indeed feasible, but probably more expensive than desired.
> 
> Declare the Z position for all planes with an immutable property
> at least for now, so that the userspace can take its decisions
> accordingly.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_crtc.c  |  2 +-
>  drivers/gpu/drm/mediatek/mtk_plane.c | 18 +++++++++++++++++-
>  drivers/gpu/drm/mediatek/mtk_plane.h |  3 +--
>  3 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c
> index 072b2fdae87b..327214721b4d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
> @@ -874,7 +874,7 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev,
>  				mtk_crtc_plane_type(mtk_crtc->layer_nr, num_planes),
>  				mtk_ddp_comp_supported_rotations(comp),
>  				mtk_ddp_comp_get_formats(comp),
> -				mtk_ddp_comp_get_num_formats(comp));
> +				mtk_ddp_comp_get_num_formats(comp), i);
>  		if (ret)
>  			return ret;
>  
> diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c
> index 5bf757a3ef20..7d2cb4e0fafa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_plane.c
> @@ -321,7 +321,7 @@ static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
>  int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  		   unsigned long possible_crtcs, enum drm_plane_type type,
>  		   unsigned int supported_rotations, const u32 *formats,
> -		   size_t num_formats)
> +		   size_t num_formats, unsigned int plane_idx)
>  {
>  	int err;
>  
> @@ -338,6 +338,22 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  		return err;
>  	}
>  
> +	/*
> +	 * The hardware does not support repositioning planes by muxing: their
> +	 * Z-position is infact fixed and the only way to change the actual
> +	 * order is to swap the contents of the entire register set of one
> +	 * overlay with another, which may be more expensive than desired.
> +	 *
> +	 * With no repositioning, the caller of this function guarantees that
> +	 * the plane_idx is correct. This means that, for example, the PRIMARY
> +	 * plane fed to this function will always have plane_idx zero.
> +	 */
> +	err = drm_plane_create_zpos_immutable_property(plane, plane_idx);
> +	if (err) {
> +		DRM_ERROR("Failed to create zpos property for plane %u\n", plane_idx);
> +		return err;
> +	}
> +
>  	if (supported_rotations) {
>  		err = drm_plane_create_rotation_property(plane,
>  							 DRM_MODE_ROTATE_0,
> diff --git a/drivers/gpu/drm/mediatek/mtk_plane.h b/drivers/gpu/drm/mediatek/mtk_plane.h
> index 231bb7aac947..5b177eac67b7 100644
> --- a/drivers/gpu/drm/mediatek/mtk_plane.h
> +++ b/drivers/gpu/drm/mediatek/mtk_plane.h
> @@ -49,6 +49,5 @@ to_mtk_plane_state(struct drm_plane_state *state)
>  int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
>  		   unsigned long possible_crtcs, enum drm_plane_type type,
>  		   unsigned int supported_rotations, const u32 *formats,
> -		   size_t num_formats);
> -
> +		   size_t num_formats, unsigned int plane_idx);
>  #endif

  parent reply	other threads:[~2024-08-12  1:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18  8:25 AngeloGioacchino Del Regno
2024-07-18  9:50 ` Fei Shao
2024-07-18 11:15 ` Daniel Stone
2024-07-18 11:19   ` AngeloGioacchino Del Regno
2024-08-12  1:37 ` CK Hu (胡俊光) [this message]
2024-08-22 14:19 ` Chun-Kuang Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75717fec36cdb4691723dfe90c406c1072462454.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Shawn.Sung@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®