Skip to content

Commit

Permalink
Optimize performance and graphics
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Czyz <[email protected]>
  • Loading branch information
mczyz-antmicro committed Apr 3, 2024
1 parent 3069953 commit 3811032
Show file tree
Hide file tree
Showing 33 changed files with 979 additions and 28 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/ubuntu-gui-full/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2024 Antmicro <www.antmicro.com>
// SPDX-License-Identifier: Apache-2.0

{
"image": "ghcr.io/antmicro/openroad-codespace:lxqt",
"forwardPorts": [6080],
"portsAttributes": {
"6080": {
"label": "desktop"
}
},
"postAttachCommand": "bash /usr/local/share/desktop-init.sh"
}
14 changes: 14 additions & 0 deletions .devcontainer/ubuntu-gui-minimal/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2024 Antmicro <www.antmicro.com>
// SPDX-License-Identifier: Apache-2.0

// TODO: Create a minimal version of the image
{
"image": "ghcr.io/antmicro/openroad-codespace:lxqt",
"forwardPorts": [6080],
"portsAttributes": {
"6080": {
"label": "desktop"
}
},
"postAttachCommand": "bash /usr/local/share/desktop-init.sh"
}
12 changes: 0 additions & 12 deletions .devcontainer/ubuntu-gui/devcontainer.json

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Prebuild docker image
on:
push:
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build:
name: BUILD
runs-on: ubuntu-22.04
timeout-minutes: 600
steps:
- uses: actions/checkout@v4

- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request' && github.repository == 'antmicro/openroad-codespace'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}

- name: Build ORFS
run: |
docker build -t ghcr.io/antmicro/openroad-codespace:orfs -f Dockerfile-orfs .
- name: Push container image to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request' && github.repository == 'antmicro/openroad-codespace'
run: docker push ghcr.io/antmicro/openroad-codespace:orfs

- name: Build LXQt
run: |
docker build -t ghcr.io/antmicro/openroad-codespace:lxqt -f Dockerfile-lxqt .
- name: Push container image to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request' && github.repository == 'antmicro/openroad-codespace'
run: docker push ghcr.io/antmicro/openroad-codespace:lxqt
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "third_party/OpenROAD-flow-scripts"]
path = third_party/OpenROAD-flow-scripts
url = [email protected]:The-OpenROAD-Project/OpenROAD-flow-scripts.git
23 changes: 23 additions & 0 deletions Dockerfile-lxqt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0

FROM ghcr.io/antmicro/openroad-codespace:orfs

COPY ./scripts/common.sh /usr/local/bin/common.sh
COPY ./scripts/install-desktop-deps.sh /usr/local/bin/install-desktop-deps.sh
RUN bash /usr/local/bin/install-desktop-deps.sh

COPY ./scripts/install-desktop.sh /usr/local/bin/install-desktop.sh
RUN bash /usr/local/bin/install-desktop.sh
RUN chsh -s /bin/bash

ENV DISPLAY=:1

COPY ./scripts/patch-lxqt-config.sh /usr/local/bin/patch-lxqt-config.sh
COPY ./scripts/lxqt-config /usr/local/bin/lxqt-config
RUN bash /usr/local/bin/patch-lxqt-config.sh

COPY ./scripts/patch-novnc-ui.sh /usr/local/bin/patch-novnc-ui.sh
RUN bash /usr/local/bin/patch-novnc-ui.sh

CMD ["/usr/local/share/desktop-init.sh"]
13 changes: 13 additions & 0 deletions Dockerfile-orfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0

FROM ubuntu:22.04

COPY ./scripts/install-orfs.sh /usr/local/bin/install-orfs.sh
RUN bash /usr/local/bin/install-orfs.sh

ENV PATH="$PATH:/usr/local/bin"

ENV PATH="$PATH:/yosys/"
ENV OPENROAD_EXE=/usr/bin/openroad
ENV YOSYS_CMD=/yosys/yosys
59 changes: 47 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,68 @@

The goal is to provide a web browser experience of the OpenROAD GUI. Solution works with Firefox and Chrome.

## User
## Creating a Codespace

1. First time users are encourage to read the tutorial [creating a codespace for a repository](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository). Follow this tutorial to create a codespace from the ORFS repository. Select `ubuntu gui` in the `Dev container configuration` field
2. Connect to the generated codespace
3. At the bottom, there should be tab `PORTS`, where you will find the `Forwarded Address`. Follow this link
4. NoVNC tab should open - default password is `vscode`.
5. Right-click on desktop and open Terminal and execute the following commands to run OpenROAD GUI
First time Codespace users are encouraged to read the tutorial [creating a codespace for a repository](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository)

1. Create a codespace from this repository

![create](https://github.com/antmicro/openroad-codespace/blob/main/img/create_codespace.gif)

2. Select `ubuntu gui` in the `Dev container configuration` field

![configure](https://github.com/antmicro/openroad-codespace/blob/main/img/configure_codespace.gif)

3. Click "Create codespace" and after a few minutes, the codespace should be ready for use

## Using the Codespace

### OpenROAD GUI

1. At the bottom, there should be tab `PORTS`, where you will find the `Forwarded Address`. A link is provided, which you can follow to open the OpenROAD GUI

![open](https://github.com/antmicro/openroad-codespace/blob/main/img/open_vnc.gif)

2. NoVNC tab should open - default password is `vscode`
3. Right-click on desktop and open Terminal and execute the following commands to run OpenROAD GUI

```
cd /OpenROAD-flow-scripts
source env.sh
openroad -gui
cd ~/OpenROAD-flow-scripts/flow
. ../env.sh
make
make gui_final
```

### VSCode

1. You can also use VSCode to connect to Codespaces
2. [Install VSCode](https://code.visualstudio.com/docs/setup/setup-overview).
2. [Install VSCode](https://code.visualstudio.com/docs/setup/setup-overview)
3. Open VSCode and install the [GitHub Codespaces](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) extension
4. Press `Ctrl+Shift+P` and select `Codespaces:Connect to Codespace`
5. Open a web browser and connect to url: `localhost:6080`.
5. Open a web browser and connect to url: `localhost:6080`

### Useful scripts

User can use:
* `/usr/local/bin/set-resolution` - change the resolution
* `/usr/local/share/desktop-init.sh` - desktop (GUI, VNC, etc.) initialization
* `/workspaces/openroad-codespace/kill.sh` - script to terminate all processes related to vnc. If you want to restart the vnc environment, first kill proceses, then re-lanuch by executing `/usr/local/share/desktop-init.sh`

In docker build, scripts are used:
* `patch-lxqt-config.sh` - set the GUI configuration
* `patch-novnc-ui.sh` - set remote resizing and skip login panel
* `install-*` - a group of scripts to install dependencies (Yosys, ORFS, etc.)

## Developer

OpenROAD Flow Scripts provide a docker image generation script `etc/DockerHelper.sh`, which is used here to build and publish the image to GH registry.
ORFS docker images is now built with available binaries. In CI configuration, you will find steps to reproduce the required docker images.

Useful resources:
* [Development loop](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_full-configuration-edit-loop)
* [devcontainer JSON reference](https://containers.dev/implementors/json_reference/)
* [Desktop lite feature](https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/desktop-lite.md)

### Desktop-lite feature

The desktop-lite feature is provided by the [devcontainers organization](https://github.com/devcontainers/features/tree/main/src/desktop-lite). In this repo, the scripts were heavily modified, c.f. `install-desktop.sh`.

Binary file added img/configure_codespace.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/create_codespace.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/open_vnc.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/desktop-lite.md
# Maintainer: The VS Code and Codespaces Teams

set -e

apt_get_update()
{
apt-get update -y
}

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
63 changes: 63 additions & 0 deletions scripts/install-desktop-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/desktop-lite.md
# Maintainer: The VS Code and Codespaces Teams

. common.sh

package_list="
tigervnc-standalone-server \
tigervnc-common \
dbus-x11 \
x11-utils \
x11-xserver-utils \
xdg-utils \
fbautostart \
at-spi2-core \
xterm \
eterm \
nautilus\
mousepad \
seahorse \
gnome-keyring \
libx11-dev \
libxkbfile-dev \
libsecret-1-dev \
libgbm-dev \
libnotify4 \
libnss3 \
libxss1 \
libasound2 \
htop \
ncdu \
curl \
ca-certificates\
unzip \
locales \
xfwm4 \
lxqt \
"

# Packages to attempt to install if essential tools are missing (ie: vncpasswd).
# This is useful, at least, for Ubuntu 22.04 (jammy)
package_list_additional="
tigervnc-tools"

set -e

# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive

apt_get_update
check_packages ${package_list}

# On newer versions of Ubuntu (22.04),
# we need an additional package that isn't provided in earlier versions
if ! type vncpasswd > /dev/null 2>&1; then
check_packages ${package_list_additional}
fi
Loading

0 comments on commit 3811032

Please sign in to comment.