Rockchip saveBaseParameter程序来设置显示器参数

简介: Rockchip saveBaseParameter程序来设置显示器参数

前言

rockchip android平台支持多种类型的显示器接口,如HDMI、DP、eDP、MIPI等。为了方便开发者和用户对显示器的参数进行设置和修改,rockchip提供了一个工具程序saveBaseParameter,它可以读取和写入baseparameter.img文件,这个文件存储在设备的分区中,包含了显示器的参数,如分辨率、色彩、帧缓冲区、亮度、对比度等。

本文将介绍如何使用saveBaseParameter程序来设置rockchip android平台的显示器参数,包括以下几个方面:

  • 如何编译和运行saveBaseParameter程序
  • 如何查看和修改显示器的参数
  • 如何支持双显示器的输出
  • 如何恢复显示器的默认参数

如何编译和运行saveBaseParameter程序

要编译saveBaseParameter程序,你需要先下载rockchip android平台的源码,然后在源码目录下执行以下命令:

mmm device/rockchip/common/baseparameter

这样就会在out/target/product/rk3568_r/vendor/bin/目录下生成saveBaseParameter可执行文件,你可以把它拷贝到设备上运行,或者通过adb shell命令来运行。

要运行saveBaseParameter程序,你需要把它推送到设备的/vendor/bin目录下,并且给它可执行的权限。你可以在设备上打开一个终端,或者在电脑上打开一个命令行窗口,然后输入以下命令:

adb root
adb remount
adb push out\target\product\rk3568_r\vendor\bin\saveBaseParameter /vendor/bin/saveBaseParameter 
adb shell chmod 755 /vendor/bin/saveBaseParameter

然后,你可以运行saveBaseParameter程序,它会打印出用法说明,告诉你有哪些选项和参数可以使用。例如,你可以输入以下命令:

adb shell saveBaseParameter -h

这样就会打印出帮助信息,如下所示:

rk3568_r:/ # saveBaseParameter -h
saveParameter: read and write baseparameter partition tool
Usage:
        -h       Help info
        -p       Print Baseparamter
        -t       output to target file (e: "/sdcard/baseparameter.img)"
        -f       Framebuffer Resolution (e: 1920x1080@60)
        -c       Color (e: RGB-8bit or YCBCR444-10bit)
        -u       Is Enable Auto Resolution (auto resolution:"auto";set one fixed resolution:
                 hdisplay,vdisplay,vrefresh,hsync_start,hsync_end,htotal,vsync_start,vsync_end,vtotal,vscan,flags,clock
                 e: "1920,1080,60,2008,2052,2200,1084,1089,1125,0,5,148500")
        -o       Overscan (left,top,right,bottom e: overscan "100,100,100,100")
        -b       BCSH (brightness,contrast,saturation,hue e: "50,50,50,50")
        -R       Reset Baseparameter (1:only reset user setting baseparameter partition; 2:reset baseparameter paratition include backup)
        -C       Choose Connector type and id to Setting (e: 11,0 or 16,0)
Example: saveBaseParameter -C "16,0" -f "1920x1080@60" -c Auto -u 2 -o "100,100,100,100" -b "50,50,50,50"
===== Rockchip All Rights Reserved =====

如何查看和修改显示器的参数

要查看和修改显示器的参数,你需要先选择要设置的显示器接口的类型和编号,然后根据你的需要选择不同的选项和参数来设置显示器的参数。

如何选择显示器接口的类型和编号

rockchip android平台支持以下几种类型的显示器接口:

connector_type connector_name
11 HDMI-A
12 HDMI-B
13 VGA
14 DVI
15 DP
16 eDP
17 MIPI

connector_id表示接口的序号,从0开始。你可以通过运行以下命令来查看当前连接的显示器接口的类型和编号:

rk3568_r:/ # cat /sys/kernel/debug/dri/0/state
plane[57]: Smart0-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[73]: Smart0-win1
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[87]: Smart0-win2
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[101]: Smart0-win3
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[115]: Smart1-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[129]: Smart1-win1
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[143]: Smart1-win2
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[157]: Smart1-win3
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[171]: Esmart1-win0
        crtc=(null)
        fb=0
        crtc-pos=22x28+815+642
        src-pos=22.000000x28.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[185]: Esmart1-win1
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[199]: Esmart1-win2
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[213]: Esmart1-win3
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[227]: Esmart0-win0
        crtc=(null)
        fb=0
        crtc-pos=1920x24+0+0
        src-pos=1920.000000x24.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[241]: Esmart0-win1
        crtc=(null)
        fb=0
        crtc-pos=1920x56+0+1024
        src-pos=1920.000000x56.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[255]: Esmart0-win2
        crtc=(null)
        fb=0
        crtc-pos=1920x56+0+1024
        src-pos=1920.000000x56.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[269]: Esmart0-win3
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[283]: Cluster0-win0
        crtc=video_port0
        fb=398
                allocated by = composer@2.1-se
                refcount=2
                format=AB24 little-endian (0x34324241)
                modifier=0x800000000000001
                size=1920x1080
                layers:
                        size[0]=1920x1080
                        pitch[0]=7680
                        offset[0]=0
                        obj[0]:(null)
        crtc-pos=1920x1080+0+0
        src-pos=1920.000000x1080.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[297]: Cluster0-win1
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[311]: Cluster1-win0
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
plane[325]: Cluster1-win1
        crtc=(null)
        fb=0
        crtc-pos=0x0+0+0
        src-pos=0.000000x0.000000+0.000000+0.000000
        rotation=1
        normalized-zpos=0
        color-encoding=ITU-R BT.601 YCbCr
        color-range=YCbCr limited range
crtc[71]: video_port0
        enable=1
        active=1
        planes_changed=1
        mode_changed=0
        active_changed=0
        connectors_changed=0
        color_mgmt_changed=0
        plane_mask=10000
        connector_mask=2
        encoder_mask=2
        mode: 0:"1920x1080" 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x48 0x5
connector[344]: Writeback-1
        crtc=(null)
connector[346]: HDMI-A-1
        crtc=video_port0

你可以通过运行以下命令来选择要设置的显示器接口的类型和编号:

adb shell saveBaseParameter -C "type,id"

其中,type和id表示要设置的显示器接口的类型和编号。例如,如果你想要选择第一个HDMI-A接口(connector_type为11,connector_id为0),你可以输入以下命令:

adb shell saveBaseParameter -C "11,0"

如何查看显示器的参数

要查看显示器的参数,你可以运行以下命令:

rk3568_r:/ # saveBaseParameter -p
print baseparameter
========== base parameter ==========
-connector type: 11 connector id: 0 offset: 104
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 0x0@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
-connector type: 11 connector id: 1 offset: 37040
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 0x0@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
========= backup parameter ==========
-connector type: 11 connector id: 0 offset: 104
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 0x0@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
-connector type: 11 connector id: 1 offset: 37040
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 0x0@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
====================================

这样就会打印出baseparameter.img文件中的所有参数,包括显示器的分辨率、色彩、帧缓冲区、亮度、对比度等。例如,如果你想要查看第一个HDMI-A接口(connector_type为11,connector_id为0)的显示器参数,你可以输入以下命令:

adb shell saveBaseParameter -C "11,0" -p

这样就会打印出类似于以下内容:

disp_info[0]:
    connector_type = HDMIA
    connector_id = 0
    overscan_info.maxvalue = 100;
    overscan_info.leftscale = 100;
    overscan_info.rightscale = 100;
    overscan_info.topscale = 100;
    overscan_info.bottomscale = 100;
    drm_display_mode.hdisplay = 1920;
    drm_display_mode.vdisplay = 1080;
    drm_display_mode.vrefresh = 60;
    drm_display_mode.hsync_start = 2008;
    drm_display_mode.hsync_end = 2052;
    drm_display_mode.htotal = 2200;
    drm_display_mode.vsync_start = 1084;
    drm_display_mode.vsync_end = 1089;
    drm_display_mode.vtotal = 1125;
    drm_display_mode.vscan = 0;
    drm_display_mode.flags = 5;
    drm_display_mode.clock = 148500;
    framebuffer_info.framebuffer_width = 0;
    framebuffer_info.framebuffer_height = 0;
    framebuffer_info.fps = 60;
    bcsh_info.brightness = 50;
    bcsh_info.contrast = 50;
    bcsh_info.saturation = 50;
    bcsh_info.hue = 50;

如何修改显示器的参数

要修改显示器的参数,你可以根据你的需要选择不同的选项和参数来设置显示器的参数。以下是一些常用的选项和参数:

  • -f:设置显示器的分辨率和刷新率,格式为widthxheight@fps。例如,如果你想要把第一个HDMI-A接口(connector_type为11,connector_id为0)的显示器分辨率设置为1920x1080,刷新率设置为60,你可以输入以下命令:
adb shell saveBaseParameter -C "11,0" -f "3840x2160@60"

这是改完重启后的结果 ,发现HDMI显示确实变成了3840x2160了。只影响系统开机后的显示 ,就是kernel阶段跑完进入动画发现显示的分辨率就和设置的一样了。

rk3568_r:/ # saveBaseParameter -p 
print baseparameter
========== base parameter ==========
-connector type: 11 connector id: 0 offset: 104
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 3840x2160@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
  • -c:设置显示器的色彩格式和深度,格式为color-depth。你可以选择以下几种色彩格式和深度:
color-depth color_format color_depth
RGB-8bit output_rgb depth_24bit
RGB-10bit output_rgb depth_30bit
YCBCR444-8bit output_ycbcr444 depth_24bit
YCBCR444-10bit output_ycbcr444 depth_30bit
YCBCR422-8bit output_ycbcr422 depth_24bit
YCBCR422-10bit output_ycbcr422 depth_30bit
YCBCR420-8bit output_ycbcr420 depth_24bit
YCBCR420-10bit output_ycbcr420 depth_30bit
Auto output_ycbcr_high_subsampling or output_ycbcr_low_subsampling Automatic

如果你选择Auto,那么程序会根据显示器的能力和信号源的要求来自动选择合适的色彩格式和深度。例如,如果你想要把第一个DP接口(connector_type为15,connector_id为0)的显示器色彩格式和深度设置为自动,你可以输入以下命令:

rk3568_r:/ # saveBaseParameter -C "11,0" -c Auto
rk3568_r:/ # saveBaseParameter -C "11,0" -c Auto
connector 11,0 (-C)
color Auto (-c)
rk3568_r:/ # saveBaseParameter -p
print baseparameter
========== base parameter ==========
-connector type: 11 connector id: 0 offset: 104
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 4 depth 0
        feature:  0x2
        fbinfo: 3840x2160@120
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
-connector type: 11 connector id: 1 offset: 37040
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 0x0@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
  • -u:设置显示器是否开启自动分辨率,格式为mode。如果mode为0,表示关闭自动分辨率,只输出固定的分辨率;如果mode非0,表示开启自动分辨率,根据显示器的能力和信号源的要求来输出合适的分辨率。例如,如果你想要把第一个HDMI-A接口(connector_type为11,connector_id为0)的显示器开启自动分辨率,你可以输入以下命令:
adb shell saveBaseParameter -C "11,0" -u 2
rk3568_r:/ # saveBaseParameter -C "11,0" -u 2
connector 11,0 (-C)
resolution 2 (-u)
rk3568_r:/ #
rk3568_r:/ # saveBaseParameter -p
print baseparameter
========== base parameter ==========
-connector type: 11 connector id: 0 offset: 104
        resolution: 2x0@p0-0-0-0-0-0-0-0 clk=0
        corlor: format 4 depth 0
        feature:  0x0
        fbinfo: 3840x2160@120
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
-connector type: 11 connector id: 1 offset: 37040
        resolution: 1920x1080@p60-2008-2052-2200-1084-1089-1125-5 clk=148500
        corlor: format 0 depth 0
        feature:  0x0
        fbinfo: 0x0@60
        bcsh: 50 50 50 50
        overscan: 100 100 100 100
        gamma size:0
        3dlut size:0
  • -o:设置显示器的overscan,即边缘裁剪,格式为left,top,right,bottom。overscan值越大,表示裁剪的范围越小。例如,如果你想要把第一个eDP接口(connector_type为16,connector_id为0)的显示器overscan设置为100,100,100,100,即不裁剪,你可以输入以下命令:
adb shell saveBaseParameter -C "16,0" -o "100,100,100,100"
  • -b:设置显示器的亮度、对比度、饱和度和色调,格式为brightness,contrast,saturation,hue。BCSH值的范围是0到100。例如,如果你想要把第一个DP接口(connector_type为15,connector_id为0)的显示器亮度设置为80,对比度设置为60,饱和度设置为70,色调设置为50,你可以输入以下命令:
adb shell saveBaseParameter -C "15,0" -b "80,60,70,50"

如何支持双显示器的输出

要支持双显示器的输出,即同时输出两个不同的画面,你需要先选择两个不同的显示器接口的类型和编号,然后分别设置它们的参数。

例如,如果你想要把第一个HDMI-A接口(connector_type为11,connector_id为0)和第一个DP接口(connector_type为15,connector_id为0)同时输出不同的画面,你可以输入以下命令:

adb shell saveBaseParameter -C "11,0" -f "1920x1080@60" -c Auto -u 2 -o "100,100,100,100" -b "50,50,50,50"
adb shell saveBaseParameter -C "15,0" -f "1280x720@60" -c Auto -u 2 -o "90,90,90,90" -b "60,60,60,60"

这样就完成了双显示器的输出的设置。你可以通过查看设备的显示器来确认是否生效。如果你想要关闭双显示器的输出,只输出一个画面,你可以输入以下命令:

adb shell saveBaseParameter -C "type,id" -f "0x0@0"

其中,type,id表示要关闭的显示器接口的类型和编号。例如,如果你想要关闭第一个DP接口(connector_type为15,connector_id为0)的输出,只输出第一个HDMI-A接口(connector_type为11,connector_id为0)的画面,你可以输入以下命令:

adb shell saveBaseParameter -C "15,0" -f "0x0@0"

如何恢复显示器的默认参数

要恢复显示器的默认参数,你可以运行以下命令:

adb shell saveBaseParameter -R

这样就会把baseparameter.img文件重置为备份的设置。

总结

本文介绍了如何使用saveBaseParameter程序来设置rockchip android平台的显示器参数,包括如何编译和运行saveBaseParameter程序,如何查看和修改显示器的参数,如何支持双显示器的输出,如何恢复显示器的默认参数

相关文章
|
11天前
|
Android开发
Android Mediatek 增加Recovery模式下读cmdline的强制工厂重置选项
Android Mediatek 增加Recovery模式下读cmdline的强制工厂重置选项
19 0
|
11天前
|
存储 Linux Android开发
Rockchip系列之VendorStorage uboot/kernel/user space 阶段接口使用介绍(2)
Rockchip系列之VendorStorage uboot/kernel/user space 阶段接口使用介绍(2)
24 0
|
11天前
|
Linux Android开发
Android Mediatek 修改UART设备名称和默认调试属性
Android Mediatek 修改UART设备名称和默认调试属性
12 0
|
10月前
|
编解码 人工智能 算法
Rasterio:rasterio.open函数参数和用法解析(以GPM Imerg Early nc转tif为例)
Rasterio:rasterio.open函数参数和用法解析(以GPM Imerg Early nc转tif为例)
234 0
RK3399平台开发系列讲解(USB转串口)5.49、/dev/ttyUSB 修改串口名
RK3399平台开发系列讲解(USB转串口)5.49、/dev/ttyUSB 修改串口名
144 0
 RK3399平台开发系列讲解(USB转串口)5.49、/dev/ttyUSB 修改串口名
mode 配置系统设备
mode 配置系统设备
95 0
成功解决 cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp” 和 cl: 命令行 error D8021 :无效的数值参数“/Wno-unused-function”
成功解决 cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp” 和 cl: 命令行 error D8021 :无效的数值参数“/Wno-unused-function”
成功解决 cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp” 和 cl: 命令行 error D8021 :无效的数值参数“/Wno-unused-function”