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.

@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 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
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.
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