HDMI YUV422 output

The technical reference manual states 7.6.2.3 HDMI :

HDMI

YUV444/YUV422 output (BT.601 and BT.709 formats)

  • 8/12 bpc RGB444/YUV444
  • 8/10/12 bpc RGB422/YUV422
  • 8 bpc YUV420

Also noticed in 7.5.2.13 Output Capabilities :

HDMI 2.0 and HDMI 1.4

  • 24-bit RGB and YUV 444
  • 36-bit RGB and YUV 444
  • YCbCr 4:2:2 (for rec.2020)
  • 12 bpc (8-bpc and 10-bpc content sent in the same fashion as 12-bpc)
  • YCbCr 4:2:0 8 bpc (no 10/12 bpc support)

How can I set HDMI to output YUV422 (8 bit)? From what I can tell the KMS/DRM driver is defaulting to RGB.

Hello,

The TRM indicates the hardware capability but the driver may not implement them all.

Currently, these are supported on NX. You can use OUTPUT_FORMAT_YCBCR422_30 to set 422/10bpc.

Please refer to

/usr/src/jetson_multimedia_api/samples/08_video_dec_drm
/usr/src/jetson_multimedia_api/samples/common/classes/NvDrmRenderer.cpp

NvBufGetDrmParams() shall support

YUV420/YUV422 8-bit
YUV420 10-bit has different color space like
DRM_FORMAT_TEGRA_P010_2020/DRM_FORMAT_TEGRA_P010_709/DRM_FORMAT_P010

I can get the following properties from drmModeObjectGetProperties for DRM_MODE_OBJECT_CRTC :

name : MODE_ID value 0x0
name : ACTIVE value 0x0
name : HDR_SUPPORTED value 0x0
name : HDR_METADATA_SMPTE_2086_ID value 0x0
name : OUTPUT_FORMAT value 0x0
name : OutputColorRange value 0x0
name : CTM value 0x0|

Can I set OUTPUT_FORMAT to "YUV422 ? If yes what value would I need to pass to drmModeObjectSetProperty( ?

Hello,

I think what you should use is drmModeSetCrtc to set display mode first.

drmModeSetCrtc has no parameter do that (set hdmi to yuv422), it is used to set the mode & resolution. In NvDrmRenderer.cpp the HDR_METADATA_SMPTE_2086_ID property is set using drmModeObjectSetProperty. Since these are custom properties to the driver (drm-nvdc) . I’m asking can I set OUTPUT_FORMAT and if yes what values are supported because I can’t find any doc for this.

Hi,
The existing implementation is HDR video playback. So if your usecase is different, you would need to create NvBuffer in NvBufferColorFormat_NV12_10LE_2020, create the plane in DRM_FORMAT_TEGRA_P010_2020 through drmModeAddFB2(), and put data into the NvBuffers. This is the verified case in L4T releases.

Hi,

Thanks for the reply DRM_FORMAT_TEGRA_P010_2020 would be for YUV422 10bit, what if we want YUV422 8bit what value for the plane? From my diagnostics I can see the HDMI output frames are RGB444 and following the code, I can see that in coreboot it is hard coded to default to RGB as the HDMI colorspace. When the kernel boots it picks up RGB from the bootloader and uses that as the default hence why the HDMI output is RGB444. So by changing the plane you think I can change the HDIM output format to YUV422?

See in tegrabl_hdmi.c (coreboot), the hdmi avi info frame is defaulted to RGB

/* TODO: Support ycc format */
avi->rgb_ycc = HDMI_AVI_RGB;

See tegra_hdmi_get_rgb_ycc in kernel/nvidia/drivers/video/tegra/dc/hdmi_2.0.c where if the bootloader initialised hdmi then we take the value from the SOR.

Hi,
DRM_FORMAT_TEGRA_P010_2020 is for YUV420 10-bit Rec2020. For YUV422 10-bit, it should be P210.

If your source is in YUV422 8-bit, please convert it to NvBufferColorFormat_NV12_10LE_2020 so that you can render in YUV mode in HDMI putput.

Hi,

Thanks for the update, I understand I can output YUV422 10 bit. My source is YUV422 8 bit and I want to render it to HDIM as YUV422 8 bit not 10 bit, the reason I’m asking is because the TRM it states (see below) the HDMI interface supports this mode.

7.6.2.3 HDMI

YUV444/YUV422 output (BT.601 and BT.709 formats)
8/12 bpc RGB444/YUV444
8/10/12 bpc RGB422/YUV422
8 bpc YUV420

I can the set DRM_FORMAT_YUV422 or DRM_FORMAT_UYVY for NVBuffer however I see the HDMI output is still RGB instead of YUV422, My monitor supports both RGB444 and YUV422 8bit and I want the hdmi output to be YUV422 8 bit not 10 bit.

That is why you should try drmModeSetCrtc to set the mode. Mode is not only the x_res and y res. The vmode flag also includes the format.

Hi, thanks for replying, below is the function signature and structures, I can’t find the vmode field:

typedef struct _drmModeModeInfo {
        uint32_t clock;
        uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew;
        uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan;

        uint32_t vrefresh;

        uint32_t flags;
        uint32_t type;
        char name[DRM_DISPLAY_MODE_LEN];
} drmModeModeInfo, *drmModeModeInfoPtr;

int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
                   uint32_t x, uint32_t y, uint32_t *connectors, int count,
                   drmModeModeInfoPtr mode);

Hi,
We don’t support manual control of setting YUV mode in HDMI output. Please follow this:
HDMI YUV422 output - #11 by DaneLLL

We seem to be going round in circles.

In post you mention converting to NvBufferColorFormat_NV12_10LE_2020 which works for YV422 10 bit. As per my reply . I wanted YUV422 8 bit so I tried DRM_FORMAT_YUV422 & DRM_FORMAT_UYVY and the output is still RGB not YUV422.

So another question:

If this can’t be done programmatic ally, then how I can set the output to YUV422 8 bit as the EDID from the monitor is supports both RGB-4444 and YUV422 8 bit format. If I look at the kernel code for sor.c there is support for setting the correct pixel depths based on FB_VMODE_XXX flags. Furthermore hdmi2.0.c also has code to set the AVI frameinfo based on FB_VMODE_XXX flags. I guess this wouldn’t be implemented if it can’t be used?

The TRM only indicates the hardware capability of SoC. The driver side may not implement all. For example, 422 8 bit is not implemented. This info could be found in sw feature of HDMI.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/software_features_jetson_xavier_nx.html#wwpID0E0HC0HA

Other format will be converted to RGB automatically.

I would have been happy with that answer however as I stated in the kernel code there is code to support FB_VMODE_Y422 & FB_VMODE_Y24 which equates to NV_SOR_STATE1_ASY_PIXELDEPTH_BPP_16_422. So the SOR can be configured to output the correct format to feed the display interface. Can I suggest you refer this question to the kernel team as they should be able better answer the question? In fact the link you provided doesn’t indicate it doesn’t support YUV422 8 bit as there no mention of supporting RGB-444.

Hi,

I should correct my statement.
What I mean is the kernel may have supported what you want but the userspace tool/lib does not.

If I can’t set it through userspace tool/lib is there any other way to set it ie when the kernel boots? Also could we request if this feature could be implemented in a forth coming LT release?