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

Adding config file feature #281

Draft
wants to merge 14 commits into
base: feature/compositor-ng
Choose a base branch
from

Conversation

Taha-Firoz
Copy link

@Taha-Firoz Taha-Firoz commented Aug 28, 2022

As discussed on issue #201 having more control over the display on which the application is rendered on is important. In order to provide this feature it's important to have a config file since the values needed for specifying displays would be too long to easily specify in a command line argument.

Currently there are three possible formats for the config file we can take inspiration from:

@adera's proposed format

{
  "enableHwCursor": true,
  "windows": [
    {
      "drmdev": "/dev/dri/card0",
      "mode": "1920x1080@60p",
      "dimensions": "160x90",
      "framebufferSize": "960x540",
      "pixelformat": "RGB565"
    },
    { ... }
  ]
}

ivi-homescreen's config file

{
   "disable_cursor":true,
   "debug_backend":true,
   "accessibility_features":31,
   "view":{
      "bundle_path":"/home/joel/development/gallery/.homescreen/x86/release",
      "vm_args":["--no-serve-devtools"],
      "width":1920,
      "height":1280,
      "fullscreen":true
   }
}

QT's drm config file

{
    "device": "/dev/dri/card1",
    "hwcursor" : false,
    "outputs": [
        { "name": "DSI1", "mode": "800x1280", "primary": true },
        { "name": "Composite1", "mode": "off" } 
    ]
}

A few things to figure out before this features implementation can even start:

  • What features do we need in the config file? (views, logging, card, rotation)
  • To what depth should the features be allowed to be configured
  • Should the config file have a preset path, and can that be customized via env_variables or command-line arguments?
  • Will the config file eventually just feed into command-line arguments and be possibly overwritten in case explicit command-line arguments are passed?

ardera and others added 14 commits February 23, 2022 15:00
- fix resource uploading context not being made current
- fix flutterpi_send_platform_message not calling "runs_platform_tasks_on_current_thread" correctly
- refactor surface, backing_store objects a lot
- surface is no longer universally associated with a compositor
- (so a surface can be attached with multiple compositors now theoretically)
- there's no more sugar in the surface object for associating it with a platform view id
- backing stores now fill a FlutterBackingStore* rather than FlutterOpenGlBackingStore* and so on
- add vulkan pixel format equivalents to the pixel format enum
- add a vulkan renderer and a vulkan backing store
- use backing_store_queue_present instead of surface_swap_buffers for pushing framebuffers from flutter to backing_stores
- add --vulkan cmdline argument
- add vulkan compositor and vulkan window
- fix UNREACHABLE macro
- document vk_renderer API
- cast _SRGB to _UNORM vulkan formats to work around flutter bug
- specify proper vulkan image usage flags
- close gbm bo fd on error
- remove vk backing store ref logging
cJSON path is currently relative
@ardera
Copy link
Owner

ardera commented Aug 31, 2022

So this is just a brainstorm of everything that comes to my mind: (just some ideas, supporting all this would be a huge task)

  • displays (the real, physical displays that exist in hardware)
    • identified by the KMS device + connector name (/dev/dri/card0 and HDMI-A-1 for example)
    • but also allow non-KMS devices as well (iMX framebuffer API, fbdev, maybe custom display output variants?)
    • allow specifying:
      • video mode, maybe even precise timings for flickering area on the screen #226?
      • overscan (scanout borders)
      • physical dimensions
      • color mgmt / HDR / HDMI color range
      • each display should connect to 0 or 1 touchscreen input devices (/dev/input/eventX)
  • views (the logical displays to we tell flutter about)
    • right now, a flutter instance can only have a single view
    • but there's work going on to allow it to have multiple views as well
    • allow specifying:
      • which displays to connect to (maybe allow 0 as well?)
      • framebuffer size
      • pixel ratio (even though this is fully determined by the physical dimensions, but sometimes you just want an easy way to force 1.0)
      • pixel format
      • framebuffer tiling / DRM format modifier
      • rotation or orientation
  • flutter instances
    • a single flutter engine instance
    • connects to a single flutter view (right now) and a renderer
    • specified using app bundle path
    • allow specifying:
      • engine args
      • dart entrypoint, dart entrypoint args
      • accessibility features
  • renderers
    • specifies how a flutter instance should render things
    • DRM device to use (maybe /dev/dri/card1)
    • GBM/EGL/GLES
    • GBM/Vulkan
    • iMX framebuffer API
    • software rendering (with or without GBM)

So in json that would look something like this: (just for demonstration)

{
  "displays": {...},
  "views": {...},
  "flutter instances": {...},
  "renderers": {...}
}

Anything I missed? I think we can go from this and cut stuff out that shouldn't be supported and simplify the structure till we reach something that's nice and simple like the qt EGLFS / ivi-homescreen config

For example since right now, a view can only have a single flutter instance and the other way around, so they don't need to be separate in the config (Or maybe they should, for future-compatibility?). Or the renderers are that trivial to specify that we can just specify them the flutter instance specification as well (as some "renderer-drmdev": "/dev/dri/card0" and a "renderer": "vulkan" entries)

@Taha-Firoz
Copy link
Author

I feel stupid

So basically the final json file I'm getting an idea for is, I don't really know a lot of in-depth stuff about display configurations so there will probably be some errors. Each value will be a string right, not many that are arrays.

{
  "displays": {
    "display-name": {
      "connector-name":"",
      "mode": "",
      "overscan": "",
      "dimensions": "",
      "resolution":"",
      "color": "",
      "ts-name": ""
    }
  },
  "views": {
    "view-name":{
      "display-name":"",
      "frame-buffer":"",
      "pixel-ratio": "",
      "pixel-format": "",
      "frame-buffer":{},
      "rotation": ""
    }
  },
  "flutter instances": {
    "engine-args":"",
    "accessibility":"",
    "dart":{
      "entrypoint":"",
      "args":""
    }
  },
  "renderers": {
    "renderer-drmdev": "/dev/dri/card0",
    "renderer": "vulkan"
  }
}

@ardera
Copy link
Owner

ardera commented Sep 19, 2022

Sorry for the delay.

@Taha-Firoz I didn't really mean that exact layout, it was just a rough draft 😉 So lots of those fields you could leave away, or merge or rename if that fits better together with the toyota, sony or Qt EGLFS config. Or if you like the draft how I send it you can also implement it that way.

@ardera ardera force-pushed the feature/compositor-ng branch 4 times, most recently from 7551fa1 to 37a191c Compare November 4, 2022 14:40
@ardera ardera force-pushed the feature/compositor-ng branch from c81fa43 to ad4cabd Compare April 8, 2023 10:08
@ardera ardera force-pushed the feature/compositor-ng branch from 4afa0a1 to de0a9a7 Compare July 17, 2023 10:43
@ardera ardera linked an issue Aug 18, 2023 that may be closed by this pull request
@ardera ardera force-pushed the feature/compositor-ng branch from 1c5c42d to 566c504 Compare August 22, 2023 09:44
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.

2 participants