From: "Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>
To: "wenst@chromium.org" <wenst@chromium.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"CK Hu (胡俊光)" <ck.hu@mediatek.com>,
"kernel@collabora.com" <kernel@collabora.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] drm/mediatek: Set sensible cursor width/height values to fix crash
Date: Thu, 18 Jul 2024 09:18:23 +0000 [thread overview]
Message-ID: <d2d0e23fd3b6a3dcdb164cc68020817669f23aab.camel@mediatek.com> (raw)
In-Reply-To: <CAGXv+5GBg73kWuiDt=9s7M4oJeHhWOF3bPY7Ju+qn1kJgNNaGw@mail.gmail.com>
On Thu, 2024-07-18 at 16:49 +0800, Chen-Yu Tsai wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> (CC-ed Fei Shao)
>
> On Thu, Jul 18, 2024 at 4:24 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com>
wrote:
> >
> > Hardware-speaking, there is no feature-reduced cursor specific
> > plane, so this driver reserves the last all Overlay plane as a
> > Cursor plane, but sets the maximum cursor width/height to the
> > maximum value that the full overlay plane can use.
> >
> > While this could be ok, it raises issues with common userspace
> > using libdrm (especially Mutter, but other compositors too) which
> > will crash upon performing allocations and/or using said cursor
> > plane.
> >
> > Reduce the maximum width/height for the cursor to 512x512 pixels,
> > value taken from IGT's maximum cursor size test, which succeeds.
> >
> > Fixes: a4c9410b31ca ("drm/mediatek: Set DRM mode configs
> accordingly")
> > Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > index 6f0b415a978d..b96763664c4f 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > @@ -540,8 +540,8 @@ static int mtk_drm_kms_init(struct drm_device
> *drm)
> > }
> >
> > /* IGT will check if the cursor size is configured */
> > - drm->mode_config.cursor_width = drm->mode_config.max_width;
> > - drm->mode_config.cursor_height = drm-
> >mode_config.max_height;
> > + drm->mode_config.cursor_width = 512;
> > + drm->mode_config.cursor_height = 512;
>
> Fei already did the same (?) workaround downstream just recently.
>
> OOTH, Intel recently added a feature for enumerating "suggested"
> cursor sizes. See
https://patchwork.freedesktop.org/patch/583299/
>
> Not sure if other compositors will end up using it or not.
>
> ChenYu
>
> > /* Use OVL device for all DMA memory allocations */
> > crtc = drm_crtc_from_index(drm, 0);
> > --
> > 2.45.2
> >
Just for more information, as the driver is describing the hardware limitation, and the comments for cursor_width/cursor_height in struct
drm_mode_config indicates "hint to userspace for 'max' cursor width/height". After few discussions with the reviewer, we eventually set it to the maximum size the Overlay supports (d46f652fc9fde61d7e88bfeace62f27847d55d40.camel@mediatek.com>).
Not sure if it makes sense for these userspace compositors to always
use the maximum size of the cursor plane as the cursor size.
Regards,
Shawn
next prev parent reply other threads:[~2024-07-18 9:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 8:24 [PATCH] drm/mediatek: Set sensible cursor width/height values to fix crash AngeloGioacchino Del Regno
2024-07-18 8:49 ` Chen-Yu Tsai
2024-07-18 9:18 ` Shawn Sung (宋孝謙) [this message]
2024-07-18 9:27 ` Fei Shao
2024-07-18 10:24 ` AngeloGioacchino Del Regno
2024-07-18 11:10 ` Daniel Stone
2024-07-18 11:23 ` AngeloGioacchino Del Regno
2024-07-19 8:42 ` CK Hu (胡俊光)
2024-07-19 9:20 ` AngeloGioacchino Del Regno
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=d2d0e23fd3b6a3dcdb164cc68020817669f23aab.camel@mediatek.com \
--to=shawn.sung@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=ck.hu@mediatek.com \
--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 \
--cc=wenst@chromium.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