Skip to content

Fix colord profile installation failures on Wayland - #974

Open
ahjulstad wants to merge 1 commit into
eoyilmaz:developfrom
ahjulstad:fix/colord-profile-install-wayland
Open

Fix colord profile installation failures on Wayland#974
ahjulstad wants to merge 1 commit into
eoyilmaz:developfrom
ahjulstad:fix/colord-profile-install-wayland

Conversation

@ahjulstad

Copy link
Copy Markdown

Generated with AI assistance by goose (AAIF).

Problem

After calibration and profiling, DisplayCAL fails to install the ICC profile via colord on Wayland systems. Three issues were identified:

1. CDTimeoutError — profile ID mismatch

DisplayCAL computes the colord profile ID from the ICC profile.ID header ("icc-" + hexlify(profile.ID)), but colord uses "icc-" + md5(file_contents) as its internal ID. The query_colord_for_newly_added_profile() function searches by the wrong ID and always times out after 5 seconds, raising CDTimeoutError.

2. Wrong MAPPING_device_id in profile metadata

On Wayland, xrandr --verbose does not expose EDID blocks, so display_edid is empty for all displays. The MAPPING_device_id was set using get_device_id(quirk=False) without query=True, which could not query colord for the correct device ID. This caused the profile to be tagged with the wrong display device.

3. EDID dict key type mismatch (bytes vs str)

display_cal.py used bytes keys (b"monitor_name", b"hash") to look up EDID fields, but edid.py stores them with str keys. This prevented EDID-based display matching from ever working.

Fixes

  1. colord.py: Added _find_profile_by_filename() fallback that uses colormgr find-profile-by-filename to locate the just-imported profile when the ID-based lookup times out. The object path is parsed from colormgr output by matching the /org/freedesktop/ColorManager/ pattern, making it locale-independent.

  2. display_cal.py: Changed get_device_id(quirk=False) to get_device_id(quirk=False, query=True) (matching the same pattern already used in worker.py line 13559), with a fallback to the non-query version.

  3. display_cal.py: Now checks both str and bytes keys for EDID dict lookups.

Generated with AI assistance by goose (AAIF).

Three issues fixed:

1. CDTimeoutError when importing profile into colord:
   DisplayCAL computes the colord profile ID from the ICC profile.ID
   header, but colord actually uses md5(file_contents) as its internal
   ID. The query_colord_for_newly_added_profile function searches by
   the wrong ID and always times out after 5 seconds. Added a fallback
   that uses `colormgr find-profile-by-filename` to locate the
   just-imported profile by its filename, which is locale-independent
   and works regardless of the ID scheme colord uses.

2. Wrong MAPPING_device_id in profile metadata:
   On Wayland, xrandr does not expose EDID blocks, so display_edid is
   empty for all displays. The MAPPING_device_id was set using
   get_device_id(quirk=False) without query=True, which could not query
   colord for the correct device ID. Changed to use query=True (matching
   the same call in worker.py line 13559), with a fallback to the
   non-query version.

3. EDID dict key type mismatch (bytes vs str):
   display_cal.py used bytes keys (b"monitor_name", b"hash") to look up
   EDID fields, but edid.py stores them with str keys. This prevented
   EDID-based display matching from ever working. Now checks both str
   and bytes keys.
@ahjulstad

Copy link
Copy Markdown
Author

This one might be a bit too ugly, no offense taken if you just discard this.

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.

1 participant