RK3506 RGB调试相关的

说明

RK3506的RGB调试,一些随笔。

内容

一些配置说明,可以结合调试。

summary

root@rk3506-buildroot:~# cat /sys/kernel/debug/dri/0/summary
VOP [ff600000.vop]: ACTIVE
    Connector: DPI-1
        bus_format[1013]: (unknown)
        overlay_mode[0] output_mode[0]color-encoding[1] color-range[1]
    Display mode: 800x480p59
        dclk[25000 kHz] real_dclk[25000 kHz] aclk[294912 kHz] type[48] flag[5]
        H: 800 808 812 820
        V: 480 496 500 516
    win1-0: ACTIVE
        format: XR24 little-endian (0x34325258) SDR[0] color-encoding[0] color-range[0]
        csc: y2r[0] r2r[0] r2y[0] csc mode[0]
        zpos: 0
        src: pos[0x0] rect[800x480]
        dst: pos[0x0] rect[800x480]
        buf[0]: addr: 0x06c00000 pitch: 3200 offset: 0
    post: sdr2hdr[0] hdr2sdr[0]
    pre : sdr2hdr[0]
    post CSC: r2y[0] y2r[0] CSC mode[2]

bus_format

bus_format[1013]: (unknown)

这个格式不对的,没有识别出来,

颜色寄存器

其中的显示的颜色寄存器:

buf[0]: addr: 0x06c00000 pitch: 3200 offset: 0

刷纯色

# 800x480, 32bpp (ARGB8888) 每个像素4字节
# 总大小 = 800 * 480 * 4 = 1,536,000 bytes

# 纯红 (0xFFFF0000 小端 => 00 00 FF FF)
printf '\x00\x00\xFF\xFF%.0s' $(seq 1 384000) > /dev/fb0

# 纯绿 (0xFF00FF00 => 00 FF 00 FF)
printf '\x00\xFF\x00\xFF%.0s' $(seq 1 384000) > /dev/fb0

# 纯蓝 (0xFF0000FF => FF 00 00 FF)
printf '\xFF\x00\x00\xFF%.0s' $(seq 1 384000) > /dev/fb0

# 纯白 (0xFFFFFFFF => FF FF FF FF)
printf '\xFF\xFF\xFF\xFF%.0s' $(seq 1 384000) > /dev/fb0

# 50%灰 (0xFF808080 => 80 80 80 FF)
printf '\x80\x80\x80\xFF%.0s' $(seq 1 384000) > /dev/fb0

刷纯色之后:

busybox devmem 0x06c00000

回复:

红  00 00 FF FF  -> 读回 0xFFFF0000   // XRGB: R=FF G=00 B=00
绿  00 FF 00 FF  -> 读回 0xFF00FF00   // XRGB: R=00 G=FF B=00
蓝  FF 00 00 FF  -> 读回 0xFF0000FF   // XRGB: R=00 G=00 B=FF

VOP 的 DSP_CTRL2

RK3506 VOP 的基地址 + 寄存器偏移,

// drivers/gpu/drm/rockchip/rockchip_vop_reg.h
#define RK3366_LIT_DSP_CTRL2    0x00028

所以寄存器的地址是:0xff600000 + 0x28 = 0xff600028

root@rk3506-buildroot:~# cat /sys/kernel/debug/dri/0/regs | grep "0xff600020"
0xff600020: 0100000d 00000000 09000004 00000000

分析:

dsp_data_swap bits 9~13  = 0    // 没有数据交换
dsp_rb_swap   bit 11     = 0    // 没有 R/B 交换
dsp_rg_swap   bit 12     = 0    // 没有 R/G 交换
out_mode      bits 16~19 = 0    // P888
dither_up_en  bit 2      = 1    // 正常

opengl

使用kmscube调用opengl,

buildroot开启

# buildroot/configs/rockchip_rk3506_nor_flash_defconfig
+BR2_PACKAGE_MESA3D=y
+BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
+BR2_PACKAGE_MESA3D_OPENGL_EGL=y
+BR2_PACKAGE_MESA3D_OPENGL_ES=y
+BR2_PACKAGE_MESA3D_GBM=y
+BR2_PACKAGE_KMSCUBE=y
# R2_PACKAGE_MESA3D_GBM 其实被 EGL 隐式 select,显式写上只为可读性。

编译:

产物 说明
target/usr/bin/kmscube 1.5MB,ARM EABI5 hardfloat,NEEDED=libdrm/libgbm/libEGL/libGLESv2/libm/libc
target/usr/lib/dri/kms_swrast_dri.so 10.8MB(Mesa 软渲染后端)
libEGL.so.1 / libgbm.so.1 / libGLESv2.so.2 均由 mesa3d 提供

运行

killall rk_demo
kmscube

alt text

其他

modetest -M rockchip -w 75:COLOR_RANGE:1
posted @ 2026-09-23 16:45  杨旭0324  阅读(8)  评论(0)    收藏  举报