RK3288 7.1在Auto模式下限制HDMI输出显示范围

找了很多博客,发现有些是默认,有些是加属性。发现在这个平台上没用,我这边亲测的有效的方法如下:

在hardware/rockchip\hwcomposer\hwcomposer.cpp

     hwcomposer.cpp

在 

/**
 * sys.3d_resolution.main 1920x1080p60-114693:148500
 * width x height p|i refresh-flag:clock
 */
static int update_display_bestmode(hwc_drm_display_t *hd, int display, DrmConnector *c)

方法下这个逻辑这里加这样的判断限制住就可以了

    if (len == 10 && width != 0 && height != 0) {
      for (const DrmMode &conn_mode : c->modes()) {
        if (conn_mode.equal(width, height, vrefresh, hsync_start, hsync_end,
                            htotal, vsync_start, vsync_end, vtotal, flags)) {
          c->set_best_mode(conn_mode);
          return 0;
        }
      }
    }

    uint32_t ivrefresh;
    len = sscanf(resolution, "%dx%d%c%d", &width, &height, &val, &ivrefresh);

    if (val == 'i')
      interlaced = true;
    else
      interlaced = false;
    if (len == 4 && width != 0 && height != 0) {
      for (const DrmMode &conn_mode : c->modes()) {
        if (conn_mode.equal(width, height, ivrefresh, interlaced)) {
          c->set_best_mode(conn_mode);
          return 0;
        }
      }
    }
  }

  for (const DrmMode &conn_mode : c->modes()) {
    if (conn_mode.type() & DRM_MODE_TYPE_PREFERRED) {
      c->set_best_mode(conn_mode);
      return 0;
    }
    else {
    if(conn_mode.h_display() <= 1920 && conn_mode.v_display() <= 1080){//add by zhangrui start
          temp = conn_mode.h_display()*conn_mode.v_display();
          if(MaxResolution <= temp)
            MaxResolution = temp;
      }//add by zhangrui end
    }
  }
  for (const DrmMode &conn_mode : c->modes()) {
    if(MaxResolution == conn_mode.h_display()*conn_mode.v_display()) {
      c->set_best_mode(conn_mode);
      return 0;
    }
  }

  ALOGE("Error: Should not get here display=%d %s %d\n", display, __FUNCTION__, __LINE__);
  DrmMode mode;
  c->set_best_mode(mode);

  return -ENOENT;
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值