HDMI Resolutions testing

I think these modifications can be apply to VIM2 as well as VIM.
But you said the VIM work well even it hasn’t apply these patch. :sweat:

--- a/drivers/amlogic/display/osd/osd_fb.c
+++ b/drivers/amlogic/display/osd/osd_fb.c
@@ -2581,12 +2581,10 @@ static int osd_probe(struct platform_device *pdev)
                        if (ret)
                                osd_log_info("not found display_size_default\n");
                        else {
-                               fb_def_var[index].xres = var_screeninfo[0];
-                               fb_def_var[index].yres = var_screeninfo[1];
-                               fb_def_var[index].xres_virtual =
-                                       var_screeninfo[2];
-                               fb_def_var[index].yres_virtual =
-                                       var_screeninfo[3];
+                               fb_def_var[index].xres = vinfo->width;
+                               fb_def_var[index].yres = vinfo->height;
+                               fb_def_var[index].xres_virtual = vinfo->width;
+                               fb_def_var[index].yres_virtual = vinfo->height*3;
                                fb_def_var[index].bits_per_pixel =
                                        var_screeninfo[4];
                                osd_log_info("init fbdev bpp is:%d\n",


diff --git a/drivers/amlogic/display/vout/vinfo.c b/drivers/amlogic/display/vout/vinfo.c
index d256e06..033aa378 100644
--- a/drivers/amlogic/display/vout/vinfo.c
+++ b/drivers/amlogic/display/vout/vinfo.c
@@ -132,7 +132,7 @@ enum vmode_e vmode_name_to_mode(const char *str)
        enum vmode_e vmode = VMODE_MAX;
 
        for (i = 0; i < ARRAY_SIZE(vmode_match_table); i++) {
-               if (strstr(str, vmode_match_table[i].name)) {
+               if (!strncmp(str, vmode_match_table[i].name,strlen(vmode_match_table[i].name))) {
                        vmode = vmode_match_table[i].mode;
                        break;
                }
(END)


2 Likes

I shall test it on VIM1 too.

I tested the last fix.
Yes, it does work!!! But VIM1 work is fine without this fix :grinning:

I also tested 1024*600 on VIM2 with last fix, and it has bug - green screel as wrote Albert

But VIM1 work fine and it has not green screen!!! :thinking:

1 Like

Hello, Terri!

One problem is solved and the image no longer collapses … But another problem has emerged in 800x480: the image is stretched horizontally by the edges of the screen, and if 100% is set in the screen settings, then the picture is aligned, but a black inactive region appears on the right side.

C:\ADB>adb connect 192.168.0.106

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully *
    connected to 192.168.0.106:5555

C:\ADB>adb devices
List of devices attached
192.168.0.106:5555 device

C:\ADB>adb shell
kvim2:/ $ su
kvim2:/ # cat /sys/class/display
tmp-mksh: cat: /sys/class/display: Is a directory
1|kvim2:/ # wm size
Physical size: 800x480
kvim2:/ # fbset

mode “800x480-0”
# D: 0.000 MHz, H: 0.000 kHz, V: 0.000 Hz
geometry 800 480 800 1440 32
timings 0 0 0 0 0 0 85
accel false
rgba 8/0,8/8,8/16,8/24
endmode

kvim2:/ # getbootenv
[EnableSelinux]: [permissive]
[active_slot]: [_a]
[baudrate]: [115200]
[bcb_cmd]: [get_valid_slot;]
[boot_part]: [boot]
[bootcmd]: [run storeboot]
[bootdelay]: [1]
[cmdline_keys]: [if keyman init 0x1234; then if keyman read usid ${loadaddr} str
; then setenv bootargs ${bootargs} androidboot.serialno=${usid};setenv serial ${
usid};fi;kbi ethmac;setenv bootargs ${bootargs} mac=${eth_mac} androidboot.mac=$
{eth_mac};if keyman read deviceid ${loadaddr} str; then setenv bootargs ${bootar
gs} androidboot.deviceid=${deviceid};fi;fi;]
[combine_key]: [saradc open 0;if saradc get_in_range 0x0 0x1f; then echo Detect
function key;if gpio input GPIOAO_2; then echo Detect combine keys;store init 3;
fi;fi;]
[cvbs_drv]: [0]
[cvbsmode]: [576cvbs]
[display_bpp]: [16]
[display_color_bg]: [0]
[display_color_fg]: [0xffff]
[display_color_index]: [16]
[display_height]: [1080]
[display_layer]: [osd1]
[display_width]: [1920]
[dtb_mem_addr]: [0x1000000]
[ethaddr]: [00:15:18:01:81:31]
[factory_reset_poweroff_protect]: [echo wipe_data=${wipe_data}; echo wipe_cache=
${wipe_cache};if test ${wipe_data} = failed; then run init_display; run storearg
s;if mmcinfo; then run recovery_from_sdcard;fi;if usb start 0; then run recovery
from_udisk;fi;run recovery_from_flash;fi; if test ${wipe_cache} = failed; then
run init_display; run storeargs;if mmcinfo; then run recovery_from_sdcard;fi;if
usb start 0; then run recovery_from_udisk;fi;run recovery_from_flash;fi; ]
[fb_addr]: [0x3d800000]
[fb_height]: [1080]
[fb_width]: [1920]
[fdt_high]: [0x20000000]
[firstboot]: [0]
[gatewayip]: [10.18.9.1]
[hdmimode]: [800x480p60hz]
[hostname]: [arm_gxbb]
[init_display]: [osd open;osd clear;imgread pic logo bootup $loadaddr;bmp displa
y $bootup_offset;bmp scale]
[initargs]: [rootfstype=ramfs init=/init console=ttyS0,115200 no_console_suspend
earlyprintk=aml-uart,0xc81004c0 ramoops.pstore_en=1 ramoops.record_size=0x8000
ramoops.console_size=0x4000 ]
[ipaddr]: [10.18.9.97]
[jtag]: [disable]
[loadaddr]: [1080000]
[netmask]: [255.255.255.0]
[outputmode]: [800x480p60hz]
[preboot]: [run bcb_cmd; run factory_reset_poweroff_protect;run upgrade_check;ru
n init_display;run storeargs;run combine_key;run upgrade_key;run vim2_check;run
wol_init;forceupdate;run switch_bootmode;]
[recovery_from_flash]: [setenv bootargs ${bootargs} aml_dt=${aml_dt} recovery_pa
rt={recovery_part} recovery_offset={recovery_offset};if itest ${upgrade_step} ==
3; then if ext4load mmc 1:2 ${dtb_mem_addr} /recovery/dtb.img; then echo cache
dtb.img loaded; fi;if ext4load mmc 1:2 ${loadaddr} /recovery/recovery.img; then
echo cache recovery.img loaded; wipeisb; bootm ${loadaddr}; fi;else fi;if imgrea
d kernel ${recovery_part} ${loadaddr} ${recovery_offset}; then wipeisb; bootm ${
loadaddr}; fi;]
[recovery_from_sdcard]: [setenv bootargs ${bootargs} aml_dt=${aml_dt} recovery_p
art={recovery_part} recovery_offset={recovery_offset};if fatload mmc 0 ${loadadd
r} aml_autoscript; then autoscr ${loadaddr}; fi;if fatload mmc 0 ${loadaddr} rec
overy.img; then if fatload mmc 0 ${dtb_mem_addr} dtb.img; then echo sd dtb.img l
oaded; fi;wipeisb; bootm ${loadaddr};fi;]
[recovery_from_udisk]: [setenv bootargs ${bootargs} aml_dt=${aml_dt} recovery_pa
rt={recovery_part} recovery_offset={recovery_offset};if fatload usb 0 ${loadaddr
} aml_autoscript; then autoscr ${loadaddr}; fi;if fatload usb 0 ${loadaddr} reco
very.img; then if fatload usb 0 ${dtb_mem_addr} dtb.img; then echo udisk dtb.img
loaded; fi;wipeisb; bootm ${loadaddr};fi;]
[recovery_offset]: [0]
[recovery_part]: [recovery]
[sdc_burning]: [sdc_burn ${sdcburncfg}]
[sdcburncfg]: [aml_sdc_burn.ini]
[serverip]: [10.18.9.113]
[storeargs]: [setenv bootargs ${initargs} androidboot.selinux=${EnableSelinux} l
ogo=${display_layer},loaded,${fb_addr},${outputmode} maxcpus=${maxcpus} vout=${o
utputmode},enable hdmimode=${hdmimode} cvbsmode=${cvbsmode} hdmitx=${cecconfig}
ddr_size=${ddr_size} cvbsdrv=${cvbs_drv} pq=${pq} androidboot.firstboot=${first
boot} jtag=${jtag}; setenv bootargs ${bootargs} androidboot.hardware=amlogic;run
cmdline_keys;setenv bootargs ${bootargs} androidboot.slot_suffix=${active_slot}
;]
[storeboot]: [if imgread kernel ${boot_part} ${loadaddr}; then bootm ${loadaddr}
; fi;run update;]
[switch_bootmode]: [get_rebootmode;if test ${reboot_mode} = factory_reset; then
run recovery_from_flash;else if test ${reboot_mode} = update; then run update;el
se if test ${reboot_mode} = cold_boot; then else if test ${reboot_mode} = fastbo
ot; then fastboot;fi;fi;fi;fi;]
[try_auto_burn]: [update 700 750;]
[update]: [run usb_burning; run sdc_burning; if mmcinfo; then run recovery_from

sdcard;fi;if usb start 0; then run recovery_from_udisk;fi;run recovery_from_flas
h;]
[upgrade_check]: [echo upgrade_step=${upgrade_step}; if itest ${upgrade_step} ==
3; then run init_display; run storeargs; run update;else fi;]
[upgrade_key]: [if gpio input GPIOAO_2; then echo detect upgrade key; sleep 3;if
gpio input GPIOAO_2; then run update; fi;fi;]
[upgrade_step]: [2]
[usb_burning]: [update 1000]
[vim2_check]: [saradc open 1;if saradc get_in_range 0x1a0 0x220; then echo Produ
ct checking: pass!;else if saradc get_in_range 0x0 0x1cf; then echo Product chec
king: fail!; sleep 5; reboot;fi;fi;]
[wipe_cache]: [successful]
[wipe_data]: [successful]
[wol_init]: [kbi powerstate;kbi trigger wol r;setenv bootargs ${bootargs} wol_en
able=${wol_enable};if test ${power_state} = 1; then kbi trigger wol w 1;gpio set
GPIODV_2;fi;]
[1080p60hz_deepcolor]: [rgb,8bit]
[colorattribute]: [444,8bit]
[1080p_x]: [0]
[1080p_y]: [0]
[1080p_w]: [1920]
[1080p_h]: [1080]
[is.bestmode]: [false]
[800x480p60hz_deepcolor]: [444,8bit]
[800x480p60hz_x]: [0]
[800x480p60hz_y]: [0]
[800x480p60hz_w]: [720]
[800x480p60hz_h]: [480]
[1024x600p60hz_deepcolor]: [rgb,8bit]
[1024x600p60hz_x]: [0]
[1024x600p60hz_y]: [0]
[1024x600p60hz_w]: [1024]
[1024x600p60hz_h]: [600]
[1080i60hz_deepcolor]: [rgb,8bit]
[1080i_x]: [0]
[1080i_y]: [0]
[1080i_w]: [1920]
[1080i_h]: [1080]
kvim2:/ #

Log in I attach:
Logcat
Dmesg

Thanks, best regards, Alex/

1 Like

Hi, terry!
what do you think of that and green screen?

1 Like

on davemf firmware after “cold start” i seen this
after reboot - everything is ok…
when the problem is observed, did dmesg, it’s here

It was sloved with last patch

Terry, What about last bugs?

1 Like

Sorry, davemf.
About the green screen bug for 1024x768 and 1024x600 hdmi output, I haven’t any idea for it now.
And I will put this into my work list but need some times to fix it.

2 Likes

1024x600 has green screen.
But 1024x768 has bug - >


1 Like

Hi, terry!
I use 1280*800 resolution, it work fine.
In addition to the bugs above, there is another…

Cold start - when the computer is turned off for more than some hours.
The screen resolution is set arbitrarily after the cold start. After rebooting, it returns to the previously selected resolution.

Also this happens if you turn khadas without monitor.

Can you provide some informations for me? Thanks

# adb shell
# cat /sys/class/display/mode
# wm size
# fbset
# getbootenv
# logcat
# dmesg

@london told about this bug.

dmesg on post

I’ll create new logs soon.

Hello, terry!
These are my logs (result of all commands in one file) with adb, when image on the screen seen like this.

another time, with the same image on the screen, the output of fbset was different (but, fbset is same when the image on the screen is correct):
kvim2:/ # fbset
fbset

mode “1280x720-0”
# D: 0.000 MHz, H: 0.000 kHz, V: 0.000 Hz
geometry 1280 720 1280 2160 32
timings 0 0 0 0 0 0 0
accel false
rgba 8/0,8/8,8/16,8/24
endmode

1 Like

Hi, terry!
@london maked all logs.

london, thank you for help!

Hi all, I’m new to Khadas vim platform,
I have a custom VR HMD and vim2 MAX dev board, the HMD have special HDMI timing:

[ 7598.006] (II) NVIDIA(GPU-0): Validating Mode “2880x1440_68”:
[ 7598.006] (II) NVIDIA(GPU-0): Mode Source: EDID
[ 7598.006] (II) NVIDIA(GPU-0): 2880 x 1440 @ 68 Hz
[ 7598.006] (II) NVIDIA(GPU-0): Pixel Clock : 297.00 MHz
[ 7598.006] (II) NVIDIA(GPU-0): HRes, HSyncStart : 2880, 2906
[ 7598.006] (II) NVIDIA(GPU-0): HSyncEnd, HTotal : 2918, 2998
[ 7598.006] (II) NVIDIA(GPU-0): VRes, VSyncStart : 1440, 1444
[ 7598.006] (II) NVIDIA(GPU-0): VSyncEnd, VTotal : 1446, 1449
[ 7598.006] (II) NVIDIA(GPU-0): H/V Polarity : +/+
[ 7598.006] (II) NVIDIA(GPU-0): Mode “2880x1440_68” is valid.

Test env: Ubuntu-mate 16.04
Kernel Porting branch: ubuntu-4.9 from GitHub - khadas/linux: Linux kernel for Khadas VIMs & Edges
U-boot branch: MultiOS from GitHub - khadas/u-boot: U-Boot for Khadas VIMs & Edge

I study the u-boot and kernel driver for filling these parameter in hdmitx module to create special mode,
but I stuck at video encoder register assignment inside “enc_cfg_hw.c” , I don’t know how to assign these values :slightly_frowning_face: (here tvregs_1440p_68hz is copy from tvregs_1080p, for test and failed)

Code Segments

static const struct reg_s tvregs_1440p_68hz = {
{P_ENCP_VIDEO_EN, 0},
{P_ENCI_VIDEO_EN, 0},
{P_ENCP_VIDEO_FILT_CTRL, 0x1052},
{P_VENC_DVI_SETTING, 0x0001},
{P_ENCP_VIDEO_MODE, 0x4040},
{P_ENCP_VIDEO_MODE_ADV, 0x0018},
{P_ENCP_VIDEO_YFP1_HTIME, 140},
{P_ENCP_VIDEO_YFP2_HTIME, 2060},
{P_ENCP_VIDEO_MAX_PXCNT, 2199},
{P_ENCP_VIDEO_HSPULS_BEGIN, 2156},
{P_ENCP_VIDEO_HSPULS_END, 44},
{P_ENCP_VIDEO_HSPULS_SWITCH, 44},
{P_ENCP_VIDEO_VSPULS_BEGIN, 140},
{P_ENCP_VIDEO_VSPULS_END, 2059},
{P_ENCP_VIDEO_VSPULS_BLINE, 0},
{P_ENCP_VIDEO_VSPULS_ELINE, 4},
{P_ENCP_VIDEO_HAVON_BEGIN, 148},
{P_ENCP_VIDEO_HAVON_END, 2067},
{P_ENCP_VIDEO_VAVON_BLINE, 41},
{P_ENCP_VIDEO_VAVON_ELINE, 1120},
{P_ENCP_VIDEO_HSO_BEGIN, 44},
{P_ENCP_VIDEO_HSO_END, 2156},
{P_ENCP_VIDEO_VSO_BEGIN, 2100},
{P_ENCP_VIDEO_VSO_END, 2164},
{P_ENCP_VIDEO_VSO_BLINE, 0},
{P_ENCP_VIDEO_VSO_ELINE, 5},
{P_ENCP_VIDEO_MAX_LNCNT, 1124},
{P_VPU_VIU_VENC_MUX_CTRL, 0xA},
{P_VENC_VIDEO_PROG_MODE, 0x100},
{P_ENCI_VIDEO_EN, 0},
{P_ENCP_VIDEO_EN, 1},
{MREG_END_MARKER, 0},
};

static struct vic_tvregs_set tvregsTab = {

{HDMI_3840x2160p50_16x9_Y420, tvregs_4k2k_25hz},
{HDMI_2880x1440p68_2x1, tvregs_1440p_68hz},
};

In hdmi_parameters.c :

static struct hdmi_format_para fmt_para_2880x1440p68_2x1 = {
.vic = HDMI_2880x1440p68_2x1,
.name = “2880x1440p68hz”,
.sname = “1440p68hz”,
.pixel_repetition_factor = 0,
.progress_mode = 1,
.scrambler_en = 0,
.tmds_clk_div40 = 0,
.tmds_clk = 297000,
.timing = {
.pixel_freq = 297000,
.frac_freq = 296703,
.h_freq = 99066,
.v_freq = 68368,
.vsync_polarity = 1,
.hsync_polarity = 1,
.h_active = 2880,
.h_total = 2998,
.h_blank = 118,
.h_front = 26,
.h_sync = 12,
.h_back = 80,
.v_active = 1440,
.v_total = 1449,
.v_blank = 9,
.v_front = 4,
.v_sync = 2,
.v_back = 3,
.v_sync_ln = 1,
},
.hdmitx_vinfo = {
.name = “1440p68hz”,
.mode = VMODE_HDMI,
.width = 2880,
.height = 1440,
.field_height = 1440,
.aspect_ratio_num = 2,
.aspect_ratio_den = 1,
.sync_duration_num = 68,
.sync_duration_den = 1,
.video_clk = 297000000,
.viu_color_fmt = COLOR_FMT_YUV444,
},
};

in u-boot testing:

kvim2#hdmitx get_preferred_mode
edid preferred_mode is 1440p68hz[109]
Saving Environment to aml-storage…
mmc env offset: 0x27400000
Writing to MMC(1)… done
kvim2#hdmitx output 1440p68hz
set hdmitx VIC = 109
config HPLL = 2970000
HPLL: 0xc000027b
config HPLL done
j = 4 vid_clk_div = 1
hdmitx: set enc for VIC: 109
rx version is 1.4 or below div=10
hdmtix: set audio
hdmitx phy setting done

After Patch and driver modify, I can’t get HMD works, maybe I missing some Parameter or code to
drive HDMI timing?

Edit: Add my patch:
kernel: 0001-Add-New-timing-mode-for-2880x1440-68hz-HMD.patch - Google Drive
u-boot: 0001-u-boot-Add-new-timing-for-2880x1440-68hz-HMD-testing.patch - Google Drive

Hi, terry!
I build new ROM for VIM1 on source V180206 with this patch and VIM1 has new bug - green screen on 1024*600 like VIM2!
But VIM1 does not has “green screen” and “cold start” bugs on old source with last putch!!!

How to fix it?
And how to fix “cold start” bug?

1 Like

Hi, terry!!!

I did an experiment, I built ROM N712 for VIM2 of old source codes (September - October 2017), like VIM1. Applied the latest patches.

All resolutions work perfect on VIM2!!! It has not “green screen” bug!!!

What is done in the new source code V180206, which leads to the appearance of bugs???

How to add DVB boart support on old source?

1 Like

I updated source code from official amlogic on V180206. There’s a lot of difference between V171029 and V180206.

You can download the DVB patch and try to add support for it. Thanks

1 Like

Hi, terry!
I’ve been testing ROM V171029 for a week.
It has “cold start” bug like ROM V180206.
That this may be? Any idea how to fix this?

@Terry
Where are you?
What about HDMI bugs? And what about Oreo for VIM2?