Started the Framebuffer API - Am I doing things right so far? #229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
relates to #174
cc @sunfishcode
What is this PR?
This starts a simple draw syscall for a possible framebuffer API. This is a draft PR where I am more just asking if I seem to be on the right track so far with my implementation on how i can contribute this API.
This (so far) creates:
phases/ephemeral/witx/wasi_ephemeral_framebuffer.witx
which will be the home for all of the syscalls used by the framebuffer API. And this was tested on my fork of wasmtime on my framebuffer branch.What is the proposed Framebuffer API?
Please see #174 for more context. But to me, it will eventually become the equivalent of writing directly to something like a linux framebuffer but standardized in WASI.
How did I get this up and running to start contributing?
Josh Triplett's, Extending WASI and wasmtime from WasmSF was a great starting point for me! The technical "how-to contribute" is already out of date. But I still think it is great for the context, and still is somewhat true for what you need to do (covered in my how-to below).
(Per @sunfishcode request) Here's how I was able to import my own WASi syscall to my wasm program, and then run it on my forked wasm runtime:
.witx
file in :phases/ephemeral/witx
(For example, here is my initial draw syscall).crates/wig/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx
. NOTE: We are implementing this in the latest snapshot so there is less you have to do to have wasmtime allow it.crates/wasi-common/src/hostcalls_impl/misc.rs
. (For example, here is my "println does it work?" draw syscall implementation)target/release/wasmtime
). For Example:./target/release/wasmtime ../wasi-syscall-playground/draw.wasm
.Results
EDIT: Meant to make a draft PR, but I clicked the wrong button, and there is no way to go back. Closing for now, and I'll keep working on it until it is actually ready and re-open?