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

steamcompmgr cleanups #1503

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

sharkautarch
Copy link

No description provided.

@sharkautarch sharkautarch force-pushed the steamcompmgr_cleanup branch 2 times, most recently from bc2af6d to 591a0d6 Compare September 3, 2024 00:24
@sharkautarch sharkautarch force-pushed the steamcompmgr_cleanup branch 2 times, most recently from d3176a2 to c5ecdb2 Compare September 3, 2024 01:15
@sharkautarch
Copy link
Author

sharkautarch commented Sep 3, 2024

also w.r.t. calc_scale_factor(), note that on x86 unix ABI, floats (& float-based composites) are returned in simd 128-bit xmm registers, so this PR technically also makes calc_scale_factor() slightly more efficient (in this case, glm::vec2 fits in a single xmm register)

@sharkautarch
Copy link
Author

@Joshua-Ashton
BTW, I found that we don't currently do anything w/ g_bLowLatency (targets atom gamescopeLowLatency)
Should I remove it as dead code, or will it be functional in the future?

@matte-schwartz
Copy link

ping me when this is ready for testing, I'll validate w/ the drm backend

@sharkautarch sharkautarch force-pushed the steamcompmgr_cleanup branch 6 times, most recently from db06bcc to 64d5388 Compare September 4, 2024 22:38
@sharkautarch sharkautarch marked this pull request as ready for review September 4, 2024 23:11
@sharkautarch
Copy link
Author

@matte-schwartz Yeah it's ready for testing now

@sharkautarch sharkautarch changed the title WIP: steamcompmgr cleanups steamcompmgr cleanups Sep 4, 2024
Copy link

@matte-schwartz matte-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit breaks gamescope on wayland desktops with both SDL and Wayland backends

terminate called after throwing an instance of 'std::bad_variant_access'
  what():  std::get: wrong index for variant
[gamescopereaper] [Info]  reaper: Parent of gamescopereaper was killed. Killing children.
(EE) failed to read Wayland events: Broken pipe
fish: Job 2, 'gamescope -- vkcube' terminated by signal SIGABRT (Abort)

https://gist.github.com/matte-schwartz/058fe3b75786157e57d55d0a402ad21f

@sharkautarch
Copy link
Author

@matte-schwartz
Just pushed out a commit that I think should fix that issue?

@matte-schwartz
Copy link

It does fix it

…for loop over std::reference_wrapper<steamcompmgr_win_t*>[]
@matte-schwartz
Copy link

@sharkautarch couple issues so far.

1: gamescope -e -f -h 1440 -w 3440 -- steam -steamdeck -steamos3' fails to launch on plasma wayland, gives this short coredump: https://gist.github.com/matte-schwartz/b5a25c8d286a2c59b3d1ef41d7e363c9

[gamescopereaper] [Info]  reaper: Parent of gamescopereaper was killed. Killing children.
(EE) failed to read Wayland events: Broken pipe
fish: Job 1, 'build/src/gamescope -e -f -h 14…' terminated by signal SIGABRT (Abort)

X connection to :1 broken (explicit kill or server shutdown).
src/common/framefunction.cpp (238) : Assertion Failed: CFrameFunctionMgr::~CFrameFunctionMgr: non static FrameFunction[CHTTPClient::BFrameFuncHandleCompletedWorkItems] still registered
src/common/framefunction.cpp (238) : Assertion Failed: CFrameFunctionMgr::~CFrameFunctionMgr: non static FrameFunction[CHTTPClient::BFrameFuncHandleCompletedWorkItems] still registered

works as expected on latest gamescope master

2: gamescope w/ DRM backend fails to present the main window properly. like you can hear UI noise when you use a controller or keyboard, but the screen itself stays black. gamescopectl backend_info shows that the window should be visible while it's not. Only thing that seems to show up is the cursor, and the QR code looking debugger squares to it appears that gamescope is still compositing. Not sure what logging would be useful here, I can check in the morning.

the command I'm testing with from a TTY is:
gamescope -e -f -h 1440 -w 3440 -r 175 -- steam -steamdeck -steamos3 -steampal -gamepadui

@sharkautarch
Copy link
Author

sharkautarch commented Sep 5, 2024

@matte-schwartz
try building gamescope w/ UBSAN & ASAN w/ these meson flags:
--buildtype=debugoptimized -Db_sanitize=address,undefined -Dc_args="-fsanitize-recover=all -w" -Dc_link_args="-fsanitize-recover=all -w" -Dcpp_args="-fsanitize-recover=all -w" -Dcpp_link_args="-fsanitize-recover=all -w"

and then when running gamescope, add this ASAN env: env ASAN_OPTIONS=halt_on_error=0:detect_stack_use_after_return=1:strict_string_checks=1:detect_invalid_pointer_pairs=4:dump_instruction_bytes=1 gamescope <parameters> |& tee gamescope.log

@sharkautarch
Copy link
Author

@matte-schwartz
I'm not sure whether the commit I just pushed out fixes anything

@sharkautarch
Copy link
Author

sharkautarch commented Sep 6, 2024

@matte-schwartz
I was testing running the drm backend w/ this PR, and debugging what was causing issue 2
I think I fixed at least that issue, w/ my latest commit 795aa6a

Thru debugging w/ valgrind, I realized that in handle_wl_surface_destroy in wlserver.cpp, the surf pointer could still appear valid after deleteing it, and the solution was to simply set it to null after deleting it.

After that commit, I was able to run <path/to/gamescope>/gamescope -- steam and see the steam UI stuff.

Weird that this bug isn't being triggered on upstream gamescope, tho often the OS won't immediately reclaim freed memory, so I guess we've just been lucky previously...
nevermind, I think valgrind reported a false positive
I ran gamescope -e -- steam -steamdeck -steamos3 -steampal -gamepadui and still doesnt work... for some reason :(

fixes float divide by zero bug I accidentily introduced
@sharkautarch
Copy link
Author

Figured out what was causing the black screen when running gamescope -e -- steam -steamdeck -steamos3 -steampal -gamepadui
This time it is actually fixed

@sharkautarch sharkautarch force-pushed the steamcompmgr_cleanup branch 3 times, most recently from 0a703c2 to 2a1ae84 Compare September 6, 2024 20:13
…olution

color_helpers: enable using structured bindings w/ glm::vec
@matte-schwartz
Copy link

Gotten sidetracked today but pulling your latest changes has been going okay so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants