Bug 1444472

Summary: [RFE] Inverting mouse pointer
Product: Red Hat Enterprise Linux 8 Reporter: Radek Duda <rduda>
Component: spice-gtkAssignee: Default Assignee for SPICE Bugs <rh-spice-bugs>
Status: CLOSED WONTFIX QA Contact: SPICE QE bug list <spice-qe-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 8.1CC: dblechte, fziglio, rbalakri, rduda, spice-qe-bugs, tpelka, victortoso, ybendito
Target Milestone: rcKeywords: FutureFeature
Target Release: 8.1   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-09 19:15:48 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Spice RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1425451    

Description Radek Duda 2017-04-21 12:07:31 UTC
Description of problem:
Mouse pointer can not be set to inverting

Version-Release number of selected component (if applicable):
client/host: rhel7.4beta:
spice-server-0.12.8-1.el7.x86_64
spice-gtk3-0.33-3.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64
virt-viewer-5.0-2.el7.x86_64

guest: win10 64bit
with RHEV-Tools 4.1.5
spice-qxl-wddm-dod-0.16
upstream spice-vdagent 0.8.0

/usr/libexec/qemu-kvm -name guest=win10,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu
/domain-19-win10/master-key.aes -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off,dump-guest-core=off -cpu Broadwell,+rtm,+hle,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff -m 4096 -realtime mlock=off -smp 2,sock
ets=2,cores=1,threads=1 -uuid 391164e5-0a1e-40b6-ac98-1e3223ee2131 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-19-win10/monitor.sock,server,nowait -mon chardev=ch
armonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -boot strict=on -devic
e ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -de
vice ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/home/rduda/Virtualky/win10.qcow2,format=qcow2,if=none,id=drive-i
de0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/home/rduda/Virtualky/RHEV-toolsSetup_4.1_5.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on -device ide-cd,bu
s=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -netdev tap,fd=27,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:7d:7a:f7,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chard
ev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -device usb-tablet,id=input0,bus
=usb.0,port=1 -spice port=5900,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_output
s=1,bus=pci.0,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x8 -device qxl,id=video2,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x9 -device qxl,id=video3,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0xa -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on


How reproducible:
always


Steps to Reproduce:
1. boot VM guest and connect to it with remote-viewer
2. in VM guest go to 'Control Panel\Ease of Access\Ease of Access Center\Make the mouse easier to use' and choose any size of inverting mouse pointers -> Apply

Actual results:
Mouse pointer is not inverting. Its colour is white.

Expected results:
Mouse pointer is inverting

Comment 1 ybendito 2017-04-23 16:02:01 UTC
Does Win7 QXL driver support inverted mouse correctly?

Comment 2 Radek Duda 2017-04-24 09:44:11 UTC
(In reply to ybendito from comment #1)
> Does Win7 QXL driver support inverted mouse correctly?

According to test plan attached to https://bugzilla.redhat.com/show_bug.cgi?id=1425451 it should support it (see Test ID 2.3) it should support it.

It also applies with reproduction step:
Mouse properties-> pointers-> choose Scheme as 'Windows inverted'

I noticed that mouse pointer is inverted during dragging of some window frame (change its colour to the colour inverted to the background) or when cursor is changed to 'move' shape (right click on 'title bar'). Otherwise the cursor remains white.

Comment 3 Frediano Ziglio 2017-04-27 16:19:40 UTC
Looks like it's inverted when Windows render it (on dragging usually Windows renders it).
I tested with both VNC and Spice and the problem occurs with QXL (although on VNC you get a transparent mouse while on Spice a white one), not with VGA.
So the problem seems QXL.
Looking at QXLCursorCmd, QXLCursor (the structures passed from guest to server), spice.proto (client <-> server definition file) and SpiceCursorHeader (message structure) there's no support for inverted cursors.
This means that this can currently be achieved only using software mouse (making Windows do the rendering).

Comment 4 ybendito 2017-04-28 06:55:45 UTC
(In reply to Frediano Ziglio from comment #3)
> Looks like it's inverted when Windows render it (on dragging usually Windows
> renders it).
> I tested with both VNC and Spice and the problem occurs with QXL (although
> on VNC you get a transparent mouse while on Spice a white one), not with VGA.
> So the problem seems QXL.
> Looking at QXLCursorCmd, QXLCursor (the structures passed from guest to
> server), spice.proto (client <-> server definition file) and
> SpiceCursorHeader (message structure) there's no support for inverted
> cursors.
> This means that this can currently be achieved only using software mouse
> (making Windows do the rendering).

As far as I can see this is not supported on client side.

Inverted cursor does not required any special support in spice-protocol. Windows driver receives it as regular 'monochrome cursor', which always has 2 bitmasks: 'AND' and 'XOR' (for example, https://msdn.microsoft.com/en-us/library/windows/desktop/ms648380(v=vs.85).aspx), when AND-XOR combination for each pixel defines pixel state: 00 (black), 01 (white), 10 (transparent), 11 (inverted). Spice client receives the masks, but spice-gtk converts them to ARGB color bitmap which can't describe inversion (but can describe transparency by alpha=0), then spice-gtk uses GDK for cursor creation from ARGB bitmap. GDK creates cursor and constructs AND-XOR bitmask for it, but this bitmask never contains inverted combination (inversion info was lost in previous conversion).
I did not find GDK API that can create cursor with AND-XOR, so there is no simple fix. 

I'm going to remove this test from test plan. The bug can stay open until fixed in GDK/spice-gtk

Comment 5 Victor Toso 2017-04-28 09:46:44 UTC
As per comment #4, moving to spice-gtk

Comment 7 Frediano Ziglio 2017-04-28 11:09:19 UTC
(In reply to ybendito from comment #4)
> (In reply to Frediano Ziglio from comment #3)
> > Looks like it's inverted when Windows render it (on dragging usually Windows
> > renders it).
> > I tested with both VNC and Spice and the problem occurs with QXL (although
> > on VNC you get a transparent mouse while on Spice a white one), not with VGA.
> > So the problem seems QXL.
> > Looking at QXLCursorCmd, QXLCursor (the structures passed from guest to
> > server), spice.proto (client <-> server definition file) and
> > SpiceCursorHeader (message structure) there's no support for inverted
> > cursors.
> > This means that this can currently be achieved only using software mouse
> > (making Windows do the rendering).
> 
> As far as I can see this is not supported on client side.
> 
> Inverted cursor does not required any special support in spice-protocol.
> Windows driver receives it as regular 'monochrome cursor', which always has
> 2 bitmasks: 'AND' and 'XOR' (for example,
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms648380(v=vs.85).
> aspx), when AND-XOR combination for each pixel defines pixel state: 00
> (black), 01 (white), 10 (transparent), 11 (inverted). Spice client receives
> the masks, but spice-gtk converts them to ARGB color bitmap which can't
> describe inversion (but can describe transparency by alpha=0), then
> spice-gtk uses GDK for cursor creation from ARGB bitmap. GDK creates cursor
> and constructs AND-XOR bitmask for it, but this bitmask never contains
> inverted combination (inversion info was lost in previous conversion).
> I did not find GDK API that can create cursor with AND-XOR, so there is no
> simple fix. 

You are right for mono cursors. However there are also colour inverted
cursors (at least in Windows 10) where alpha channel specifies screen (0x00) or xor (0xff) operation. These would need support in the protocol too.

Comment 8 ybendito 2017-04-29 11:35:03 UTC
(In reply to Frediano Ziglio from comment #7)
> (In reply to ybendito from comment #4)
> > (In reply to Frediano Ziglio from comment #3)
> > > Looks like it's inverted when Windows render it (on dragging usually Windows
> > > renders it).
> > > I tested with both VNC and Spice and the problem occurs with QXL (although
> > > on VNC you get a transparent mouse while on Spice a white one), not with VGA.
> > > So the problem seems QXL.
> > > Looking at QXLCursorCmd, QXLCursor (the structures passed from guest to
> > > server), spice.proto (client <-> server definition file) and
> > > SpiceCursorHeader (message structure) there's no support for inverted
> > > cursors.
> > > This means that this can currently be achieved only using software mouse
> > > (making Windows do the rendering).
> > 
> > As far as I can see this is not supported on client side.
> > 
> > Inverted cursor does not required any special support in spice-protocol.
> > Windows driver receives it as regular 'monochrome cursor', which always has
> > 2 bitmasks: 'AND' and 'XOR' (for example,
> > https://msdn.microsoft.com/en-us/library/windows/desktop/ms648380(v=vs.85).
> > aspx), when AND-XOR combination for each pixel defines pixel state: 00
> > (black), 01 (white), 10 (transparent), 11 (inverted). Spice client receives
> > the masks, but spice-gtk converts them to ARGB color bitmap which can't
> > describe inversion (but can describe transparency by alpha=0), then
> > spice-gtk uses GDK for cursor creation from ARGB bitmap. GDK creates cursor
> > and constructs AND-XOR bitmask for it, but this bitmask never contains
> > inverted combination (inversion info was lost in previous conversion).
> > I did not find GDK API that can create cursor with AND-XOR, so there is no
> > simple fix. 
> 
> You are right for mono cursors. However there are also colour inverted
> cursors (at least in Windows 10) where alpha channel specifies screen (0x00)
> or xor (0xff) operation. These would need support in the protocol too.

Inverted scheme (included in Win10 and earlier) uses monochrome cursor layout to create cursor with screen inversion and this can be fixed on client side and does not depend on spice-server/protocol.

Indeed, color cursor with inverted areas (I did not find built-in or custom cursors that use it) requires additional type of cursor in spice protocol. Currently the qxl-wddm-dod driver does not declare support for such format and if it will be supported by spice-protocol / client, this should be communicated to the windows guest driver via capabilities or other way.

Comment 9 David Blechter 2018-12-10 17:15:13 UTC
low priority, moving to rhel 8

Comment 10 Victor Toso 2020-01-23 14:29:06 UTC
(In reply to Frediano Ziglio from comment #7)
> You are right for mono cursors. However there are also colour inverted
> cursors (at least in Windows 10) where alpha channel specifies screen (0x00)
> or xor (0xff) operation. These would need support in the protocol too.

A RFE, keeping in the backlog for now.