Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚾ Basic functionality #2

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
09331dc
Create open-source Rust crate template
MarijnS95 May 8, 2023
4eec799
README: Fix `Actions Status` badge link
MarijnS95 Jun 2, 2023
ff5fc71
Reformat `CODE_OF_CONDUCT.md` and `release.toml`
MarijnS95 Jun 9, 2023
58a7d5e
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 11, 2023
734ae5a
Merge pull request #1 from Traverse-Research/dependabot/github_action…
MarijnS95 Sep 11, 2023
dec0d19
dependabot: Only run `github-actions` check over `.github/workflows` …
MarijnS95 Nov 3, 2023
3be10af
Add MSRV test with minimal-version dependencies
MarijnS95 Nov 24, 2023
659cb32
cargo: Add `categories` and `keywords`
MarijnS95 Nov 24, 2023
4dfd256
Start
Jasper-Bekkers Aug 14, 2024
da76654
Start adding structs and error types.
janie177 Aug 28, 2024
743c8b5
Rebase on rust template and module refactors.
janie177 Aug 29, 2024
949254c
Initalize the init args with mostly zero versions so that the API cor…
janie177 Sep 2, 2024
50b1984
Add functions to query flip mode and artificial frame rate caps.
janie177 Sep 2, 2024
6fc03b4
Add a device adapter function to query endurance gaming.
janie177 Sep 2, 2024
c7ba3e2
Query LUIDs on windows and don't query at all on other platforms.
janie177 Sep 2, 2024
9a313e5
Fix the mysterious segfault and uninitialized error.
janie177 Sep 3, 2024
696c1b9
Initialize igcl with the correct major and minor version.
janie177 Sep 3, 2024
ff84676
Add a scope enum to let the user decide how to query settings.
janie177 Sep 3, 2024
e019842
Recursively query different scopes to get the global defined setting …
janie177 Sep 3, 2024
e359a18
Formatting.
janie177 Sep 3, 2024
8486410
fmt.
janie177 Sep 3, 2024
b6bf792
Formatting.
janie177 Sep 4, 2024
3371e14
Merge remote-tracking branch 'origin/main' into basic-functionality
janie177 Sep 4, 2024
075b454
Post rebase fixes.
janie177 Sep 4, 2024
82249b4
Appease clippy and don't use windows crate when not on windows.
janie177 Sep 4, 2024
b8903aa
Remove cargo lock from git.
janie177 Sep 4, 2024
e7e63ce
Merge includes.
janie177 Sep 4, 2024
0405b65
Fix some comments.
janie177 Sep 4, 2024
add0709
Apply feedback related to spacing and the num adapters field.
janie177 Sep 4, 2024
48a1931
Apply more feedback.
janie177 Sep 4, 2024
0e14e63
Return CStr instead of &[i8].
janie177 Sep 4, 2024
226b6c2
Undo clippy suggestion.
janie177 Sep 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: "/.github/workflows/"
schedule:
interval: weekly
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
pull_request:

jobs:
Copy link
Member

@MarijnS95 MarijnS95 Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a job that runs api_gen and compares the output, like some (but not all) of our other bindings crates.

(In other words you can copy-paste the setup from one of the others we have!)

rust:
name: Lint Rust code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Cargo test
run: cargo test --workspace

rust-msrv:
name: Build-test MSRV (1.74) with minimal crate dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Generate minimal-version dependencies
run: cargo -Zminimal-versions generate-lockfile
- uses: dtolnay/[email protected]
- name: Cargo check
run: cargo check --workspace --all-targets
15 changes: 15 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish

on:
push:
tags:
paths: "/Cargo.toml"

jobs:
Publish:
if: github.repository_owner == 'Traverse-Research'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish
run: cargo publish --token ${{ secrets.cratesio_token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/Cargo.lock
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[submodule "vendor/drivers.gpu.control-library"]
path = vendor/drivers.gpu.control-library
url = https://github.com/intel/drivers.gpu.control-library.git
depth = 1
update = none
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
79 changes: 77 additions & 2 deletions Cargo.lock
janie177 marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
[package]
name = "igcl-rs"
version = "0.1.0"
name = "igcl"
version = "0.0.0"
authors = ["Traverse Research <[email protected]>"]
edition = "2021"
license = "MIT"
homepage = "https://traverseresearch.nl"
repository = "https://github.com/Traverse-Research/igcl-rs"
description = "Bindings to Intel GPU Control Library"
include = ["src", "LICENSE"]
categories = ["external-ffi-bindings", "api-bindings", "graphics"] # https://crates.io/category_slugs
keywords = ["intel", "igcl", "gpu"]

[dependencies]
anyhow = "1.0.79"
libloading = "0.8"

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.58.0", default-features = false, features = ["Win32_Foundation"] }

[workspace]
members = [
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Traverse Research BV

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# IGCL

[![Actions Status](https://github.com/Traverse-Research/igcl-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Traverse-Research/igcl-rs/actions)
[![Latest version](https://img.shields.io/crates/v/igcl.svg?logo=rust)](https://crates.io/crates/igcl)
[![Documentation](https://docs.rs/igcl/badge.svg)](https://docs.rs/igcl)
[![MSRV](https://img.shields.io/badge/rustc-1.74.0+-ab6000.svg)](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html)
[![Lines of code](https://tokei.rs/b1/github/Traverse-Research/igcl-rs)](https://github.com/Traverse-Research/igcl-rs)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4%20adopted-ff69b4.svg)](./CODE_OF_CONDUCT.md)

[![Banner](banner.png)](https://traverseresearch.nl)

Bindings to [Intel GPU Control Library (IGCL)].

## Usage

Add this to your Cargo.toml:

```toml
[dependencies]
igcl = "0.0.0"
```

```rust
// A code example
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fill this in.

```

[Intel GPU Control Library (IGCL)]: https://github.com/intel/drivers.gpu.control-library
15 changes: 13 additions & 2 deletions api_gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@ use std::path::Path;
fn main() {
let crate_root = Path::new(env!("CARGO_MANIFEST_DIR"));

// let header_path = crate_root.join("wrapper.h");
let header_path = crate_root.join("../vendor/drivers.gpu.control-library/include/igcl_api.h");
let header_path = crate_root.join("wrapper.h");

let bindings = bindgen::Builder::default()
.header(header_path.to_string_lossy())
.clang_arg(format!(
"-I{}",
crate_root
.join("../vendor/drivers.gpu.control-library/include/")
.display()
))
.dynamic_link_require_all(true)
.dynamic_library_name("ControlLib")
.clang_arg("-x")
.clang_arg("c++")
.clang_arg("-std=c++11")
.clang_arg("-Wno-pragma-once-outside-header")
.allowlist_item("(ctl|CTL)\\w+")
.default_enum_style(bindgen::EnumVariation::Rust {
non_exhaustive: true,
})
.generate()
.expect("failed to generate igcl bindings");

Expand Down
1 change: 1 addition & 0 deletions api_gen/wrapper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <igcl_api.h>
Binary file added banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions release.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pre-release-commit-message = "Release {{version}}"
tag-message = "Release {{version}}"
tag-name = "{{version}}"
sign-commit = true
sign-tag = true
publish = false

pre-release-replacements = [
{ file = "README.md", search = "igcl = .*", replace = "{{crate_name}} = \"{{version}}\"" },
]

# cargo-release only allows using {{version}} in the commit title when creating one
# commit across all released packages in this workspace (we only release one package
# though), or by using the same version for all packages.
# https://github.com/crate-ci/cargo-release/issues/540#issuecomment-1328769105
# https://github.com/crate-ci/cargo-release/commit/3af94caa4b9bbee010a5cf3f196cc4afffbaf192
consolidate-commits = false
shared-version = true
Loading