pelya / xserver-xsdl

XSDL - X.Org server ported to Android using SDL.
https://play.google.com/store/apps/details?id=x.org.server
Other
304 stars 54 forks source link

mouse emulation laggy #110

Open zanfix opened 4 years ago

zanfix commented 4 years ago

XServer XSDL version: 1.20.41 Device: Google Pixel C (Nvidia Tegra X1, aarch64) OS: lineage os 14.1

environment: debian 9 stretch with xfec4 in local chroot, SYSVIPC enabled in kernel, /dev/shm mounted and libandroid-shmem.o set in /etc/ld.so.preload

I noticed that, on my device, with the new version (1.20.41) the mouse emulation is not working as smooth as with the previous version (1.11.40).

I will try to explain my issue: (mouse emulation mode: "Desktop (no emulation) or laptop (large)"

It seems that the issue has something to do with moving the mouse while the left button is pressed

I tried executing xinput in test mode, to see what i get, with the following command:

~$ xinput test "Android touchscreen and stylus"

What i see is that while i drag the finger/stylus on the screen area, no "move" events will appear on the terminal. They will appear all together (like if blocked...?!) once i stop moving the finger/stylus

Example:

zanf@localhost:~$ xinput test "Android touchscreen and stylus"

---> touched screen here motion a[0]=117 a[1]=1268 a[2]=25
motion a[2]=50 button press 1 a[2]=75 motion a[2]=101

---> No events while dragging finger over screen!!!

<--- stopped moving and removed finger from screen events will appear on terminal all together! motion a[0]=136 a[1]=1256 a[2]=26 motion a[0]=148 a[1]=1250 a[2]=26 motion a[0]=162 a[1]=1243 a[2]=26 motion a[0]=175 a[1]=1236 a[2]=26 motion a[0]=189 a[1]=1226 a[2]=26 motion a[0]=204 a[1]=1216 a[2]=26 motion a[0]=219 a[1]=1206 a[2]=26 motion a[0]=237 a[1]=1194 a[2]=26 motion a[0]=254 a[1]=1182 a[2]=26 motion a[0]=275 a[1]=1167 a[2]=26 motion a[0]=295 a[1]=1155 a[2]=26 motion a[0]=316 a[1]=1140 a[2]=26 motion a[0]=338 a[1]=1123 a[2]=26 motion a[0]=361 a[1]=1107 a[2]=26 motion a[0]=385 a[1]=1089 a[2]=26 motion a[2]=53 motion a[0]=408 a[1]=1074 a[2]=27 motion a[0]=433 a[1]=1057 a[2]=27 motion a[0]=457 a[1]=1041 a[2]=27 motion a[2]=53 motion a[0]=481 a[1]=1026 a[2]=26 motion a[0]=507 a[1]=1010 a[2]=26 motion a[0]=531 a[1]=994 a[2]=26 motion a[0]=555 a[1]=979 a[2]=26 motion a[0]=579 a[1]=963 a[2]=26 motion a[2]=53 motion a[0]=603 a[1]=948 a[2]=27 motion a[0]=627 a[1]=934 a[2]=27 motion a[0]=651 a[1]=918 a[2]=27 motion a[0]=675 a[1]=903 a[2]=27 motion a[2]=53 motion a[0]=699 a[1]=888 a[2]=26 motion a[0]=724 a[1]=873 a[2]=26 motion a[2]=53 motion a[0]=747 a[1]=858 a[2]=27 motion a[0]=770 a[1]=842 a[2]=27 motion a[2]=53 motion a[0]=793 a[1]=825 a[2]=26 motion a[0]=816 a[1]=810 a[2]=26 motion a[2]=53 motion a[0]=840 a[1]=795 a[2]=27 motion a[0]=863 a[1]=780 a[2]=27 motion a[0]=886 a[1]=766 a[2]=27 motion a[0]=909 a[1]=750 a[2]=27 motion a[2]=53 motion a[0]=933 a[1]=736 a[2]=26 motion a[2]=53 motion a[0]=956 a[1]=721 a[2]=27 motion a[0]=978 a[1]=706 a[2]=27 motion a[0]=999 a[1]=691 a[2]=27 motion a[0]=1022 a[1]=677 a[2]=27 motion a[0]=1042 a[1]=664 a[2]=27 motion a[0]=1062 a[1]=651 a[2]=27 motion a[0]=1080 a[1]=638 a[2]=27 motion a[0]=1101 a[1]=624 a[2]=27 motion a[2]=53 motion a[0]=1119 a[1]=613 a[2]=26 motion a[0]=1138 a[1]=602 a[2]=26 motion a[0]=1155 a[1]=591 a[2]=26 motion a[2]=53 motion a[0]=1170 a[1]=579 a[2]=27 motion a[0]=1186 a[1]=569 a[2]=27 motion a[0]=1201 a[1]=558 a[2]=27 motion a[0]=1216 a[1]=548 a[2]=27 motion a[0]=1230 a[1]=539 a[2]=27 motion a[0]=1243 a[1]=528 a[2]=27 motion a[2]=53 motion a[0]=1257 a[1]=520 a[2]=26 motion a[0]=1269 a[1]=511 a[2]=26 motion a[2]=53 motion a[0]=1283 a[1]=503 a[2]=27 motion a[2]=55 motion a[0]=1295 a[1]=495 a[2]=28 motion a[2]=55 motion a[0]=1306 a[1]=488 a[2]=27 motion a[0]=1317 a[1]=480 a[2]=27 motion a[0]=1327 a[1]=473 a[2]=27 motion a[0]=1336 a[1]=466 a[2]=27 motion a[0]=1345 a[1]=460 a[2]=27 motion a[0]=1354 a[1]=453 a[2]=27 motion a[0]=1363 a[1]=447 a[2]=27 motion a[2]=53 motion a[0]=1371 a[1]=441 a[2]=26 motion a[0]=1379 a[1]=435 a[2]=26 motion a[0]=1386 a[1]=431 a[2]=26 motion a[0]=1392 a[1]=426 a[2]=26 motion a[2]=53 motion a[0]=1398 a[1]=422 a[2]=27 motion a[0]=1404 a[1]=418 a[2]=27 motion a[0]=1410 a[1]=414 a[2]=27 motion a[0]=1416 a[1]=410 a[2]=27 motion a[2]=53 motion a[0]=1421 a[1]=407 a[2]=26 motion a[2]=53 motion a[0]=1428 a[1]=403 a[2]=27 motion a[0]=1434 a[1]=399 a[2]=27 motion a[0]=1439 a[1]=395 a[2]=27 motion a[2]=53 motion a[0]=1444 a[1]=391 a[2]=26 motion a[0]=1448 a[1]=388 a[2]=26 motion a[2]=53 motion a[0]=1453 a[1]=385 a[2]=27 motion a[0]=1458 a[1]=382 a[2]=27 motion a[0]=1462 a[1]=378 a[2]=27 motion a[0]=1467 a[1]=375 a[2]=27 motion a[0]=1472 a[1]=371 a[2]=27 motion a[2]=53 motion a[0]=1477 a[1]=367 a[2]=26 motion a[2]=53 motion a[0]=1481 a[1]=363 a[2]=27 motion a[2]=53 motion a[0]=1487 a[1]=359 a[2]=26 motion a[0]=1492 a[1]=354 a[2]=26 motion a[0]=1497 a[1]=349 a[2]=26 motion a[0]=1502 a[1]=347 a[2]=26 motion a[2]=53 motion a[0]=1507 a[1]=342 a[2]=27 motion a[0]=1512 a[1]=337 a[2]=27 motion a[2]=53 motion a[0]=1518 a[1]=333 a[2]=26 motion a[2]=53 motion a[0]=1523 a[1]=328 a[2]=27 motion a[0]=1527 a[1]=324 a[2]=27 motion a[2]=53 motion a[0]=1533 a[1]=318 a[2]=26 motion a[0]=1538 a[1]=314 a[2]=26 motion a[2]=53 motion a[0]=1543 a[1]=309 a[2]=27 motion a[0]=1548 a[1]=306 a[2]=27 motion a[2]=53 motion a[0]=1553 a[1]=301 a[2]=26 motion a[0]=1560 a[1]=296 a[2]=26 motion a[0]=1564 a[1]=291 a[2]=26 motion a[0]=1569 a[1]=286 a[2]=26 motion a[0]=1574 a[1]=282 a[2]=26 motion a[2]=53 motion a[0]=1579 a[1]=278 a[2]=27 motion a[2]=53 motion a[0]=1584 a[1]=275 a[2]=26 motion a[0]=1589 a[1]=270 a[2]=26 motion a[0]=1593 a[1]=265 a[2]=26 motion a[0]=1598 a[1]=261 a[2]=26 motion a[0]=1602 a[1]=257 a[2]=26 motion a[0]=1608 a[1]=252 a[2]=26 motion a[0]=1612 a[1]=248 a[2]=26 motion a[0]=1616 a[1]=246 a[2]=26 motion a[0]=1620 a[1]=243 a[2]=26 motion a[0]=1623 a[1]=240 a[2]=26 motion a[0]=1626 a[1]=237 a[2]=26 motion a[0]=1628 a[1]=236 a[2]=26 motion a[0]=1629 a[1]=234 a[2]=26 motion a[0]=1631 a[1]=233 a[2]=26 motion a[0]=1632 a[1]=231 a[2]=26 motion a[0]=1634 a[1]=230 a[2]=26 motion a[0]=1635 a[1]=229 a[2]=26 motion a[0]=1635 a[1]=228 a[2]=26 motion a[2]=31 motion a[0]=1635 a[1]=224 a[2]=5 button release 1 a[2]=5

I have done the same test with xinput on the previous version (1.11.40) an i noticed that while i move the finger/stylus on the screen the "move" events will be logged correctly on the terminal!

Any pointer here would be appreciated!

zanfix commented 4 years ago

Hi all,

I upgraded the version of XServer XSDL to 1.20.41 on my samsung galaxy s5 (klte) to see if the issue is present, and I can say that it is! I have Lineage os 15.1 on this device.

So I can reproduce the problem on two different devices but i wonder if it's due to a problem in LineageOS... but on my tablet it's 14.1 and on my phone it's 15.1...

The fact is that mouse lag really degrades the experience for me... mainly because window scrolling is slow or choppy! If i click on the screen, and my click involves a mouse move (can happen also if my click was not "precise") the entire UI will lag!!! It becomes quite annoyng while using firefox with a bluetooth mouse...

So is anybody getting the same issue on another platform/device?

Pelya, I have seen that the todo.txt in commandergenius has been updated... Is there anything I can do to help this out? I have C language experience

gahu777 commented 4 years ago

on my ofw note 9 the same , after 1.11.40 something is broken

JackHunt commented 4 years ago

I have noticed the same on a Galaxy Tab S4, Android 9 with March 2020 security patches.

nik012003 commented 4 years ago

Same problem here, anyone found a solution?

commander-cb commented 4 years ago

heya. have the same problem samsung tab a . trying different things.

try starting server and all that ~ then plug in the mouse . see if it acts different for me it did. the lag , in the cursor was gone . the lag on the windows remained , and there was a double cursor. so it the end, there might be somethibg somewhere that is easily fixable i think i can use it with the double cursor, at least it isnt laggy at all

pelya commented 4 years ago

1.20.50 should fix mouse lag, and it fixes double cursor on Android 9 and newer.

As for window lag, is your WiFi connection fast enough? Does both your tablet and your WiFi router support 5 GHz mode? If you decrease video resolution to 800x600, does the lag disappear? Less pixels to transfer would mean less lag. You can also check it by plugging your tablet into PC using USB cable, enabling USB tethering in Android settings, and putting your tethered IP address into DISPLAY variable.

zanfix commented 4 years ago

I must say that with version 1.20.50 overall user experience has improved a lot, it feels more responsive!!! The mouse pointer does not lag or jump on the screen anymore.

Also "Window lag" appears to have improved, but not gone yet. It's quite apparent if you do, for example:

I use XFCE, and if I disable "Menu (Whisker) > Settings > Window Manager Tweaks > Enable display composing" the "lag" problem gets even worse!

zanfix commented 3 years ago

I noticed that if a gui program will hide the mouse cursor, the video lag inside that program will disappear!!! Example: quakespasm. Playing the game with a physical mouse is fine!!!

So i wondered if it would be possible to disable the mouse cursor entirely in X, and i found out that there is the -nocursor option! Add it in Xsdl "Device Configuation" under "Command line parameters, one per line"

This workaround will make the video lag disappear entirely!!! Dragging around a window or scrolling it using the scroll bar becomes super smooth!!!

Sure, this means that you will NOT see a mouse cursor at all, but should be fine (in my opinion) if you are using only the touchscreen. (not using a physical mouse, bluetooth or usb)

nik012003 commented 3 years ago

So i wondered if it would be possible to disable the mouse cursor entirely in X, and i found out that there is the -nocursor option! Add it in Xsdl "Device Configuation" under "Command line parameters, one per line"

This workaround will make the video lag disappear entirely!!! Dragging around a window or scrolling it using the scroll bar becomes super smooth!!!

I can confirm that this solution worked on OnePlus 6t running Android 10. (XServer XSDL 1.20.50)

4nric commented 3 years ago

@pelya

I can also confirm -nocursor solves the laggy UI issue. Great solution for touchscreens, but bad if cursor is really needed.

I use Samsung DeX a lot. I can confirm the mouse still works albiet the cursor being invisible. Windows can now be dragged around smoothly, no more scrolling or freezing UI issue, and videos no longer drop frames when mouse is moved -- all while trying to guess where to click though. I'd rather have the default Android system cursor even if it doesn't change on context. If you have time, I would love to have an APK for this.. Maybe adding an option to unhide the default cursor on Device configuration?

Version 1.20.51

zanfix commented 3 years ago

@pelya

I can also confirm -nocursor solves the laggy UI issue. Great solution for touchscreens, but bad if cursor is really needed.

I use Samsung DeX a lot. I can confirm the mouse still works albiet the cursor being invisible. Windows can now be dragged around smoothly, no more scrolling or freezing UI issue, and videos no longer drop frames when mouse is moved -- all while trying to guess where to click though. I'd rather have the default Android system cursor even if it doesn't change on context. If you have time, I would love to have an APK for this.. Maybe adding an option to unhide the default cursor on Device configuration?

Version 1.20.51

Looking at the sources I found out that if you compile the app setting HideSystemMousePointer=n in project/jni/application/src/AndroidAppSettings.cfg will do the trick...

I'm using a Samsung Galaxy Tab s6 with OneUi 2.5 (android 10)

4nric commented 3 years ago

project/jni/application/src/AndroidAppSettings.cfg

Is this an existing file or it has to be made before compiling? I can't seem to find it on the repo.. Still have to fix my PC though. I'll try to compile soon.

zanfix commented 3 years ago

project/jni/application/src/AndroidAppSettings.cfg

Is this an existing file or it has to be made before compiling? I can't seem to find it on the repo.. Still have to fix my PC though. I'll try to compile soon.

Yeah sorry, the src folder is a simlink...

Look in project/jni/application/xserver/AndroidAppSettings.cfg

skRebel commented 3 years ago

https://github.com/andykitchen/swcursor this might work as a temporary work around

zanfix commented 3 years ago

https://github.com/andykitchen/swcursor this might work as a temporary work around

It works, but for some reason the cursor remains behind the xfce panel

skRebel commented 3 years ago

https://github.com/andykitchen/swcursor this might work as a temporary work around

It works, but for some reason the cursor remains behind the xfce panel

Yeah I noticed that too, can't win everything ig, I was thinking about writing my own fork of it to maybe fix the issue and emulate a proper mouse cursor, with changing cursor icons and everything but I unfortunately just don't have the time at the moment

Syco54645 commented 2 years ago

I noticed that if a gui program will hide the mouse cursor, the video lag inside that program will disappear!!! Example: quakespasm. Playing the game with a physical mouse is fine!!!

So i wondered if it would be possible to disable the mouse cursor entirely in X, and i found out that there is the -nocursor option! Add it in Xsdl "Device Configuation" under "Command line parameters, one per line"

This workaround will make the video lag disappear entirely!!! Dragging around a window or scrolling it using the scroll bar becomes super smooth!!!

Sure, this means that you will NOT see a mouse cursor at all, but should be fine (in my opinion) if you are using only the touchscreen. (not using a physical mouse, bluetooth or usb)

Unfortunately this does not appear working with klipperscreen, the application freezes at launch. Have not looked further in to why it would freeze.