Invert pixel values using LUT or Color Matrix

I have a custom board design with two HDMI outputs.
The hardware for the second HDMI port has pixel values inverted.
That can be resolved in software by subtracting each value from 255, using an nvivafilter in the pipeline.

The device tree contains nvidia,cmu-csc and nvidia,cmu-lut2; which should provide another mechanism to workaround the hardware problem.
I have been unable to find any documentation on these items, other than Android DT doc

Can you provide a pointer to documentation and/or alternative solution to the inversion?

You could refer to the TX2 TRM (technical reference manual) for the detail about CMU.

For TX2, what you need to refer to should be “nvidia,cmu-lut” and “nvidia,panel-csc”.

BTW, I am not very sure your request. Could you tell us why you need to -255 here?

LUT is used for the gamma correction and CSC is used for converting to 601/709 and 2020 color space.

There are pre-comp and post-comp process in display controller and it is not a simple linear conversion like “-255”.

The second HDMI head outputs via an Inneos fiber transceiver.
That transceiver is inverting the data bits of the TMDSsignal.

In the TRM I found

Per-window CGMT (color gamut) matrix

  • 4x3 matrix multiplication with software-defined coefficients in the [-4.0, 3.999] range

That should suffice, if I can determine how to set it.

I found references to a Byte Swap, that might be relevant

global byte_swap; BYTE_SWAP.BYTE_SWAP $byte_swap

In dc.c
tegra_dc_writel(dc, 0, DC_WIN_BYTE_SWAP);

No documentation as to what this means

Hardware engineers sharpened their pencils and solved the problem.

1 Like