Unigraf Support in IGT
========================

This document provides information and instructions for Unigraf support in IGT.

Introduction
------------

Unigraf devices are a set of devices that can be used to test all sort of graphical
interface and signals. See Unigraf website for more information about all the
capabilities of each devices: https://unigraf.fi

Unigraf documentation
---------------------

All the documentation for libTSI, the library used to communicate with the unigraf,
can be found on unigraf website: https://www.unigraf.fi/downloads/

Setting up Unigraf
------------------

For most of the unigraf devices, this should be as simple as "plugging the
unigraf and plug the video cable". If you need to install some license, upgrade
the firmware... please take a look at the official unigraf documentation.

Compiling IGT with Unigraf support
----------------------------------

Unfortunately, the communication with the device use a proprietary library and the
underlying protocol is not open. To use the unigraf you need to install the unigraf
SDK, grab the libTSI.so and make it available on the build machine and the DUT.

Deploying the Unigraf with IGT
------------------------------

Unigraf may work out of the box: by default if IGT find a unigraf device, it will
try to connect and configure it to use USB-C input. This allows running most of
the existing tests without an actual screens.

Here is a complete example configuration:

        [Unigraf]
        # Choose a device using his name, you can find it in UCDConsole (installed with the SDK)
        Device=UCD-500 [2434C620]
        # Choose a role for the device, you can find it UCDConsole
        Role=USB-C, DP Alt Mode Source and Sink
        # Choose active input for the device
        Input=DP RX
        # Set the connector name used by the unigraf device. If not set, IGT will try to
        # autodetect which connector is used.
        Connector=DP-2
        # Set the EDID used by Unigraf
        EDID=DEL_16543_DELL_P2314T_DP
        # Enable or disable the use of Unigraf's CRCs instead of the CRTC CRCs
        UseCRC=1
        # Set the number of emulated MST streams (0 = Single Stream Transport, >=1 = MST)
        MSTStreams=0

Current Support in IGT
----------------------

Support for the Unigraf devices in IGT is found in the following places:
* lib/unigraf/unigraf.[ch] -> IGT API
* lib/unigraf/TSI.h -> Header for libTSI.so, not provided by Unigraf
* lib/unigraf/TSI_types.h -> Header containing all the relevant values from unigraf SDK. The unigraf SDK can't be used directly because it is only compatible with windows and c++.

Current unigraf.c features are:
* Plug, unplug, hotplug pulse
* EDID management
* MST/SST stream management
* CRC calculation

Current testing are:
* All igt tests that require a display and use a CRC (kms_plane, kms_cursor_crc, ...)
* Basic EDID and MST tests

Planned tests:
* Link training scenarios (link rate, lane count, scrambling, ...)
* Bandwidth constraint management
* HDCP content protection
* Display stream compression
