找了很多博客,发现有些是默认,有些是加属性。发现在这个平台上没用,我这边亲测的有效的方法如下:
在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;
}