Live data from Hacker News

"Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

gist.github.com

21–30 of 115 posts

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#21
post #10

What's with "guard !foo else return" instead of "if foo return", is that just how Swift is written?

guard has two advantages: the compiler ensures that you exit the current scope if the condition does not hold (via return, break, continue, etc), and bindings established in the guard clause (e.g. let foo = optionalBar) remaining in scope after the guard block, rather than inside it like an if block.

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#22

But at the moment when it lags the system switches from hardware cursor to software cursor (CGCursorIsDrawnInFramebuffer() goes from 0 to 1) so maybe that transition is stalled somehow on Macbook Neo. With the disclaimer that I have zero knowledge of the MacBook Neo hardware, but I do know a bit about GPUs in general (including having written some GPU-accelerated drivers for Windows and the associated cursor-handling…

This was a really informative and interesting reply articulated in simple enough terms that I am now interested in GPUs, thanks

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#23

But at the moment when it lags the system switches from hardware cursor to software cursor (CGCursorIsDrawnInFramebuffer() goes from 0 to 1) so maybe that transition is stalled somehow on Macbook Neo. With the disclaimer that I have zero knowledge of the MacBook Neo hardware, but I do know a bit about GPUs in general (including having written some GPU-accelerated drivers for Windows and the associated cursor-handling…

>A software cursor is manually drawn by the graphics stack, which saves what was under it, draws the cursor, and then whenever it needs to be moved, writes the original data back, saves the data at the new position, and then draws the cursor there.

If a hardware layer is not being used the cursor layer will be treated like any other layer in the compositor. Modern compositors don't try and save and write pixels like that. It will just rerender it.

>(which is normally done per mouse interrupt);

It's normally done every frame the compositor makes.

>or it may end up drawing over what software wants to draw

The compositor composites everything at that will be shown on the next refresh of the display. Things don't indepently step on each others toes since it's just the compositor rendering and synchronizing all hardware layers (planes).

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#24
post #8

I’m not sure what the bug is, but this is a terrible fix. What this is doing is forcing the WindowServer to composite the cursor rather than treat it as a hardware overlay. I suppose the issue must be pretty bad for OP if this helps, but … ugh.

Terrible fix but it's a fix that's minimally-invasive and addresses a bug that causes a disproportionate annoyance to the fix. I can imagine your cursor lagging is something that is extremely annoying over time.

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#25
post #3

Steve turning in his grave

Relevant quote from https://www.folklore.org/Shut_Up.html : We showed [Gates] how the Macintosh mouse cursor moved smoothly, in a flicker-free fashion. "What kind of hardware do you use to draw the cursor?", he asked. Many current personal computers had special hardware to draw small bitmaps called "sprites", and he thought we might be doing something similar.

This quote from 1981 stresses that taking away a responsive cursor is the most arrogant and disrespectful bug.

The audacity of developers to restart the discussion whether the mouse should follow user input induces rage on so many levels.

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#26

But at the moment when it lags the system switches from hardware cursor to software cursor (CGCursorIsDrawnInFramebuffer() goes from 0 to 1) so maybe that transition is stalled somehow on Macbook Neo. With the disclaimer that I have zero knowledge of the MacBook Neo hardware, but I do know a bit about GPUs in general (including having written some GPU-accelerated drivers for Windows and the associated cursor-handling…

how do hardware cursors work in a composited desktop?

the cursor could just be another small rectangle texture you position on top of the other surfaces. there is no need to read the framebuffer/write into it, its just a z-stack of 3d surfaces now

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#28
post #24
post #8

I’m not sure what the bug is, but this is a terrible fix. What this is doing is forcing the WindowServer to composite the cursor rather than treat it as a hardware overlay. I suppose the issue must be pretty bad for OP if this helps, but … ugh.

Terrible fix but it's a fix that's minimally-invasive and addresses a bug that causes a disproportionate annoyance to the fix. I can imagine your cursor lagging is something that is extremely annoying over time.

linux was plagued for a long time by lagging mouse cursor

Re: "Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

#30
Round rect corners are to blame?

The root cause for the issue is probably (I'm not an Apple developer) due to huge round rectangles on the window shape corners. Rendering the window with the corners would include rendering whatever other windows and widgets under the window. (Which will have a lag and some more operations with transparency, which the developers probably want to avoid - while I'm not sure about this part).

Post reply on HN