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

[RFC] Use object properties to configure platform implementations #363

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aperezdc
Copy link
Member

This is an initial RFC to steer towards improving how platform modules are configured. The main idea is to turn options into properties of the CogPlatform subclass implemented by the platform module.

The information about object properties/settings can then be inspected e.g. at run time and used in different ways:

  • Programmatically read property values from the configuration file (implemented in this PR as an usage example).
  • Allowing passing options at creation time, e.g. adding a new cog_platform_new_with_options() function.
  • Reading options from the command line based on the available properties.
  • Using their documentation comments to generate pages of the reference manual.

…and probably others.

@aperezdc aperezdc added the enhancement New feature or request label Sep 24, 2021
@aperezdc aperezdc self-assigned this Sep 24, 2021
@aperezdc aperezdc marked this pull request as draft September 24, 2021 23:28
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch 5 times, most recently from 904da7c to 524f64f Compare October 6, 2022 08:58
@tobias-grasse
Copy link

From a purely user perspective, this sounds very desirable (e.g. for our WPE snap package).

@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch from 524f64f to a3fd502 Compare September 25, 2023 21:40
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch 3 times, most recently from 92e8c4e to 10b5bbd Compare November 23, 2023 20:43
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch 2 times, most recently from e62433e to e027ced Compare November 30, 2023 19:20
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch from e027ced to ca60557 Compare December 18, 2023 08:34
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch from ca60557 to df2ee42 Compare January 3, 2024 20:47
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch from df2ee42 to 126a761 Compare March 6, 2024 16:00
Add a new cog_apply_properties_from_key_file() function which iterates
over writable properties of an object and sets their values from the
items of a GKeyFile group with the same names as the properties. The
goal is to use this to ease picking configuration options for the
different platform modules--as long as they define their settings as
properties of some object.
Turn the settings for atomic mode setting and the device scale factor
into properties of the CogDrmPlatform class. This allows using
cog_apply_properties_from_key_file() to automatically apply the
settings from the configuration file.

In the future it may be possible to also pass properties when creating
an object with cog_platform_new(), and/or via the "params" argument
of cog_platform_setup(), and always using the same mechanism (object
properties) regardless of where the values come from.
Move the routine from the DRM plugin used to parse a comma-separated
key=value set of parameters into cog_key_file_parse_params_string()
which sets values into a GKeyFile. This allows building up the final
set of options into the configuration object held by CogShell, then
using that as canonical source for reading options.
@aperezdc aperezdc force-pushed the aperezdc/plat-props-config branch from 126a761 to 7c8d26d Compare March 21, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants