Bug 51410

Summary: xrandr --scale crashes Xorg
Product: Sisyphus Reporter: Ivan A. Melnikov <iv>
Component: xorg-drv-atiAssignee: Valery Inozemtsev <shrek>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: shrek
Version: unstable   
Hardware: x86_64   
OS: Linux   

Description Ivan A. Melnikov 2024-09-05 13:18:35 MSK
Сизиф, скромный R5 230, классический Xorg, XFCE.

Команда

xrandr --output HDMI-0 --scale 2

приводит к segfault'у X.
Comment 1 Ivan A. Melnikov 2024-09-05 13:21:25 MSK
Небольшой отрывок сессии gdb:

Thread 1 "X" received signal SIGSEGV, Segmentation fault.   
0x0000000000000000 in ?? ()                                                                                             
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00005555580d0dbc in SourceValidateOnePicture (pPicture=0x55558e5057d0) at mipict.c:297
#2  miCompositeSourceValidate (pPicture=0x55558e5057d0) at mipict.c:304
#3  0x00005555580d1144 in miComputeCompositeRegion (pRegion=pRegion@entry=0x7ffffbe97928, pSrc=pSrc@entry=0x55558e5057d0, pMask=pMask@entry=0x0, pDst=pDst@entry=0x55558e5ae730, xSrc=<optimized out>, ySrc=<optimized out>, 
    xMask=<optimized out>, yMask=<optimized out>, xDst=<optimized out>, yDst=0, width=width@entry=1920, height=height@entry=1080) at mipict.c:382
#4  0x00007fffebe72b1c in glamor_composite (op=1 '\001', source=0x55558e5057d0, mask=0x0, dest=0x55558e5ae730, x_source=0, y_source=0, x_mask=0, y_mask=0, x_dest=0, y_dest=0, width=1920, height=1080) at glamor_render.c:1660
#5  0x00005555580e3c7c in damageComposite (op=1 '\001', pSrc=0x55558e5057d0, pMask=0x0, pDst=0x55558e5ae730, xSrc=0, ySrc=0, xMask=0, yMask=0, xDst=0, yDst=0, width=1920, height=1080) at damage.c:513
#6  0x00007fffeec3074c in radeon_scanout_do_update (xf86_crtc=0x55558d8d13b0, scanout_id=<optimized out>, src_pix=<optimized out>, extents=...) at /usr/src/debug/xorg-drv-ati-19.1.0/src/radeon_kms.c:997
#7  0x00007fffeec3c0a4 in drmmode_crtc_scanout_update (y=<synthetic pointer>, x=<synthetic pointer>, fb=<synthetic pointer>, scanout_id=<optimized out>, mode=0x7ffffbe97f18, crtc=0x55558d8d13b0)
    at /usr/src/debug/xorg-drv-ati-19.1.0/src/drmmode_display.c:786
#8  drmmode_set_mode_major (crtc=0x55558d8d13b0, mode=0x7ffffbe97f18, rotation=<optimized out>, x=0, y=0) at /usr/src/debug/xorg-drv-ati-19.1.0/src/drmmode_display.c:915
#9  0x0000555558075ff8 in xf86CrtcSetModeTransform (crtc=crtc@entry=0x55558d8d13b0, mode=mode@entry=0x7ffffbe97f18, rotation=rotation@entry=1, transform=transform@entry=0x55558e1941c8, x=x@entry=0, y=y@entry=0) at xf86Crtc.c:319
#10 0x000055555807d744 in xf86RandR12CrtcSet (pScreen=0x55558d7d50a0, randr_crtc=0x55558e194160, randr_mode=0x55558e13de60, x=0, y=0, rotation=1, num_randr_outputs=<optimized out>, randr_outputs=0x55558d8659e0) at xf86RandR12.c:1218
#11 0x00005555580be2ac in RRCrtcSet (crtc=0x55558e194160, mode=0x55558e13de60, x=0, y=0, rotation=rotation@entry=1, numOutputs=numOutputs@entry=1, outputs=outputs@entry=0x55558d8659e0) at rrcrtc.c:780
#12 0x00005555580bf8cc in ProcRRSetCrtcConfig (client=0x55558eb3aac0) at rrcrtc.c:1459
#13 0x0000555558000130 in Dispatch () at dispatch.c:550
#14 0x000055555800441c in dix_main (argc=14, argv=0x7ffffbe98518, envp=<optimized out>) at main.c:272
#15 0x00007fffef81d59c in __libc_start_call_main (main=main@entry=0x555557fec874 <main>, argc=argc@entry=14, argv=argv@entry=0x7ffffbe98518) at ../sysdeps/nptl/libc_start_call_main.h:58
#16 0x00007fffef81d688 in __libc_start_main_impl (main=0x555557fec874 <main>, argc=14, argv=0x7ffffbe98518, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at libc-start.c:360
#17 0x0000555557fec8c0 in _start ()
(gdb) frame 1
#1  0x00005555580d0dbc in SourceValidateOnePicture (pPicture=0x55558e5057d0) at mipict.c:297
[...]
(gdb) p /x pPicture
$1 = 0x55558e5057d0
(gdb) p /x pPicture->pDrawable
$2 = 0x55558e116650
(gdb) p /x pPicture->pDrawable->pScreen
$3 = 0x55558d7d50a0
(gdb) p /x pPicture->pDrawable->pScreen->SourceValidate
$4 = 0x0

SourceValidate NULL, но этого никто не проверяет:

(gdb) list
292         if (!pDrawable)
293             return;
294
295         pScreen = pDrawable->pScreen;
296
297         pScreen->SourceValidate(pDrawable, 0, 0, pDrawable->width,
298                                 pDrawable->height, pPicture->subWindowMode);
299     }
300
301     void


Однако можно найти такое вот:

(gdb) frame 6
#6  0x00007fffeec3074c in radeon_scanout_do_update (xf86_crtc=0x55558d8d13b0, scanout_id=<optimized out>, src_pix=<optimized out>, extents=...) at /usr/src/debug/xorg-drv-ati-19.1.0/src/radeon_kms.c:997
997             CompositePicture(PictOpSrc,
(gdb) list
992             if (xf86_crtc->filter)
993                 SetPicturePictFilter(src, xf86_crtc->filter, xf86_crtc->params,
994                                      xf86_crtc->nparams);
995
996             pScreen->SourceValidate = NULL;
997             CompositePicture(PictOpSrc,
998                              src, NULL, dst,
999                              extents.x1, extents.y1, 0, 0, extents.x1,
1000                             extents.y1, extents.x2 - extents.x1,
1001                             extents.y2 - extents.y1);


SourceValidate явно выставляется в NULL.
Comment 2 Ivan A. Melnikov 2024-09-05 13:23:37 MSK
Действительно, когда-то в этом месте xorg-server проверял SourceValidate, а потом, начиная с 21.1, перестал:

https://git.altlinux.org/gears/x/xorg-server.git?p=xorg-server.git;a=commitdiff;h=ff310903f34ac34c916ad74e919d1ac12aea4715
Comment 3 Ivan A. Melnikov 2024-09-05 13:24:57 MSK
В мастере у xf86-video-ati найдено такое вот:

https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/commit/7a6a34af026f0bef8080b91baf97a729380bca01

С виду должно помочь.
Comment 4 Repository Robot 2024-09-09 10:31:39 MSK
xorg-drv-ati-4:22.0.0-alt1 -> sisyphus:

 Mon Sep 09 2024 Valery Inozemtsev <shrek@altlinux.ru> 4:22.0.0-alt1
 - 22.0.0 (closes: #51410)
Comment 5 Ivan A. Melnikov 2024-09-09 13:40:28 MSK
Спасибо, теперь работает.