Magma Contributing and Best Practices
Submitting a patch
The source code for a magma graphics driver may be hosted entirely within the garnet repository.
The core magma code is found under:
Implementations of the magma service drivers are found under:
Implementations of the magma application driver may be located in drivers/gpu; though often these are built from third party projects, such as third_party/mesa.
Coding Conventions and Formatting
- Use the Google style guide for source code.
- Run clang-format on your changes to maintain consistent formatting.
Build Configuration for Testing
Product for L0 and L1 testing:
Packages for L0 and L1 testing:
Product for L2 testing:
Package for L2 testing:
For details on the testing strategy for magma, see Test Strategy.
There are multiple levels for magma TPS. Each level includes all previous levels.
When submitting a change you must indicate the TPS level tested, preface by the hardware on which the testing was performed:
Includes all unit tests and integration tests. There are 2 steps at this tps level:
Build with --args magma_enable_developer_build=true; this will run unit tests that require hardware, then present the device as usual for general applications. Inspect the syslog for test results.
Run the test script lib/magma/scripts/test.sh and inspect the test results.
If you have an attached display, execute the spinning vkcube.
This test uses an imagepipe swapchain to pass frames to the system compositor.
Run the test with
run fuchsia-pkg://fuchsia.com/present_view#meta/present_view.cmx fuchsia-pkg://fuchsia.com/vkcube_on_scenic#meta/vkcube_on_scenic.cmx.
A full UI 'smoke' test. Build the entire product including your change.
Login as Guest on the device and run both of these commands: ./scripts/fx shell sessionctl --story_name=spinning_cube --mod_name=spinning_cube --mod_url=spinning_cube add_mod spinning_cube ./scripts/fx shell sessionctl --story_name=spinning_cube2 --mod_name=spinning_cube2 --mod_url=spinning_cube add_mod spinning_cube
For details, refer to top level project documentation.
For stress testing, run the test script lib/magma/scripts/stress.sh and ensure that the driver does not leak resources over time.
A full UI stress test. Launch the spinning_cube example and the infinite_scroller, and let them run overnight.
For some changes, it's appropriate to run the Vulkan conformance test suite before submitting. See Conformance.
For some changes, it's appropriate to run benchmarks to validate performance metrics. See Benchmarking.
For details on the Vulkan conformance test suite, see
The source to Vulkan gfxbench is access-restricted. It should be cloned into third_party.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-11-07.