Skip to content
Snippets Groups Projects
  1. Jul 15, 2023
  2. Jul 14, 2023
    • Tom Rini's avatar
      Merge branch '2023-07-14-expo-initial-config-editor' · b3bbad81
      Tom Rini authored
      To quote the author:
      This series provides a means to edit board configuration in U-Boot in a
      graphical manner. It supports multiple menu items and allows moving
      between them and selecting items. The configuration is defined in a data
      format so that code is not needed in most cases. This allows the board
      configuration to be provided in the devicetree.
      
      This is still at an early stage, since it only supports menus. Numeric
      values are not supported. Most importantly it does not yet support
      loading or saving the configuration selected by the user.
      
      To try it out you can use something like:
      
          ./tools/expo.py -e test/boot/files/expo_layout.dts \
              -l test/boot/files/expo_layout.dts -o cedit.dtb
          ./u-boot -Tl -c "cedit load hostfs - cedit.dtb; cedit run"
      
      Use the arrow keys to move between menus, enter to open a menu, escape
      to exit.
      
      Various minor fixes and improvements are provided in this series:
      - Update STB TrueType library to latest
      - Support clearing part of the video display
      - Support multiple livetrees loaded at runtime
      - Support loading and allocating a file
      - Support proper measuring of text in expo
      - Support simple themes for expo
      b3bbad81
    • Simon Glass's avatar
      video: Update stb_truetype · 04f3dcd5
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      This was brought in in 2016 and a number of changes have been made since
      then. There does not seem to be much change in functionality, but it is
      a good idea to update from time to time.
      
      Bring in the latest version:
      
         5736b15 ("re-add perlin noise again")
      
      Add a few necessary functions, with dummies in some cases. Update the tests
      as there are subtle changes in rendering, perhaps not for the better.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      04f3dcd5
    • Simon Glass's avatar
      expo: Add tests for the configuration editor · 87c1a413
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add some simple tests and a helpful script to make the configuration
      editor easier to set up.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      87c1a413
    • Simon Glass's avatar
      expo: Add a configuration editor · a0874dc4
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a new 'cedit' command which allows editing configuration using an
      expo. The configuration items appear as menus on the display.
      
      This is extremely basic, only supporting menus and not providing any way
      to load or save the configuration.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a0874dc4
    • Simon Glass's avatar
      expo: Support building an expo from a description file · 82cafee1
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      The only way to create an expo at present is by calling the functions to
      create each object. It is useful to have more data-driven approach, where
      the objects can be specified in a suitable file format and created from
      that. This makes testing easier as well.
      
      Add support for describing an expo in a devicetree node. This allows more
      complex tests to be set up, as well as providing an easier format for
      users. It also provides a better basis for the upcoming configuration
      editor.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      82cafee1
    • Simon Glass's avatar
      expo: Add spacing around menus and items · 7230fdb3
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      It looks better if menus have a bit of an inset, rather than be drawn hard
      up against the background. Also, menu items look better if they have a bit
      of spacing between them.
      
      Add theme options for these and implement the required changes.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      7230fdb3
    • Simon Glass's avatar
      expo: Implement the keypress logic for popup menus · 4e64beeb
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      In 'popup' mode, the expo allows moving around the objects in a scene.
      When 'enter' is pressed on a menu, it opens and the user can move around
      the items in the menu.
      
      Implement this using keypress handles and actions.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      4e64beeb
    • Simon Glass's avatar
      expo: Draw the current opened menu on top · 4c87e073
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      When a menu is opened, it must be displayed over all other objects in
      the scene, so that all its items are visible.
      
      Handle this by drawing the menu object a second time, after all other
      objects have been drawn. Draw all of the objects which are dependent
      on the menu object.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      4c87e073
    • Simon Glass's avatar
      expo: Draw popup menus in both opened and closed states · 756c9559
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      When a popup menu is closed it shows only the selected item. When it is
      open it shows a background and all items, with a highlight that can be
      moved between the items.
      
      Add the drawing logic for this.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      756c9559
    • Simon Glass's avatar
      expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEM · 3f33b9c7
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      At present we only support a single menu, so all that can be pointed to
      is the current menu item. Rename this action so that we can also add
      an action for pointing to an object. This will allow cycling through
      the objects in a scene.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      3f33b9c7
    • Simon Glass's avatar
      expo: Support drawing of popup menus · d3db0216
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      At present only a single menu is supported. All items are shown and a
      pointer object points to the current item.
      
      Add support for multiple menus, one of which is highlighted, indicated
      by the highlight_id property in the scene.
      
      The highlighted menu item has a SCENEOF_POINT flag, indicating that it
      is currently pointed to.
      
      The popup menu is normally closed, in which case it shows only the
      current menu item. When it is opened, it shows all items, allowing the
      user to select one.
      
      Rather than requiring the menu item to have a description, require it to
      have a label. Use the label (only) for the popup menu.
      
      With this, most of the drawing and layout logic is complete.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      d3db0216
    • Simon Glass's avatar
      expo: Move menu-item selection into a function · 8872bc7f
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      The current implementation supports a 'pointer' object which points to
      the currently highlighted menu item. We want to support highlighting the
      label of the menu item instead, e.g. with inverse video. In this case we
      will need to 'unhighlight' the old item and highlight the new one.
      
      As a first step, move the pointer logic into a function. This fixes a
      bug where the item is hidden when it should not be.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      8872bc7f
    • Simon Glass's avatar
      expo: Support simple themes · 2e593897
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      It is a pain to manually set the fonts of all objects to be consistent.
      Some spacing settings are also better set globally than by manually
      positioning each object.
      
      Add a 'theme' to the expo, to hold this information. For now it includes
      only the font size.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      2e593897
    • Simon Glass's avatar
      expo: Set up the width and height of objects · 699b0acb
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Provide a way to set the full dimensions of objects, i.e. including the
      width and height.
      
      For menus, calculate the bounding box of all objects in the menu. Set all
      labels to be the same size, so that highlighting works correct, once
      implemented.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      699b0acb
    • Simon Glass's avatar
      expo: Calculate text bounding-box correctly · 50f02037
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Rather than estimating, measure the text accurately, using the new
      vidconsole feature. This allows accurate placement of objects.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      50f02037
    • Simon Glass's avatar
      expo: Use flags for objects · ce72c9ec
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      We currently have just a 'hide' property for each object. In preparation
      for adding more properties, convert the struct to use a flags value,
      instead of individual booleans. This is more extensible.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ce72c9ec
    • Simon Glass's avatar
      expo: Add width and height to objects · ae45d6cf
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      At present objects only have a position so it is not possible to determine
      the amount of space they take up on the display.
      
      Add width and height properties, using a struct to keep all the dimensions
      together.
      
      For now this is not used. Future work will set up these new properties.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ae45d6cf
    • Simon Glass's avatar
      video: Use enum with video_index_to_colour() · 2d6ee92c
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Use the provided enum with this function, so it is clearer what should be
      passed to it.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      2d6ee92c
    • Simon Glass's avatar
      expo: Allow setting the start of the dynamic-ID range · 9af34150
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Provide a way to set this value so that it is easy to separate the
      statically allocated IDs (generated by the caller) from those
      generated dynamically by expo itself.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      9af34150
    • Simon Glass's avatar
      console: Allow measuring the bounding box of text · b828ed7d
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      For laying out text accurately it is necessary to know the width and
      height of the text. Add a measure() method to the console API, so this
      can be supported.
      
      Add an implementation for truetype and a base implementation for the
      normal console.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      b828ed7d
    • Simon Glass's avatar
      video: Allow temporary colour changes · 648a4991
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      It is sometimes necessary to highlight some text in a different colour.
      Add an easy way to do this and then restore the original console colours.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      648a4991
    • Simon Glass's avatar
      video: Correct docs for video_index_to_colour() · 7ea207db
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      This uses the private data of the video uclass, not the console uclass
      (its child). Update the comment to avoid confusion.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Fixes: a032e4b5 ("video: Move console colours to the video uclass")
      7ea207db
    • Simon Glass's avatar
      bootstd: Add a separate log category for expo · c98cb512
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      This feature is different enough from bootstd that it probably deserves
      its own log category. It cannot use a uclass since it is not a device.
      
      Add a new category.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      c98cb512
    • Simon Glass's avatar
      fdt: Allow more general use of livetree · a8f2ac2a
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      At present livetree can only be used for the control FDT. It is useful
      to be able to use the ofnode API for other FDTs, e.g. those used by
      the upcoming configuration editor.
      
      We already have most of the support present, and tests can be marked with
      the UT_TESTF_OTHER_FDT flag to use another FDT as a special case. But
      with this change, the functionality becomes more generally available.
      
      Plumb in the require support.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a8f2ac2a
    • Simon Glass's avatar
      fdt: Clarify the fdt pre-relocation warning · c8a4e293
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Reword this so it is easier to understand.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      c8a4e293
    • Simon Glass's avatar
      fdt: Align the start of the livetree · 9cf39bbe
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Ensure that the block of memory used by live tree is aligned according to
      the default for structures. This ensures that the root node appears at
      the start of the block, so it can be used with free(), rather than being
      4 bytes later in some cases.
      
      This corrects a rather obscure bug in unflatten_device_tree().
      
      Fixes: 8b50d526 ("dm: Add a function to create a 'live' device tree")
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      9cf39bbe
    • Simon Glass's avatar
      cat: Update command to use fs_load_alloc() · 822f7a45
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Use this new function since it implements the required functionality and
      reduces duplicated code.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      822f7a45
    • Simon Glass's avatar
      fs: Create functions to load and allocate a file · de7b5a8a
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      This functionality current sits in bootstd, but it is more generally
      useful. Add a function to load a file into memory, allocating it as
      needed. Adjust bootstd to use this version.
      
      Note: Tests are added in the subsequent patch which converts the 'cat'
      command to use this function.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      de7b5a8a
    • Simon Glass's avatar
      expo: Rename exp_set_text_mode() · 5904d953
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Rename this function to match its peers, using the full "expo' prefix.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      5904d953
    • Simon Glass's avatar
      console: Correct truetype spacing error · a8f80409
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      The putc_xy() method is supposed to return the amount of space used. The
      existing implementation erroneously adds the previous sub-pixel position
      to the returned value. This spaces out the characters very slightly more
      than it should. It is seldom noticeable but it does make accurate
      measurement of the text impossible.
      
      Fix this minor but long-standing bug.
      
      Fixes: a29b0120 ("video: Add a console driver that uses TrueType fonts")
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      a8f80409
    • Simon Glass's avatar
      expo: Avoid automatically arranging the scene · 14a86a51
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      This should ideally be done once after all scene changes have been made.
      Require an explicit call when everything is ready.
      
      Always arrange after a key it sent, just for convenience.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      14a86a51
    • Simon Glass's avatar
      expo: Store the console in the expo · 42b18494
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Rather than finding this each time, keep a pointer to it. This simplifies
      the code a little.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      42b18494
Loading