Skip to content

直接从framebuffer读取画面赋值到bitmap发现显示混乱 #113

@Tracker647

Description

@Tracker647

环境为ubuntu 20虚拟机,在进程获取fb0数据赋值给bitmap输出到画面,发现显示混乱,但是在嵌入式机器上就没问题,对比下是line_length和xres不一致导致的(比如分辨率800x480, 理应line_length是3200,但是ubuntu 20虚拟机上的line length是6688对应xres_virtual=1672),但是fbset上又没办法改line_length, 改分辨率只是表面参数,没法解决这个

测试片段:

void update_g_bitmap_backgroud() {
	rect_t r = rect_init(0, 0, g_bitmap->w, g_bitmap->h);
	char *shared_data = LibFrameBufferGet(USE_FB_ID)->fbdata;  

	bitmap_t temp_bmp;
	bitmap_init(&temp_bmp, 800, 480, BITMAP_FMT_BGRA8888, shared_data);
	bitmap_save_png(&temp_bmp, "test.png");
	helper_bitmap_bgra8888_to_rgba8888(g_bitmap, &temp_bmp);
	bitmap_deinit(&temp_bmp);
}

虚拟机fb信息, 有参考vmware调试ubuntu的文档做了双缓存:

devices_load : path = file:///home/zhangdalin/AWStudioProjects/kp25sweb/process/Awtk_GamiWebDisplayStream/config/devices.json
devices[0]: path = /dev/fb0, type = fb
devices[1]: path = /dev/dri/card0, type = drm
fb_info_t: /dev/fb0
xres=800 yres=600
xres_virtual=1672 yres_virtual=1254
bits_per_pixel=32 line_length=6688
fb_info_t: red(16 8) green(8 8) blue(0 8)
xpanstep=1 ywrapstep=0
fb_size=4012800 fb_total_size=8386752 fb_nr=2 smem_len=8386752
fb_open clear
fb_open ok
run in vmware and fix FBIOPAN_DISPLAY block issue
=========fb_number=2
ratio=1.000000 800 600
ratio=1.000000 800 600
Build at: Dec  9 2024 22:34:41
LibFrameBufferCreate /dev/fb0
LibFrameBuffer: width 800 height: 600 bpp: 4
SIGPIPE ignore

左边是截图,右边是虚拟机fb显示:
image-20241210001708112
问awtk上有没有将fb还原到bitmap的方式?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions