From: Bibby Hsieh <bibby.hsieh@mediatek.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Sascha Hauer <kernel@pengutronix.de>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Cawa Cheng <cawa.cheng@mediatek.com>,
Thierry Reding <thierry.reding@gmail.com>,
linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>,
Yingjoe Chen <yingjoe.chen@mediatek.com>,
Mao Huang <littlecvr@chromium.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [v2] drm: mediatek: change the variable type of rdma threshold
Date: Thu, 22 Jun 2017 10:25:21 +0800 [thread overview]
Message-ID: <1498098321.717.17.camel@mtksdaap41> (raw)
In-Reply-To: <20170621211456.GA21176@roeck-us.net>
Hi, Guenter,
Thanks for your test and comment.
On Wed, 2017-06-21 at 14:14 -0700, Guenter Roeck wrote:
> On Fri, May 19, 2017 at 05:57:23PM +0800, Bibby Hsieh wrote:
> > For some greater resolution, the rdma threshold
> > variable will overflow.
> >
> > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> > index 0df05f9..9afdcd7 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> > @@ -37,7 +37,7 @@
> > #define DISP_REG_RDMA_FIFO_CON 0x0040
> > #define RDMA_FIFO_UNDERFLOW_EN BIT(31)
> > #define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16)
> > -#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16)
> > +#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) (((bytes) / 16) & 0x3ff)
>
> I agree with the earlier comment; clamp_val() might be more appropriate here
> and would avoid unexpected results.
>
Yep, It's a good suggestion to me, I will add clamp_val() to avoid
unexpected value, thanks.
> >
> > /**
> > * struct mtk_disp_rdma - DISP_RDMA driver structure
> > @@ -109,7 +109,7 @@ static void mtk_rdma_config(struct mtk_ddp_comp *comp, unsigned int width,
> > unsigned int height, unsigned int vrefresh,
> > unsigned int bpc)
> > {
> > - unsigned int threshold;
> > + unsigned long long threshold;
> > unsigned int reg;
> >
> > rdma_update_bits(comp, DISP_REG_RDMA_SIZE_CON_0, 0xfff, width);
> > @@ -121,7 +121,8 @@ static void mtk_rdma_config(struct mtk_ddp_comp *comp, unsigned int width,
> > * output threshold to 6 microseconds with 7/6 overhead to
> > * account for blanking, and with a pixel depth of 4 bytes:
> > */
> > - threshold = width * height * vrefresh * 4 * 7 / 1000000;
> > + threshold = (unsigned long long)width * height * vrefresh *
> > + 4 * 7 / 1000000;
>
> This is a 64 bit divide operation. It will result in a build failure
> if compiled for a 32 bit kernel (eg arm:allmodconfig).
>
> ERROR: "__aeabi_uldivmod" [drivers/gpu/drm/mediatek/mediatek-drm.ko] undefined!
>
Sorry about the lack of tests, I will change the divide operation to
div_u64 function, thanks for your suggestions.
> Guenter
--
Bibby
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2017-06-22 2:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 9:57 [PATCH v2] drm: mediatek: change the variable type of rdma threshold Bibby Hsieh
2017-05-22 5:46 ` CK Hu
2017-06-22 2:21 ` Bibby Hsieh
2017-06-21 21:14 ` [v2] " Guenter Roeck
2017-06-22 2:25 ` Bibby Hsieh [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=1498098321.717.17.camel@mtksdaap41 \
--to=bibby.hsieh@mediatek.com \
--cc=cawa.cheng@mediatek.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=littlecvr@chromium.org \
--cc=matthias.bgg@gmail.com \
--cc=thierry.reding@gmail.com \
--cc=yingjoe.chen@mediatek.com \
/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;
as well as URLs for NNTP newsgroup(s).