Skip to content

modesetting resulted in black screen on qualcomm adreno gpu devices #3459

Description

@fish4terrisa-MSDSM

Select the version

25.2.2

Describe your issue

I'm making this issue after conversation through private chat with @Saikatsaha1996
The test device is an Adreno 610 device owned by @Saikatsaha1996, tho samiliar behavior could also be observed on a Adreno 740 device owned by myself. Both of the devices are using downstream kernel. The mesa freedreno support for them is at https://github.com/lfdevs/mesa-for-android-container (drm support is from @Saikatsaha1996 's fork https://github.com/Saikatsaha1996/mesa-for-android-container , in the branch turnip-kgsl-drm
The tested Xlibre version is 25.2.2, from xlibre debian repo https://xlibre-debian.github.io/debian .
(not related but why we dont have 25.2.X selectable already)


So after installing turnip and zink from the mesa fork, glmark2-drm and glmark2-es2-drm run fine and wayland compositors like sway runs well on the device. I'd expect modesetting to support the devices.
The device is using DRM/KMS system, but is using kgsl insteal of render nodes.
When the user start Xlibre with modesettimg driver, it'll result in a black screen with nothing displayed.
The Xorg.conf used:

Section "Device"
    Identifier  "Adreno GPU"
    Driver     "modesetting"
    Option         "Atomic" "true"

    Option         "TearFree" "false"

    Option "RenderingAPI" "es"  
    Option         "AccelMethod" "glamor"

EndSection

Here's Xorg.0.log
The relevant log is probably

(EE) modeset(0): failed to set mode: Invalid argument   

Which is caused by

1574    can_test = drmmode_crtc_can_test_mode(crtc);
1575    if (drmmode_crtc_set_mode(crtc, can_test)) {
1576        xf86DrvMsg(... "failed to set mode: %s\n", strerror(errno));

In drmmode_set_mode_major().
Inside drmmode_crtc_set_mode(),

    drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode);
    ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
                         fb_id, x, y, output_ids, output_count, &kmode);

drmModeSetCrtc() failed and caused the EINVAL
Here's the gdb log of this part:

Thread 1 "Xorg" hit Breakpoint 1, drmmode_crtc_set_mode (crtc=crtc@entry=0x5555d71110,                           
test_only=test_only@entry=0) at ../../../hw/xfree86/drivers/video/modesetting/drmmode_display.c:955
955         ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,                              
(gdb) bt
#0  drmmode_crtc_set_mode (crtc=crtc@entry=0x5555d71110, test_only=test_only@entry=0)                            
at ../../../hw/xfree86/drivers/video/modesetting/drmmode_display.c:955                                   
#1  0x0000007ff6d642e4 in drmmode_set_mode_major                                                                 
(crtc=0x5555d71110, mode=<optimized out>, rotation=<optimized out>, x=<optimized out>, y=<optimized out>) at 
../../../hw/xfree86/drivers/video/modesetting/drmmode_display.c:1575                                     
#2  0x0000007ff6d65904 in drmmode_set_desired_modes                                                              
(pScrn=0x555586e8a0, drmmode=<optimized out>, set_hw=1, ign_err=0)                                           
at ../../../hw/xfree86/drivers/video/modesetting/drmmode_display.c:4282
#3  0x00000055555d6438 in BlockHandler (pTimeout=pTimeout@entry=0x7fffffef44) at ../../../dix/dixutils.c:353 
#4  0x00000055556a1918 in WaitForSomething (are_ready=0) at ../../../os/WaitFor.c:198
#5  0x00000055555cf1f4 in Dispatch () at ../../../dix/dispatch.c:491                                         
#6  0x00000055555d5aa8 in dix_main (argc=2, argv=0x7ffffff258, envp=<optimized out>)
    at ../../../dix/main.c:288                                                                               
#7  0x0000007ff776225c in ??? () at /lib/aarch64-linux-gnu/libc.so.6                                         
#8  0x0000007ff776233c in __libc_start_main () at /lib/aarch64-linux-gnu/libc.so.6                           
#9  0x0000005555593170 in _start ()                                                                          
(gdb) info locals                                                                                            
ms = 0x555586ede0                                                                                            
xf86_config = 0x5555a63e00                                                                                   
drmmode_crtc = 0x5555d71be0                                                                                  
drmmode = 0x555586ee30                                                                                       
kmode = {clock = 173640, hdisplay = 1080, hsync_start = 1130, hsync_end = 1134, htotal = 
1166, hskew = 0,      vdisplay = 2340, vsync_start = 2452, vsync_end = 2456, vtotal = 
2482, vscan = 0, vrefresh = 0,
  flags = 536870912, type = 0, name = '\000' <repeats 31 times>}                                             
output_count = <optimized out>                                                                               
output_ids = 0x555688e5b0                                                                                    
fb_id = 110                                                                                                  
x = 0                                                                                                        
y = 0
i = <optimized out>
ret = 0                                                                                                      
ctm = <optimized out>                                                                                        
(gdb) print drmmode->fd                                                                                      
$1 = 14
(gdb) print drmmode_crtc->mode_crtc->crtc_id
$2 = 72
(gdb) print fb_id                                                                                            
$3 = 110
(gdb) print output_count                                                                                     
$4 = <optimized out>
(gdb) print output_ids[0]
$5 = 29
(gdb) print/x kmode.flags                                                                                    
$6 = 0x20000000
(gdb) print kmode.hdisplay                                                                                   
$7 = 1080
(gdb) print kmode.vdisplay                                                                                   
$8 = 2340
(gdb) next                                                                                                   
957         if (!ret && !ms->atomic_modeset) {                                                               
(gdb) print ret                                                                                              
$9 = -22
(gdb)

Btw this occured one single time where

kmode:
clock = 4294962256
hdisplay = 127
vdisplay = 0
htotal = 62822
vtotal = 85
x = 127
y = -177803960
fb_id = 4294962256

Still have no idea why and it havent happened since(could be a separate issue), and no idea why.(The screen remain black even when kmode value is sane, so I'll say at most of the times it's not caused by this)

Steps to reproduce

Run Xlibre, with the mesa fork and using the Xorg.conf provided on an Adreno 610/Adreno 740(potentially also other gpu models) running downstream kernel(the msm module should be called msm_drm instead of msm
You'll see a black screen, meanwhile sway, glmark2-drm and other stuffs all worked.

What did you expect?

I expect it to display things on screen and working.

Additional Information

(I clicked I'd like to work on this issue, it means I'll help debugging this but my knowledge about this is quite limited)

Extra fields

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions