forked from ValveSoftware/steamos-compositor
-
Notifications
You must be signed in to change notification settings - Fork 213
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
script: use "display" instead of "value" in debug output #1568
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"value" is not used or defined in either device's lua config. Instead, use "display" for the debug output string. Fixes a coredump when entering gamescope-session on ROG Ally.
matte-schwartz
force-pushed
the
rog-ally-fix
branch
from
October 8, 2024 06:51
9919983
to
d2f7161
Compare
Hmmm... probably shouldnt coredump in that state. Maybe something going wrong with the lua error handling? |
Will merge, but backtrace would be interesting. |
https://gist.github.com/matte-schwartz/901683a5212757de9b9746db3c35715d journal log leading up to crash + bt |
Does the following code fix it? std::optional<std::pair<std::string_view, sol::table>> GamescopeScript_t::Config_t::LookupDisplay( CScriptScopedLock &script, std::string_view psvVendor, uint16_t uProduct, std::string_view psvModel )
{
int nMaxPrority = -1;
std::optional<std::pair<std::string_view, sol::table>> oOutDisplay;
sol::table tDisplay = script->create_table();
tDisplay["vendor"] = psvVendor;
tDisplay["product"] = uProduct;
tDisplay["model"] = psvModel;
for ( auto iter : KnownDisplays )
{
sol::optional<sol::table> otTable = iter.second.as<sol::optional<sol::table>>();
if ( !otTable )
continue;
sol::table tTable = *otTable;
sol::optional<sol::function> ofnMatches = tTable["matches"];
if ( !ofnMatches )
continue;
sol::function fnMatches = *ofnMatches;
if ( !fnMatches )
continue;
sol::function_result ret = fnMatches(tDisplay);
if ( !ret.valid() || !ret.get<sol::optional<int>>() )
continue;
int nPriority = ret.get<int>();
if ( nPriority <= nMaxPrority )
continue;
std::string_view psvKey = iter.first.as<std::string_view>();
nMaxPrority = nPriority;
oOutDisplay = std::make_pair( psvKey, tTable );
}
return oOutDisplay;
} does the following code also fix it if so? std::optional<std::pair<std::string_view, sol::table>> GamescopeScript_t::Config_t::LookupDisplay( CScriptScopedLock &script, std::string_view psvVendor, uint16_t uProduct, std::string_view psvModel )
{
int nMaxPrority = -1;
std::optional<std::pair<std::string_view, sol::table>> oOutDisplay;
sol::table tDisplay = script->create_table();
tDisplay["vendor"] = psvVendor;
tDisplay["product"] = uProduct;
tDisplay["model"] = psvModel;
for ( auto iter : KnownDisplays )
{
sol::optional<sol::table> otTable = iter.second.as<sol::optional<sol::table>>();
if ( !otTable )
continue;
sol::table tTable = *otTable;
sol::optional<sol::function> ofnMatches = tTable["matches"];
if ( !ofnMatches )
continue;
sol::function fnMatches = *ofnMatches;
if ( !fnMatches )
continue;
sol::optional<int> onPriority = fnMatches(tDisplay);
if ( !onPriority )
continue;
int nPriority = *onPriority;
if ( nPriority <= nMaxPrority )
continue;
std::string_view psvKey = iter.first.as<std::string_view>();
nMaxPrority = nPriority;
oOutDisplay = std::make_pair( psvKey, tTable );
}
return oOutDisplay;
} |
I think I answered this but ftr yes, both do work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"value" is not used or defined in either device's lua config for the matches function. Instead, use "display" for the debug output string.
Fixes a coredump when entering gamescope-session on ROG Ally. whoops