主线linux5.19 开启了CONFIG_TINYDRM_ILI9341,启动可以显示logo并打印控制台
用fbv看图,图片长宽比屏幕长宽都明显小就能显示,否则oops而且没图像
用fb-test也会这样
报错之后还不能软件reboot了,而且后续/dev/fb0怎么操作屏幕都没反应,reset后恢复正常
设备树
&spi0 {
status = "okay";
ili9341@0 {
compatible = "adafruit,yx240qv29";
pinctrl-names = "default";
pinctrl-0 = <&ili9341_pins>;
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
spi-cpol;
spi-cpha;
rgb;
fps = <30>;
rotation = <90>;
spi-max-frequency = <50000000>;
reset-gpios = <&pio 1 6 GPIO_ACTIVE_HIGH>;
dc-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>;
buswidth =<8>;
power-supply = <®_vcc3v3>;
};
};
oops
# fbv l2d.png
fbv - The Framebuffer Viewer
l2d.png
280 x 250
[ 39.402276] 8<--- cut here ---
[ 39.405380] Unable to handle kernel paging request at virtual address c496000 0
[ 39.412700] [c4960000] *pgd=4100b811, *pte=00000000, *ppte=00000000
[ 39.418997] Internal error: Oops: 7 [#1] SMP ARM
[ 39.423615] Modules linked in:
[ 39.426672] CPU: 0 PID: 54 Comm: kworker/0:2 Not tainted 5.19.0-CatiumDeck_V3 s #19
[ 39.434238] Hardware name: Allwinner sun8i Family
[ 39.438939] Workqueue: events drm_fb_helper_damage_work
[ 39.444186] PC is at mmiocpy+0x4c/0x334
[ 39.448029] LR is at 0x0
[ 39.450563] pc : [<c048cfcc>] lr : [<00000000>] psr: 20070013
[ 39.456823] sp : c4965eb0 ip : 00000000 fp : c4965ec0
[ 39.462042] r10: c4938f80 r9 : 00000000 r8 : 00000000
[ 39.467261] r7 : c13f2040 r6 : 00000000 r5 : 00000000 r4 : 00000000
[ 39.473781] r3 : 00000000 r2 : 00000180 r1 : c4960000 r0 : c4939000
[ 39.480303] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 39.487432] Control: 10c5387d Table: 41ba406a DAC: 00000051
[ 39.493170] Register r0 information: 0-page vmalloc region starting at 0xc491 3000 allocated at dma_common_contiguous_remap+0x64/0x80
[ 39.505089] Register r1 information: 38-page vmalloc region starting at 0xc49 3a000 allocated at drm_fb_helper_generic_probe+0xe8/0x19c
[ 39.517172] Register r2 information: non-paged memory
[ 39.522222] Register r3 information: NULL pointer
[ 39.526924] Register r4 information: NULL pointer
[ 39.531623] Register r5 information: NULL pointer
[ 39.536324] Register r6 information: NULL pointer
[ 39.541025] Register r7 information: slab kmalloc-64 start c13f2040 pointer o ffset 0 size 64
[ 39.549479] Register r8 information: NULL pointer
[ 39.554181] Register r9 information: NULL pointer
[ 39.558882] Register r10 information: 0-page vmalloc region starting at 0xc49 13000 allocated at dma_common_contiguous_remap+0x64/0x80
[ 39.570876] Register r11 information: 2-page vmalloc region starting at 0xc49 64000 allocated at kernel_clone+0x94/0x370
[ 39.581655] Register r12 information: NULL pointer
[ 39.586443] Process kworker/0:2 (pid: 54, stack limit = 0x57579c6a)
[ 39.592755] Stack: (0xc4965eb0 to 0xc4966000)
[ 39.597114] 5ea0: 000000f3 c13ef190 c13a9 0c0 c495ff80
[ 39.605285] 5ec0: c4938f80 00000280 00000000 c057105c c0e94df4 c0e94e00 c0e94 dec c0571d90
[ 39.613456] 5ee0: 000000f4 c102e000 c13ef1b4 c13ef194 00000000 c4913000 00000 000 00000000
[ 39.621627] 5f00: 00f40140 82dd4a9d c0e94e08 c13ef194 c1881e80 c3f66d80 c3f69 e00 00000000
[ 39.629798] 5f20: 00000000 c3f69e05 c13b2200 c0135c70 c3f66d80 c3f66d80 c3f66 d9c c1881e80
[ 39.637969] 5f40: c3f66d80 c1881e98 c3f66d9c c0e03d40 00000008 c13b2200 c3f66 d80 c0135ed4
[ 39.646140] 5f60: c1881e80 c0ecb1ae c4829ecc c1898000 c13b2200 c0135e7c c1881 e80 c18980c0
[ 39.654311] 5f80: c4829ecc 00000000 00000000 c013d5f4 c1898000 c013d524 00000 000 00000000
[ 39.662481] 5fa0: 00000000 00000000 00000000 c0100148 00000000 00000000 00000 000 00000000
[ 39.670651] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000 000 00000000
[ 39.678821] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000 000 00000000
[ 39.687001] mmiocpy from drm_fb_helper_damage_work+0x29c/0x2f8
[ 39.692934] drm_fb_helper_damage_work from process_one_work+0x1d8/0x3e4
[ 39.699644] process_one_work from worker_thread+0x58/0x54c
[ 39.705218] worker_thread from kthread+0xd0/0xec
[ 39.709932] kthread from ret_from_fork+0x14/0x2c
[ 39.714641] Exception stack(0xc4965fb0 to 0xc4965ff8)
[ 39.719691] 5fa0: 00000000 00000000 00000 000 00000000
[ 39.727861] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000 000 00000000
[ 39.736030] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 39.742643] Code: ba000002 f5d1f03c f5d1f05c f5d1f07c (e8b15378)
[ 39.748946] ---[ end trace 0000000000000000 ]---
佬们有没有遇到过的说下问题何在
离线
定位到问题了 drivers/gpu/drm/drm_fb_helper.c
函数drm_fb_helper_damage_blit_real
static void drm_fb_helper_damage_blit_real(struct drm_fb_helper *fb_helper,
struct drm_clip_rect *clip,
struct iosys_map *dst)
{
//printk("drm_fb_helper_damage_blit_real entrance");
struct drm_framebuffer *fb = fb_helper->fb;
unsigned int cpp = fb->format->cpp[0];
size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
void *src = fb_helper->fbdev->screen_buffer + offset;
size_t len = (clip->x2 - clip->x1) * cpp;
unsigned int y;
iosys_map_incr(dst, offset); /* go to first pixel within clip rect */
//printk("drm_fb_helper_damage_blit_real 1");
//大概是这里y越界 减小1之后可以显示图片
//for (y = clip->y1; y < clip->y2; y++) {
for (y = clip->y1; y < clip->y2 - 1; y++) {
//printk("y = %d",y);
iosys_map_memcpy_to(dst, 0, src, len);
iosys_map_incr(dst, fb->pitches[0]);
src += fb->pitches[0];
}
//printk("drm_fb_helper_damage_blit_real ret");
}
离线
上述修复有个问题 就是每次刷新的矩形区域最下面不能显示一排像素,我又修改了一下现在好多了
static void drm_fb_helper_damage_blit_real(struct drm_fb_helper *fb_helper,
struct drm_clip_rect *clip,
struct iosys_map *dst)
{
struct drm_framebuffer *fb = fb_helper->fb;
unsigned int cpp = fb->format->cpp[0];
size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
void *src = fb_helper->fbdev->screen_buffer + offset;
size_t len = (clip->x2 - clip->x1) * cpp;
unsigned int y;
iosys_map_incr(dst, offset); /* go to first pixel within clip rect */
//for (y = clip->y1; y < clip->y2; y++) {
int max_y = fb->height;
//printk("height = %d",fb->height);
int real_y = clip -> y2 > max_y ? clip -> y2 - 1 : clip -> y2;
for (y = clip->y1; y < real_y; y++) {
iosys_map_memcpy_to(dst, 0, src, len);
iosys_map_incr(dst, fb->pitches[0]);
src += fb->pitches[0];
}
}
离线