Reliably selecting non-CEA modes on Intel graphics (and maybe others)

Michael Olbrich m.olbrich at pengutronix.de
Mon Apr 22 13:58:15 UTC 2024


Hi,

In short: I have a HDMI monitor attached to Intel graphics. I'm trying to
set a non-CEA mode but the driver always maps it to the corresponding CEA
mode.

More specifically, the monitor has two 1920x1080 at 60 modes in the EDID:
1. The CEA mode with VIC 16
2. A custom DTD mode with exactly the same timings (this is the preferred
   mode).

>From a userspace perspective, the two modes are mostly identical, except
for the 16:9 aspect ratio flag in the CEA mode and the preferred type in
the other.

I want to select the second (preferred) mode, but that does not seem
possible:
intel_hdmi_compute_avi_infoframe() tries to determine which VIC should be
added to the avi infoframe and if limited or full range is used.
It uses various DRM helpers here but in the end drm_match_cea_mode() is
called. And here lies the problem:
The mode provided by the userspace has explicitly no aspect ratio. But
here, it is interpreted as "the aspect ration is undefined". So matching
ignored the aspect ratio and the CEA mode with VIC 16 is found and limited
range is used.

The commit that introduces this fuzzy matching
357768cc9e3fdacf6551da0ae1483bc87dbcb4e8 ("drm/edid: Fix cea mode aspect
ratio handling") made sense at the time. The capability
DRM_CLIENT_CAP_ASPECT_RATIO that exposes aspect ratios to userspace was
introduced later in the same merge request, from what I can tell
7595bda2fb4378ccbb8db1d0e8de56d15ea7f7fa ("drm: Add DRM client cap for
aspect-ratio").

Am I missing something here, or is it just not possible to select the
non-CEA mode right now? In my specific example, the selected CEA mode is
actually supported by the monitor, but as far as I can tell, the CEA mode
is used even if the monitor does not support it at all.

I've only tested this on Intel, but I assume that other drivers that use
the same helpers have the same problem.

So how can this be fixed? I've considered matching the aspect ratio based
on the DRM_CLIENT_CAP_ASPECT_RATIO capability, but I'm not sure if that is
valid. The documentation is limited and I found nothing that describes what
the userspace should do here.
Or would a new capability make sense here? Or something entirely different?
I'm not sure how I should proceed here. Any help would be appreciated.

Regards,
Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


More information about the dri-devel mailing list