Skip to content

Commit

Permalink
Merge branch 'main' into feature/mirtest-internal-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Apr 25, 2024
2 parents 4fdc1b5 + 50e3924 commit 475c9a0
Show file tree
Hide file tree
Showing 36 changed files with 689 additions and 463 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/refresh-downstreams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Refresh downstreams

on:
push:
branches:
- main

jobs:
Refresh:
runs-on: ubuntu-latest

timeout-minutes: 5

strategy:
fail-fast: false
matrix:
ref:
- core24

steps:
- name: Check out code
uses: actions/checkout@v4
with:
# so that we know what to cherry-pick from
fetch-depth: 2

- name: Update `${{ matrix.ref }}`
env:
GIT_COMMITTER_NAME: "Mir CI Bot"
GIT_COMMITTER_EMAIL: "[email protected]"
run: |
# bring downstream changes on top of HEAD
git fetch origin ${{ matrix.ref }}
git cherry-pick HEAD..origin/${{ matrix.ref }}
# and force-push to downstream
git push --force origin HEAD:${{ matrix.ref }}
1 change: 0 additions & 1 deletion .github/workflows/snap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ jobs:
- snap: Miriway/Miriway
track: latest
review-opts: --allow-classic
snapcraft-channel: edge

steps:
- name: Check out code
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/spread.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
"lxd:ubuntu-22.04:spread/build/sbuild:ubuntu_arm64"
"lxd:ubuntu-22.04:spread/build/sbuild:ubuntu_armhf"
"lxd:ubuntu-22.04:spread/build/ubuntu:clang"
"lxd:fedora-38:spread/build/fedora:amd64"
"lxd:fedora-39:spread/build/fedora:amd64"
"lxd:fedora-40:spread/build/fedora:amd64"
"lxd:fedora-rawhide:spread/build/fedora:amd64"
"lxd:ubuntu-22.04:spread/build/sbuild:ubuntu_devel"
"lxd:ubuntu-22.04:spread/build/sbuild:ubuntu_proposed"
Expand Down Expand Up @@ -79,6 +79,8 @@ jobs:
sudo snap install spread-mir-ci
sudo snap connect spread-mir-ci:lxd lxd:lxd
lxc profile set default security.privileged=true security.nesting=true
# work around https://github.com/actions/runner-images/issues/8846
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install --yes binfmt-support qemu-user-static
echo "LXD_DIR=/var/snap/lxd/common/lxd" >> $GITHUB_ENV
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/symbols-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Symbols Check

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number && format('pr{0}', github.event.number) || github.ref_name }}
cancel-in-progress: true

jobs:
Run:
runs-on: ubuntu-latest

timeout-minutes: 10
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install dependencies
run: |
# work around https://github.com/actions/runner-images/issues/8846
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository --update "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main"
sudo apt install libclang1-19
sudo apt install python3-clang-19
echo "MIR_SYMBOLS_MAP_GENERATOR_CLANG_SO_PATH=/usr/lib/llvm-19/lib/libclang-19.so.1" >> $GITHUB_ENV
echo "MIR_SYMBOLS_MAP_GENERATOR_CLANG_LIBRARY_PATH=/usr/lib/llvm-19/lib" >> $GITHUB_ENV
sudo apt-get build-dep ./
- name: Configure
run: >
cmake -B build ${{ github.workspace }}
- name: Check symbols
run: |
RET=0
cmake --build build --target check-miral-symbols-map || RET=$?
cmake --build build --target check-miroil-symbols-map || RET=$?
cmake --build build --target check-mirserver-symbols-map || RET=$?
exit $RET
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ cmake-*
build
benchmarks/build

tools/bot-data.tar.xz
tools/symbols_map_generator/venv
tools/bot-data.tar.xz
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Vcs-Git: https://github.com/MirServer/mir

#TODO: Packaging infrastructure for better dependency generation,
# ala pkg-xorg's xviddriver:Provides and ABI detection.
Package: libmirserver60
Package: libmirserver61
Section: libs
Architecture: linux-any
Multi-Arch: same
Expand Down Expand Up @@ -142,7 +142,7 @@ Section: libdevel
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libmirserver60 (= ${binary:Version}),
Depends: libmirserver61 (= ${binary:Version}),
libmirplatform-dev (= ${binary:Version}),
libmircommon-dev (= ${binary:Version}),
libglm-dev,
Expand All @@ -159,7 +159,7 @@ Section: libdevel
Architecture: linux-any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libmirserver60 (= ${binary:Version}),
Depends: libmirserver61 (= ${binary:Version}),
libmirplatform-dev (= ${binary:Version}),
libmircommon-dev (= ${binary:Version}),
libmircore-dev (= ${binary:Version}),
Expand Down
2 changes: 2 additions & 0 deletions debian/libmiral7.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ libmiral.so.7 libmiral7 #MINVER#
(c++)"miral::CursorTheme::CursorTheme(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@MIRAL_5.0" 5.0.0
(c++)"miral::CursorTheme::operator()(mir::Server&) const@MIRAL_5.0" 5.0.0
(c++)"miral::CursorTheme::~CursorTheme()@MIRAL_5.0" 5.0.0
(c++)"miral::CustomRenderer::CustomRenderer(std::function<std::unique_ptr<mir::renderer::Renderer, std::default_delete<mir::renderer::Renderer> > (std::unique_ptr<mir::graphics::gl::OutputSurface, std::default_delete<mir::graphics::gl::OutputSurface> >, std::shared_ptr<mir::graphics::GLRenderingProvider>)>&&)@MIRAL_5.0" 5.0.0
(c++)"miral::CustomRenderer::operator()(mir::Server&) const@MIRAL_5.0" 5.0.0
(c++)"miral::DisplayConfiguration::DisplayConfiguration(miral::DisplayConfiguration const&)@MIRAL_5.0" 5.0.0
(c++)"miral::DisplayConfiguration::DisplayConfiguration(miral::MirRunner const&)@MIRAL_5.0" 5.0.0
(c++)"miral::DisplayConfiguration::add_output_attribute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@MIRAL_5.0" 5.0.0
Expand Down
1 change: 0 additions & 1 deletion debian/libmirserver60.install

This file was deleted.

1 change: 1 addition & 0 deletions debian/libmirserver61.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libmirserver.so.61
File renamed without changes.
File renamed without changes.
75 changes: 75 additions & 0 deletions include/common/mir/signal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MIR_SIGNAL_H_
#define MIR_SIGNAL_H_

#include <atomic>

namespace mir
{
/**
* A thread-synchronisation barrier.
*
* The expected usage is that one thread sits in `wait()` until
* signalled from another thread with `raise()`.
*
* This mechanism does not attempt to ensure that only one thread
* is released per `raise()` or that each `raise()` unblocks only
* one `wait()`. The only guarantees are that:
* 1) At least one call to `raise()` strongly-happens-before
* a call to `wait()` returns, and
* 2) `wait()` will block until a call to `raise()` that
* happens-after the most recent return from `wait()`.
*
* The primary use-case for such a barrier is to signal a
* worker thread to run the next iteration of work.
*
* This is very similar to a `std::binary_semaphore` but
* without the precondition that `raise()` is not called
* if the Signal is already raised.
*/
class Signal
{
public:
Signal();

/**
* Raise the signal, releasing any thread in `wait()`
*
* This does not synchronise with any other call to `raise()`
* This synchronises-with a subsequent call to `wait()`, but does
* not guarantee that each call to `raise()` releases at least one
* `wait()`.
*
* Two unsynchronised calls to `raise()` may result in either one
* or two calls to `wait()` being unblocked, depending on timing.
*/
void raise();

/**
* Wait for the signal to be raised
*
* This synchronises-with a previous call to `raise()`, and
* then resets the signal.
*/
void wait();
private:
std::atomic<bool> raised;
};
}

#endif // MIR_SIGNAL_H_
59 changes: 59 additions & 0 deletions include/miral/miral/custom_renderer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MIRAL_CUSTOM_RENDERER_H
#define MIRAL_CUSTOM_RENDERER_H

#include <memory>
#include <functional>

namespace mir
{
class Server;
namespace graphics
{
class GLRenderingProvider;
namespace gl
{
class OutputSurface;
}
}
namespace renderer
{
class Renderer;
}
}

namespace miral
{

class CustomRenderer
{
public:
using Builder = std::function<
std::unique_ptr<mir::renderer::Renderer>(
std::unique_ptr<mir::graphics::gl::OutputSurface>, std::shared_ptr<mir::graphics::GLRenderingProvider>)
>;

explicit CustomRenderer(Builder&& renderer);
void operator()(mir::Server& server) const;
private:
struct Self;
std::shared_ptr<Self> self;
};
}

#endif //MIRAL_CUSTOM_RENDERER_H
4 changes: 2 additions & 2 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ backends:
- alpine-3.19
- alpine-edge
- ubuntu-22.04
- fedora-38
- fedora-39
- fedora-40
- fedora-rawhide:
image: images:fedora/39
image: images:fedora/40

environment:
ARCH: amd64
Expand Down
2 changes: 2 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ list(APPEND MIR_COMMON_SOURCES
thread_pool_executor.cpp
linearising_executor.cpp
immediate_executor.cpp
${PROJECT_SOURCE_DIR}/include/common/mir/signal.h
signal.cpp
)

set(
Expand Down
34 changes: 34 additions & 0 deletions src/common/signal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "mir/signal.h"

mir::Signal::Signal()
: raised{false}
{
}

void mir::Signal::raise()
{
raised = true;
raised.notify_all();
}

void mir::Signal::wait()
{
raised.wait(false);
raised = false;
}
4 changes: 4 additions & 0 deletions src/common/symbols.map
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ MIR_COMMON_2.17 {
mir::SharedLibraryProberReport::?SharedLibraryProberReport*;
mir::SharedLibraryProberReport::SharedLibraryProberReport*;
mir::SharedLibraryProberReport::operator*;
mir::Signal::Signal*;
mir::Signal::?Signal*;
mir::Signal::raise*;
mir::Signal::wait*;
mir::SignalBlocker::?SignalBlocker*;
mir::SignalBlocker::SignalBlocker*;
mir::detail::RefCountedLibrary::?RefCountedLibrary*;
Expand Down
Loading

0 comments on commit 475c9a0

Please sign in to comment.