Repository navigation
Conversation
…f slave's
When using `xdotool mouseup 1` in Chromium 136, a slave device is passed
to `drmmode_sprite_set_cursor`.
In `dix/events.c`, `dev->spriteInfo->sprite` for slave devices points to
their master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in `mi/misprite.c`, `miSpritePointerFuncs` checks
`IsFloating` for the incoming device, and `GetSprite` converts slave
devices to master devices if a non-floating slave is passed.
By contrast, the `drmmode_sprite_funcs` series functions track
per-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between `drmmode_sprite_funcs` and other sprite
handlers leads to the following issues in the drmmode sprite driver:
1. The slave device stores state that it shouldn't record.
2. The master device's record becomes stale. (e.g., `ChangeToCursor` in
`dix/events.c` called for a slave device updates the master's sprite,
causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with `mi/misprite.c`.
---
The reason physical devices work while XTEST devices fail is that
`ActivateGrab` and `DeactivateGrab` in XTEST devices' `deviceGrab` are
set to `ActivatePointerGrab` and `DeactivatePointerGrab`, respectively.
Physical devices use `ActivateKeyboardGrab` and
`DeactivateKeyboardGrab`. Thus, releasing a physical device will not
trigger `DeactivatePointerGrab`.
The physical device is initialized by `AddInputDevice` using
"KeyboardGrab", whereas the XTEST device is initialized by
`AllocDevicePair`, which overrides the default KeyboardGrab with
"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282>
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)
PR: #3787
Review: changes requested — mandatory trailer missingThe code change is sound. The commit message is not acceptable yet. Code: fineThe macro #define msGetSpritePriv(dev, ms, screen) dixLookupScreenPrivate(&(dev)->devPrivates, ...)becomes a function that resolves the master device first: if (!IsFloating(pDev))
pDev = GetMaster(pDev, MASTER_POINTER);
return dixLookupScreenPrivate(&(pDev)->devPrivates, ...);Checked for completeness: the private key is registered in This matches the reported failure: Blocking:
|
8b9f53a to
363f9c4
Compare
…f slave's
When using `xdotool mouseup 1` in Chromium 136, a slave device is passed
to `drmmode_sprite_set_cursor`.
In `dix/events.c`, `dev->spriteInfo->sprite` for slave devices points to
their master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in `mi/misprite.c`, `miSpritePointerFuncs` checks
`IsFloating` for the incoming device, and `GetSprite` converts slave
devices to master devices if a non-floating slave is passed.
By contrast, the `drmmode_sprite_funcs` series functions track
per-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between `drmmode_sprite_funcs` and other sprite
handlers leads to the following issues in the drmmode sprite driver:
1. The slave device stores state that it shouldn't record.
2. The master device's record becomes stale. (e.g., `ChangeToCursor` in
`dix/events.c` called for a slave device updates the master's sprite,
causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with `mi/misprite.c`.
---
The reason physical devices work while XTEST devices fail is that
`ActivateGrab` and `DeactivateGrab` in XTEST devices' `deviceGrab` are
set to `ActivatePointerGrab` and `DeactivatePointerGrab`, respectively.
Physical devices use `ActivateKeyboardGrab` and
`DeactivateKeyboardGrab`. Thus, releasing a physical device will not
trigger `DeactivatePointerGrab`.
The physical device is initialized by `AddInputDevice` using
"KeyboardGrab", whereas the XTEST device is initialized by
`AllocDevicePair`, which overrides the default KeyboardGrab with
"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282>
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)
PR: #3787
…f slave's
When using `xdotool mouseup 1` in Chromium 136, a slave device is passed
to `drmmode_sprite_set_cursor`.
In `dix/events.c`, `dev->spriteInfo->sprite` for slave devices points to
their master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in `mi/misprite.c`, `miSpritePointerFuncs` checks
`IsFloating` for the incoming device, and `GetSprite` converts slave
devices to master devices if a non-floating slave is passed.
By contrast, the `drmmode_sprite_funcs` series functions track
per-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between `drmmode_sprite_funcs` and other sprite
handlers leads to the following issues in the drmmode sprite driver:
1. The slave device stores state that it shouldn't record.
2. The master device's record becomes stale. (e.g., `ChangeToCursor` in
`dix/events.c` called for a slave device updates the master's sprite,
causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with `mi/misprite.c`.
---
The reason physical devices work while XTEST devices fail is that
`ActivateGrab` and `DeactivateGrab` in XTEST devices' `deviceGrab` are
set to `ActivatePointerGrab` and `DeactivatePointerGrab`, respectively.
Physical devices use `ActivateKeyboardGrab` and
`DeactivateKeyboardGrab`. Thus, releasing a physical device will not
trigger `DeactivatePointerGrab`.
The physical device is initialized by `AddInputDevice` using
"KeyboardGrab", whereas the XTEST device is initialized by
`AllocDevicePair`, which overrides the default KeyboardGrab with
"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282>
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)
PR: #3787
c42756b to
77653c3
Compare
77653c3 to
d770db6
Compare
…f slave's
When using `xdotool mouseup 1` in Chromium 136, a slave device is passed
to `drmmode_sprite_set_cursor`.
In `dix/events.c`, `dev->spriteInfo->sprite` for slave devices points to
their master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in `mi/misprite.c`, `miSpritePointerFuncs` checks
`IsFloating` for the incoming device, and `GetSprite` converts slave
devices to master devices if a non-floating slave is passed.
By contrast, the `drmmode_sprite_funcs` series functions track
per-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between `drmmode_sprite_funcs` and other sprite
handlers leads to the following issues in the drmmode sprite driver:
1. The slave device stores state that it shouldn't record.
2. The master device's record becomes stale. (e.g., `ChangeToCursor` in
`dix/events.c` called for a slave device updates the master's sprite,
causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with `mi/misprite.c`.
---
The reason physical devices work while XTEST devices fail is that
`ActivateGrab` and `DeactivateGrab` in XTEST devices' `deviceGrab` are
set to `ActivatePointerGrab` and `DeactivatePointerGrab`, respectively.
Physical devices use `ActivateKeyboardGrab` and
`DeactivateKeyboardGrab`. Thus, releasing a physical device will not
trigger `DeactivatePointerGrab`.
The physical device is initialized by `AddInputDevice` using
"KeyboardGrab", whereas the XTEST device is initialized by
`AllocDevicePair`, which overrides the default KeyboardGrab with
"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282>
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)
PR: #3787
d770db6 to
7d3f1a9
Compare
Review: passed (superseding the earlier
|
When using `xdotool mouseup 1` in Chromium 136, a slave device is passed
to `drmmode_sprite_set_cursor`.
In `dix/events.c`, `dev->spriteInfo->sprite` for slave devices points to
their master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in `mi/misprite.c`, `miSpritePointerFuncs` checks
`IsFloating` for the incoming device, and `GetSprite` converts slave
devices to master devices if a non-floating slave is passed.
By contrast, the `drmmode_sprite_funcs` series functions track
per-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between `drmmode_sprite_funcs` and other sprite
handlers leads to the following issues in the drmmode sprite driver:
1. The slave device stores state that it shouldn't record.
2. The master device's record becomes stale. (e.g., `ChangeToCursor` in
`dix/events.c` called for a slave device updates the master's sprite,
causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with `mi/misprite.c`.
---
The reason physical devices work while XTEST devices fail is that
`ActivateGrab` and `DeactivateGrab` in XTEST devices' `deviceGrab` are
set to `ActivatePointerGrab` and `DeactivatePointerGrab`, respectively.
Physical devices use `ActivateKeyboardGrab` and
`DeactivateKeyboardGrab`. Thus, releasing a physical device will not
trigger `DeactivatePointerGrab`.
The physical device is initialized by `AddInputDevice` using
"KeyboardGrab", whereas the XTEST device is initialized by
`AllocDevicePair`, which overrides the default KeyboardGrab with
"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282>
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)
Signed-off-by: Ben Song <bensongsyz@gmail.com>
7d3f1a9 to
d239d7c
Compare
…f slave's
When using `xdotool mouseup 1` in Chromium 136, a slave device is passed
to `drmmode_sprite_set_cursor`.
In `dix/events.c`, `dev->spriteInfo->sprite` for slave devices points to
their master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in `mi/misprite.c`, `miSpritePointerFuncs` checks
`IsFloating` for the incoming device, and `GetSprite` converts slave
devices to master devices if a non-floating slave is passed.
By contrast, the `drmmode_sprite_funcs` series functions track
per-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between `drmmode_sprite_funcs` and other sprite
handlers leads to the following issues in the drmmode sprite driver:
1. The slave device stores state that it shouldn't record.
2. The master device's record becomes stale. (e.g., `ChangeToCursor` in
`dix/events.c` called for a slave device updates the master's sprite,
causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with `mi/misprite.c`.
---
The reason physical devices work while XTEST devices fail is that
`ActivateGrab` and `DeactivateGrab` in XTEST devices' `deviceGrab` are
set to `ActivatePointerGrab` and `DeactivatePointerGrab`, respectively.
Physical devices use `ActivateKeyboardGrab` and
`DeactivateKeyboardGrab`. Thus, releasing a physical device will not
trigger `DeactivatePointerGrab`.
The physical device is initialized by `AddInputDevice` using
"KeyboardGrab", whereas the XTEST device is initialized by
`AllocDevicePair`, which overrides the default KeyboardGrab with
"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282>
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)
PR: #3787
When using
xdotool mouseup 1in Chromium 136, a slave device is passedto
drmmode_sprite_set_cursor.In
dix/events.c,dev->spriteInfo->spritefor slave devices points totheir master device when they are not floating, allowing these functions
to handle slave device cases correctly.
Similarly, in
mi/misprite.c,miSpritePointerFuncschecksIsFloatingfor the incoming device, andGetSpriteconverts slavedevices to master devices if a non-floating slave is passed.
By contrast, the
drmmode_sprite_funcsseries functions trackper-screen cursor reference counts. This cursor state should also be
recorded on the master device rather than the non-floating slave device.
This inconsistency between
drmmode_sprite_funcsand other spritehandlers leads to the following issues in the drmmode sprite driver:
ChangeToCursorindix/events.ccalled for a slave device updates the master's sprite,causing the subsequent comparison between old and new cursors on the
master device to fail.)
This patch resolves the inconsistency by using GetMaster when the device
is not floating, aligning the behavior with
mi/misprite.c.The reason physical devices work while XTEST devices fail is that
ActivateGrabandDeactivateGrabin XTEST devices'deviceGrabareset to
ActivatePointerGrabandDeactivatePointerGrab, respectively.Physical devices use
ActivateKeyboardGrabandDeactivateKeyboardGrab. Thus, releasing a physical device will nottrigger
DeactivatePointerGrab.The physical device is initialized by
AddInputDeviceusing"KeyboardGrab", whereas the XTEST device is initialized by
AllocDevicePair, which overrides the default KeyboardGrab with"PointerGrab".
(gdb) bt
#0 drmmode_sprite_set_cursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580, x=681, y=181)
at ../xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c:4349
#1 0x00005555555980a6 in miPointerUpdateSprite (pDev=0x5555569b88f0) at ../xorg-server/mi/mipointer.c:490
#2 0x0000555555597877 in miPointerDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/mi/mipointer.c:208
#3 0x000055555568ef1f in CursorDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/xfixes/cursor.c:168
#4 0x0000555555644150 in AnimCurDisplayCursor (pDev=0x5555569b88f0, pScreen=0x555555c26990, pCursor=0x55555702c580) at ../xorg-server/render/animcur.c:197
#5 0x00005555555d5f12 in ChangeToCursor (pDev=0x5555569b88f0, cursor=0x55555702c580) at ../xorg-server/dix/events.c:952
#6 0x00005555555d60ad in PostNewCursor (pDev=0x5555569b88f0) at ../xorg-server/dix/events.c:1003
#7 0x00005555555d79ac in DeactivatePointerGrab (mouse=0x5555569b88f0) at ../xorg-server/dix/events.c:1716
#8 0x000055555569d217 in ProcessDeviceEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:1955
#9 0x000055555569d433 in ProcessOtherEvent (ev=0x7fffe4073c20, device=0x5555569b88f0) at ../xorg-server/Xi/exevents.c:2020
#10 0x00005555556eb297 in ProcessPointerEvent (ev=0x7fffe4073c20, mouse=0x5555569b88f0) at ../xorg-server/xkb/xkbAccessX.c:756
#11 0x000055555558c86c in mieqProcessDeviceEvent (dev=0x5555569b88f0, event=0x7fffe4073c20, screen=0x555555c26990) at ../xorg-server/mi/mieq.c:503
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
#13 0x000055555566941a in ProcXTestDispatch (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:468
#14 0x00005555555c002c in Dispatch () at ../xorg-server/dix/dispatch.c:552
#15 0x00005555555cf546 in dix_main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/main.c:274
#16 0x00005555557bbf07 in main (argc=8, argv=0x7fffffffe9b8, envp=0x7fffffffea00) at ../xorg-server/dix/stubmain.c:34
(gdb) p pDev->name
$1 = 0x5555569b9960 "Virtual core XTEST pointer"
(gdb) frame 12
#12 0x00005555556692d9 in ProcXTestFakeInput (client=0x555556b5bf60) at ../xorg-server/Xext/xtest.c:434
434 mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
(gdb) p client->clientIds[0]->cmdname
$2 = 0x5555570852f0 "xdotool"
(gdb) p client->clientIds[0]->cmdargs
$3 = 0x555557078b30 "mouseup 1"
Closes: #1685
Part-of: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2282
(cherry picked from commit e19e86c)
(cherry picked from commit 035caac7b2468fd3857e0c2bff74956272993974)
(cherry picked from commit f170a12)