diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 666384f..096bb66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: doc: runs-on: ubuntu-latest + needs: cargo-readme steps: - uses: actions/checkout@v2 - name: Setup Rust @@ -59,6 +60,15 @@ jobs: DOCS_RS: 1 with: command: doc + - name: Setup Cargo readme + uses: actions/cache@v2 + with: + path: ~/.cargo/bin/cargo-readme + key: ${{ runner.os }}-cargo-readme + - name: Generate README + run: | + cargo readme > README.md + git diff --quiet || (echo '::error::Generated README is, please regenerate with `cargo readme > README.md`'; git diff; false) check: runs-on: ubuntu-latest @@ -305,3 +315,19 @@ jobs: registry-token: ${{ secrets.CRATES_TOKEN }} args: --no-verify #dry-run: true + + cargo-readme: + runs-on: ubuntu-latest + steps: + - name: Prepare cache + uses: actions/cache@v2 + id: cache + with: + path: ~/.cargo/bin/cargo-readme + key: ${{ runner.os }}-cargo-readme + - name: Install cargo readme + if: steps.cache.outputs.cache-hit != 'true' + uses: actions-rs/cargo@v1 + with: + command: install + args: cargo-readme diff --git a/README.md b/README.md index 711ce94..c0d3cba 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,20 @@ +gbm += + +[![Actions Status](https://github.com/Smithay/gbm.rs/workflows/Continuous%20integration/badge.svg)](https://github.com/Smithay/gbm.rs/actions) +[![Latest version](https://img.shields.io/crates/v/hassle-rs.svg)](https://crates.io/crates/hassle-rs) +[![Documentation](https://docs.rs/hassle-rs/badge.svg)](https://docs.rs/hassle-rs) +[![Lines of code](https://tokei.rs/b1/github/Smithay/gbm.rs)](https://github.com/Smithay/gbm.rs) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) + +## Usage + +Add to your `Cargo.toml`: + +```toml +gbm = "0.6.0" +``` + ## Safe `libgbm` bindings for [rust](https://www.rust-lang.org) The Generic Buffer Manager @@ -11,30 +28,23 @@ the underlying memory manager. This library is best used in combination with [`drm-rs`](https://github.com/Smithay/drm-rs), provided through the `drm-support` feature. -## Usage - -Add to your Cargo.toml - -```toml -gbm = "0.6.0" -``` - -## Example +### Example ```rust -extern crate drm; -extern crate gbm; - use drm::control::{self, crtc, framebuffer}; use gbm::{BufferObjectFlags, Device, Format}; +# +# +# +# // ... init your drm device ... let drm = init_drm_device(); // init a GBM device let gbm = Device::new(drm).unwrap(); -// create a buffer +// create a 4x4 buffer let mut bo = gbm .create_buffer_object::<()>( 1280, @@ -59,7 +69,14 @@ bo.write(&buffer).unwrap(); // create a framebuffer from our buffer let fb = gbm.add_framebuffer(&bo, 32, 32).unwrap(); +# // display it (and get a crtc, mode and connector before) gbm.set_crtc(crtc_handle, Some(fb), (0, 0), &[con], Some(mode)) .unwrap(); ``` + +Current version: 0.6.0 + +Some additional info here + +License: MIT diff --git a/README.tpl b/README.tpl new file mode 100644 index 0000000..e4e40b6 --- /dev/null +++ b/README.tpl @@ -0,0 +1,20 @@ +{{crate}} += + +[![Actions Status](https://github.com/Smithay/gbm.rs/workflows/Continuous%20integration/badge.svg)](https://github.com/Smithay/gbm.rs/actions) +[![Latest version](https://img.shields.io/crates/v/hassle-rs.svg)](https://crates.io/crates/hassle-rs) +[![Documentation](https://docs.rs/hassle-rs/badge.svg)](https://docs.rs/hassle-rs) +[![Lines of code](https://tokei.rs/b1/github/Smithay/gbm.rs)](https://github.com/Smithay/gbm.rs) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) + +### Usage + +Add to your `Cargo.toml`: + +```toml +gbm = "0.6.0" +``` + +{{readme}} + +License: {{license}} diff --git a/src/lib.rs b/src/lib.rs index 9a4fa52..36dc7f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,6 +60,7 @@ //! BufferObjectFlags::SCANOUT | BufferObjectFlags::WRITE, //! ) //! .unwrap(); +//! //! // write something to it (usually use import or egl rendering instead) //! let buffer = { //! let mut buffer = Vec::new();