高通UEFI研究[五]

高通UEFI显示部分函数研究:

1、显示环境变量QcomPkg/QcomTestPkg/DisplayApp/DisplayApp.c

EnvVarEntry EnvVarList[] =
{
  {L"DISABLEDISPLAY", sizeof(UINT8)},     // DISPLAY_VAR_DISABLEDISPLAY
  {L"DISPLAYCONFIG",  sizeof(UINT32)},    // DISPLAY_VAR_DISPLAYFLAGS
  {L"DISPLAYID",      sizeof(UINT32)},    // DISPLAY_VAR_DISPLAYID  
};

2、DisplayDxeInitialize调用MDPInit获取当前屏的硬件配置和屏的信息

3、MDPDetect 用于检测显示器是否存在以及支持的模式,通过XML, I2C or EDID,具体看xml配置。

    MDPDetect->MDPDetectPanel(QcomPkg/Library/MDPLib/MDPEDID.c)->XML_UpdateTag->MDPPlatformConfigure

4、MDPDetectExtPlugin  用于检测外部显示器信息ExtDisp_Init

     MDPDetectExtPlugin->ExtDisp_Init(直接返回成功)->ExtDisp_IsDisplayPlugged(直接返回0)

5、CheckPanelOverride  帮助程序功能,检查是否设置了面板替代并解析替代
字符串(如果设置),这个是处理fastboot oem panel name手动设置新的面板的处理流程,一般我们不会设置,走默认设置就可以了!

6、MDPSetProperty 此函数将配置特定的显示属性

     MDP_DISPLAY_PROPERTY_BACKLIGHT  设置背光

     MDP_DISPLAY_PROPERTY_FIRMWAREENV

     MDP_DISPLAY_PROPERTY_MODE_INFO              // 

     MDP_DISPLAY_PROPERTY_POWER_STATE          //缓存当前显示电源状态信息

     MDP_DISPLAY_PROPERTY_ABL_INTERFACE_INIT //   初始化数据变量 和 初始化显示上下文,稍后将用于为ABL创建面板配置字符串

7、MDP_DataPartitionInit  读取显示数据分区并设置引导服务变量

8、Display_Utils_Initialize  初始化数据变量 和 初始化显示上下文,稍后将用于为ABL创建面板配置字符串,这个函数主要会调用CheckTargetPanelSupport 获取受支持面板的列表并构建DT信息数组

9 、CheckTargetPanelSupport 主要调用MDPPlatformConfigure 获取面板信息,然后把下面的面板信息传给abl

typedef enum {
  MDPPLATFORM_PANEL_NONE =0x0,                            /* No panel specified                     */
  MDPPLATFORM_PANEL_SIM_VIDEO_PANEL,                      /* Single DSI video mode simulation panel */
  MDPPLATFORM_PANEL_SIM_DUALDSI_VIDEO_PANEL,              /* Dual DSI video mode simulation panel   */
  MDPPLATFORM_PANEL_SIM_CMD_PANEL,                        /* Single DSI CMD mode simulation panel */
  MDPPLATFORM_PANEL_SIM_DUALDSI_CMD_PANEL,                /* Dual DSI CMD mode simulation panel   */
  MDPPLATFORM_PANEL_SIM_DSC_375_CMD_PANEL,                /* Single DSI CMD mode with DSC 3.75 compression simulation panel */
  MDPPLATFORM_PANEL_SIM_DUAL_DSC_375_CMD_PANEL,           /* Dual DSI CMD mode with DSC 3.75 compression simulation panel   */
  MDPPLATFORM_PANEL_SHARP_4K_DSC_CMD,                     /* NT35950 4k command panel DSC mode      */
  MDPPLATFORM_PANEL_SHARP_4K_DSC_VIDEO,                   /* NT35950 4k video panel DSC mode        */
  MDPPLATFORM_PANEL_TRULY_WQXGA_DSC_CMD,                  /* Truly 2k cmd panel DSC mode single dsi     */
  MDPPLATFORM_PANEL_TRULY_WQXGA_DSC_VIDEO,                /* Truly 2k video panel DSC mode single dsi     */
  MDPPLATFORM_PANEL_TRULY_WQXGA_DUALDSI_CMD,              /* Truly 2k cmd panel non-DSC mode      */
  MDPPLATFORM_PANEL_TRULY_WQXGA_DUALDSI_VIDEO,            /* Truly 2k video panel non-DSC mode      */
  MDPPLATFORM_PANEL_SHARP_1080P_CMD,                      /* Sharp 1080p cmd panel non-DSC mode      */
  MDPPLATFORM_PANEL_SHARP_120HZ_1080P_CMD,                /* Sharp 120hz 1080p cmd panel non-DSC mode      */
  MDPPLATFORM_PANEL_SAMSUNG_WQHD_AMOLED_DSC_CMD,          /* Samsung mg2 wqhd amoled cmd panel DSC mode      */
  MDPPLATFORM_PANEL_SAMSUNG_1080P_AMOLED_DSC_CMD,         /* Samsung mg2 1080p amoled cmd panel DSC mode      */
  MDPPLATFORM_PANEL_SAMSUNG_720P_AMOLED_CMD,              /* Samsung mg2 720p amoled cmd panel non-DSC mode      */
  MDPPLATFORM_PANEL_SAMSUNG_WQHD_AMOLED_DUAL_CMD,         /* Samsung mg1 wqhd amoled dual cmd panel non-DSC mode      */
  MDPPLATFORM_PANEL_TRULY_1080P_VIDEO,                    /* Truly 1080P single dsi video mode      */
  MDPPLATFORM_PANEL_TRULY_1080P_CMD,                      /* Truly 1080P single dsi command mode    */
  MDPPLATFORM_PANEL_SHARP_WQHD_DUALDSI_CMD,               /* sharp wqhd dual dsi command mode */
  MDPPLATFORM_PANEL_SHARP_WQHD_DUALDSI_VIDEO,             /* sharp wqhd dual dsi video mode */
  MDPPLATFORM_PANEL_NT36850_TRULY_WQHD_CMD,               /* NT36850 Truly wqhd dual dsi command mode */
  MDPPLATFORM_PANEL_MAX
} MDPPlatformPanelType;

10、FUNCTION: panel_ConfigGPIO() 
  Initialize LCD panel GPIOs and PMICs

11、MDPPlatformConfigure 这个函数完成大部分的功能,屏的配置和获取信息最终都通过这个函数执行的。

函数原型MDP_Status MDPPlatformConfigure(MDP_Display_IDType eDisplayId, MDPPlatformConfigType eConfig, MDPPlatformParams *pPlatformParams)

参数1:

typedef enum
{
  MDP_DISPLAY_PRIMARY,                 /* Primary display */
  MDP_DISPLAY_SECONDARY,               /* Secondary display */
  MDP_DISPLAY_EXTERNAL,                /* External display */
  MDP_DISPLAY_MAX,
  MDP_DISPLAY_FORCE_32BIT = 0x7FFFFFFF
} MDP_Display_IDType;

参数2:

typedef enum
{
  MDPPLATFORM_CONFIG_GETPANELCONFIG = 0x0,               /* Retrieve panel configuration */
  MDPPLATFORM_CONFIG_POWERUP,                            /* Power up power grid */
  MDPPLATFORM_CONFIG_POWERDOWN,                          /* Power down power grid */
  MDPPLATFORM_CONFIG_GETPANELID,                         /* Return the panel identifier */
  MDPPLATFORM_CONFIG_SETBACKLIGHT,                       /* Set a brightness or backlight level */
  MDPPLATFORM_CONFIG_GETPLATFORMINFO,                    /* Return platform configuration information */
  MDPPLATFORM_CONFIG_SW_RENDERER,                        /* Return SW render mode information */
  MDPPLATFORM_CONFIG_RESETPANEL,                         /* Physical reset of the panel */
  MDPPLATFORM_CONFIG_SETGPIOSTATE,                       /* Set the state of a GPIO */
  MDPPLATFORM_CONFIG_GETPANELLIST,                       /* Get list of supported panels */
  MDPPLATFORM_CONFIG_GETPANELDTINFO,                     /* Get list of panels DT Info*/
  MDPPLATFORM_CONFIG_GETPANELSUPPORTFLAGS,               /* Check if a supplied panel is supported in bootloader */
  MDPPLATFORM_CONFIG_BYPASS,                             /* Configuration bypass */
  MDPPLATFORM_CONFIG_MAX
} MDPPlatformConfigType;
 

参数3:/* Union of panel properties passed to MDPPlatformConfigure() function
*/
typedef union
{
    MDPPlatformPanelInfo       sPlatformPanel;      /* MDPPLATFORM_CONFIG_GETPANELCONFIG(Primary) */
    HDMI_PinInfo               sHDMIPinConfig;      /* MDPPLATFORM_CONFIG_GETPANELCONFIG(HDMI) */
    DP_InterfaceInfo           sDPConfig;           /* MDPPLATFORM_CONFIG_GETPANELCONFIG(DP) */
    BacklightConfigType        sBacklightConfig;    /* MDPPLATFORM_CONFIG_SETBACKLIGHT */
    MDPPlatformInfo            sPlatformInfo;       /* MDPPLATFORM_CONFIG_GETPLATFORMINFO */
    MDPPlatformPanelResetInfo  sPlatformPanelReset; /* MDPPLATFORM_CONFIG_RESETPANEL */
    PowerConfigType            sPowerConfig;        /* MDPPLATFORM_CONFIG_POWERUP/MDPPLATFORM_CONFIG_POWERDOWN */
    GpioStateType              sGPIOState;          /* MDPPLATFORM_CONFIG_SETGPIOSTATE */
    PanelListType              sPanelList;          /* MDPPLATFORM_CONFIG_GETPANELLIST */
    PanelInfoType             *psPanelDTInfo;       /* MDPPLATFORM_CONFIG_GETPANELDTINFO */
    PanelSupportType           sPanelSupport;       /* MDPPLATFORM_CONFIG_GETPANELSUPPORTFLAGS */
} MDPPlatformParams;

MDPPlatformConfigure分析

MDP_Status MDPPlatformConfigure(MDP_Display_IDType eDisplayId, MDPPlatformConfigType eConfig, MDPPlatformParams *pPlatformParams)
{
  MDP_Status               eStatus               = MDP_STATUS_OK;
  uint32                   uPanelID              = 0;
  uint32                   uPlatformSubtype      = 0;
  uint32                   uHardwareVersionMajor = 0;
  uint32                   uHardwareVersionMinor = 0;
  MDPPlatformConfigType    ePlatformConfig;
  PlatformDSIDetectParams  *pPanelList           = NULL;
  uint32                   uPanelCnt;

  /* Static information, initial once during the first call */
  static bool32                 bInitFlag        = FALSE;
  static MDPPlatformInfo        sPlatformInfo;
  static Panel_PowerCtrlParams  sPanelPowerCtrl;

  if (FALSE == bInitFlag)
  {
    MDP_OSAL_MEMZERO(&sPlatformInfo,    sizeof(MDPPlatformInfo));
    MDP_OSAL_MEMZERO(&sPanelPowerCtrl,  sizeof(Panel_PowerCtrlParams));
    bInitFlag = TRUE;
  }

  // Get remapped platform configuration enum
  ePlatformConfig = PlatformConfigRemap(&sPlatformInfo, eConfig); //在SW渲染模式下,绕过操纵硬件的所有配置,绕过gpio  背光等硬件配置
      
  // Read the platform ID once
  if (FALSE == sPlatformInfo.bPlatformDetected)
  {
    if (MDP_STATUS_OK == ReadPlatformIDAndChipID(&sPlatformInfo.sEFIPlatformType, &sPlatformInfo.sEFIChipSetId, &sPlatformInfo.sEFIChipSetFamily))//读取平台硬件信息
    {
      uint32 uTemp                    = 0;
      sPlatformInfo.bPlatformDetected = TRUE;

      // Read the display panel ID override
      if (MDP_STATUS_OK == MDP_GetEnvironmentVariable(L"DISPLAYID", &uTemp, sizeof(uTemp)))// 检测用户是否修改屏
      {
        if (uTemp > 0)
        {
          DEBUG((EFI_D_ERROR, "DisplayDxe: Panel override enabled (ID:0x%x)\n", uTemp));
          sPlatformInfo.uPanelIdOverride =  uTemp;
        }
      }
    }

    /*
     * Napali QRD device panels need 180 inverted
     */
    if ((sPlatformInfo.sEFIChipSetFamily == EFICHIPINFO_FAMILY_SDM845) &&
        (sPlatformInfo.sEFIPlatformType.platform == EFI_PLATFORMINFO_TYPE_QRD))
    {
          sPlatformInfo.uPanelOrientationOverride = MDP_ROTATE_180;
    }

    // Parse sub-revision specific info to determine the QRD platform type
    uPlatformSubtype      = sPlatformInfo.sEFIPlatformType.subtype         & 0xFF;
    uHardwareVersionMajor = (sPlatformInfo.sEFIPlatformType.version >> 16) & 0xFF;
    uHardwareVersionMinor = sPlatformInfo.sEFIPlatformType.version         & 0xFF;
  }
  
  switch (ePlatformConfig)
  {
  case MDPPLATFORM_CONFIG_SW_RENDERER:
  
    if (NULL == pPlatformParams)
    {
      eStatus = MDP_STATUS_BAD_PARAM;
    }
    else if (TRUE == sPlatformInfo.bSWRender)
    {
      // SW Render mode is enabled already, just return the status
      pPlatformParams->sPlatformInfo.bSWRender = TRUE;
    }
    else if ((EFI_PLATFORMINFO_TYPE_UNKNOWN == sPlatformInfo.sEFIPlatformType.platform) ||
             (EFI_PLATFORMINFO_TYPE_VIRTIO  == sPlatformInfo.sEFIPlatformType.platform) ||
             (EFI_PLATFORMINFO_TYPE_RUMI    == sPlatformInfo.sEFIPlatformType.platform) ||
             (TRUE == pPlatformParams->sPlatformInfo.bSWRenderOverrride) ||
             (TRUE == PcdGetBool(PcdDisplayForceSwRenderer)))
    {
      // Force SW render mode for emulation and unknown platforms
      pPlatformParams->sPlatformInfo.bSWRender = TRUE;
      // Store that an override has been requested by the caller
      sPlatformInfo.bSWRenderOverrride         = pPlatformParams->sPlatformInfo.bSWRenderOverrride;
      // Cache that SW Rendering is enabled
      sPlatformInfo.bSWRender                  = TRUE;
      DEBUG((EFI_D_ERROR, "DisplayDxe: SW renderer mode enabled!\n"));
    }
    else
    {
      // Force SW render mode off
      sPlatformInfo.bSWRender                  = FALSE;      
      // Report SW render mode is disabled
      pPlatformParams->sPlatformInfo.bSWRender = FALSE;
    }
    break;
  case MDPPLATFORM_CONFIG_GETPANELCONFIG:  //获取屏配置信息
    {
      if (NULL == pPlatformParams)
      {
        eStatus = MDP_STATUS_BAD_PARAM;
      }
      else
      {
        // Retrieve panel configuration (could be dependent on the interface)
        switch (eDisplayId)
        {
        case MDP_DISPLAY_PRIMARY:
          
          pPlatformParams->sPlatformPanel.uDefaultVendor   = 0;
          pPlatformParams->sPlatformPanel.uDefaultRevision = 0;
          pPlatformParams->sPlatformPanel.uPanelId         = 0;
          pPlatformParams->sPlatformPanel.uPowerGridId     = sPanelPowerCtrl.ePMICSecondaryPower[eDisplayId];
          pPlatformParams->sPlatformPanel.pPanelXMLConfig  = NULL;
  
          if (TRUE == Panel_CheckOverride(eDisplayId, pPlatformParams))
          {
            //Use configuration set by panel override
          }
          else if (TRUE == sPlatformInfo.bSWRender)
          {
            //use dummy panel for sw rendering
            pPlatformParams->sPlatformPanel.pPanelXMLConfig  = (int8 *)dummy_xmldata;
            pPlatformParams->sPlatformPanel.uConfigSize      = sizeof(dummy_xmldata);
            pPlatformParams->sPlatformPanel.eSelectedPanel   = MDPPLATFORM_PANEL_NONE;
          }
          else
          {
            // Report the proper information depending on the display.
            switch (sPlatformInfo.sEFIPlatformType.platform)
            {
            case EFI_PLATFORMINFO_TYPE_CDP:
            case EFI_PLATFORMINFO_TYPE_MTP:
            case EFI_PLATFORMINFO_TYPE_QRD:
       剩余代码省略.........................

}

 

 

  • 0
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值