public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Reliably selecting non-CEA modes on Intel graphics (and maybe others)
@ 2024-04-22 13:58 Michael Olbrich
  2024-04-22 14:13 ` Jani Nikula
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Olbrich @ 2024-04-22 13:58 UTC (permalink / raw)
  To: dri-devel, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Ville Syrjälä,
	Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
	intel-gfx, intel-xe, linux-kernel
  Cc: graphics

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-22 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-22 13:58 Reliably selecting non-CEA modes on Intel graphics (and maybe others) Michael Olbrich
2024-04-22 14:13 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox