AR# 68227

Video Common Library - How do I add support for custom resolutions to the Video Timing Table?

Description

How do I add support for custom resolutions to the Video Timing Table?

The default timing table in the video common library covers many of the common timing tables, but how do I add a resolution for my application?

Solution

The Video Common has an API for creating a custom resolution table, and registering it.

Here is an example of how to register a specific resolution. Both 1 and 2 can be placed wherever the constant declarations are made, such as a .h file. 

However, 3 will need to be done at run time.

1) Assign Mode ID Enumeration. These must be greater than the XVIDC_VM_CUSTOM constant.

/* Assign Mode ID Enumeration. First entry Must be > XVIDC_VM_CUSTOM */
typedef enum {
    XVIDC_VM_3840x2160_30_P_SB = (XVIDC_VM_CUSTOM + 1),
    XVIDC_CM_NUM_SUPPORTED
} XVIDC_CUSTOM_MODES;

2) Create a custom table with entries for each of the custom resolutions that the user wants to support.

/* Create entry for each mode in the custom table */
const XVidC_VideoTimingMode XVidC_MyVideoTimingMode[(XVIDC_CM_NUM_SUPPORTED - (XVIDC_VM_CUSTOM + 1))] =
{
    { XVIDC_VM_3840x2160_30_P_SB, "3840x2160@30Hz (SB)", XVIDC_FR_30HZ,
        {3840, 48, 32, 80, 4000, 1,
         2160, 3, 5, 23, 2191, 0, 0, 0, 0, 1} }
};

3) The user will then need to register this table in their application.

This can be done prior to initializing peripherals.

/* User registers custom timing table */
  xil_printf("INFO> Registering Custom Timing Table with %d entries \r\n", (XVIDC_CM_NUM_SUPPORTED - (XVIDC_VM_CUSTOM + 1)));
  Status = XVidC_RegisterCustomTimingModes(XVidC_MyVideoTimingMode, (XVIDC_CM_NUM_SUPPORTED - (XVIDC_VM_CUSTOM + 1)));
  if (Status != XST_SUCCESS) {
      xil_printf("ERR: Unable to register custom timing table\r\n\r\n");
  }

Note: Formatting for the table is seen below:

/*
* This table contains the main stream attributes for various standard
* resolutions. Each entry is of the format:
* 1) ID: XVIDC_VM_x__(_RB = Reduced Blanking)
* 2) Resolution naming: "x@"
* 3) Frame rate: XVIDC_FR_
* 4) Video timing structure:
* 1) Horizontal active resolution (pixels)
* 2) Horizontal front porch (pixels)
* 3) Horizontal sync width (pixels)
* 4) Horizontal back porch (pixels)
* 5) Horizontal total (pixels)
* 6) Horizontal sync polarity (0=negative|1=positive)
* 7) Vertical active resolution (lines)
* 8) Frame 0: Vertical front porch (lines)
* 9) Frame 0: Vertical sync width (lines)
* 10) Frame 0: Vertical back porch (lines)
* 11) Frame 0: Vertical total (lines)
* 12) Frame 1: Vertical front porch (lines)
* 13) Frame 1: Vertical sync width (lines)
* 14) Frame 1: Vertical back porch (lines)
* 15) Frame 1: Vertical total (lines)
* 16) Vertical sync polarity (0=negative|1=positive)
*/
AR# 68227
Date 08/18/2017
Status Active
Type General Article
IP