mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	"alpernebiyasak@gmail.com" <alpernebiyasak@gmail.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
	"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3] drm/mediatek: ovl: Add fmt_convert function pointer to driver data
Date: Mon, 23 Sep 2024 07:07:21 +0000	[thread overview]
Message-ID: <09a9180341b0d4898dd8185038aecdea4b147522.camel@mediatek.com> (raw)
In-Reply-To: <d59c3b6a965daf22750be79b0f74703c216ec44a.camel@mediatek.com>

On Mon, 2024-09-23 at 03:51 +0000, CK Hu (胡俊光) wrote:
> Hi, Jason:
> 
> On Wed, 2024-09-18 at 00:44 +0800, Jason-JH.Lin wrote:
> > OVL_CON_CLRFMT_MAN is a configuration for extending color format
> > settings of DISP_REG_OVL_CON(n).
> > It will change some of the original color format settings.
> > 
> > Take the settings of (3 << 12) for example.
> > - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA8888.
> > - If OVL_CON_CLRFMT_MAN = 1 means OVL_CON_CLRFMT_PARGB8888.
> > 
> > Since OVL_CON_CLRFMT_MAN is not supported on previous SoCs,
> > It breaks the OVL color format setting of MT8173.
> > 
> > Therefore, the fmt_convert function pointer is added to the driver
> > data
> > and mtk_ovl_fmt_convert_with_blend is implemented for MT8192 and
> > MT8195
> > that support OVL_CON_CLRFMT_MAN, and mtk_ovl_fmt_convert is
> > implemented
> > for other SoCs that do not support it to solve the degradation
> > problem.
> > 
> > Fixes: a3f7f7ef4bfe ("drm/mediatek: Support "Pre-multiplied"
> > blending in OVL")
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 63
> > ++++++++++++++++++++++---
> >  1 file changed, 56 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > index 89b439dcf3a6..4948f269fb81 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > @@ -143,6 +143,7 @@ struct mtk_disp_ovl_data {
> >  	unsigned int addr;
> >  	unsigned int gmc_bits;
> >  	unsigned int layer_nr;
> > +	unsigned int (*fmt_convert)(struct device *dev, struct
> > mtk_plane_state *state);
> >  	bool fmt_rgb565_is_0;
> >  	bool smi_id_en;
> >  	bool supports_afbc;
> > @@ -386,13 +387,54 @@ void mtk_ovl_layer_off(struct device *dev,
> > unsigned int idx,
> >  		      DISP_REG_OVL_RDMA_CTRL(idx));
> >  }
> >  
> > -static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl,
> > unsigned int fmt,
> > -				    unsigned int blend_mode)
> > +static unsigned int mtk_ovl_fmt_convert(struct device *dev, struct
> > mtk_plane_state *state)
> >  {
> > -	/* The return value in switch "MEM_MODE_INPUT_FORMAT_XXX"
> > -	 * is defined in mediatek HW data sheet.
> > -	 * The alphabet order in XXX is no relation to data
> > -	 * arrangement in memory.
> > +	struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
> > +	unsigned int fmt = state->pending.format;
> > +
> > +	switch (fmt) {
> > +	default:
> > +	case DRM_FORMAT_RGB565:
> > +		return OVL_CON_CLRFMT_RGB565(ovl);
> > +	case DRM_FORMAT_BGR565:
> > +		return OVL_CON_CLRFMT_RGB565(ovl) | OVL_CON_BYTE_SWAP;
> > +	case DRM_FORMAT_RGB888:
> > +		return OVL_CON_CLRFMT_RGB888(ovl);
> > +	case DRM_FORMAT_BGR888:
> > +		return OVL_CON_CLRFMT_RGB888(ovl) | OVL_CON_BYTE_SWAP;
> > +	case DRM_FORMAT_RGBX8888:
> > +	case DRM_FORMAT_RGBA8888:
> > +	case DRM_FORMAT_RGBX1010102:
> > +	case DRM_FORMAT_RGBA1010102:
> > +		return OVL_CON_CLRFMT_RGBA8888;
> 
> Comparing mtk_ovl_fmt_convert() with
> mtk_ovl_fmt_convert_with_blend(), some pixel formats are supported,
> such as BGRA8888.
> But in kernel v6.10, these formats are supported.
> Is the code wrong in v6.10?
> 

Yes, I lost those parts...

I'll add the cases:

case BGRX8888:
case BGRA8888:
case BGRX1010102:
case BGRA1010102:
    return OVL_CON_CLRFMT_BGRA8888;

and send the v4 soon.

Regards,
Jason-JH.Lin

> Regards,
> CK

      reply	other threads:[~2024-09-23  7:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17 16:44 Jason-JH.Lin
2024-09-18 10:15 ` AngeloGioacchino Del Regno
2024-09-23  3:51 ` CK Hu (胡俊光)
2024-09-23  7:07   ` Jason-JH Lin (林睿祥) [this message]

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=09a9180341b0d4898dd8185038aecdea4b147522.camel@mediatek.com \
    --to=jason-jh.lin@mediatek.com \
    --cc=Nancy.Lin@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Shawn.Sung@mediatek.com \
    --cc=Singo.Chang@mediatek.com \
    --cc=alpernebiyasak@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    /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®