Re: [RFC PATCH 3/4] drm/tilcdc: Implement state readout support

From: Maxime Ripard

Date: Wed Nov 25 2026 - 05:07:24 EST


On Tue, Nov 24, 2026 at 03:11:19PM +0100, Màxim Pedraza Padilla wrote:
> On Wed, Nov 18, 2026 at 10:21:14PM +0100, Màxim Pedraza Padilla wrote:
> > Makes sense, I'll use the same approach in tilcdc, and see if it can be
> > turned into a common helper along the way.
>
> A follow-up on this one, now that I've rebased on v9. I ended up doing
> it differently, so I'd rather explain why before sending the next
> version.
>
> 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?

> 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(). That's what the
> leeway is needed for: tilcdc_crtc_set_clk() only gets as close as the
> clock tree allows. I checked it with modesets at 20 pixel clocks between
> 16.9 and 45 MHz: the PLL misses some of them by up to 0.015%, which the
> exact comparison reported as mismatches, and they all pass now.

Yes, that's why we need the above mentionned helper, and more generally
why a lot of drivers allow some deviation from the clock.

> 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.

Maxime

Attachment: signature.asc
Description: PGP signature