modetest applies not until video starts

  • Hello all,

    I have a TV that supports only 1360x768 60Hz and should use limited color range (16-235).

    My device is LibreELEC 10.0.2 on RPi4.

    After a fresh setup of LibreELEC the video mode defaults to 1360x768 60Hz full color range so that extreme black and white levels get cut off.

    The setting limited color range setting in "settings -> system -> video" does not work as it only affects the GUI, not the video playback. Although when I disable DRM Prime Decoder the setting works correctly in video playback.

    On LibreElec <10 I used to set the config.txt hdmi_pixel_encoding to 1, which obviously does not apply anymore.

    As an alternative I added "modetest -M vc4 -w 32:Colorspace:12 -w 32:"max bpc":12 -w 32:"Broadcast RGB":2" to my autostart.sh.

    But some quirks are remaining: When the RPi4 boots it takes longer as usual and the displaymode changes back and forth. Eventually it displays 1360x768 full range :(
    When I start a video the video mode changes again (my TV has to re-adjust) to 1360x768 limited range and the video plays correctly.

    The limited range stays applied even if the video is closed. Yay!

    My goal is to boot directly into limited range.

    It would be great if someone could help me.

    Kind regards.

  • Thank you Hias. Your latest build works as expected and the mode change is successfully applied during boot :thumbup:
    I do not know if the following is also part of this problem,
    but is it possible to define only one fixed video mode and disable all mode changes?
    It seems to me that modetest in autostart.sh only changes the already negotiated video mode. My TV reacts with some flickering during boot.

  • These modechanges (modesets) are unavoidable as they are needed to push the changes through the video driver. And by changing max_bpc you are actually changing HDMI clocks - 12bit need 1.5x higher clocks than 8bit so the whole video output block needs to be reinitialized to set the correct HDMI output (which now runs 1.5 times faster than before).

    BTW: not sure why you set Colorspace to 12, that would be DCI-P3_RGB_Theater?

    My guess is you could leave Colorspace and max_bpc as they are and only change Broadcast RGB property.

    so long,

    Hias

  • Actually I only set"Broadcast RGB":2" when it worked. But it is still the same question.

    Thank you for the explanation, but I don't completely understand yet.
    I assume that first the TV sends its available modes and the RPi selects the best and does modeset(s). Later I do my modeset again.
    Can't we disable the negotiaton completely and only use one manual modeset?
    Of course the RPi would only work with this one display configuration afterwards.
    I'm just curious.

  • No, that's a limitation of the display driver (it may even be a limitation of the hardware).

    When you switch from full to limited range the driver needs to completely reinit the hardware to change the output colorspace conversion - previously it combined the RGB full range Kodi GUI with YUV limited range video and output it as RGB full range, now both need to be combined and outputted as limited - as you can imagine that requires different combination and functions (internally colorspace conversion matrices) to be applied - this can't be changed "on the fly".

    so long,

    Hias