UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    MirOil-for-Lomiri

    Scheduled Pinned Locked Moved Lomiri (was Unity8)
    13 Posts 2 Posters 2.5k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • alan_gA Offline
        alan_g
        last edited by

        MirOil-for-Lomiri

        I've set up a temporary Github project to maintain the work in progress on Miroil. It is here:

        https://github.com/MirOil-for-Lomiri

        This contains forks of two projects: Mir and QtMir. These can be kept in step with the growing Miroil API.

        So that these can be used together, the default branch (mir-1.9-miroil) of Mir is based upon Mir 1.8, and the default branch (miroil) of QtMir is based on https://github.com/ubports/qtmir/tree/xenial_-_edge_-_wayland_-_x11.

        This is work I started last year and have been continued by "erlend-g" this year.

        The problem and the approach

        Currently QtMir can only build against Mir 1.x as it depends on some APIs that were removed in Mir 2.x. Miroil is intended to replace the missing functionality by moving some logic from QtMir to Miroil.

        By publishing the functionality as new, cleaner APIs in Miroil this will make it possible to use QtMir on Mir 2.x. This is important for UBports as QtMir is the library that Lomiri uses to work on Mir.

        By basing this work in progress on Mir 1.x, it is possible to make incremental changes to both Miroil and QtMir while everything keeps running. In particular, it is possible to run the QtMir demo and tests (but see below) following changes to these projects.

        Getting and building the source

        QtMir has a bunch of dependencies that are not in the Ubuntu archive, so the best approach I've found is to take an Ubuntu 16.04 system (installed on an old laptop) and add the UBports archive. (It is also possible to a VM, but this stack needs 3D acceleration enabled, and there may be other quirks.)

        So, on a 16.04 system:

        sudo apt-add-repository http://repo.ubports.com/
        sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4BD4B4D6DBB583F1
        sudo apt update
        sudo apt dist-upgrade
        

        Mir

        Next, add some development tools and clone and build Mir:

        sudo apt install devscripts equivs git
        git clone --recursive https://github.com/MirOil-for-Lomiri/mir.git
        cd mir
        sed -i /.*wlcs.*/d debian/control
        mk-build-deps -i -s sudo
        mkdir build
        cd  build
        cmake -DMIR_ENABLE_WLCS_TESTS=off ..
        make -4
        

        Then install in /usr/local:

        sudo make install
        sudo ldconfig
        

        QtMir

        Clone QtMir, get the remaining dependencies and build:

        git clone https://github.com/MirOil-for-Lomiri/qtmir.git
        cd qtmir
        mk-build-deps -i -s sudo
        mkdir -p cmake-build-debug
        cd cmake-build-debug
        cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
        make -j 4 all test
        

        Note that one of the tests crashes: Test #9: ApplicationManager ...............***Exception: SegFault 0.28 sec. That happens on the upstream branch too and I've not investigated further.

        Then install in /usr/local:

        sudo make install
        sudo ldconfig
        sudo ln -s /usr/local/share/glib-2.0/schemas/com.canonical.qtmir.gschema.xml /usr/share/glib-2.0/schemas/
        sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
        

        Running the demo

        The demos are in the demos directory.

        export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/lib/qt5/plugins/platforms
        export QML2_IMPORT_PATH=/usr/local/lib/qt5/qml
        export QT_QPA_PLATFORM=mirserver
        export MIR_SERVER_ENABLE_MIRCLIENT=
        export MIR_SERVER_CURSOR=null
        qmlscene demos/qml-demo-shell/qml-demo-shell.qml
        

        Next steps

        I'm in the process of syncing the Mir branch with the changes upstream, and have re-sync'ed the QtMir branch. I've invited @mariogrip and "erlend-g" to join the project, and anyone else interested in helping should contact me.

        E 1 Reply Last reply Reply Quote 3
        • E Offline
          erlend @alan_g
          last edited by

          Hi! I've started working on this... How should I work with this?

          Create a branch and then send you PR? Or push changes directly into miroil branch?

          Any way I don't have permission to push to a new branch....

          alan_gA 1 Reply Last reply Reply Quote 0
          • alan_gA Offline
            alan_g @erlend
            last edited by

            Hi @erlend, thanks.

            Please make PRs and I'll review as I get time. And also sync the work back to upstream MirOil branch.

            I can also add you to the MirOil-for-Lomiri project to make that a little easier (need your github ID for that).

            I do want to do an update about this work as:

            1. it is now possible to use a 20.04 base using the http://repo2.ubports.com/ repository; and,
            2. QtMir has migrated to gitlab (but I still need to sync with the right branch)
            E 1 Reply Last reply Reply Quote 0
            • E Offline
              erlend @alan_g
              last edited by

              Okey... Shall I wait until you have updated it to 20.04? or can I start now?
              What do you think?

              Github id is: 58894514 (erlend-g)

              alan_gA 1 Reply Last reply Reply Quote 0
              • alan_gA Offline
                alan_g @erlend
                last edited by

                @erlend don't wait for me.

                E 1 Reply Last reply Reply Quote 0
                • E Offline
                  erlend @alan_g
                  last edited by

                  @alan_g Okey

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    erlend
                    last edited by

                    Hi!

                    I still haven't got write permission to qtmir... Need it to create a branch... I tried forking the project but that does not work since i have already forked ubports/qtmir. I can't fork it more that once.

                    Can you fix that?

                    alan_gA 1 Reply Last reply Reply Quote 0
                    • alan_gA Offline
                      alan_g @erlend
                      last edited by

                      @erlend said in MirOil-for-Lomiri:

                      I still haven't got write permission to qtmir

                      Try now

                      E 1 Reply Last reply Reply Quote 0
                      • E Offline
                        erlend @alan_g
                        last edited by

                        @alan_g Yes,Works.. Thank You!

                        1 Reply Last reply Reply Quote 0
                        • E Offline
                          erlend
                          last edited by

                          I'm trying to find a good way to solve qtmir tests. For the test to work they need a lot of mocks that are based on internal mir stuff. And since they are used directly into mir it is not possible to build wrappers.

                          Include file Object test file Defined in
                          mir/main_loop.h mir::MainLoop tests/framework/mock_main_loop.h src/include/server/mir/main_loop.h
                          mir/scene/prompt_session.h mir::scene::PromptSession tests/framework/mock_prompt_session.h src/include/server/mir/scene/prompt_session.h
                          mir/scene/surface.h> mir::scene::Surface tests/framework/mock_surface.h src/include/server/mir/scene/surface.h
                          mir/shell/persistent_surface_store.h mir::shell::PersistentSurfaceStore tests/framework/mock_persistent_surface_store.h src/include/server/mir/shell/persistent_surface_store.h
                          mir/scene/session.h mir::scene::Session tests/framework/mock_mir_session.h src/include/server/mir/scene/session.h

                          So the best solution (or least bad) that I have come up with is...
                          to move all those mocks to miroil and make them accessible through a MockFactory... Something like:

                          class MockFactory
                          {
                              auto get_mock_surface()                  -> std::shared_ptr<mir::scene::Surface>;
                              auto get_mock_main_loop()                -> std::shared_ptr<mir::MainLoop>;
                              auto get_mock_prompt_session()           -> std::shared_ptr<mir::scene::PromptSession>;
                              auto get_mock_persistent_surface_store() -> std::shared_ptr<mir::shell::PersistentSurfaceStore>;
                              auto get_mock_session()                  -> std::shared_ptr<mir::scene::Session>;    
                              
                              std::shared_ptr<mir::scene::Surface>                   surfaces;
                              std::shared_ptr<mir::MainLoop>                         main_loops;
                              std::shared_ptr<mir::scene::PromptSession>             prompt_sessions;
                              std::shared_ptr<mir::shell::PersistentSurfaceStore>    persistent_surface_stores;
                              std::shared_ptr<mir::scene::Session>                   sessions;       
                          };
                          

                          The problem is that qtmir does not know the destructor of this objects, to they will have to be deleted inside miroil.
                          Therefore I have added a reference in MockFactor to the objects. Which are deleted by MockFactory. This will only work if MockFactory is the last object to be deleted, so we have to make sure it is.

                          So do you guys see any better solutions than this?

                          alan_gA 1 Reply Last reply Reply Quote 2
                          • alan_gA Offline
                            alan_g @erlend
                            last edited by

                            @erlend thanks for bringing this up.

                            I don't have the headspace right now to look at the problematic tests. But, for background, Mir used to publish a test helpers library containing various stubs, mocked objects and test fixtures. That got unpublished along with the mirclient stuff that it depended heavily on. (It is on my "tech debt" list to reinstate something appropriate to the current APIs.)

                            I think a separate "testing support" library is a better place to support mocks than libmiroil.

                            Another possibility would be that at least some of these tests belong as tests of miroil (i.e. in the Mir project).

                            I will have a closer look, but not sure when I'll have time.

                            E 1 Reply Last reply Reply Quote 1
                            • E Offline
                              erlend @alan_g
                              last edited by

                              @alan_g Okey good, I'll start by upstream what is left, and then return to the test after that.

                              alan_gA 1 Reply Last reply Reply Quote 0
                              • alan_gA Offline
                                alan_g @erlend
                                last edited by

                                @erlend I've had a first look, and three of those test doubles are unused in the current codebase. There's a PR dropping them for your review.

                                The others are used in a range of tests I've yet to work through.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post