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

Ignore zero length gamma curves #3248

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Ignore zero length gamma curves #3248

merged 1 commit into from
Feb 23, 2024

Conversation

AlanGriffiths
Copy link
Collaborator

After a wake we might see an invalid Gamma curve. Ignore it.

Fixes: #3238

It fixes the problem because ensure_crtc() might allocate a new current_crtc but the drmModeCrtcSetGamma() will fail leaving it unused - but still associated with the output.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d0a68ae) 77.81% compared to head (0a89793) 77.83%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3248      +/-   ##
==========================================
+ Coverage   77.81%   77.83%   +0.02%     
==========================================
  Files        1058     1068      +10     
  Lines       67163    67565     +402     
==========================================
+ Hits        52265    52592     +327     
- Misses      14898    14973      +75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@RAOF RAOF left a comment

Choose a reason for hiding this comment

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

This change certainly isn't wrong, but why are we attempting to set a zero-sized gamma curve? What's trying to set this further up the stack?

@AlanGriffiths
Copy link
Collaborator Author

why are we attempting to set a zero-sized gamma curve? What's trying to set this further up the stack?

I wondered that too. I've not been able to identify specific wrong logic. It like we default construct it and never change it, and I don't see anything that guarantees we will change it so...

Will have a further look, but IMO this mitigation is good anyway

@AlanGriffiths AlanGriffiths added this pull request to the merge queue Feb 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 23, 2024
@AlanGriffiths AlanGriffiths added this pull request to the merge queue Feb 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 23, 2024
@Saviq Saviq added this pull request to the merge queue Feb 23, 2024
Merged via the queue into main with commit bd0feb1 Feb 23, 2024
33 of 35 checks passed
@Saviq Saviq deleted the ignore-zero-length-gamma branch February 23, 2024 13:54
@AlanGriffiths
Copy link
Collaborator Author

Will have a further look, but IMO this mitigation is good anyway

The only place gamma gets set is mgg::RealKMSOutput::update_from_hardware_state() and there it is set by this dubious path:

    GammaCurves gamma;

    /* Get information about the current mode */
    if (current_crtc) {
        current_mode_info = current_crtc->mode;

        if (current_crtc->gamma_size > 0)
            gamma = mg::LinearGammaLUTs(current_crtc->gamma_size);
    }
...
    output.gamma = gamma;

The upshot of which is, that if there no current_crtc then it is set to the default constructed GammaCurves gamma. (Even if it had been set previously - which I doubt.)

And, empirically, the usual way to reach this code is with current_crtc false.

mattkae pushed a commit that referenced this pull request Mar 27, 2024
mattkae pushed a commit that referenced this pull request Mar 27, 2024
mattkae pushed a commit that referenced this pull request Mar 28, 2024
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.

Crash on wake when outputs have the same geometry
3 participants