From: Gustavo Padovan <gustavo@padovan.org>
To: Daniel Stone <daniel@fooishbar.org>
Cc: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>,
"inki.dae@samsung.com" <inki.dae@samsung.com>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"liquid.acid@gmx.net" <liquid.acid@gmx.net>
Subject: Re: drm/exynos: Add atomic modesetting support
Date: Mon, 18 May 2015 18:02:39 -0300 [thread overview]
Message-ID: <20150518210239.GB18856@joana> (raw)
In-Reply-To: <CAPj87rOnseYOzPqetbxKpq7_4855Vup2cySzZJmz8JejBHFPMw@mail.gmail.com>
2015-05-18 Daniel Stone <daniel@fooishbar.org>:
> Hi,
>
> On Monday, May 18, 2015, Gustavo Padovan <gustavo@padovan.org> wrote:
>
> > Hi Tobias,
> >
> > 2015-05-15 Tobias Jakobi <tjakobi@math.uni-bielefeld.de <javascript:;>>:
> > > I did another run with drm.debug=0xff and also tried to figure out where
> > the
> > > div-by-zero comes from.
> > >
> > > The only division I see is in fimd_calc_clkdiv() (which is called by
> > > fimd_commit()). So it looks like 'ideal_clk' is zero when calling
> > > DIV_ROUND_UP().
> > >
> > > 'htotal' and 'vtotal' can't be zero, since this is checked early in
> > > fimd_commit(). So 'vrefresh' has to be zero. Maybe this helps?
> >
> > What is is the output when you run with this patch:
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > index 12ab80c..f5d215d 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > @@ -310,6 +310,8 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
> > unsigned long ideal_clk = mode->htotal * mode->vtotal *
> > mode->vrefresh;
> > u32 clkdiv;
> >
> > + DRM_DEBUG_KMS("vrefresh %d\n", mode->vrefresh);
> > +
> > if (ctx->i80_if) {
> > /*
> > * The frame done interrupt should be occurred prior to the
> > @@ -328,6 +330,7 @@ static bool fimd_mode_fixup(struct exynos_drm_crtc
> > *crtc,
> > const struct drm_display_mode *mode,
> > struct drm_display_mode *adjusted_mode)
> > {
> > + DRM_DEBUG_KMS("vrefresh %d\n", adjusted_mode->vrefresh);
> > if (adjusted_mode->vrefresh == 0)
> > adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
> >
>
> vrefresh can legitimately be zero, which makes this FIMD_DEFAULT_FRAMERATE
> assignment problematic rather than harmless.
>
> If it's zero, you can find a vrefresh value with drm_mode_vrefresh, which
> will calculate it for you.
So better try this. Ideally fimd_mode_fixup should go away too, I'll do a proper
patch once we know this works.
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 12ab80c..363353b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -307,9 +307,17 @@ static void fimd_iommu_detach_devices(struct fimd_context *ctx)
static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
const struct drm_display_mode *mode)
{
- unsigned long ideal_clk = mode->htotal * mode->vtotal * mode->vrefresh;
+ unsigned long ideal_clk;
+ int vrefresh;
u32 clkdiv;
+ if (mode->vrefresh == 0)
+ vrefresh = drm_mode_vrefresh(mode);
+ else
+ vrefresh = mode->vrefresh;
+
+ ideal_clk = mode->htotal * mode->vtotal * vrefresh;
+
if (ctx->i80_if) {
/*
* The frame done interrupt should be occurred prior to the
next prev parent reply other threads:[~2015-05-18 21:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-15 11:44 drm/exynos: Add atomic modesetting support Tobias Jakobi
2015-05-18 19:51 ` Gustavo Padovan
2015-05-18 20:35 ` Daniel Stone
2015-05-18 21:02 ` Gustavo Padovan [this message]
2015-05-19 13:53 ` Tobias Jakobi
2015-05-19 14:06 ` Daniel Stone
2015-05-19 14:52 ` Tobias Jakobi
2015-05-19 17:27 ` Tobias Jakobi
2015-05-19 18:43 ` Gustavo Padovan
2015-05-19 18:54 ` Daniel Stone
-- strict thread matches above, loose matches on Subject: below --
2015-05-15 10:16 Tobias Jakobi
2015-04-30 21:50 Gustavo Padovan
2015-05-06 21:45 ` Gustavo Padovan
2015-05-07 2:45 ` Inki Dae
2015-05-08 21:45 ` Gustavo Padovan
2015-05-08 21:51 ` Tobias Jakobi
2015-05-09 10:23 ` Inki Dae
2015-05-09 12:13 ` Tobias Jakobi
2015-05-09 12:20 ` Tobias Jakobi
2015-05-09 12:30 ` Tobias Jakobi
2015-05-10 13:54 ` Inki Dae
2015-05-12 18:29 ` Gustavo Padovan
2015-05-14 18:41 ` Gustavo Padovan
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=20150518210239.GB18856@joana \
--to=gustavo@padovan.org \
--cc=daniel@fooishbar.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=liquid.acid@gmx.net \
--cc=tjakobi@math.uni-bielefeld.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