Limited/Full Color Range by default

After Jetson TX2 with L4T R28.1 bootup, X11 has Full (0-255 channel value) Color Range. 1

However, if X11 is closed (sudo service lightdm stop) or switched to a Virtual Terminal (via CTRL+ATL+F1 or sudo chvt 1), then Limited (16-254 channel value, washed out colors, low-contract image) Color Range is used.
This behavior is tested on different monitors (one with HDMI-IN, and two with DVI-IN).

After a lot of digging I’ve found undocumented Tegra-specific FB_VMODE_LIMITED_RANGE bitflag of fb_var_screeninfo.vmode than is responsible for selecting Color Range.

To get the value Color Range, run cat /sys/kernel/debug/tegradc.0/mode | grep vmode.

To set the value of Color Range, compile and run:

#include </usr/src/linux-headers-4.4.38-tegra/include/uapi/linux/fb.h>

int main() {
  fb_var_screeninfo vinfo;
  assert(!ioctl(f, FBIOGET_VSCREENINFO, &vinfo));
  v.vmode &= ~FB_VMODE_LIMITED_RANGE; // Sets Full Color Range.
  //v.vmode |= FB_VMODE_LIMITED_RANGE; // Sets limited Color Range.
  assert(!ioctl(f, FBIOPUT_VSCREENINFO, &vinfo));

  return 0;
}

Further notes:

  • /usr/include/linux/fb.h of both Vanilla Linux and L4T R28.1 does not have bitflag FB_VMODE_LIMITED_RANGE defined.
  • Setting Color Range to Full only persists when in Graphics Mode of Virtual Terminal (assert(!ioctl(f, KDSETMODE, KD_GRAPHICS))).
  • Setting Color Range to Full returns back to Limited in a couple of seconds when in Text Mode of Virtual Terminal (assert(!ioctl(f, KDSETMODE, KD_TEXT))).
  • FB_VMODE_LIMITED_RANGE affects DRM Example (tegra_multimedia_api.orig/samples/08_video_dec_drm/video_decode_drm) the same way is affects Linux Framebuffer.

-What is the proper way to set Full Color Range in non-X11 environment?

  • Does Limited Color Range is selected because of the monitor (video-in) properties?
    • If yes, which ones?
    • If no, does HDMI-OUT always have Limited Color Range by default?

Alex_Polotsk,

This is set by DC driver in kernel if you don’t have userspace window system(e.g. X11). I guess this is set to limited color range all the time. This property(full range) is enabled in X11 on rel-28.1. Before rel-28.1, there was always limited color range for HDMI output.

Still, you could also check the kernel code if possible.

For YCbCr normal mode does not support full range. Only sYCC and Adobe YCC modes of YCbCr support it. Two xvYCC modes are only limited range though.