Rock Pi 4 screen resolution on Android 9

Hello everybody. I want to use Rock Pi 4 with a display having an aspect ratio of 16x10. But in the list of permissions selection I do not need (1280x800). I came across the following instruction, but apparently it doesn’t work for Rock Pi 4 or I did something wrong. The required file “drivers/video/rockchip/hdmi/hdmi-lcdc.c” is not there, but it was similar “kernel/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c”.
Here is the resulting config
I added the following block (203-224):

    .mode = {
        .name = "1280x800p@60Hz",
        .refresh = 60,
        .xres = 1280,
        .yres = 800,
        .pixclock = 83500000,
        .left_margin = 200,
        .right_margin = 72,
        .upper_margin = 22,
        .lower_margin = 3,
        .hsync_len = 128,
        .vsync_len = 6,
        .sync = 0,
        .vmode = 0,
        .flag = 0,
    },
    .vic = HDMI_VIDEO_DMT | 10,
    .vic_2nd = 0,
    .pixelrepeat = 1,
    .interface = OUT_P888,
    },

Please tell me how to add the desired resolution to the list for Android 9?

You also need to add it in
/device/rockchip/common/resolution_white.xml file to show in Android.
Or with root rights replace in /system/usr/share/resolution_white.xml

Since Android 8, the kernel driver is in kernel/drivers/gpu/drm now and not in /drivers/video/rockchip anymore.

Thank you for answer. Do you know how to find parameters in this file? Here they are slightly different than rockchip-hdmi-lcdc.c

	<resolution> <!-- 1280x720P60 -->
		<clock>74250</clock>
		<hdisplay>1280</hdisplay>
		<hsync_start>1390</hsync_start>
		<hsync_end>1430</hsync_end>
		<htotal>1650</htotal>
		<hskew>0</hskew>
		<vdisplay>720</vdisplay>
		<vsync_start>725</vsync_start>
		<vsync_end>730</vsync_end>
		<vtotal>750</vtotal>
		<vscan>0</vscan>
		<vrefresh>60</vrefresh>
		<flags>5</flags>
		<vic>4</vic>
	</resolution>

And also, I couldn’t find which file to modify in kernel/drivers/gpu/drm. I looked at all *.c files in the rockchip folder and didn’t find anything that at least somehow resembled a file hdmi-lcdc.c. Also in the folder drm I did not find a some file with “lcd” in the name.

You can read 4.4, 6.4

You could also remove the resolution_white.xml file to see all resolutions added to the kernel.

If I delete resolution_white.xml - The necessary screen resolution appears. But the dock menu moves from the wide (bottom) to the narrow (right) side. If the file is returned to its place, it disappears again. No matter how it changes the values in the file - resolution does not appear.
This is how I calculated the parameters. The only thing I did not quite understand how to fill out hskew, vscan, flags, vic:

	<resolution> <!-- 1280x800P60 -->
		<clock>83500</clock> <!-- Pxl Clock -->
		<hdisplay>1280</hdisplay> <!-- H Active Pxl -->
		<hsync_start>1352</hsync_start> <!-- 1280 (H Active Pxl) + 72 (H Sync Offset) -->
		<hsync_end>1480</hsync_end> <!-- 1280 (H Active Pxl) + 72 (H Sync Offset) + 128 (H Sync Width) -->
		<htotal>1680</htotal> <!-- 1280 (H Active Pxl) + 400 (H Blank) -->
		<hskew>0</hskew>
		<vdisplay>800</vdisplay> <!-- V Active Pxl -->
		<vsync_start>803</vsync_start> <!-- 800 (V Active Pxl) + 3 (V Sync Offset) -->
		<vsync_end>809</vsync_end> <!-- 800 (V Active Pxl) + 3 (V Sync Offset) + 6 (V Sync Width) -->
		<vtotal>831</vtotal> <!-- 800 (V Active Pxl) + 31 (V Blank) -->
		<vscan>0</vscan>
		<vrefresh>60</vrefresh> <!-- Frequency -->
		<flags>0</flags>
		<vic>0</vic>
	</resolution>

According to drivers//gpu/drm/drm_edid.c
These 2 resolutions might be responsible for 1280x800
So you can add them to the resolution_white.xml file if you want to use the file and block resolutions not in the file.

/* 0x1b - 1280x800@60Hz RB */
{ DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 71000, 1280, 1328,
	   1360, 1440, 0, 800, 803, 809, 823, 0,
	   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
/* 0x1c - 1280x800@60Hz */
{ DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 83500, 1280, 1352,
	   1480, 1680, 0, 800, 803, 809, 831, 0,

vrefresh values you can use 60 and flags can try 5, vic can use incremental values eg. 107, 108 from where it stopped last in the resolution_white.xml file

If you want the exact values, you can build firmware with the resolution_white.xml file removed
and in
hardware/libhardware/modules/hw_output/hw_output.cpp hw_output_get_display_modes
change all the ALOGV text to ALOGD
If you run new built firmware now and get a logcat, all the resolutions with all their values and names like clock, hdisplay, vtotal, vscan etc, will show, then you can add them to the resolution_white.xml file easier.

It turns out that corresponds to 0x1c from drm_edid.c. I changed flag to 5 and vic to 103 (last in resolution_white.xml is 102) / 108 (last in drm_edid.c is 107), but when I start when the pulsating android caption appears, it shifts right down. Further, when the system booted up, black bars appear on the display on the sides (the active part of the display decreases).

In principle, I am satisfied with the option if I delete the file resolution_white.xml with root and change the dpi using the wm density command (so that the menu bar is at the bottom, not the right). How correct is this?

The DPI eg. 160, 230, 240 will affect the navigation bar placements etc. so changing it is right.
Removing the file is an easy solution to get all resolutions but it will also show a lot of unnecessary resolutions not needed then.
So removing the file doesn’t cause black bars or does it too?
If you post pictures or a short video and model of the screen, maybe Radxa or Rockchip can help further if removing the file still has other display problems with the 1280x800 resolution.

Removing the file doesn’t cause black bars. Unnecessary resolutions - don’t care. This needs to be installed only once. Moreover, it seemed to me that there was only one permission - just the one I needed

UPD: I apologize for misinformation - apparently the black bars appeared for another reason. Now I tried to do it all over again - there are no black bars. But the required screen resolution for some reason still does not appear in the list. Also, if I delete the file resolution_white.xml, then quite a lot of screen resolutions appear, but since you need to select it only once, I do not consider this a problem. Thank you very much for your help.