AR# 68227

Video Common Library - How do I add support for custom resolutions to the Video Timing Table in the bare-metal driver and Linux driver?

描述

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?

解决方案

Bare-metal Application

The Video Timing is defined in the XIDC_timings_table.c file of the Video Common library. It 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 in 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");
  }

 

Linux Application

The Video Timing information is defined in https://github.com/Xilinx/linux-xlnx/blob/master/drivers/gpu/drm/drm_edid.c.

User needs to add new resolution in static const struct drm_display_mode drm_dmt_modes[] = {}

/* 0x59 - 1440x2560@50Hz 16:9 */ //customer size
{ DRM_MODE("1440x2560", DRM_MODE_TYPE_DRIVER, 204792, 1440, 1510,
1545, 1590, 0, 2560, 2572, 2574, 2576, 0,
DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },

Also add new resolution in static const struct drm_display_mode edid_cea_modes[] = {}

/* 108 - 1440x2560@50Hz 16:9 */ //customer size
{ DRM_MODE("1440x2560", DRM_MODE_TYPE_DRIVER, 204792, 1440, 1510,
1545, 1590, 0, 2560, 2572, 2574, 2576, 0,
DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
.vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE, },

Now rebuild the kernel.

链接问答记录

主要问答记录

Answer Number 问答标题 问题版本 已解决问题的版本
54546 HDMI 1.4/2.0 Receiver (RX) Subsystem - Release Notes and Known Issues for the Vivado 2015.1 tool and later versions N/A N/A
AR# 68227
日期 10/23/2020
状态 Active
Type 综合文章
IP