From: "Màxim Pedraza Padilla" <maximpedraza@gmail.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: "Neil Armstrong" <neil.armstrong@linaro.org>,
"Jessica Zhang" <jesszhan0024@gmail.com>,
"Jyri Sarha" <jyri.sarha@iki.fi>,
"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Robert Foss" <rfoss@kernel.org>,
"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 3/4] drm/tilcdc: Implement state readout support
Date: Wed, 25 Nov 2026 14:31:49 +0100 [thread overview]
Message-ID: <20261125133150.507558-1-maximpedraza@gmail.com> (raw)
In-Reply-To: <awau4IF7KE7hUg6U@houat>
On Wed, Nov 25, 2026 at 11:07:17AM +0100, Maxime Ripard wrote:
> > The tidss approach rounds the clock to the closest standard refresh rate.
> > Panels driven by tilcdc often don't use one: with the timings from its
> > datasheet, the panel on this board runs at 56.8 Hz (33.3 MHz), which would
> > be read back as 60 Hz and 35.19 MHz. The adopted mode would then never
> > match the panel mode, even with U-Boot programming exactly the same one.
>
> This is *very* surprising. Do you have the datasheet available somewhere?
You were right to be surprised, I got it wrong, sorry. The datasheet
counts the sync pulse within the back porch: a line is 1056 clocks
(800 + 46 + 210) and a frame 525 lines (480 + 23 + 22), so 60.06 Hz at
33.3 MHz. The board DT added the sync lengths on top of the porches,
hence the 56.8 Hz. The bootloader had the same mistake, and also ran the
panel at 16.94 MHz.
With the timings fixed, and the bootloader programming the same mode as
the kernel, the readout adopts exactly the DT mode (33300 kHz, 60 Hz),
and the first commit from userspace with that mode doesn't need a
modeset at all.
> > So the readout keeps the actual rate (rounded to the nearest kHz), and
> > tilcdc's CRTC compare hook accepts a 1% difference on the pixel clock
> > before calling drm_atomic_helper_crtc_compare_state(). [...]
>
> Yes, that's why we need the above mentionned helper, and more generally
> why a lot of drivers allow some deviation from the clock.
If it helps, I can write that helper: dispc_find_closest_refresh_rate_from_clk()
turned into a DRM helper, with the tolerance as a parameter since drivers
want different ones (5% for tidss, 0.5% for most). Something like:
int drm_mode_set_clock_from_rate(struct drm_display_mode *mode,
unsigned long rate,
unsigned int tolerance);
with the tolerance in per mille, so 0.5% can be expressed. It would fill
mode->clock with the ideal clock of the closest standard refresh rate, or
return an error if none is close enough. tidss would then use it, and so
would tilcdc instead of its own compare hook. I'm also fine with you
folding it into your series if you'd rather do it yourself, just let me
know.
> > Testing on v9 also found a bug in my readout: re-enabling the CRTC
> > (ACTIVE=0 then 1) with the adopted framebuffer crashed in set_scanout(),
> > since it has no GEM object. It now keeps the DMA address the bootloader
> > programmed.
>
> It should be fixed in v10, I'm now creating a gem object.
Great, I'll drop it when rebasing on v10.
Thanks,
Màxim
next prev parent reply other threads:[~2026-11-25 13:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 14:27 [RFC PATCH 0/4] drm/tilcdc: Implement state readout Màxim Pedraza Padilla
2026-11-16 14:27 ` [RFC PATCH 1/4] drm/bridge: Add atomic_sro_install_state hook Màxim Pedraza Padilla
2026-11-16 16:58 ` Maxime Ripard
2026-11-16 14:27 ` [RFC PATCH 2/4] drm/panel: Implement state readout in the panel bridge Màxim Pedraza Padilla
2026-11-16 16:59 ` Maxime Ripard
2026-11-16 14:27 ` [RFC PATCH 3/4] drm/tilcdc: Implement state readout support Màxim Pedraza Padilla
2026-11-16 17:12 ` Maxime Ripard
2026-11-18 21:21 ` Màxim Pedraza Padilla
2026-11-20 14:01 ` Maxime Ripard
2026-11-23 10:55 ` Màxim Pedraza Padilla
2026-11-24 14:11 ` Màxim Pedraza Padilla
2026-11-24 14:38 ` Tomi Valkeinen
2026-11-25 10:11 ` Maxime Ripard
2026-11-25 11:43 ` Tomi Valkeinen
2026-11-25 12:21 ` Maxime Ripard
2026-11-25 10:15 ` Màxim Pedraza Padilla
2026-11-25 11:53 ` Tomi Valkeinen
2026-11-25 10:07 ` Maxime Ripard
2026-11-25 13:31 ` Màxim Pedraza Padilla [this message]
2026-11-16 14:27 ` [RFC PATCH 4/4] drm/panel: simple: Keep the enable GPIO as left by the bootloader Màxim Pedraza Padilla
2026-11-16 16:50 ` [RFC PATCH 0/4] drm/tilcdc: Implement state readout Maxime Ripard
2026-11-18 21:21 ` Màxim Pedraza Padilla
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=20261125133150.507558-1-maximpedraza@gmail.com \
--to=maximpedraza@gmail.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jesszhan0024@gmail.com \
--cc=jonas@kwiboo.se \
--cc=jyri.sarha@iki.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
--cc=ukleinek@kernel.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®