Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer lock/release fixes #7110

Merged
merged 14 commits into from
Jul 31, 2024
Merged

Buffer lock/release fixes #7110

merged 14 commits into from
Jul 31, 2024

Conversation

vaxerski
Copy link
Member

Fixes a few edge cases with buffer locking and releasing. Needs testing.

Fixes #7091

Possibly impacted:

  • direct scanout
  • cursors

Untested:

  • xwayland

@vaxerski
Copy link
Member Author

vaxerski commented Jul 30, 2024

also @UjinT34 looking at the nvidia dumb copy this might break this with client side cursors, but I am unsure. Care to test?

(tbh we should drop the double-logic and just pass texture buffers directly)

@vaxerski
Copy link
Member Author

I need some testing, rocking this rn and all seems well

@Agent00Ming
Copy link
Contributor

Cursor dumb copy crashes to tty when I hover over a client side cursor window. Trying to get the backtrace only gives

#0  0x00005d287978b64e in Hyprutils::Memory::CWeakPointer<IHLBuffer>::lock (this=0x0) at /usr/include/hyprutils/memory/WeakPtr.hpp:122
#1  0x00005d2879822932 in CPointerManager::renderHWCursorBuffer (this=0x5d28b4d2aa80, state=..., texture=...) at /home/ming/documents/git/hyprland/src/managers/PointerManager.cpp:433
        PDUMB = {p_ = 0x5d28b4d9fb00}

Direct scanout works (intel). Xwayland works.

@diniamo
Copy link
Contributor

diniamo commented Jul 30, 2024

Guess I'll put it here too:

  • Black borders appeared on the edge of my monitor
  • XCursor shapes are wrong again

@vaxerski
Copy link
Member Author

dumb copy is a bit complicated here, I'll see what I can do... the way it's been working right now was technically wrong

@vaxerski
Copy link
Member Author

@Agent00Ming pls test dumb

@Agent00Ming
Copy link
Contributor

crashes on start bt.txt

@vaxerski
Copy link
Member Author

can you compile hyprutils with asan and get a trace?

@Agent00Ming
Copy link
Contributor

dunno if I did it right asan.txt

@vaxerski
Copy link
Member Author

now?

@Agent00Ming
Copy link
Contributor

no, it still crashes on start

@vaxerski
Copy link
Member Author

woo cursed fixed

@vaxerski
Copy link
Member Author

try no

@Agent00Ming
Copy link
Contributor

hmm, cursor is invisible in blender but appears normally elsewhere.
hyprlandd.log

@vaxerski
Copy link
Member Author

vaxerski commented Jul 30, 2024

try now

@Agent00Ming
Copy link
Contributor

crash on client side cursor bt.txt

@vaxerski
Copy link
Member Author

yeeeaaa this is a problem ugh

@vaxerski
Copy link
Member Author

vaxerski commented Jul 30, 2024

architecture kinda sucks in this scenario try now

@Agent00Ming
Copy link
Contributor

Agent00Ming commented Jul 30, 2024

it works now but direct scanout is left and entered for every frame in minecraft (xwayland) and it causes the same for the very first frame that the cursor hovers over vkcube-wayland in direct scanout nvm it happens on main too, something weird going on that has gone unnoticed

@vaxerski
Copy link
Member Author

can you bisect that one to make sure it's not something that should be fixed here

@Agent00Ming
Copy link
Contributor

first bad commit: [6828656] xwayland: fix high cpu idle usage
bisect_xwl_ds.log

@vaxerski
Copy link
Member Author

ok its unrelated to this then, will merge tomorrow. Thanks, you can open another issue I guess

@Beyley
Copy link

Beyley commented Jul 31, 2024

Can confirm this PR fixes #7103 for me. However it seems to introduce a crash when closing Minecraft (only when running under gamescope) which did not happen before. This could be an unrelated crash caused by external changes though.
hyprlandCrashReport127343.txt

i attempted a bisect, and it points to ec9e209, although on that commit i couldnt even open the game since almost no windows would render

@vaxerski
Copy link
Member Author

get a debug stacktrace please

@vaxerski
Copy link
Member Author

I'll wait a few hours more, otherwise I am merging and that crash can be opened as an issue, if anyone can repro

@gulafaran
Copy link
Contributor

I'll wait a few hours more, otherwise I am merging and that crash can be opened as an issue, if anyone can repro

compiling atm, il fire up my trusty bg3, and various xwl things see if i can reproduce. heh

I'll wait a few hours more, otherwise I am merging and that crash can be opened as an issue, if anyone can repro

I'll wait a few hours more, otherwise I am merging and that crash can be opened as an issue, if anyone can repro

gamescope -f vkcube

#0  0x00007ffff70a159c in pthread_kill () at /usr/lib64/libc.so.6
#1  0x00007ffff704449a in raise () at /usr/lib64/libc.so.6
#2  0x00007ffff70284ed in abort () at /usr/lib64/libc.so.6
#3  0x0000555555691f73 in handleUnrecoverableSignal (sig=11) at ../hyprland-9999/src/Compositor.cpp:72
#4  0x00007ffff7044530 in <signal handler called> () at /usr/lib64/libc.so.6
#5  std::vector<Hyprutils::Memory::CWeakPointer<CWLSubsurfaceResource>, std::allocator<Hyprutils::Memory::CWeakPointer<CWLSubsurfaceResource> > >::size (this=0x348) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/vector:113
#6  std::erase_if<Hyprutils::Memory::CWeakPointer<CWLSubsurfaceResource>, std::allocator<Hyprutils::Memory::CWeakPointer<CWLSubsurfaceResource> >, CWLSurfaceResource::bfHelper(std::vector<Hyprutils::Memory::CSharedPointer<CWLSurfaceResource> >, std::function<void(Hyprutils::Memory::CSharedPointer<CWLSurfaceResource>, const Hyprutils::Math::Vector2D&, void*)>, void*)::<lambda(const auto:56&)> > (__cont=<error reading variable: Cannot access memory at address 0x350>, __pred=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/vector:117
#7  CWLSurfaceResource::bfHelper (this=this@entry=0x555556c47120, nodes=std::vector of length 6, capacity 6 = {...}, fn=..., data=data@entry=0x7fffffffcdf0) at ../hyprland-9999/src/protocols/core/Compositor.cpp:261
#8  0x00005555558ec5aa in CWLSurfaceResource::bfHelper (this=this@entry=0x555556c47120, nodes=std::vector of length 1, capacity 1 = {...}, fn=..., data=data@entry=0x7fffffffcdf0) at ../hyprland-9999/src/protocols/core/Compositor.cpp:294
#9  0x00005555558ec861 in CWLSurfaceResource::breadthfirst (this=0x555556c47120, fn=..., data=0x7fffffffcdf0) at ../hyprland-9999/src/protocols/core/Compositor.cpp:300
#10 0x000055555593898a in CHyprRenderer::renderWindow (this=<optimized out>, pWindow=..., pMonitor=0x5555568e50d0, time=<optimized out>, decorate=true, mode=RENDER_PASS_ALL, ignorePosition=false, ignoreAllGeometry=false) at ../hyprland-9999/src/render/Renderer.cpp:619
#11 0x00005555559305c2 in CHyprOpenGLImpl::makeWindowSnapshot (this=<optimized out>, pWindow=...) at ../hyprland-9999/src/render/OpenGL.cpp:2327
#12 0x000055555576e5ef in Events::listener_unmapWindow (owner=<optimized out>, data=<optimized out>) at ../hyprland-9999/src/events/Windows.cpp:611
#13 0x0000555555753daa in operator() (__closure=0x555556a6c240, d=std::any [no contained value]) at ../hyprland-9999/src/desktop/Window.cpp:68
#14 std::__invoke_impl<void, CWindow::CWindow(Hyprutils::Memory::CSharedPointer<CXDGSurfaceResource>)::<lambda(std::any)>&, std::any> (__f=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:61
#15 std::__invoke_r<void, CWindow::CWindow(Hyprutils::Memory::CSharedPointer<CXDGSurfaceResource>)::<lambda(std::any)>&, std::any> (__fn=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:111
#16 std::_Function_handler<void(std::any), CWindow::CWindow(Hyprutils::Memory::CSharedPointer<CXDGSurfaceResource>)::<lambda(std::any)> >::_M_invoke(const std::_Any_data &, std::any &&) (__functor=..., __args#0=<optimized out>)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:290
#17 0x00007ffff7c56fcc in Hyprutils::Signal::CSignalListener::emit(std::any) () at /usr/lib64/libhyprutils.so.1
#18 0x00007ffff7c5753e in Hyprutils::Signal::CSignal::emit(std::any) () at /usr/lib64/libhyprutils.so.1
#19 0x00005555558dc829 in operator() (d=std::any [no contained value], __closure=0x555556af70d0) at ../hyprland-9999/src/protocols/XDGShell.cpp:338
#20 std::__invoke_impl<void, CXDGSurfaceResource::CXDGSurfaceResource(Hyprutils::Memory::CSharedPointer<CXdgSurface>, Hyprutils::Memory::CSharedPointer<CXDGWMBase>, Hyprutils::Memory::CSharedPointer<CWLSurfaceResource>)::<lambda(std::any)>&, std::any> (__f=...)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:61
#21 std::__invoke_r<void, CXDGSurfaceResource::CXDGSurfaceResource(Hyprutils::Memory::CSharedPointer<CXdgSurface>, Hyprutils::Memory::CSharedPointer<CXDGWMBase>, Hyprutils::Memory::CSharedPointer<CWLSurfaceResource>)::<lambda(std::any)>&, std::any> (__fn=...)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:111
#22 std::_Function_handler<void(std::any), CXDGSurfaceResource::CXDGSurfaceResource(Hyprutils::Memory::CSharedPointer<CXdgSurface>, Hyprutils::Memory::CSharedPointer<CXDGWMBase>, Hyprutils::Memory::CSharedPointer<CWLSurfaceResource>)::<lambda(std::any)> >::_M_invoke(const std::_Any_data &, std::any &&) (__functor=..., __args#0=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:290
#23 0x00007ffff7c56fcc in Hyprutils::Signal::CSignalListener::emit(std::any) () at /usr/lib64/libhyprutils.so.1
#24 0x00007ffff7c5753e in Hyprutils::Signal::CSignal::emit(std::any) () at /usr/lib64/libhyprutils.so.1
#25 0x00005555558e977a in CWLSurfaceResource::destroy (this=0x555556c47120) at ../hyprland-9999/src/protocols/core/Compositor.cpp:159
#26 0x0000555555973031 in std::function<void(CWlSurface*)>::operator() (this=0x555556c470c0, __args#0=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:591
#27 CWlSurface::onDestroyCalled (this=0x555556c46f60) at protocols/wayland.cpp:2031
#28 _CWlSurface__DestroyListener (l=<optimized out>, d=<optimized out>) at protocols/wayland.cpp:1853
#29 0x00007ffff7e610d4 in ??? () at /usr/lib64/libwayland-server.so.0
#30 0x00007ffff7e651c3 in wl_client_destroy () at /usr/lib64/libwayland-server.so.0
#31 0x00007ffff7e655d8 in ??? () at /usr/lib64/libwayland-server.so.0
#32 0x00007ffff7e646b3 in ??? () at /usr/lib64/libwayland-server.so.0
#33 0x00007ffff7e65509 in wl_display_run () at /usr/lib64/libwayland-server.so.0
#34 0x00005555557fc6f5 in CEventLoopManager::enterLoop (this=0x555555bfe290) at ../hyprland-9999/src/managers/eventLoop/EventLoopManager.cpp:52
#35 0x000055555564c77e in main (argc=<optimized out>, argv=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/unique_ptr.h:193

@vaxerski
Copy link
Member Author

thanks :)

@vaxerski
Copy link
Member Author

try now

@gulafaran
Copy link
Contributor

try now

yeah works now

@vaxerski
Copy link
Member Author

top, merging then, thanks!

@vaxerski vaxerski merged commit 37e1411 into main Jul 31, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Screen flickering with mouse movement in Minecraft Kitty has green artifacts
5 participants