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

Support wp color management proto #9444

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Support wp color management proto #9444

wants to merge 11 commits into from

Conversation

UjinT34
Copy link
Contributor

@UjinT34 UjinT34 commented Feb 19, 2025

Describe your PR, what does it fix/add?

Support wp color-management. #9443
Added debug:full_cm_proto to switch proto into debug mode (requires restart).

In regular mode this implementation does almost nothing. It handles the minimum required subset of features.
In debug mode all features and values are marked as supported. Features related to fullscreen HDR will work the same as with xx-cm and frog-cm. Other features will only store and pass values and output some log messages.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Needs #9064 to be useful. Without it xx-cm and frog-cm should be used instead because those protos are less likely to break things for newer clients with correct wp-cm support.
Needs nix wp version bump.
Needs a proper way of handling images description ids to avoid duplication (not a priority, very unlikely conditions to be useful)

Is it ready for merging, or does it need work?

Ready.

  • use xml from wayland-protocols (requires wp 1.41)
  • move bits from xx-cm and frog-cm to wp
  • use internal enums
  • add some common CM constants
  • correctly state supported features
  • add debug mode with all the features
  • handle cm attached to subsurfaces

@vaxerski
Copy link
Member

thanks as always! tag me for review when this is ready.

@UjinT34 UjinT34 marked this pull request as ready for review February 23, 2025 11:32
@UjinT34
Copy link
Contributor Author

UjinT34 commented Feb 23, 2025

@vaxerski ready for review

}

SP<CWLSurfaceResource> CWLSurfaceResource::findFirst(std::function<bool(SP<CWLSurfaceResource>)> fn) {
return findFirstHelper(self.lock(), fn);
Copy link
Member

Choose a reason for hiding this comment

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

why is this preorder and not bf? If it's supposed to be preorder, the fn should mention this (e.g. findFirstPreorder)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no reason, can be any order. just an easy solution which assumes that there are few total subsurfaces and only one of them has CM attached. it's probably a wine-wayland quirk and most clients will have cm on the main surface. if it's not the case then we can't just passthrough cm properties to hdr metadata.
leave it as is, findAny, findFirstPreorder?

Copy link
Member

Choose a reason for hiding this comment

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

findFirstPreorder

CM_TRANSFER_FUNCTION_HLG = 13,
};

// FIXME should be ok this way. unsupported primaries/tfs must be rejected earlier. might need a proper switch-case with exception as default.
Copy link
Member

Choose a reason for hiding this comment

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

each enum should have a 0 for INVALID and return invalid if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need for INVALID. proto spec has 2 requirements: clients must send only supported values and compositors must respond with INVALID_PRIMARIES_NAMED error if the value isn't supported. this ensures that only supported values are passed to this function. internal enum values should be kept in sync with supported proto values. will need a fix if for some reason this enums will diverge in the future.

Copy link
Member

Choose a reason for hiding this comment

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

then it shouldn't be a FIXME but a warning at best

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.

2 participants