VIM4 KMS custom video timing - is it possible?

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 22.04

Which version of system do you use? Khadas official images, self built images, or others?

Khadas official image

Please describe your issue below:

For a OpenGL ES application driving a custom display through VIM4 HDMI output, I have to set a custom video timing (i.e. pixel clock, resolution, sync pulses, similar to XFree86 modeline). The display does not provide EDID, so I have to do it manually. Questions are:

  • Is it possible at all ?
  • If so, which API should be used (KMS, KMS Atomic) ?

Using the libdrm API, and filling one of the drmModeModeinfo structures of drmModeConnector with the parameters of my specific mode (see code below). This works on a PC with an Intel HD 630 GPU, but not on the VIM4:

  • On the first run of my test program, my custom mode is accepted, but I get no signal on the HDMI port
  • On the second and consecutive runs the VIM4 the mode defaults to a 480p60hz mode.
  • My monitor accepts the mode from the code below (i.e. 1080p50hz) from the PC, so it’s not a monitor issue

To me it looks like an issue of the Mali driver/firmware.

Thanks for any help!

drmModeModeInfo* mode = &connector->modes[1];
mode->vrefresh = 50;
mode->clock = 123750;
mode->hdisplay = 1920;
mode->hsync_start = 2008;
mode->hsync_end = 2052;
mode->htotal = 2200;
mode->vdisplay = 1080;
mode->vsync_start = 1084;
mode->vsync_end = 1089;
mode->vtotal = 1125;