Vim3 Android Pie Force Resolution and Ignore EDID

Hi all, is there’s any way to force display resolution on Android Pie vim3 and ignore EDID,

The case is, I sometimes use vim on display that have bad hpd/EDID implementation - so it can show proper 4k30hz resolution - but sometimes it fallback to save-mode 1080p (after it fallback to 1080p, it won’t get back to 4k30 after reboot)

So my requirement is to force vim to use specified resolution and ignore whatever EDID value.

I’ve tried to write env value on uboot

setenv outputmode 2160p30hz
setenv hdmimode 2160p30hz
setenv ubootenv.var.hdmimode 2160p30hz
setenv ubootenv.var.outputmode 2160p30hz
setenv ubootenv.var.is.bestmode 2160p30hz
setenv hdmi_read_edid 0
setenv disablehpd 1
setenv hpd_state 0
setenv hpd 0
setenv display_autodetect 0
saveenv

But it seems that it still can sometimes fallback to 1080p mode - and change the above value.

In old pie rom I can change vendor/amlogic/common/frameworks/services/ DisplayMode.cpp & DisplayMode.h by adding code that force my specified resolution

    // i add a `prop` key to force the resolution 
    pSysWrite->getPropertyString(PROP_FALLBACK_EDID_MODE, fallbackEdidMode, "");
    if (strlen(fallbackEdidMode) != 0) {
        // fallback is set!
        strcpy(mode, fallbackEdidMode);
        SYS_LOGI("getBestHdmiMode - set HDMI to fallback edid mode: %s\n", fallbackEdidMode);
    }        

But it does not works on the new pie ROM.

Anyone can kindly help me point to the right place to enforce resolution and ignore EDID? thanks

Did you want to disable the best mode for hdmi output? You can try to execute following commands with usb adb.

setbootenv ubootenv.var.is.bestmode  false
setbootenv ubootenv.var.hdmimode 1080p60hz
setbootenv ubootenv.var.outputmode 1080p60hz
echo 1080p60hz > /sys/class/display/mode
1 Like

Hi Terry,

Yes i’ve tried that. And it can switch to 2160p30hz

setbootenv ubootenv.var.is.bestmode  false
setbootenv ubootenv.var.hdmimode 2160p30hz
setbootenv ubootenv.var.outputmode 2160p30hz
echo 2160p30hz > /sys/class/display/mode

But my display not a monitor, it have unusual EDID — so intermittently it can fallback to 1080p60hz (failsave resolution) - I want it to be always forced to 2160p30hz and ignore EDID capabilities

on previous code - i modify vendor/amlogic/common/frameworks/services/ DisplayMode.cpp - but it no longer works

@azureru You can make the following modifications, which should meet your requirements.

hlm@Server:/users/hlm/4_VIM3/common$ git diff
diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
index 7e30eda..0fdef9d 100755
--- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
+++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
@@ -2221,6 +2221,10 @@ static ssize_t show_disp_cap(struct device *dev,
        enum hdmi_vic vic;
        char mode_tmp[32];
+       pos = snprintf(buf, PAGE_SIZE, "2160p30hz\n");
+       printk("force 2160p30hz out\n");
+       return pos;
+
3:48
hlm@Server:/users/hlm/4_VIM3/vendor/amlogic/common/frameworks$ git diff
diff --git a/services/systemcontrol/DisplayMode.cpp b/services/systemcontrol/DisplayMode.cpp
index 53c4ebc..3d42a10 100755
--- a/services/systemcontrol/DisplayMode.cpp
+++ b/services/systemcontrol/DisplayMode.cpp
@@ -205,7 +205,10 @@ void DisplayMode::init() {
     getBootEnv(UBOOTENV_REBOOT_MODE, mRebootMode);
     SYS_LOGI("reboot_mode :%s\n", mRebootMode);
-
+       setBootEnv(UBOOTENV_HDMIMODE, "2160p30hz");
+       setBootEnv(UBOOTENV_OUTPUTMODE, "2160p30hz");
+       setBootEnv(UBOOTENV_ISBESTMODE, "2160p30hz");
+       SYS_LOGI("hlm-ubootenv.var.outputmode :2160p30hz\n");
        if(!getBootEnv(UBOOTENV_ISBESTMODE, isBestMode)){
                setBootEnv(UBOOTENV_ISBESTMODE, "false");
        }
2 Likes