.. include:: /keyword.rst ================ Chromium Browser ================ .. figure:: /_asset/thirdparty_chromium_screenshot.png :width: 85% |IOT-YOCTO| has integrated a patched version of the open source `Chromium`_ browser via a fork of the `meta-chromium`_ Yocto layer, with GPU and Video Codec acceleration for the following SoCs: - Genio 510 - Genio 700 - Genio 1200 |IOT-YOCTO| provides a image recipe, ``rity-browser-image``, which includes the Chromium browser in the image. The build time of the ``rity-browser-image`` recipe is roughly three times longer than ``rity-demo-image``. .. note:: For performance evaluation on Genio EVK, we recommend you to download the prebuilt ``rity-browser-image`` binaries from :doc:`/sw/yocto/download` due to the long compile times. Chromium hardware acceleration enablement is a collaboration between MediaTek and `Collabora`_. The required modifications are being contributed to the upstream projects. This process is ongoing thus |IOT-YOCTO| v24.1 uses forked repositories that includes necessary patches for hardware acceleration and system integration. The forked open source repositories are developed and hosted by Collabora: - `forked meta-chromium`_ for |IOT-YOCTO|. The Yocto layer above contains the patches applied on top of the Chromium ``132.0.6834.6`` release tarball. See patches list `here. `__ The following sections shows you how to launch and evaluate performances with prebuilt ``rity-browser-image`` binaries and Genio EVK. .. _Chromium: https://www.chromium.org/Home/ .. _meta-chromium: https://github.com/OSSystems/meta-browser/tree/master/meta-chromium .. _Collabora: https://www.collabora.com/ .. _Forked meta-chromium: https://gitlab.collabora.com/mediatek/aiot/rity/meta-browser/-/tree/collabora/kirkstone/chromium/meta-chromium?ref_type=heads Hardware Setup ============== Chromium browser is a GUI application that requires keyboard and pointing device to use. To evaluate it, prepare the following hardware: - Genio 510/700/1200 EVK - USB keyboard - USB mouse - USB-C hub if using Genio 510/700 EVK - (optional) USB web camera for video conference and encoding scenario - (optional) external monitor Connect the keyboard and mouse to Genio EVK, as shown below: .. tabs:: .. group-tab:: |G510-EVK| Connect a USB-C hub to USB-C PD port, and then connect keyboard and mouse to the board. .. figure:: /_asset/hw_evk_g700-evk_ports.png :alt: Ports of |G510-G700-EVK-REF-BOARD| main board :align: center :width: 65% Ports of |G510-G700-EVK-REF-BOARD| main board .. group-tab:: |G700-EVK| Connect a USB-C hub to USB-C PD port, and then connect keyboard and mouse to the board. .. figure:: /_asset/hw_evk_g700-evk_ports.png :alt: Ports of |G510-G700-EVK-REF-BOARD| main board :align: center :width: 65% Ports of |G510-G700-EVK-REF-BOARD| main board .. group-tab:: |G1200-EVK| Connect keyboard and mouse to USB A (USB 3.1 Gen 1) ports. .. figure:: /_asset/hw_evk_g1200-evk_ports.png :alt: Ports of |G1200-EVK-REF-BOARD| main board :align: center :width: 65% Ports of |G1200-EVK-REF-BOARD| main board To use external monitor, follow the instructions in :doc:`/sw/yocto/app-dev/display/display-common` . Flash Image =========== Download ``rity-browser-image`` from :doc:`/sw/yocto/download`. Flash the image to Genio EVK following the instructions in :doc:`/sw/yocto/get-started/flash`. Launch Chromium Browser ======================= After flashing the ``rity-browser-image`` to Genio EVK, a graphical desktop should appear on the display. Follow these steps to launch Chromium browser: 1. Use the mouse and click the terminal icon on the top-left corner of the displayed desktop. This launches the built-in terminal console. 2. Connect to the internet. Use the terminal console in step 1 and follow the commands inc :doc:`Ethernet ` or on-board :doc:`Wi-Fi module`. 3. Run the following commands in the terminal console: .. prompt:: bash # auto # chromium Chromium Command Switches ------------------------- The ``chromium`` command is a wrapper. It has pre-defined command switches to enable hardware acceleration, e.g. ``--ozone-platform=wayland``. You may need to adjust the `command switches`_ for your product. For example, the ``--no-sandbox`` flag allows Chromium to run as the root user, which is the default user configured in ``rity-browser-image``. In an actual production image, root user should be disabled, and normal users do not need to use the ``--no-sandbox`` flag. .. _command switches: https://peter.sh/experiments/chromium-command-line-switches/ Chromium Hardware Acceleration Support ====================================== To check which hardware-acceleration features have been enabled, type the following URL in the Chromium browser's address bar: .. code-block:: chrome://gpu The report indicates if hardware video decode and encode acceleration is enabled and the backend GPU driver version, as shown below: .. figure:: /_asset/thirdparty_chromium_gpu-info.png :alt: Chromium chrom://gpu report :align: center :width: 45% Chromium Graphics Feature Status on Genio 700 EVK This modified version of Chromium enables hardware acceleration for the following formats: +---------------+-------------------+-----------------------+ | | Decode | Encode | +===============+===================+=======================+ | H.264 | V | V | +---------------+-------------------+-----------------------+ | HEVC(H.265) | V | V | +---------------+-------------------+-----------------------+ | VP8 | V | Not Supported | +---------------+-------------------+-----------------------+ | VP9 | V | Not Supported | +---------------+-------------------+-----------------------+ Browser Use Cases ================= The Chromium integration in |IOT-YOCTO| is a POC(Proof-of-Concept) for hardware acceleration. The following browser use cases are known to work on this Chromium integration, but any other use cases have not been validated. Visiting a Web Site ------------------- 1. Visit https://www.google.com and Google home page loads properly. 2. Search for "MediaTek" and scroll the page. It should be reasonably responsive. File Download ------------- 1. Visit https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/ 2. Scroll down and click on the ``debian-12.8.0-amd64-netinst.iso`` entry to start downloading it 3. The download succeeds and the downloaded ``debian-12.8.0-amd64-netinst.iso`` should have ``sha256sum`` of ``04396d12b0f377958a070c38a923c227832fa3b3e18ddc013936ecf492e9fbb3``. Video Decoding -------------- 1. Visit https://www.youtube.com/watch?v=LXb3EKWsInQ 2. Use the YouTube UI to adjust resolution to 4K and skip ads if necessary. The video playback should be smooth on Genio 1200 and Genio 700. 3. Right-click in the video area and open "Stats for nerds" - The ``Codecs`` row should start with ``vp09`` - If the row starts with ``av01``, expect degraded performance, since ``av01`` is not hardware accelerated. Local File Video Playback ------------------------- 1. Download https://download.blender.org/demo/movies/BBB/bbb_sunflower_2160p_60fps_normal.mp4.zip and unzip it with the following commands: .. prompt:: bash # auto # curl -o ~/bbb.zip "https://download.blender.org/demo/movies/BBB/bbb_sunflower_2160p_60fps_normal.mp4.zip" # unzip ~/bbb.zip -d ~/bbb 2. Start Chromium and play the downloaded video file in full screen kiosk mode: .. prompt:: bash # auto # chromium --kiosk ~/bbb/bbb_sunflower_2160p_60fps_normal.mp4 WebCodecs Decode ---------------- 1. Visit https://w3c.github.io/webcodecs/samples/video-decode-display/ 2. For each of: H264, H265, VP8, VP9: - Select corresponding entry and start playback - Video contents are displayed properly - Video rendering rate should be higher than 150 FPS WebCodecs Encode and Decode --------------------------- 1. Connect USB webcam to EVK 2. Visit https://w3c.github.io/webcodecs/samples/encode-decode-worker/index.html 3. For each of H264, H265: - Select corresponding codec entry - Set Encoder Hardware Acceleration Preference: Prefer Hardware - Set Decoder Hardware Acceleration Preference: Prefer Hardware 4. Set Resolution: Full HD - Press Start - Source captured from the webcam should be displayed smoothly under "Video Source" - Decoded video should be displayed smoothly under "Local Video" To compare performance between hardware acceleration and software implementation, change the **Hardware Acceleration Preference** options to **Perfer Software**. You can use command line tools such as ``htop`` to observe CPU usage, or use ``sar 1 10`` to record CPU usage. As a reference, the following table shows the result comparison between hardware and software codecs on |G1200-EVK|: +------------------------------------+-------------------+-----------------------+ | | Software Codec | Hardware Accelerated | +====================================+===================+=======================+ | H.264 Decode | 283 FPS | 339 FPS | +------------------------------------+-------------------+-----------------------+ | H.265 Decode | Not Supported | 339 FPS | +------------------------------------+-------------------+-----------------------+ | VP8 Decode | 180 FPS | 233 FPS | +------------------------------------+-------------------+-----------------------+ | VP9 Decode | 259 FPS | 335 FPS | +------------------------------------+-------------------+-----------------------+ | H.264 Encode-Decode Latency | 72 ~ 317ms | 100 ~ 160ms | +------------------------------------+-------------------+-----------------------+ Known Issues and Limitations ============================ The integrated Chromium browser on |IOT-YOCTO| has only been tested with basic scenarios to validate hardware acceleration for video and graphics. The list below collects known issues and limitations: - Chromium browser does not support videos playback for DRM(digital rights management) protected contents. - Genio 350 EVK is not suitable to run Chromium browser due to DRAM size and CPU/GPU performance. - WebGL and WebGL2 use cases have not been validated. - On Genio 510 EVK, 4K 60 FPS video playback in browser is not smooth, due to lower DRAM memory bandwidth. - |IOT-YOCTO| lacks full support for a system-wide audio mixer framework, allowing only one audio source at a time. Consequently, playing multiple videos in different browser tabs does not work.