Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b6b40eed8 |
No files matched your search
@@ -1,67 +0,0 @@
|
||||
language: en-US
|
||||
early_access: false
|
||||
tone_instructions: >-
|
||||
Prioritize actionable correctness, security, and runtime regressions. Keep
|
||||
feedback concise. Do not request explanatory code comments; preserve license
|
||||
headers and compiler-consumed annotations.
|
||||
reviews:
|
||||
profile: chill
|
||||
request_changes_workflow: false
|
||||
high_level_summary: true
|
||||
high_level_summary_in_walkthrough: true
|
||||
poem: false
|
||||
sequence_diagrams: false
|
||||
tools:
|
||||
github-checks:
|
||||
enabled: false
|
||||
auto_review:
|
||||
enabled: true
|
||||
auto_incremental_review: true
|
||||
auto_pause_after_reviewed_commits: 0
|
||||
drafts: false
|
||||
pre_merge_checks:
|
||||
docstrings:
|
||||
mode: "off"
|
||||
title:
|
||||
mode: "off"
|
||||
description:
|
||||
mode: "off"
|
||||
finishing_touches:
|
||||
docstrings:
|
||||
enabled: false
|
||||
unit_tests:
|
||||
enabled: false
|
||||
simplify:
|
||||
enabled: false
|
||||
autofix:
|
||||
enabled: false
|
||||
fix_ci:
|
||||
enabled: false
|
||||
resolve_merge_conflict:
|
||||
enabled: false
|
||||
path_instructions:
|
||||
- path: "**/*"
|
||||
instructions: >-
|
||||
For cleanup changes, compare executable behavior against the PR merge
|
||||
base. Check for removed guards, changed return values, weakened compiler
|
||||
flags, and deleted regression tests. A passing APK build alone does not
|
||||
establish behavior preservation. Avoid style-only or comment-coverage
|
||||
requests.
|
||||
- path: "app/src/main/**"
|
||||
instructions: >-
|
||||
Review Android lifecycle, external-display visibility, input cancellation,
|
||||
permissions, threading, and Compose state. For JNI, native, and Rust
|
||||
changes, check ABI compatibility, resource ownership, synchronization,
|
||||
and error paths. Preserve persisted user settings and existing runtime
|
||||
contracts.
|
||||
- path: "tools/**"
|
||||
instructions: >-
|
||||
Check shell quoting, error handling, path and filesystem semantics, and
|
||||
Python helper behavior. Preserve MSI same-file protection and strict
|
||||
compiler checks. Verify downstream patches apply to their pinned sources
|
||||
and retain intended executable behavior, including embedded scripts.
|
||||
- path: ".github/workflows/**"
|
||||
instructions: >-
|
||||
Check job permissions, triggers, merge validation, build variants,
|
||||
signing, artifact paths, and release conditions. Verify checks apply to
|
||||
the current PR head and keep review configuration advisory.
|
||||
@@ -0,0 +1,49 @@
|
||||
# .forker.yaml — per-fork configuration for Repo Forker.
|
||||
#
|
||||
# The upstream URL and its token are NOT set here. They are set in the Gitea UI:
|
||||
# Settings -> Actions -> Variables & Secrets
|
||||
# UPSTREAM_URL = https://github.com/owner/repo.git (any provider)
|
||||
# UPSTREAM_TOKEN = <token that can read the upstream>
|
||||
# This keeps secrets out of the repo. Everything below is non-secret.
|
||||
#
|
||||
# All values are optional; sensible defaults apply when a key is absent.
|
||||
|
||||
# (unused — Bearer auth needs no username; retained for compatibility)
|
||||
token_user: oauth2
|
||||
|
||||
# Mirror all tags (true/false). Default: true
|
||||
mirror_tags: true
|
||||
|
||||
# Prune branches that were deleted upstream (true/false). Default: true
|
||||
mirror_prune: true
|
||||
|
||||
# Which upstream branches to mirror. "*" = all (default).
|
||||
# Comma-separated list to restrict, e.g. "main,develop" (stray spaces
|
||||
# tolerated). NOTE: pruning is always checked against the FULL upstream
|
||||
# branch set, so a branch outside this filter but still upstream is never
|
||||
# deleted.
|
||||
mirror_branches: "*"
|
||||
|
||||
# When a new upstream tag is mirrored, automatically build + publish a release
|
||||
# on this Gitea (true/false). Default: true
|
||||
on_new_tag: true
|
||||
|
||||
# Also mirror the upstream's existing releases (metadata + assets) via the
|
||||
# provider API (true/false). Default: false
|
||||
mirror_upstream_releases: false
|
||||
|
||||
# Build commands run inside the tag's working tree to produce release assets.
|
||||
# Multiple commands are ';'-separated. Leave empty to skip the local build and
|
||||
# only mirror upstream release assets.
|
||||
# build_cmd: "make && go build -o dist/app ."
|
||||
build_cmd: ""
|
||||
|
||||
# Optional: point to a custom build script (path relative to the forker branch)
|
||||
# instead of build_cmd. If set, build_cmd is ignored.
|
||||
# build_script: "forker/build-custom.sh"
|
||||
build_script: ""
|
||||
|
||||
# Artifacts to attach to the locally-built release. Space-separated globs,
|
||||
# relative to the tag's working tree.
|
||||
# artifacts: "dist/*"
|
||||
artifacts: ""
|
||||
@@ -1,12 +0,0 @@
|
||||
tools/linuxfs/** text=auto eol=lf
|
||||
tools/mangoapp/** text=auto eol=lf
|
||||
tools/comet/LICENSE whitespace=-blank-at-eof
|
||||
tools/comet/droiddeck.patch whitespace=-blank-at-eol,-blank-at-eof
|
||||
|
||||
# These helpers are packaged verbatim and executed inside the Linux runtime.
|
||||
tools/linuxfs/overlay/** text eol=lf
|
||||
tools/linuxfs/desktop/** text eol=lf
|
||||
tools/mangoapp/mangoapp text eol=lf
|
||||
app/src/main/assets/desktop-removal/*.json text eol=lf
|
||||
app/src/main/assets/desktop-removal/*.txt text eol=lf
|
||||
*.pdf binary
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Repo Forker — Release (build + publish)
|
||||
|
||||
# Produces a release on this Gitea fork. Two modes (see .forker.yaml):
|
||||
# BUILD — checkout the tag's working tree, run the configured build command,
|
||||
# publish the release (tag + assets) on this Gitea.
|
||||
# MIRROR — mirror the upstream's existing release (metadata + assets).
|
||||
#
|
||||
# NOTE: this workflow is triggered MANUALLY from the UI (workflow_dispatch).
|
||||
# Automatic releases on new tags are handled INLINE by sync.sh, because a
|
||||
# mirrored tag points at an upstream commit whose tree has no .gitea/workflows,
|
||||
# so a "push: tags" trigger would never find this file. See sync.sh.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag to release'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run release
|
||||
run: |
|
||||
export GITEA_REPO="${GITEA_OWNER_REPO##*/}"
|
||||
bash forker/release.sh "$TAG"
|
||||
env:
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
GITEA_OWNER: ${{ gitea.repository_owner }}
|
||||
GITEA_OWNER_REPO: ${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
UPSTREAM_URL: ${{ vars.UPSTREAM_URL }}
|
||||
UPSTREAM_TOKEN: ${{ secrets.UPSTREAM_TOKEN }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Repo Forker — Runner check
|
||||
|
||||
# Verifies a runner is available for this repo before relying on the cron sync
|
||||
# and local builds. Run it once after forking (or when a sync run is "pending"
|
||||
# for a long time — that usually means no runner is registered for this repo).
|
||||
#
|
||||
# In this Gitea build, runners are repo-scoped: a runner registered on one repo
|
||||
# does NOT serve another. Register a runner for this repo (see README, "Runner").
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Confirm a runner picked this job up
|
||||
run: |
|
||||
echo "A runner is online and serving this job."
|
||||
echo "OS=$RUNNER_OS Arch=$RUNNER_ARCH"
|
||||
|
||||
- name: Which runner(s) serve this repo
|
||||
env:
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
# The repo-level API does NOT list shared runners, so check the
|
||||
# shared (instance) list too and report which serves the repo.
|
||||
# (The Gitea Actions token has admin scope in this setup; with a
|
||||
# plain repo token the admin call 403s and we say so, not hide it.)
|
||||
curl -sS --max-time 20 -H "Authorization: Bearer $GITEA_TOKEN" \
|
||||
"$GITEA_SERVER_URL/api/v1/repos/${GITEA_OWNER}/${GITEA_REPO}/actions/runners" > /tmp/repo_runners.json
|
||||
curl -sS --max-time 20 -H "Authorization: Bearer $GITEA_TOKEN" \
|
||||
"$GITEA_SERVER_URL/api/v1/admin/actions/runners?limit=50" > /tmp/shared_runners.json
|
||||
python3 -c 'import json; R=json.load(open("/tmp/repo_runners.json")).get("runners",[]); S=[r for r in json.load(open("/tmp/shared_runners.json")).get("runners",[]) if r.get("shared")]; print("Repo-scoped runners: "+(", ".join("%s (%s)"%(r["name"],r["status"]) for r in R) or "(none)")); print("Shared runners: "+(", ".join("%s (%s)"%(r["name"],r["status"]) for r in S) or "(none)")); print("OK: a runner serves this repo." if (R or S) else "WARNING: no runner (repo-scoped or shared) registered - cron runs will stay queued.")'
|
||||
@@ -0,0 +1,82 @@
|
||||
name: Repo Forker — Sync (mirror upstream)
|
||||
|
||||
# Periodically mirrors the upstream repo (all branches, tags, full history) into
|
||||
# this Gitea fork. This is the "worker" job.
|
||||
#
|
||||
# One-time setup (Gitea UI):
|
||||
# Settings -> Actions -> Variables & Secrets
|
||||
# UPSTREAM_URL = https://github.com/owner/repo.git (any provider)
|
||||
# UPSTREAM_TOKEN = <secret: token that can read the upstream>
|
||||
# GITEA_* values below are injected automatically by Gitea Actions.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# "very periodically" — every 10 minutes. Tune to taste (5-field cron).
|
||||
- cron: '*/10 * * * *'
|
||||
workflow_dispatch: {} # manual trigger from the UI
|
||||
push:
|
||||
branches: [forker] # re-sync when the forker config changes
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
# A cold full-history fetch can exceed the 10-min cron interval (or a
|
||||
# push/dispatch can land mid-run); without this, two overlapping runs
|
||||
# both see the same tag as "missing release" and both build/publish —
|
||||
# duplicate releases + double builds. Serialize per repo (do NOT
|
||||
# cancel-in-progress: an in-flight sync must finish).
|
||||
concurrency:
|
||||
group: sync-${{ gitea.repository }}
|
||||
steps:
|
||||
# A repo without UPSTREAM_URL (e.g. the template itself) is not a mirror:
|
||||
# skip the whole job with a notice instead of failing.
|
||||
- name: Upstream configured?
|
||||
id: check
|
||||
env:
|
||||
UPSTREAM_URL: ${{ vars.UPSTREAM_URL }}
|
||||
run: |
|
||||
if [ -z "$UPSTREAM_URL" ]; then
|
||||
echo "::notice::UPSTREAM_URL is not set — this repo is not configured as a mirror (e.g. the template). No-op."
|
||||
echo "configured=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "configured=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Checkout
|
||||
if: steps.check.outputs.configured == 'true'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore mirror cache
|
||||
if: steps.check.outputs.configured == 'true'
|
||||
uses: actions/cache@v4
|
||||
continue-on-error: true # no cache service configured? continue cold — still correct
|
||||
with:
|
||||
path: .mirror
|
||||
# Unique per run so saves never conflict; restore-keys pulls the most
|
||||
# recent saved mirror (incremental fetch). No cache → full fetch, still
|
||||
# correct.
|
||||
key: forker-mirror-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
forker-mirror-
|
||||
|
||||
- name: Show config
|
||||
if: steps.check.outputs.configured == 'true'
|
||||
run: |
|
||||
echo "UPSTREAM_URL=${UPSTREAM_URL:?set in Gitea UI (Variables & Secrets)}"
|
||||
echo "Gitea repo: ${{ gitea.repository }}"
|
||||
env:
|
||||
UPSTREAM_URL: ${{ vars.UPSTREAM_URL }}
|
||||
|
||||
- name: Run sync
|
||||
if: steps.check.outputs.configured == 'true'
|
||||
run: |
|
||||
# gitea.repository is "owner/repo"; extract just the repo name.
|
||||
export GITEA_REPO="${GITEA_OWNER_REPO##*/}"
|
||||
bash forker/sync.sh
|
||||
env:
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
GITEA_OWNER: ${{ gitea.repository_owner }}
|
||||
GITEA_OWNER_REPO: ${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
UPSTREAM_URL: ${{ vars.UPSTREAM_URL }}
|
||||
UPSTREAM_TOKEN: ${{ secrets.UPSTREAM_TOKEN }}
|
||||
@@ -1,29 +0,0 @@
|
||||
name: Build AAudio sink module
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'tools/aaudio-sink/**'
|
||||
- '.github/workflows/build-aaudio-sink.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: PulseAudio 13.0 source
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsSL -o pa.tar.gz https://github.com/pulseaudio/pulseaudio/archive/refs/tags/v13.0.tar.gz
|
||||
mkdir -p pa13 && tar -xzf pa.tar.gz -C pa13 --strip-components=1
|
||||
- name: Build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
tools/aaudio-sink/build.sh "$PWD/pa13" "$PWD/out"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: audio-sink-modules
|
||||
path: out/*.so
|
||||
@@ -1,92 +0,0 @@
|
||||
name: Build desktop package (KDE Plasma)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'tools/desktop-kde/**'
|
||||
- '.github/workflows/build-desktop-kde.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag to publish as (e.g. desktop-kde-r1); empty = artifact only'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
kwin:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build KWin with nested desktop scaling
|
||||
run: |
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq zstd xz-utils gpgv patch binutils >/dev/null
|
||||
bash tools/desktop-kde/build-kwin.sh out/kwin
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: desktop-kde-kwin
|
||||
retention-days: 7
|
||||
path: out/kwin/
|
||||
build:
|
||||
needs: kwin
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: desktop-kde-kwin
|
||||
path: out/kwin
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: components-token
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-Components
|
||||
- name: Refuse a published tag
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.components-token.outputs.token }}
|
||||
run: |
|
||||
if gh release view '${{ inputs.tag }}' -R Droid-Deck/DroidDeck-Components >/dev/null 2>&1; then
|
||||
echo "::error::${{ inputs.tag }} is already published, and published tags are never replaced: use a new tag"
|
||||
exit 1
|
||||
fi
|
||||
- name: Build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq zstd xz-utils gpgv >/dev/null
|
||||
KDE_KWIN_OVERRIDE="$PWD/out/kwin" tools/desktop-kde/build.sh out
|
||||
cp out/kwin/desktop-kde.kwin.txt out/
|
||||
echo "size $(stat -c %s out/desktop-kde.tar.zst) sha256 $(cat out/desktop-kde.sha256)"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: desktop-kde
|
||||
retention-days: 7
|
||||
compression-level: 0
|
||||
path: |
|
||||
out/desktop-kde.tar.zst
|
||||
out/desktop-kde.packages.txt
|
||||
out/desktop-kde.kwin.txt
|
||||
out/desktop-kde.sha256
|
||||
- name: Publish
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.components-token.outputs.token }}
|
||||
GH_REPO: Droid-Deck/DroidDeck-Components
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG='${{ inputs.tag }}'
|
||||
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||
echo "::error::$TAG is already published in DroidDeck-Components, and published tags are never replaced: use a new tag"
|
||||
exit 1
|
||||
fi
|
||||
gh release create "$TAG" --latest=false --prerelease=false --title "$TAG" \
|
||||
--notes "KDE Plasma desktop package for DroidDeck's Linux runtime ($GITHUB_REPOSITORY tools/desktop-kde, $GITHUB_SHA). size $(stat -c %s out/desktop-kde.tar.zst), sha256 $(cat out/desktop-kde.sha256). desktop-kde.packages.txt lists the signature-checked Arch Linux ARM packages it was built from." \
|
||||
out/desktop-kde.tar.zst out/desktop-kde.sha256 out/desktop-kde.packages.txt out/desktop-kde.kwin.txt
|
||||
gh release edit "$TAG" --latest=false --prerelease=false
|
||||
@@ -1,49 +0,0 @@
|
||||
name: Build FEX (x86-64 Steam client)
|
||||
|
||||
# Checks tools/fex: the same build DroidDeck-Components' build-fex.yml runs from this repository to publish FEX
|
||||
# (its single `fex` release and fex.json, which the app follows). Nothing is published from here.
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'tools/fex/**'
|
||||
- '.github/workflows/build-fex.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
thunks:
|
||||
description: 'Build the host thunks (Vulkan/GL/X11/... to the runtime arm64 libraries)'
|
||||
required: false
|
||||
default: 'false'
|
||||
cxxflags:
|
||||
description: 'Extra CXXFLAGS for a diagnostic build (e.g. -DDEBUG_STRACE)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Build in Arch Linux ARM
|
||||
# Inputs reach the shell as environment variables, never pasted into the script.
|
||||
env:
|
||||
FEX_EXTRA_CXXFLAGS: ${{ inputs.cxxflags }}
|
||||
FEX_THUNKS: ${{ inputs.thunks == 'true' && '1' || '0' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm -e FEX_EXTRA_CXXFLAGS="$FEX_EXTRA_CXXFLAGS" -e FEX_THUNKS="$FEX_THUNKS" -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/fex/build-in-arch.sh
|
||||
sudo chown -R "$(id -u):$(id -g)" .
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fex
|
||||
path: |
|
||||
fex.tzst
|
||||
fex.tzst.sha256
|
||||
fex-needed.txt
|
||||
fex-files.txt
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Build gamescope (patched)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'tools/gamescope/**'
|
||||
- '.github/workflows/build-gamescope.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag to publish as (e.g. gamescope-3.16.29-p1); empty = artifact only'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build in Arch Linux ARM
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/gamescope/build-in-arch.sh
|
||||
sudo chown -R "$(id -u):$(id -g)" .
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gamescope-patched
|
||||
path: |
|
||||
gamescope.tzst
|
||||
gamescope.tzst.sha256
|
||||
- name: Publish
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh release create "${{ inputs.tag }}" --latest=false --prerelease=false --title "${{ inputs.tag }}" --notes "gamescope 3.16.29 with tools/gamescope/patches; staged by the apk over /usr/local/bin/gamescope. sha256 $(cut -d' ' -f1 gamescope.tzst.sha256)" gamescope.tzst gamescope.tzst.sha256 || gh release upload "${{ inputs.tag }}" gamescope.tzst gamescope.tzst.sha256 --clobber
|
||||
gh release edit "${{ inputs.tag }}" --latest=false --prerelease=false
|
||||
@@ -1,800 +0,0 @@
|
||||
name: Build APK
|
||||
run-name: ${{ github.event_name == 'pull_request' && format('building pr {0} on {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('building {0} on {1}', github.ref_name, github.sha) }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'LICENSE'
|
||||
- '.gitignore'
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
types: [ opened, synchronize, reopened, ready_for_review ]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'LICENSE'
|
||||
- '.gitignore'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: build-${{ github.event.pull_request.number || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
PRELOAD_CACHE_VERSION: v6
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build APK
|
||||
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
outputs:
|
||||
variants: ${{ steps.variants.outputs.list }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check co-authors
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch --no-tags origin main
|
||||
base=$(git merge-base origin/main HEAD)
|
||||
messages=$(git log --format=%B "$base..HEAD")
|
||||
messages+=$'\n'"$(jq -r '.pull_request.title, (.pull_request.body // "")' "$GITHUB_EVENT_PATH")"
|
||||
if grep -Eiq '^[[:space:]]*Co-authored-by:.*(Claude|Anthropic|OpenAI|ChatGPT|GPT|Copilot|Cursor|Gemini|Codex|Devin|Windsurf|Codeium|Amazon Q|Tabnine|Cody|\[bot\])' <<<"$messages"; then
|
||||
echo "::error::AI and bot identities cannot be co-authors; remove the Co-authored-by trailer."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: The packages a signed build ships as
|
||||
id: variants
|
||||
run: echo "list=$(awk '!/^#/ && NF { print $1 }' tools/release/variants.txt | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: No private key in the tree
|
||||
run: |
|
||||
set -euo pipefail
|
||||
keys=$(git ls-files | grep -iE '\.(jks|keystore|p12|pfx|pk8|pem|key)$' | grep -vx 'keystore/testkey.p12' || true)
|
||||
if [ -n "$keys" ]; then
|
||||
echo "::error::a private key is committed - remove it from the history and make a new one: $keys"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Version bumps are isolated
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch --no-tags origin main
|
||||
base=$(git merge-base origin/main HEAD)
|
||||
diff=$(git diff -U0 "$base..HEAD" -- app/build.gradle)
|
||||
grep -Eq '^[+-][[:space:]]*version(Code|Name)[[:space:]]' <<<"$diff" || exit 0
|
||||
other_files=$(git diff --name-only "$base..HEAD" | grep -v '^app/build.gradle$' || true)
|
||||
other_gradle=$(grep -E '^[+-]' <<<"$diff" | grep -Ev '^(---|\+\+\+)' | grep -Ev '^[+-][[:space:]]*version(Code|Name)[[:space:]]' || true)
|
||||
if [[ -n "$other_files" || -n "$other_gradle" ]]; then
|
||||
echo "::error::versionCode/versionName changes must be isolated in their own PR"
|
||||
echo "A version PR may only change the versionCode/versionName lines in app/build.gradle." >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Merge onto main, or say what conflicts
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
set -uo pipefail
|
||||
git config user.name "ci"
|
||||
git config user.email "ci@users.noreply.github.com"
|
||||
git fetch --no-tags origin main
|
||||
BASE=$(git rev-parse --short origin/main)
|
||||
HEAD=$(git rev-parse --short HEAD)
|
||||
if git merge --no-ff --no-edit origin/main >/tmp/merge.out 2>&1; then
|
||||
{
|
||||
echo "### Mergeable"
|
||||
echo
|
||||
echo "\`$HEAD\` merges cleanly onto main (\`$BASE\`). What follows was built from the merged result."
|
||||
} > /tmp/pr-merge.md
|
||||
cat /tmp/pr-merge.md >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
FILES=$(git diff --name-only --diff-filter=U)
|
||||
if [ -z "$FILES" ]; then
|
||||
{
|
||||
echo "### ERROR: Could not merge onto main (\`$BASE\`)"
|
||||
echo
|
||||
echo '```'
|
||||
cat /tmp/merge.out
|
||||
echo '```'
|
||||
} > /tmp/pr-merge.md
|
||||
cat /tmp/pr-merge.md >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "::error::git could not merge main: $(head -3 /tmp/merge.out | tr '\n' ' ')"
|
||||
exit 1
|
||||
fi
|
||||
{
|
||||
echo "### ERROR: Not mergeable - conflicts with main (\`$BASE\`)"
|
||||
echo
|
||||
echo "Files that conflict:"
|
||||
echo
|
||||
for f in $FILES; do echo "- \`$f\`"; done
|
||||
echo
|
||||
echo "Each conflicting hunk, as git leaves it: \`<<<<<<< HEAD\` is this pull request, \`>>>>>>> origin/main\` is main."
|
||||
echo
|
||||
for f in $FILES; do
|
||||
echo "<details><summary><code>$f</code></summary>"
|
||||
echo
|
||||
echo '```'
|
||||
awk '/^<<<<<<< /{p=1} p{print} /^>>>>>>> /{p=0}' "$f" | head -300
|
||||
echo '```'
|
||||
echo "</details>"
|
||||
echo
|
||||
done
|
||||
echo "Not built: rebase or merge main into the branch and push again."
|
||||
} > /tmp/pr-merge.md
|
||||
cat /tmp/pr-merge.md >> "$GITHUB_STEP_SUMMARY"
|
||||
git merge --abort || true
|
||||
echo "::error::the pull request conflicts with main: $(echo $FILES | tr '\n' ' ')"
|
||||
exit 1
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
cache-cleanup: on-success
|
||||
|
||||
- name: Resolve the runner's NDK
|
||||
run: |
|
||||
NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
VERSION=$(sed -n 's/^Pkg.Revision *= *//p' "$NDK/source.properties")
|
||||
echo "NDK_VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set the APK build label
|
||||
id: build-label
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
BUILD_REF: ${{ github.ref_name }}
|
||||
BUILD_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
tree_state=dirty
|
||||
else
|
||||
tree_state=clean
|
||||
fi
|
||||
echo "DROIDDECK_BUILD_TREE_STATE=$tree_state" >> "$GITHUB_ENV"
|
||||
if [[ -n "$PR_NUMBER" ]]; then
|
||||
label="pr${PR_NUMBER} at ${PR_HEAD_SHA:0:7}"
|
||||
else
|
||||
label="${BUILD_REF} at ${BUILD_SHA:0:7}"
|
||||
fi
|
||||
echo "label=$label" >> "$GITHUB_OUTPUT"
|
||||
echo "DROIDDECK_SOURCE_COMMIT=${PR_HEAD_SHA:-$BUILD_SHA}" >> "$GITHUB_ENV"
|
||||
echo "DROIDDECK_PR_NUMBER=${PR_NUMBER:-0}" >> "$GITHUB_ENV"
|
||||
echo "Build: \`$label\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Cache the preloads
|
||||
id: preloads
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: app/src/main/assets/linuxfs
|
||||
key: preloads-${{ env.PRELOAD_CACHE_VERSION }}-${{ hashFiles('app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/cpp/adrenotools/src/hook/kgsl.h', 'tools/quest/*', 'tools/linuxfs/preload/*.c', 'tools/linuxfs/build-x86-preloads.sh', 'tools/linuxfs/fex/*', 'tools/linuxfs/clipboard/*.c', 'tools/linuxfs/ssbs/*.c', 'tools/proot/fastpath/*.c', 'tools/linuxfs/overlay/usr/local/bin/*', 'tools/linuxfs/overlay/usr/bin/**', 'tools/linuxfs/desktop/*', 'tools/gamescope/release.env', 'tools/wlroots/release.env', 'tools/linuxfs/uruntime.env', 'tools/linuxfs/licenses/*', 'tools/mangoapp/*', 'tools/msitools/**', 'tools/comet/**', 'tools/linuxfs/debian-image.env', 'tools/vr/**') }}
|
||||
|
||||
- name: Build libfakeinput.so and libblsession.so (glibc aarch64)
|
||||
if: steps.preloads.outputs.cache-hit != 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libvulkan1 mesa-vulkan-drivers >/dev/null
|
||||
D=app/src/main/assets/linuxfs
|
||||
mkdir -p "$D"
|
||||
aarch64-linux-gnu-g++ -shared -fPIC -O2 -Wall -Wno-attributes -Wno-nonnull-compare \
|
||||
-pthread -std=c++17 -static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL \
|
||||
-o "$D/libfakeinput.so" app/src/main/cpp/fakeinput_steam.cpp -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/libfakeinput.so"
|
||||
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \
|
||||
-o "$D/libblsession.so" tools/linuxfs/preload/*.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/libblsession.so"
|
||||
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \
|
||||
-o "$D/libblfastpath.so" tools/proot/fastpath/fastpath.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/libblfastpath.so"
|
||||
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -nostdlib -ffreestanding -fno-stack-protector \
|
||||
-fno-tree-loop-distribute-patterns -Wl,-z,defs -o "$D/libblaudit.so" tools/proot/fastpath/audit.c
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/libblaudit.so"
|
||||
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -pthread \
|
||||
-o "$D/libssbs.so" tools/linuxfs/ssbs/ssbs_adapter.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/libssbs.so"
|
||||
mkdir -p "$D/usr/local/bin"
|
||||
aarch64-linux-gnu-gcc -O2 -Wall -Wextra -o "$D/usr/local/bin/droiddeck-clipboard" tools/linuxfs/clipboard/clipboard.c -ldl
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$D/usr/local/bin/droiddeck-clipboard"
|
||||
VK_INCLUDE=$(ls -d "${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1) \
|
||||
tools/vr/build.sh --native "$D/usr/local/lib/droiddeck-vr"
|
||||
for script in tools/linuxfs/overlay/usr/local/bin/droiddeck-* tools/linuxfs/overlay/usr/local/bin/steam-compatibility; do
|
||||
install -Dm644 "$script" "$D/usr/local/bin/$(basename "$script")"
|
||||
done
|
||||
for f in tools/linuxfs/overlay/usr/bin/* tools/linuxfs/overlay/usr/bin/steamos-polkit-helpers/*; do
|
||||
[ -f "$f" ] && install -Dm644 "$f" "$D/${f#tools/linuxfs/overlay/}"
|
||||
done
|
||||
if [ -f tools/gamescope/release.env ]; then
|
||||
. tools/gamescope/release.env
|
||||
gh release download "${GAMESCOPE_TAG}" -R "${GAMESCOPE_REPO:-${GITHUB_REPOSITORY}}" -p gamescope.tzst -O gamescope.tzst
|
||||
echo "${GAMESCOPE_SHA256} gamescope.tzst" | sha256sum -c -
|
||||
tar --use-compress-program=unzstd -xf gamescope.tzst -C "$D"
|
||||
test -f "$D/usr/local/bin/gamescope"
|
||||
rm gamescope.tzst
|
||||
fi
|
||||
. tools/linuxfs/uruntime.env
|
||||
curl -fsSL --retry 3 -o uruntime "https://github.com/VHSgunzo/uruntime/releases/download/${URUNTIME_VERSION}/${URUNTIME_ASSET}"
|
||||
echo "${URUNTIME_SHA256} uruntime" | sha256sum -c -
|
||||
install -Dm644 uruntime "$D/usr/local/lib/droiddeck/uruntime"
|
||||
install -Dm644 tools/linuxfs/licenses/uruntime-LICENSE "$D/usr/local/share/licenses/uruntime/LICENSE"
|
||||
rm uruntime
|
||||
M="$D/usr/local/lib/mangoapp"
|
||||
mkdir -p "$M" mango-pkgs
|
||||
grep -v '^#' tools/mangoapp/packages.txt | while read -r sum url; do
|
||||
[ -n "$url" ] || continue
|
||||
curl -fsSL --retry 3 -o mango-pkgs/pkg.tar.zst "$url"
|
||||
echo "$sum mango-pkgs/pkg.tar.zst" | sha256sum -c -
|
||||
tar --use-compress-program=unzstd -xf mango-pkgs/pkg.tar.zst -C mango-pkgs
|
||||
rm mango-pkgs/pkg.tar.zst
|
||||
done
|
||||
install -m644 mango-pkgs/usr/bin/mangoapp "$M/mangoapp"
|
||||
for so in libfmt.so.10 libspdlog.so.1.13 libglfw.so.3 libtraceevent.so.1; do
|
||||
cp -L "mango-pkgs/usr/lib/$so" "$M/$so"
|
||||
done
|
||||
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -Wl,-soname,libtracefs.so.1 \
|
||||
-o "$M/libtracefs.so.1" tools/mangoapp/libtracefs-shim.c
|
||||
aarch64-linux-gnu-strip --strip-unneeded "$M/libtracefs.so.1"
|
||||
install -Dm644 tools/mangoapp/mangoapp "$D/usr/local/bin/mangoapp"
|
||||
rm -rf mango-pkgs
|
||||
ls -l "$M"
|
||||
T="$D/usr/local/lib/droiddeck-msitools"
|
||||
mkdir -p "$T" msi-pkgs
|
||||
grep -v '^#' tools/msitools/packages.txt | while read -r sum url; do
|
||||
[ -n "$url" ] || continue
|
||||
curl -fsSL --retry 3 -o msi-pkgs/pkg.tar.xz "$url"
|
||||
echo "$sum msi-pkgs/pkg.tar.xz" | sha256sum -c -
|
||||
tar -xJf msi-pkgs/pkg.tar.xz -C msi-pkgs
|
||||
rm msi-pkgs/pkg.tar.xz
|
||||
done
|
||||
install -m644 msi-pkgs/usr/bin/msiinfo "$T/msiinfo"
|
||||
install -m644 msi-pkgs/usr/bin/cabextract "$T/cabextract"
|
||||
install -m644 msi-pkgs/usr/lib/7zip/7z "$T/7z"
|
||||
install -m644 msi-pkgs/usr/lib/7zip/7z.so "$T/7z.so"
|
||||
for so in libmsi-1.0.so.0 libgsf-1.so.114 libgcab-1.0.so.0; do
|
||||
cp -L "msi-pkgs/usr/lib/$so" "$T/$so"
|
||||
done
|
||||
for f in NOTICE GPL-2 GPL-3 LGPL-2.1 7zip-License 7zip-unRarLicense; do
|
||||
install -Dm644 "tools/msitools/licenses/$f" "$D/usr/local/share/licenses/droiddeck-msitools/$f"
|
||||
done
|
||||
rm -rf msi-pkgs
|
||||
ls -l "$T"
|
||||
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop "$D/usr/local/bin/droiddeck-desktop"
|
||||
install -Dm644 tools/linuxfs/desktop/droiddeck-gpu "$D/usr/local/bin/droiddeck-gpu"
|
||||
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop-gpu "$D/usr/local/bin/droiddeck-desktop-gpu"
|
||||
install -Dm644 tools/linuxfs/desktop/kwin_wayland_wrapper "$D/usr/local/bin/kwin_wayland_wrapper"
|
||||
install -Dm644 tools/linuxfs/desktop/firefox-droiddeck.js "$D/usr/lib/firefox/defaults/pref/droiddeck.js"
|
||||
ls -lR "$D"
|
||||
|
||||
- name: Fetch the Debian image the preloads build in
|
||||
if: steps.preloads.outputs.cache-hit != 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
. tools/linuxfs/debian-image.env
|
||||
image=public.ecr.aws/docker/library/debian:bullseye
|
||||
if gh release download "$DEBIAN_IMAGE_TAG" -R "$GITHUB_REPOSITORY" -p "$DEBIAN_IMAGE_ASSET" -O /tmp/debian-image.tar.zst \
|
||||
&& { [ -z "$DEBIAN_IMAGE_SHA256" ] || echo "$DEBIAN_IMAGE_SHA256 /tmp/debian-image.tar.zst" | sha256sum -c -; }; then
|
||||
zstd -dc /tmp/debian-image.tar.zst | docker load
|
||||
rm -f /tmp/debian-image.tar.zst
|
||||
else
|
||||
echo "::warning::the hosted Debian image could not be fetched; pulling from the registry instead"
|
||||
for attempt in 1 2 3 4 5; do
|
||||
docker pull "$image" && break
|
||||
[ "$attempt" -lt 5 ] || { echo "::error::could not pull $image after $attempt attempts"; exit 1; }
|
||||
echo "pull attempt $attempt failed (registry busy?); retrying in $((attempt * 30)) s"
|
||||
sleep $((attempt * 30))
|
||||
done
|
||||
fi
|
||||
docker image ls "$image"
|
||||
|
||||
- name: Build the x86 preloads FEX guests load (glibc 2.31)
|
||||
if: steps.preloads.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm -v "$PWD:/src" -w /src public.ecr.aws/docker/library/debian:bullseye bash -c '
|
||||
set -euo pipefail
|
||||
install_compilers() {
|
||||
apt-get -o Acquire::Check-Valid-Until=false update -qq &&
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends gcc g++ gcc-multilib g++-multilib binutils >/dev/null
|
||||
}
|
||||
printf "deb http://deb.debian.org/debian bullseye main\ndeb http://security.debian.org/debian-security bullseye-security main\n" > /etc/apt/sources.list
|
||||
if ! install_compilers; then
|
||||
printf "deb http://archive.debian.org/debian bullseye main\ndeb http://archive.debian.org/debian-security bullseye-security main\n" > /etc/apt/sources.list
|
||||
install_compilers
|
||||
fi
|
||||
tools/linuxfs/build-x86-preloads.sh app/src/main/assets/linuxfs
|
||||
'
|
||||
sudo chown -R "$(id -u):$(id -g)" app/src/main/assets/linuxfs
|
||||
ls -l app/src/main/assets/linuxfs/x86_64 app/src/main/assets/linuxfs/i386
|
||||
|
||||
- name: Bundle the droiddeck-esync packs
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -f tools/droiddeck-esync/release.env ]; then
|
||||
. tools/droiddeck-esync/release.env
|
||||
gh release download "$SYNC_BUNDLE_TAG" -R "$SYNC_BUNDLE_REPO" -p "$SYNC_BUNDLE_ASSET" -O sync-bundle.tzst
|
||||
echo "$SYNC_BUNDLE_SHA256 sync-bundle.tzst" | sha256sum -c -
|
||||
mkdir -p app/src/main/assets/droiddeck-esync
|
||||
tar --use-compress-program=unzstd -xf sync-bundle.tzst -C app/src/main/assets/droiddeck-esync
|
||||
rm sync-bundle.tzst
|
||||
gh release download "$SYNC_BUNDLE_TAG" -R "$SYNC_BUNDLE_REPO" -p index.json -O sync-index.json
|
||||
revoked=$(python3 -c 'import json, sys; print(" ".join(p["id"] for p in json.load(open(sys.argv[1]))["packs"] if p.get("revoked") is True))' sync-index.json)
|
||||
for id in $revoked; do
|
||||
if [ -e "app/src/main/assets/droiddeck-esync/packs/$id.tzst" ]; then
|
||||
echo "::warning::$SYNC_BUNDLE_ASSET carries revoked pack $id; it is left out of the APK (point tools/droiddeck-esync/release.env at a newer bundle)"
|
||||
rm -f "app/src/main/assets/droiddeck-esync/packs/$id.tzst"
|
||||
fi
|
||||
done
|
||||
rm sync-index.json
|
||||
test -f app/src/main/assets/droiddeck-esync/index.json
|
||||
test -f app/src/main/assets/droiddeck-esync/index.json.sig
|
||||
ls -lR app/src/main/assets/droiddeck-esync
|
||||
fi
|
||||
|
||||
- name: Cache PulseAudio 13.0 source
|
||||
id: pa-src
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: pa13
|
||||
key: pulseaudio-src-13.0
|
||||
- name: Fetch PulseAudio 13.0 source
|
||||
if: steps.pa-src.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsSL -o pa.tar.gz https://github.com/pulseaudio/pulseaudio/archive/refs/tags/v13.0.tar.gz
|
||||
mkdir -p pa13 && tar -xzf pa.tar.gz -C pa13 --strip-components=1 && rm pa.tar.gz
|
||||
- name: Fetch DirectAudio (tools/directaudio/release.env)
|
||||
run: tools/directaudio/fetch.sh "$PWD" "$PWD/sink-out"
|
||||
- name: Build the AAudio sink into the audio bundle
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
tools/aaudio-sink/build.sh "$PWD/pa13" "$PWD/sink-out"
|
||||
rm -rf pa-bundle && mkdir -p pa-bundle
|
||||
tar --use-compress-program=unzstd -xf app/src/main/assets/pulseaudio.tzst -C pa-bundle
|
||||
test ! -f pa-bundle/modules/arm64/module-aaudio-sink.so
|
||||
install -m755 sink-out/module-aaudio-sink.so pa-bundle/modules/arm64/module-aaudio-sink.so
|
||||
install -m755 sink-out/module-directaudio-native-sink.so pa-bundle/modules/arm64/module-directaudio-native-sink.so
|
||||
(cd pa-bundle && tar --use-compress-program='zstd -19' -cf ../pulseaudio.tzst .)
|
||||
mkdir -p app/build/prepared-assets
|
||||
mv pulseaudio.tzst app/build/prepared-assets/pulseaudio.tzst
|
||||
tar --use-compress-program=unzstd -tf app/build/prepared-assets/pulseaudio.tzst | grep -c '\.so$'
|
||||
rm -rf pa-bundle sink-out
|
||||
- name: Cache proot
|
||||
id: proot
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
app/src/main/jniLibs/arm64-v8a/libproot.so
|
||||
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
||||
key: proot-${{ env.NDK_VERSION }}-${{ hashFiles('tools/proot/**') }}
|
||||
- name: Build proot
|
||||
if: steps.proot.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
tools/proot/build.sh app/src/main/jniLibs/arm64-v8a
|
||||
|
||||
- name: Check the preloads
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash tools/linuxfs/check-preloads.sh app/src/main/assets/linuxfs
|
||||
|
||||
- name: Check Quest tracking IPC
|
||||
run: |
|
||||
set -euo pipefail
|
||||
NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
VK_INCLUDE=$(ls -d "$NDK"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1)
|
||||
mkdir -p build/vr/include
|
||||
cp -R "$VK_INCLUDE/vulkan" build/vr/include/
|
||||
if [ -d "$VK_INCLUDE/vk_video" ]; then cp -R "$VK_INCLUDE/vk_video" build/vr/include/; fi
|
||||
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_tracking.cpp -o /tmp/test-xr-tracking
|
||||
/tmp/test-xr-tracking
|
||||
g++ -std=c++17 -Wall -Wextra -Werror tools/vr/tests/test_xr_touch.cpp -o /tmp/test-xr-touch
|
||||
/tmp/test-xr-touch
|
||||
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_vsync.cpp -o /tmp/test-xr-vsync
|
||||
/tmp/test-xr-vsync
|
||||
g++ -std=c++17 -Wall -Wextra -Werror -pthread tools/vr/tests/test_xr_frames.cpp -o /tmp/test-xr-frames
|
||||
/tmp/test-xr-frames
|
||||
cc -Itools/vr/third_party/wayland -c tools/vr/src/wayland_client_stub.c -o /tmp/test-wayland-stub.o
|
||||
cc -Itools/vr/third_party/wayland -c app/src/main/cpp/waylandcomp/generated/xdg-shell-protocol.c -o /tmp/test-xdg-shell.o
|
||||
g++ -std=c++17 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -pthread -Ibuild/vr/include \
|
||||
-Itools/vr/third_party/wayland -Iapp/src/main/cpp/waylandcomp/generated \
|
||||
tools/vr/tests/test_presenter_shutdown.cpp tools/vr/src/presenter.cpp /tmp/test-wayland-stub.o /tmp/test-xdg-shell.o \
|
||||
-ldl -o /tmp/test-presenter-shutdown
|
||||
timeout 10 /tmp/test-presenter-shutdown
|
||||
|
||||
- name: Rust toolchain for the store engines (aarch64-linux-android)
|
||||
id: rust
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rustup target add aarch64-linux-android
|
||||
echo "rustc=$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT"
|
||||
rustc -V; cargo -V
|
||||
|
||||
- name: Cache cargo registry and the store engines' target
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
~/.cargo/bin/cargo-ndk
|
||||
app/src/main/rust/stores/target
|
||||
key: stores-${{ steps.rust.outputs.rustc }}-${{ hashFiles('app/src/main/rust/stores/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
stores-${{ steps.rust.outputs.rustc }}-
|
||||
|
||||
- name: cargo-ndk
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v cargo-ndk >/dev/null || cargo install cargo-ndk --locked
|
||||
cargo ndk --version
|
||||
|
||||
- name: Cache the CMake build tree
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
app/.cxx
|
||||
app/build/intermediates/cxx
|
||||
key: cxx-${{ env.NDK_VERSION }}-${{ hashFiles('app/src/main/cpp/**', 'tools/vr/src/xr_*.h') }}
|
||||
restore-keys: |
|
||||
cxx-${{ env.NDK_VERSION }}-
|
||||
|
||||
- name: Build GOG Galaxy companion
|
||||
if: steps.preloads.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
rustup toolchain install 1.90.0 --profile minimal
|
||||
rustup target add --toolchain 1.90.0 aarch64-unknown-linux-gnu
|
||||
RUSTUP_TOOLCHAIN=1.90.0 bash tools/comet/build.sh
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
env:
|
||||
DROIDDECK_BUILD_LABEL: ${{ steps.build-label.outputs.label }}
|
||||
SGDB_API_KEY: ${{ secrets.SGDB_API_KEY }}
|
||||
run: |
|
||||
set -o pipefail
|
||||
python3 tools/quest/build-driver.py "$ANDROID_HOME/ndk/$NDK_VERSION"
|
||||
python3 tools/release/runtime_inputs.py record
|
||||
./gradlew assembleRelease --console=plain -PndkVersion="$NDK_VERSION" 2>&1 | tee /tmp/build.log
|
||||
python3 tools/release/check_session_assets.py app/build/outputs/apk/release/app-release.apk
|
||||
python3 tools/release/runtime_inputs.py apk app/build/outputs/apk/release/app-release.apk
|
||||
|
||||
- name: Check the store engines' library
|
||||
run: |
|
||||
set -euo pipefail
|
||||
NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
python3 tools/release/check_android_libraries.py app/build/outputs/apk/release/app-release.apk \
|
||||
--readelf "$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf"
|
||||
git diff --stat -- app/src/main/rust/stores/Cargo.lock
|
||||
git diff --exit-code -- app/src/main/rust/stores/Cargo.lock \
|
||||
|| { echo "::error::Cargo.lock changed during the build; commit the regenerated lockfile (uploaded as stores-cargo-lock)"; exit 1; }
|
||||
|
||||
- name: Store engines host unit tests
|
||||
timeout-minutes: 10
|
||||
continue-on-error: true
|
||||
run: |
|
||||
cd app/src/main/rust/stores
|
||||
cargo test --locked 2>&1 | tail -60
|
||||
|
||||
- name: Upload the regenerated Cargo.lock
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: stores-cargo-lock
|
||||
path: app/src/main/rust/stores/Cargo.lock
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Steam import and game environment tests
|
||||
run: python3 -m unittest discover -s tools/tests -p 'test_*.py'
|
||||
|
||||
- name: Unit tests
|
||||
id: unit-tests
|
||||
run: |
|
||||
set -o pipefail
|
||||
mkdir -p app/build
|
||||
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
|
||||
|
||||
- name: Upload unit test diagnostics
|
||||
id: unit-test-diagnostics
|
||||
if: always() && steps.unit-tests.outcome != 'skipped'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: unit-test-results
|
||||
path: |
|
||||
app/build/unit-tests.log
|
||||
app/build/test-results/testReleaseUnitTest/
|
||||
app/build/reports/tests/testReleaseUnitTest/
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
- name: Sign with the testkey (v1 + v2 + v3)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APK=$(find app/build/outputs/apk -name '*.apk' | head -1)
|
||||
TOOLS=$(find "$ANDROID_HOME/build-tools" -maxdepth 1 -type d | sort -V | tail -1)
|
||||
"$TOOLS/zipalign" -p -f 4 "$APK" "$APK.aligned"
|
||||
"$TOOLS/apksigner" sign \
|
||||
--ks keystore/testkey.p12 --ks-type PKCS12 --ks-pass pass:android \
|
||||
--ks-key-alias testkey --key-pass pass:android \
|
||||
--v1-signing-enabled true --v2-signing-enabled true --v3-signing-enabled true \
|
||||
--out "$APK" "$APK.aligned"
|
||||
rm -f "$APK.aligned" "$APK.idsig"
|
||||
|
||||
- name: Check the signature
|
||||
run: |
|
||||
set -euo pipefail
|
||||
APK=$(find app/build/outputs/apk -name '*.apk' | head -1)
|
||||
APKSIGNER=$(find "$ANDROID_HOME/build-tools" -name apksigner | sort -V | tail -1)
|
||||
"$APKSIGNER" verify --min-sdk-version 21 --verbose --print-certs "$APK" | tee /tmp/sig.txt
|
||||
unzip -l "$APK" | grep -qE 'META-INF/.*\.(SF|RSA|DSA)$' \
|
||||
|| { echo "::error::apk carries no JAR signature files"; exit 1; }
|
||||
for scheme in "v1 scheme (JAR signing): true" "v2 scheme (APK Signature Scheme v2): true" \
|
||||
"v3 scheme (APK Signature Scheme v3): true"; do
|
||||
grep -qF "$scheme" /tmp/sig.txt || { echo "::error::apk is not signed with $scheme"; exit 1; }
|
||||
done
|
||||
grep -qi "CN=Android, OU=Android, O=Android" /tmp/sig.txt \
|
||||
|| { echo "::error::apk is not signed with the AOSP testkey"; exit 1; }
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
id: apk-upload
|
||||
with:
|
||||
name: droiddeck-apk
|
||||
path: app/build/outputs/apk/release/*.apk
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
compression-level: 0
|
||||
|
||||
- name: Report on the pull request
|
||||
if: always() && github.event_name == 'pull_request'
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR: ${{ github.event.pull_request.number }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
BUILD_OUTCOME: ${{ steps.build.outcome }}
|
||||
UNIT_TEST_OUTCOME: ${{ steps.unit-tests.outcome }}
|
||||
TEST_DIAGNOSTICS_URL: ${{ steps.unit-test-diagnostics.outputs.artifact-url }}
|
||||
APK_OUTCOME: ${{ steps.apk-upload.outcome }}
|
||||
SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
run: |
|
||||
set -uo pipefail
|
||||
MARK="<!-- droiddeck-pr-build -->"
|
||||
{
|
||||
echo "$MARK"
|
||||
echo "## Build of this pull request"
|
||||
echo
|
||||
[ -f /tmp/pr-merge.md ] && cat /tmp/pr-merge.md
|
||||
echo
|
||||
case "$BUILD_OUTCOME:$UNIT_TEST_OUTCOME:$APK_OUTCOME" in
|
||||
success:success:success)
|
||||
echo "### Build passed"
|
||||
echo
|
||||
echo "The \`droiddeck-apk\` artifact is [on this run]($RUN_URL), signed with the public test key."
|
||||
echo
|
||||
if [ "$SAME_REPO" = true ]; then
|
||||
echo "A release-signed tester build that installs over Stable or Preview is being published now and will appear in DroidDeck's **Test builds** list. Label the PR \`no-test-build\` to skip that."
|
||||
else
|
||||
echo "**Maintainer:** add the \`publish-test\` label to publish a release-signed tester build that installs over Stable or Preview and appears in DroidDeck's **Test builds** list. The label is removed automatically after publishing."
|
||||
fi
|
||||
echo
|
||||
echo "Fallback: [open **PR Release Publish**]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/workflows/pr-release-publish.yml) on \`main\` and enter PR \`$PR\`."
|
||||
;;
|
||||
success:success:*)
|
||||
echo "### APK publication incomplete"
|
||||
echo
|
||||
echo "Compilation and unit tests passed, but APK publication did not complete. See [the run]($RUN_URL)."
|
||||
;;
|
||||
success:failure:*)
|
||||
echo "### ERROR: Unit tests failed"
|
||||
echo
|
||||
echo "The APK compiled, but unit tests failed. No installable artifact was published."
|
||||
echo
|
||||
if [ -n "$TEST_DIAGNOSTICS_URL" ]; then
|
||||
echo "The [unit-test-results]($TEST_DIAGNOSTICS_URL) artifact contains the test log and any generated reports."
|
||||
else
|
||||
echo "The test diagnostics upload did not complete. See [the test log]($RUN_URL)."
|
||||
fi
|
||||
;;
|
||||
success:*)
|
||||
echo "### Build incomplete"
|
||||
echo
|
||||
echo "The APK compiled, but unit tests did not complete successfully. See [the run]($RUN_URL)."
|
||||
;;
|
||||
failure:*)
|
||||
echo "### ERROR: Build failed"
|
||||
echo
|
||||
echo "The compiler's errors ([full log]($RUN_URL)):"
|
||||
echo
|
||||
echo '```'
|
||||
{ grep -E '^e: |^w: .*error|error:|CMake Error|fatal error|ninja: error|FAILED|What went wrong|Execution failed for task|Unresolved reference|Type mismatch|Unresolved' /tmp/build.log 2>/dev/null \
|
||||
| sed -e 's#file:///home/runner/work/[^/]*/[^/]*/##' -e 's#/home/runner/work/[^/]*/[^/]*/##' \
|
||||
| grep -v '^w: ' | awk '!seen[$0]++' | head -80; } || true
|
||||
echo '```'
|
||||
echo
|
||||
echo "<details><summary>What went wrong (Gradle)</summary>"
|
||||
echo
|
||||
echo '```'
|
||||
awk '/^\* What went wrong/{p=1} /^\* Try:/{p=0} p{print}' /tmp/build.log 2>/dev/null | head -60
|
||||
echo '```'
|
||||
echo "</details>"
|
||||
;;
|
||||
skipped:*|cancelled:*)
|
||||
echo "### Not built"
|
||||
echo
|
||||
echo "The build did not run (see above, or [the run]($RUN_URL))."
|
||||
;;
|
||||
esac
|
||||
echo
|
||||
} > /tmp/pr-report.md
|
||||
cat /tmp/pr-report.md >> "$GITHUB_STEP_SUMMARY"
|
||||
ID=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR}/comments" --paginate --jq ".[] | select(.body | startswith(\"$MARK\")) | .id" | head -1 || true)
|
||||
if [ -n "$ID" ]; then
|
||||
gh api -X PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${ID}" -F body=@/tmp/pr-report.md >/dev/null
|
||||
else
|
||||
gh api -X POST "repos/${GITHUB_REPOSITORY}/issues/${PR}/comments" -F body=@/tmp/pr-report.md >/dev/null
|
||||
fi
|
||||
|
||||
sign:
|
||||
needs: build
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
uses: ./.github/workflows/sign.yml
|
||||
with:
|
||||
environment: signing-main
|
||||
variants: ${{ needs.build.outputs.variants }}
|
||||
secrets: inherit
|
||||
|
||||
announce:
|
||||
needs: [build, sign]
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
env:
|
||||
CI_REPO: Droid-Deck/DroidDeck-CI
|
||||
KEEP: 10
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: droiddeck-signed-*
|
||||
merge-multiple: true
|
||||
path: signed
|
||||
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: ci-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
|
||||
- name: Describe the change
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pr=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" \
|
||||
--jq '[.[] | select(.merged_at != null and .base.ref == "main")] | first // empty')
|
||||
if [ -n "$pr" ]; then
|
||||
number=$(jq -r .number <<<"$pr")
|
||||
title=$(jq -r .title <<<"$pr")
|
||||
merged=$(jq -r '.merged_at[:10]' <<<"$pr")
|
||||
summary=$(jq -r '.body // ""' <<<"$pr" | tr -d '\r' | { grep -v '^🤖' || true; } |
|
||||
awk '!p && /^#/ { next } NF { p = 1; print; next } p { exit }' | head -n 6 | cut -c1-400)
|
||||
{
|
||||
echo "**Merged to main** - [PR #$number]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$number): $title (merged $merged)"
|
||||
if [ -n "$summary" ]; then
|
||||
echo
|
||||
echo "$summary"
|
||||
fi
|
||||
} > notes-head.md
|
||||
else
|
||||
subject=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA" --jq '.commit.message | split("\n")[0]')
|
||||
echo "**Pushed to main** without a PR - $subject" > notes-head.md
|
||||
fi
|
||||
cat notes-head.md
|
||||
|
||||
- name: Publish to DroidDeck-CI
|
||||
id: publish
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tag=main-${GITHUB_SHA::7}
|
||||
cat signed/SHA256SUMS-*.txt > signed/SHA256SUMS.txt
|
||||
rm signed/SHA256SUMS-*.txt
|
||||
notes="$(cat notes-head.md)
|
||||
|
||||
Signed build of $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA - in main, not yet in a DroidDeck release; for testing.
|
||||
Commit: $GITHUB_SHA
|
||||
VersionCode: $(sed -n 's/^ *versionCode \([0-9][0-9]*\)$/\1/p' app/build.gradle)
|
||||
Each apk installs over a DroidDeck release and keeps its data. \`standard\` is the normal app; the others are the same app under another package name, installed beside it.
|
||||
|
||||
SHA-256:
|
||||
\`\`\`
|
||||
$(cat signed/SHA256SUMS.txt)
|
||||
\`\`\`"
|
||||
gh release delete "$tag" -R "$CI_REPO" --yes --cleanup-tag 2>/dev/null || true
|
||||
gh release create "$tag" -R "$CI_REPO" --target main --prerelease \
|
||||
--title "main ${GITHUB_SHA::7}" --notes "$notes" signed/*
|
||||
gh release list -R "$CI_REPO" -L 200 --json tagName,publishedAt \
|
||||
--jq '[.[] | select(.tagName | startswith("main-"))] | sort_by(.publishedAt) | reverse | .['"$KEEP"':][] | .tagName' |
|
||||
while IFS= read -r old; do
|
||||
if [ "$old" = "$tag" ]; then
|
||||
continue
|
||||
fi
|
||||
if ! gh release delete "$old" -R "$CI_REPO" --yes --cleanup-tag 2>/dev/null; then
|
||||
if gh release view "$old" -R "$CI_REPO" >/dev/null 2>&1; then
|
||||
echo "::error::Could not delete old release $old"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
published=$(gh release view "$tag" -R "$CI_REPO" --json tagName,assets)
|
||||
jq -e --arg tag "$tag" '.tagName == $tag and (.assets | length) > 0' <<< "$published" >/dev/null
|
||||
url="$GITHUB_SERVER_URL/$CI_REPO/releases/tag/$tag"
|
||||
apk=$(cd signed && ls DroidDeck-*.apk | awk 'length(a) == 0 || length($0) < length(a) { a = $0 } END { print a }')
|
||||
echo "release=$url" >> "$GITHUB_OUTPUT"
|
||||
echo "apk=$GITHUB_SERVER_URL/$CI_REPO/releases/download/$tag/$apk" >> "$GITHUB_OUTPUT"
|
||||
echo "Published $url"
|
||||
|
||||
- name: Post the Preview build to Discord
|
||||
env:
|
||||
WEBHOOK: ${{ secrets.DISCORD_BUILDS_WEBHOOK }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE: ${{ steps.publish.outputs.release }}
|
||||
APK: ${{ steps.publish.outputs.apk }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "$WEBHOOK" ]; then
|
||||
echo "::notice::No DISCORD_BUILDS_WEBHOOK secret; nothing posted"
|
||||
exit 0
|
||||
fi
|
||||
commit=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA")
|
||||
subject=$(jq -r '.commit.message | split("\n")[0]' <<<"$commit")
|
||||
title=$(jq -r '.commit.message | split("\n") | map(select(length > 0)) | .[1] // ""' <<<"$commit")
|
||||
pr=$(sed -n 's/^Merge pull request #\([0-9]*\).*/\1/p' <<<"$subject")
|
||||
if [ -n "$pr" ]; then
|
||||
what="[#$pr]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$pr): ${title:-$subject}"
|
||||
else
|
||||
what="[\`${GITHUB_SHA::7}\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA): $subject"
|
||||
fi
|
||||
get=$(printf 'Download: [standard APK](<%s>) · [all variants](<%s>)' "$APK" "$RELEASE")
|
||||
content=$(printf '**New signed Preview build** `main-%s`\n%s\nIn the app: **Updates → Preview**\n%s' "${GITHUB_SHA::7}" "$what" "$get")
|
||||
jq -n --arg content "$content" '{content: $content, allowed_mentions: {parse: []}}' |
|
||||
curl -fsS -H 'Content-Type: application/json' -d @- "$WEBHOOK" -o /dev/null
|
||||
echo "Posted: $content"
|
||||
|
||||
catalog:
|
||||
needs: announce
|
||||
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.announce.result != 'skipped' }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
@@ -1,51 +0,0 @@
|
||||
name: Publish the CI Debian image
|
||||
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag to publish to (a new -rN tag for a refresh; builds pin the one in tools/linuxfs/debian-image.env)'
|
||||
required: true
|
||||
default: 'ci-debian-bullseye-r2'
|
||||
replace:
|
||||
description: 'Overwrite the asset if the release already has one (changes its checksum: re-pin it in debian-image.env)'
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Pull, save and publish
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
REPLACE: ${{ inputs.replace }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
image=public.ecr.aws/docker/library/debian:bullseye
|
||||
if [ "$REPLACE" != true ] && gh release view "$TAG" -R "$GITHUB_REPOSITORY" --json assets -q '.assets[].name' 2>/dev/null | grep -qx debian-bullseye.tar.zst; then
|
||||
echo "::error::$TAG already carries debian-bullseye.tar.zst; publish to a new tag, or set replace and re-pin tools/linuxfs/debian-image.env"
|
||||
exit 1
|
||||
fi
|
||||
for attempt in 1 2 3 4 5 6; do
|
||||
docker pull "$image" && break
|
||||
[ "$attempt" -lt 6 ] || { echo "::error::could not pull $image"; exit 1; }
|
||||
echo "pull attempt $attempt failed (registry busy?); retrying in $((attempt * 30)) s"
|
||||
sleep $((attempt * 30))
|
||||
done
|
||||
docker image inspect "$image" --format 'image id {{.Id}} created {{.Created}}'
|
||||
docker save "$image" | zstd -19 -T0 -o debian-bullseye.tar.zst
|
||||
sha256sum debian-bullseye.tar.zst | tee SHA256SUMS
|
||||
ls -l debian-bullseye.tar.zst
|
||||
if ! gh release view "$TAG" -R "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
||||
gh release create "$TAG" -R "$GITHUB_REPOSITORY" --title "CI Debian 11 image ($TAG)" --latest=false \
|
||||
--notes "The debian:bullseye image build.yml compiles the x86 preloads in (glibc 2.31), saved with docker save and compressed with zstd. Pulled from public.ecr.aws/docker/library/debian:bullseye on $(date -u +%Y-%m-%d); image id $(docker image inspect "$image" --format '{{.Id}}'). Pinned in tools/linuxfs/debian-image.env."
|
||||
fi
|
||||
gh release upload "$TAG" -R "$GITHUB_REPOSITORY" debian-bullseye.tar.zst SHA256SUMS --clobber
|
||||
{ echo "Published \`$TAG\`:"; echo; echo '```'; cat SHA256SUMS; echo '```'; } >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -1,77 +0,0 @@
|
||||
name: PR Release Cleanup
|
||||
run-name: remove PR
|
||||
|
||||
|
||||
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ closed ]
|
||||
branches: [ main ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
concurrency:
|
||||
group: pr-release-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: false
|
||||
queue: max
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Check the current PR state
|
||||
id: state
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
state=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq .state)
|
||||
echo "closed=$([ "$state" = closed ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/create-github-app-token@v2
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
id: ci-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
- name: Delete the test build
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
found=0
|
||||
for tag in "pr-$PR_NUMBER" "pr-$PR_NUMBER.0"; do
|
||||
if gh release view "$tag" -R Droid-Deck/DroidDeck-CI >/dev/null 2>&1; then
|
||||
gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag
|
||||
echo "Deleted $tag"
|
||||
found=1
|
||||
fi
|
||||
done
|
||||
[ "$found" = 1 ] || echo "No test build for PR #$PR_NUMBER"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
with:
|
||||
ref: main
|
||||
persist-credentials: false
|
||||
- name: Retire the Discord PR announcement
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
env:
|
||||
WEBHOOK: ${{ secrets.DISCORD_PR_BUILDS_WEBHOOK }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: python3 tools/release/pr_discord.py retire
|
||||
|
||||
catalog:
|
||||
needs: cleanup
|
||||
if: ${{ always() }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
@@ -1,325 +0,0 @@
|
||||
name: PR Release Publish
|
||||
run-name: "sign PR #${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.event_name == 'workflow_run' && github.event.workflow_run.pull_requests[0].number || inputs.pr_number }} with the release key"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: Open pull request number
|
||||
required: true
|
||||
type: string
|
||||
pull_request_target:
|
||||
types: [labeled]
|
||||
branches: [main]
|
||||
workflow_run:
|
||||
workflows: [Build APK]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: pr-release-${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.event_name == 'workflow_run' && github.event.workflow_run.pull_requests[0].number || inputs.pr_number }}
|
||||
cancel-in-progress: false
|
||||
queue: max
|
||||
|
||||
jobs:
|
||||
authorize:
|
||||
if: >-
|
||||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
|
||||
(github.event_name == 'pull_request_target' && github.event.label.name == 'publish-test') ||
|
||||
(github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.head_repository.full_name == github.repository &&
|
||||
github.event.workflow_run.pull_requests[0] != null)
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
outputs:
|
||||
pr_number: ${{ steps.gate.outputs.pr_number }}
|
||||
run_id: ${{ steps.gate.outputs.run_id }}
|
||||
head_sha: ${{ steps.gate.outputs.head_sha }}
|
||||
base_sha: ${{ steps.gate.outputs.base_sha }}
|
||||
version_code: ${{ steps.gate.outputs.version_code }}
|
||||
label: ${{ steps.gate.outputs.label }}
|
||||
skip: ${{ steps.gate.outputs.skip }}
|
||||
automatic: ${{ steps.gate.outputs.automatic }}
|
||||
variants: ${{ steps.variants.outputs.list }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: The packages a signed build ships as
|
||||
id: variants
|
||||
run: echo "list=$(awk '!/^#/ && NF { print $1 }' tools/release/variants.txt | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
|
||||
- name: Check the requester, PR, and build
|
||||
id: gate
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
REQUESTER: ${{ github.actor }}
|
||||
PR_NUMBER: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.event_name == 'workflow_run' && github.event.workflow_run.pull_requests[0].number || inputs.pr_number }}
|
||||
BUILT_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
[[ "$PR_NUMBER" =~ ^[1-9][0-9]*$ ]] || { echo "::error::Invalid PR number '$PR_NUMBER'"; exit 1; }
|
||||
skip() { echo "::notice::Not publishing PR #$PR_NUMBER: $1"; echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0; }
|
||||
if [ "$EVENT_NAME" = workflow_run ]; then
|
||||
echo "automatic=true" >> "$GITHUB_OUTPUT"
|
||||
pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER")
|
||||
[ "$(jq -r .state <<<"$pr")" = open ] || skip "it is not open"
|
||||
[ "$(jq -r .draft <<<"$pr")" = false ] || skip "it is a draft"
|
||||
[ "$(jq -r .base.ref <<<"$pr")" = main ] || skip "it does not target main"
|
||||
[ "$(jq -r .head.repo.full_name <<<"$pr")" = "$GITHUB_REPOSITORY" ] || skip "it comes from a fork"
|
||||
jq -e 'any(.labels[]; .name == "no-test-build")' <<<"$pr" >/dev/null && skip "it is labelled no-test-build"
|
||||
[ "$(jq -r .head.sha <<<"$pr")" = "$BUILT_SHA" ] || skip "a newer push is building"
|
||||
fi
|
||||
if [ "$EVENT_NAME" = pull_request_target ]; then
|
||||
permission=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$REQUESTER/permission" --jq .permission)
|
||||
case "$permission" in
|
||||
admin|maintain|write) ;;
|
||||
*) echo "::error::@$REQUESTER does not have permission to publish release-signed test builds"; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER")
|
||||
jq -e '.state == "open" and .draft == false and .base.ref == "main"' <<<"$pr" >/dev/null ||
|
||||
{ echo "::error::PR #$PR_NUMBER must be open, ready for review, and target main"; exit 1; }
|
||||
head=$(jq -r '.head.sha' <<<"$pr")
|
||||
base=$(jq -r '.base.sha' <<<"$pr")
|
||||
|
||||
run_id=
|
||||
for attempt in $(seq 1 60); do
|
||||
latest=$(gh run list -R "$GITHUB_REPOSITORY" --workflow build.yml \
|
||||
--event pull_request --commit "$head" \
|
||||
--json databaseId,headSha,status,conclusion,createdAt,attempt -L 100 |
|
||||
jq -c --arg head "$head" '[.[] | select(.headSha == $head)] |
|
||||
sort_by([.createdAt, .attempt]) | last // empty')
|
||||
if [[ -n "$latest" && $(jq -r .status <<<"$latest") == completed ]]; then
|
||||
conclusion=$(jq -r .conclusion <<<"$latest")
|
||||
[[ "$conclusion" == success ]] || { echo "::error::The latest PR build is not green ($conclusion)"; exit 1; }
|
||||
run_id=$(jq -r .databaseId <<<"$latest")
|
||||
break
|
||||
fi
|
||||
status=not-started
|
||||
[[ -z "$latest" ]] || status=$(jq -r .status <<<"$latest")
|
||||
echo "Waiting for the PR build of ${head:0:7} to finish ($status)"
|
||||
sleep 30
|
||||
done
|
||||
[[ -n "$run_id" ]] || { echo '::error::The PR build did not finish within 30 minutes'; exit 1; }
|
||||
run=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$run_id")
|
||||
jq -e --arg head "$head" --arg repo "$(jq -r .head.repo.full_name <<<"$pr")" --arg ref "$(jq -r .head.ref <<<"$pr")" '
|
||||
.event == "pull_request" and .head_sha == $head and .conclusion == "success" and
|
||||
.head_repository.full_name == $repo and .head_branch == $ref
|
||||
' <<<"$run" >/dev/null ||
|
||||
{ echo "::error::Build run $run_id is not a green build of PR #$PR_NUMBER at ${head:0:7}"; exit 1; }
|
||||
|
||||
sdk=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-}}
|
||||
tools=$(find "$sdk/build-tools" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -1)
|
||||
main_code=$(sed -n 's/^[[:space:]]*versionCode[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' app/build.gradle)
|
||||
[[ "$main_code" =~ ^[0-9]+$ ]] || { echo "::error::No numeric versionCode in main's app/build.gradle"; exit 1; }
|
||||
mkdir -p "$RUNNER_TEMP/pr"
|
||||
gh run download "$run_id" -R "$GITHUB_REPOSITORY" -n droiddeck-apk -D "$RUNNER_TEMP/pr"
|
||||
mapfile -t apks < <(find "$RUNNER_TEMP/pr" -type f -name '*.apk')
|
||||
[[ ${#apks[@]} == 1 ]] || { echo '::error::Expected one PR APK'; exit 1; }
|
||||
package_line() {
|
||||
"$tools/aapt" dump badging "$1" | sed -n "s/^package: name='\\([^']*\\)' versionCode='\\([^']*\\)'.*/\\1 \\2/p"
|
||||
}
|
||||
candidate=$(package_line "${apks[0]}")
|
||||
[[ "$candidate" =~ ^com\.droiddeck\.launcher\ [0-9]+$ && ${candidate##* } -ge $main_code ]] || {
|
||||
echo "::error::PR package/versionCode '$candidate' cannot install over main (versionCode $main_code)"; exit 1;
|
||||
}
|
||||
|
||||
current=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER")
|
||||
jq -e --arg head "$head" --arg base "$base" '
|
||||
.state == "open" and .draft == false and .base.ref == "main" and
|
||||
.head.sha == $head and .base.sha == $base
|
||||
' <<<"$current" >/dev/null ||
|
||||
{ echo "::error::PR #$PR_NUMBER moved on while its build was checked; publish again"; exit 1; }
|
||||
{
|
||||
echo "pr_number=$PR_NUMBER"
|
||||
echo "run_id=$run_id"
|
||||
echo "head_sha=$head"
|
||||
echo "base_sha=$base"
|
||||
echo "version_code=${candidate##* }"
|
||||
echo "label=PR.$PR_NUMBER-${head:0:7}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
sign:
|
||||
needs: authorize
|
||||
uses: ./.github/workflows/sign.yml
|
||||
with:
|
||||
environment: signing-main
|
||||
variants: ${{ needs.authorize.outputs.variants }}
|
||||
run_id: ${{ needs.authorize.outputs.run_id }}
|
||||
label: ${{ needs.authorize.outputs.label }}
|
||||
artifact: droiddeck-pr-signed
|
||||
secrets: inherit
|
||||
if: ${{ needs.authorize.outputs.skip != 'true' }}
|
||||
|
||||
publish:
|
||||
needs: [authorize, sign]
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
persist-credentials: false
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: droiddeck-pr-signed-*
|
||||
merge-multiple: true
|
||||
path: signed
|
||||
- name: Describe the change
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER")
|
||||
title=$(jq -r .title <<<"$pr")
|
||||
summary=$(jq -r '.body // ""' <<<"$pr" | tr -d '\r' | { grep -v '^🤖' || true; } |
|
||||
awk '!p && /^#/ { next } NF { p = 1; print; next } p { exit }' | head -n 6 | cut -c1-400)
|
||||
{
|
||||
echo "**Not merged** - a test build of open [PR #$PR_NUMBER]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$PR_NUMBER): $title"
|
||||
if [ -n "$summary" ]; then
|
||||
echo
|
||||
echo "$summary"
|
||||
fi
|
||||
} > notes-head.md
|
||||
cat notes-head.md
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: ci-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
- name: Publish to DroidDeck-CI
|
||||
id: publish
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
HEAD_SHA: ${{ needs.authorize.outputs.head_sha }}
|
||||
BASE_SHA: ${{ needs.authorize.outputs.base_sha }}
|
||||
VERSION_CODE: ${{ needs.authorize.outputs.version_code }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
repo=Droid-Deck/DroidDeck-CI
|
||||
tag="pr-$PR_NUMBER"
|
||||
cat signed/SHA256SUMS-*.txt > signed/SHA256SUMS.txt
|
||||
rm signed/SHA256SUMS-*.txt
|
||||
notes="$(cat notes-head.md)
|
||||
|
||||
Source: https://github.com/$GITHUB_REPOSITORY/pull/$PR_NUMBER
|
||||
Commit: $HEAD_SHA
|
||||
Base: $BASE_SHA
|
||||
VersionCode: $VERSION_CODE
|
||||
Each apk installs over a DroidDeck release and keeps its data. \`standard\` is the normal app; the others are the same app under another package name, installed beside it.
|
||||
|
||||
SHA-256:
|
||||
\`\`\`
|
||||
$(cat signed/SHA256SUMS.txt)
|
||||
\`\`\`"
|
||||
first=false
|
||||
if ! gh release view "$tag" -R "$repo" >/dev/null 2>&1; then
|
||||
gh release create "$tag" -R "$repo" --target main --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
|
||||
first=true
|
||||
fi
|
||||
echo "first=$first" >> "$GITHUB_OUTPUT"
|
||||
gh release upload "$tag" signed/* -R "$repo" --clobber
|
||||
gh release edit "$tag" -R "$repo" --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
|
||||
keep=$(cd signed && ls | jq -R . | jq -sc .)
|
||||
gh api "repos/$repo/releases/tags/$tag" |
|
||||
jq -r --argjson keep "$keep" '.assets[] | select(.name as $n | $keep | index($n) | not) | .id' |
|
||||
while IFS= read -r id; do
|
||||
gh api --method DELETE "repos/$repo/releases/assets/$id" >/dev/null
|
||||
done
|
||||
|
||||
published=$(gh release view "$tag" -R "$repo" --json tagName,assets)
|
||||
jq -e --arg tag "$tag" '.tagName == $tag and (.assets | length) > 0' <<<"$published" >/dev/null
|
||||
release="$GITHUB_SERVER_URL/$repo/releases/tag/$tag"
|
||||
apk=$(cd signed && ls DroidDeck-*.apk | awk 'length(a) == 0 || length($0) < length(a) { a = $0 } END { print a }')
|
||||
echo "release=$release" >> "$GITHUB_OUTPUT"
|
||||
echo "apk=$GITHUB_SERVER_URL/$repo/releases/download/$tag/$apk" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Whether the PR's branch is in this repo
|
||||
id: same-repo
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
run: |
|
||||
head_repo=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq .head.repo.full_name)
|
||||
echo "same=$([ "$head_repo" = "$GITHUB_REPOSITORY" ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Clear the publish request label
|
||||
if: ${{ github.event_name == 'pull_request_target' && steps.publish.outcome == 'success' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
run: |
|
||||
gh api --method DELETE "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/labels/publish-test"
|
||||
|
||||
- name: Report the signed build on the PR
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
HEAD_SHA: ${{ needs.authorize.outputs.head_sha }}
|
||||
RELEASE: ${{ steps.publish.outputs.release }}
|
||||
APK: ${{ steps.publish.outputs.apk }}
|
||||
SAME_REPO: ${{ steps.same-repo.outputs.same }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
short=${HEAD_SHA:0:7}
|
||||
mark='<!-- droiddeck-pr-release -->'
|
||||
if [ "$SAME_REPO" = true ]; then
|
||||
NEXT='Each green build of a new push is signed and published here on its own. Label the PR `no-test-build` to stop that.'
|
||||
else
|
||||
NEXT='Pushes to this PR do not re-sign automatically. After a new green build, a maintainer can add the `publish-test` label again.'
|
||||
fi
|
||||
body=$(cat <<EOF
|
||||
$mark
|
||||
## Signed test build
|
||||
|
||||
A release-signed build of this PR at \`$short\` is ready. It installs over Stable or Preview and keeps app data.
|
||||
|
||||
[Download the standard APK]($APK) · [All variants and checksums]($RELEASE)
|
||||
|
||||
It is also available in **DroidDeck → Updates → Test builds → PR #$PR_NUMBER**.
|
||||
|
||||
$NEXT
|
||||
EOF
|
||||
)
|
||||
comment=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" --paginate --slurp | \
|
||||
jq "[.[][] | select(.user.login == \"github-actions[bot]\") | select(.body | startswith(\"$mark\"))] | first // {}")
|
||||
id=$(jq -r '.id // empty' <<<"$comment")
|
||||
if [ -n "$id" ]; then
|
||||
state=$(jq -r '.body | split("\n")[] | select(startswith("<!-- droiddeck-discord: ") and endswith(" -->"))' <<<"$comment")
|
||||
if [ -n "$state" ]; then body=$(printf '%s\n%s' "$body" "$state"); fi
|
||||
gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$id" -f body="$body" >/dev/null
|
||||
else
|
||||
gh api -X POST "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" -f body="$body" >/dev/null
|
||||
fi
|
||||
|
||||
- name: Update the Discord PR announcement
|
||||
if: ${{ always() && steps.publish.outcome == 'success' }}
|
||||
env:
|
||||
WEBHOOK: ${{ secrets.DISCORD_PR_BUILDS_WEBHOOK }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
HEAD_SHA: ${{ needs.authorize.outputs.head_sha }}
|
||||
RELEASE: ${{ steps.publish.outputs.release }}
|
||||
APK: ${{ steps.publish.outputs.apk }}
|
||||
run: python3 tools/release/pr_discord.py publish
|
||||
|
||||
catalog:
|
||||
needs: publish
|
||||
if: ${{ always() && needs.publish.result != 'skipped' }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
@@ -1,117 +0,0 @@
|
||||
name: Release APKs
|
||||
run-name: release ${{ inputs.version }} from main ${{ github.sha }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Version for the file names, e.g. 0.1.7
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
find:
|
||||
name: find the main build
|
||||
if: github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
run_id: ${{ steps.find.outputs.run_id }}
|
||||
variants: ${{ steps.find.outputs.variants }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- id: find
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
[[ $VERSION =~ ^[0-9A-Za-z._-]+$ ]] || { echo "::error::version '$VERSION': letters, digits, . _ - only"; exit 1; }
|
||||
name=$(sed -n 's/^ *versionName "\(.*\)"$/\1/p' app/build.gradle)
|
||||
[[ $VERSION == "$name" || $VERSION == "$name"-* ]] || {
|
||||
echo "::error::version '$VERSION' does not match versionName '$name' in app/build.gradle: bump versionName and versionCode first"; exit 1;
|
||||
}
|
||||
runs=$(gh run list -R "$GITHUB_REPOSITORY" --workflow build.yml --branch main --commit "$GITHUB_SHA" \
|
||||
--status success --json databaseId,event,headSha -L 20)
|
||||
id=$(jq -r --arg sha "$GITHUB_SHA" \
|
||||
'[.[] | select(.headSha == $sha and (.event == "push" or .event == "workflow_dispatch"))][0].databaseId // empty' <<<"$runs")
|
||||
if [ -z "$id" ]; then
|
||||
echo "::error::main ${GITHUB_SHA::7} has no successful Build APK run yet: wait for it, then release"
|
||||
exit 1
|
||||
fi
|
||||
variants=$(awk '!/^#/ && NF { print $1 }' tools/release/variants.txt | jq -R . | jq -sc .)
|
||||
echo "run_id=$id" >> "$GITHUB_OUTPUT"
|
||||
echo "variants=$variants" >> "$GITHUB_OUTPUT"
|
||||
echo "Signing Build APK run $id (main ${GITHUB_SHA::7}) as $VERSION: $variants" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
sign:
|
||||
needs: find
|
||||
uses: ./.github/workflows/sign.yml
|
||||
with:
|
||||
environment: release
|
||||
variants: ${{ needs.find.outputs.variants }}
|
||||
run_id: ${{ needs.find.outputs.run_id }}
|
||||
label: ${{ inputs.version }}
|
||||
artifact: droiddeck-release
|
||||
secrets: inherit
|
||||
|
||||
publish:
|
||||
name: publish the release
|
||||
needs: [find, sign]
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: droiddeck-release-*
|
||||
merge-multiple: true
|
||||
path: out
|
||||
|
||||
- name: Publish
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
BUILD_RUN: ${{ needs.find.outputs.run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
notes="docs/releases/$VERSION.md"
|
||||
[ -f "$notes" ] || { echo "::error::$notes is missing: add the release notes first"; exit 1; }
|
||||
if gh release view "$VERSION" -R "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
||||
echo "::error::release $VERSION already exists"; exit 1
|
||||
fi
|
||||
title=$(sed -n '1s/^# *//p' "$notes")
|
||||
[ -n "$title" ] || title="DroidDeck $VERSION"
|
||||
raw="https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$VERSION/docs/releases/media/"
|
||||
{
|
||||
sed '1{/^# /d;}' "$notes" | sed -E "s#(\]\(|src=\")media/#\1$raw#g"
|
||||
echo
|
||||
echo "---"
|
||||
echo
|
||||
echo "Built by [Build APK run $BUILD_RUN]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN) from \`$GITHUB_SHA\`, signed and published by [Release APKs run $GITHUB_RUN_ID]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
|
||||
} > "$RUNNER_TEMP/body.md"
|
||||
( cd out && cat SHA256SUMS-*.txt | sort -k2 > SHA256SUMS.txt && rm SHA256SUMS-*.txt && cat SHA256SUMS.txt )
|
||||
gh release create "$VERSION" -R "$GITHUB_REPOSITORY" out/*.apk out/SHA256SUMS.txt \
|
||||
--target "$GITHUB_SHA" --title "$title" --notes-file "$RUNNER_TEMP/body.md" --latest
|
||||
echo "Published [$title]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$VERSION)" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
catalog:
|
||||
needs: publish
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
secrets: inherit
|
||||
@@ -1,95 +0,0 @@
|
||||
name: Sign APKs
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
environment:
|
||||
type: string
|
||||
required: true
|
||||
variants:
|
||||
description: JSON array of names from tools/release/variants.txt
|
||||
type: string
|
||||
required: true
|
||||
run_id:
|
||||
description: The Build APK run whose apk to sign; empty for the calling run's own
|
||||
type: string
|
||||
default: ''
|
||||
label:
|
||||
description: Goes in the file names (a version); empty for <branch>-<short sha>
|
||||
type: string
|
||||
default: ''
|
||||
artifact:
|
||||
type: string
|
||||
default: droiddeck-signed
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
sign:
|
||||
name: sign ${{ matrix.variant }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
environment: ${{ inputs.environment }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant: ${{ fromJSON(inputs.variants) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: The apk (this run's build)
|
||||
if: inputs.run_id == ''
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: droiddeck-apk
|
||||
path: in
|
||||
|
||||
- name: The apk (a main build)
|
||||
if: inputs.run_id != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RUN: ${{ inputs.run_id }}
|
||||
run: gh run download "$RUN" -R "$GITHUB_REPOSITORY" -n droiddeck-apk -D in
|
||||
|
||||
- name: Sign
|
||||
env:
|
||||
RELEASE_KEYSTORE_B64: ${{ secrets.RELEASE_KEYSTORE_B64 }}
|
||||
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
|
||||
RELEASE_KEY_ALIAS: droiddeck
|
||||
ENVIRONMENT: ${{ inputs.environment }}
|
||||
VARIANT: ${{ matrix.variant }}
|
||||
LABEL: ${{ inputs.label }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "$RELEASE_KEYSTORE_B64" ]; then
|
||||
echo "::error::environment '$ENVIRONMENT' has no signing key: run tools/release/make-release-key.sh once"
|
||||
exit 1
|
||||
fi
|
||||
export RELEASE_KEYSTORE="$RUNNER_TEMP/release.p12"
|
||||
( umask 077; base64 -d <<<"$RELEASE_KEYSTORE_B64" > "$RELEASE_KEYSTORE" )
|
||||
BUILD_TOOLS=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -n1)
|
||||
export BUILD_TOOLS
|
||||
[ -n "$LABEL" ] || LABEL="${GITHUB_REF_NAME//\//-}-${GITHUB_SHA::7}"
|
||||
suffix=$(awk -v v="$VARIANT" '!/^#/ && $1 == v { print $3 }' tools/release/variants.txt)
|
||||
[ "$suffix" = - ] && suffix=
|
||||
apks=(in/*.apk)
|
||||
[ ${#apks[@]} = 1 ] && [ -f "${apks[0]}" ] || { echo "::error::expected one apk in the build"; exit 1; }
|
||||
mkdir -p out
|
||||
out="out/DroidDeck-$LABEL$suffix.apk"
|
||||
tools/release/sign-apk.sh "${apks[0]}" "$VARIANT" "$out"
|
||||
( cd out && sha256sum -- *.apk > "SHA256SUMS-$VARIANT.txt" && cat "SHA256SUMS-$VARIANT.txt" )
|
||||
echo "- \`$(basename "$out")\` - $(cut -c1-16 "out/SHA256SUMS-$VARIANT.txt")…" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Forget the key
|
||||
if: always()
|
||||
run: rm -f "$RUNNER_TEMP/release.p12"
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.artifact }}-${{ matrix.variant }}
|
||||
path: out/*
|
||||
if-no-files-found: error
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Update app catalog
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published, edited, deleted, unpublished]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
concurrency:
|
||||
group: update-app-catalog
|
||||
cancel-in-progress: false
|
||||
queue: max
|
||||
|
||||
jobs:
|
||||
catalog:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: ci-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
|
||||
- name: Regenerate catalog.json
|
||||
env:
|
||||
SOURCE_GITHUB_TOKEN: ${{ github.token }}
|
||||
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 tools/release/update_catalog.py
|
||||
+21
-33
@@ -1,35 +1,23 @@
|
||||
*.iml
|
||||
.gradle/
|
||||
local.properties
|
||||
.idea/
|
||||
# The bare mirror holds upstream objects; never commit it.
|
||||
.mirror/
|
||||
|
||||
# Local runner config (contains tokens) — but KEEP runner/docker-compose.yml
|
||||
# tracked, otherwise a fresh fork has no documented runner setup at all.
|
||||
# (The runner/_svc_*.go files are untracked Gitea-source scratch snippets.)
|
||||
runner/config/
|
||||
runner/_svc_*.go
|
||||
*.runner.conf
|
||||
|
||||
# OS / editor noise
|
||||
.DS_Store
|
||||
build/
|
||||
captures/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
.kotlin/
|
||||
app/src/main/assets/linuxfs/
|
||||
app/src/main/jniLibs/arm64-v8a/libproot.so
|
||||
app/src/main/jniLibs/arm64-v8a/.proot-inputs
|
||||
app/src/main/jniLibs/arm64-v8a/.proot-outputs
|
||||
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
||||
app/src/main/jniLibs/arm64-v8a/libdirectaudiorelay.so
|
||||
app/src/main/rust/stores/target/
|
||||
app/src/main/assets/droiddeck-esync/
|
||||
*.swp
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
.kotlin/
|
||||
|
||||
*.jks
|
||||
*.keystore
|
||||
*.p12
|
||||
*.pfx
|
||||
*.pk8
|
||||
*.pem
|
||||
!keystore/testkey.p12
|
||||
droiddeck-release-key/
|
||||
password.txt
|
||||
__pycache__/
|
||||
|
||||
.signing.env
|
||||
app/src/main/assets/directaudio/
|
||||
/tools/vr/out/
|
||||
# stray binaries that are never part of this template
|
||||
*.AppImage
|
||||
*.appimage
|
||||
.superdesign/
|
||||
ui/node_modules/
|
||||
ui/dist/
|
||||
ui/*.log
|
||||
@@ -1,3 +1,151 @@
|
||||
# Rules
|
||||
# AGENTS.md — how to operate Repo Forker
|
||||
|
||||
- Comments should be rare, factual, and explain only non-obvious external constraints or business invariants.
|
||||
Instructions for AI agents (and humans) working on or with this repository.
|
||||
|
||||
## What this is
|
||||
|
||||
A **template**. Each fork/generation of it is a *live mirror* of one upstream
|
||||
git repo on this Gitea: all branches, all tags, full history, plus releases
|
||||
produced on the runner. The working tree (the `forker` branch) holds only the
|
||||
machinery — the upstream's content never enters it.
|
||||
|
||||
```
|
||||
This repo (template) → fork/generate per upstream (Lago/<upstream>)
|
||||
├── forker branch ← scripts, config, workflows
|
||||
├── .mirror/ ← bare mirror (gitignored)
|
||||
└── refs ← upstream branches + tags
|
||||
```
|
||||
|
||||
## Golden rules (non-negotiable)
|
||||
|
||||
1. **Never authenticate to upstreams with the operator's personal accounts or
|
||||
stored credentials.** Public upstreams are fetched **anonymously**:
|
||||
`sync.sh`/`release.sh` cut `GIT_CONFIG_GLOBAL`/`GIT_CONFIG_SYSTEM` and the
|
||||
credential helper before any upstream git call, and add a Bearer header
|
||||
**only** when `UPSTREAM_TOKEN` is explicitly set. Do not "simplify" this
|
||||
away — a `credential.helper=store` entry must never be offered to
|
||||
`git fetch`. Do not pass tokens from `~/.git-credentials` into the tool.
|
||||
2. **An empty token must mean "no auth header", not "Bearer <empty>".**
|
||||
GitHub rejects empty Bearer headers (401). All code paths (git
|
||||
`extraHeader`, `provider.sh` curl calls) must branch on token presence.
|
||||
3. **Secrets live in Gitea Actions Variables/Secrets, never in the repo.**
|
||||
`UPSTREAM_URL` (variable) and `UPSTREAM_TOKEN` (secret, optional). The
|
||||
`GITEA_*` values are injected by Gitea Actions automatically.
|
||||
4. **Keep `.forker.yaml` flat** (`key: value`, no nesting) — `config.sh` is a
|
||||
simple grep parser.
|
||||
|
||||
## How it runs
|
||||
|
||||
- **Cron** (`sync.yml`, every 10 min) → `forker/sync.sh`:
|
||||
1. fetch all branches + tags + history into the bare `.mirror/` (incremental
|
||||
when `actions/cache` restores it),
|
||||
2. push refs onto this repo + prune what upstream deleted (fork state is
|
||||
read via the Gitea **API**, not git state — works on cold mirrors),
|
||||
3. for each **tag that has no release yet**, run `forker/release.sh <tag>`
|
||||
inline (a tag-push can't trigger a workflow: the tag points at an upstream
|
||||
commit whose tree has no `.gitea/workflows`). The "missing release" check
|
||||
(not "new tag") makes a failed release retry on the next cron tick.
|
||||
`release.sh` publishes only when there is actual content (build assets or
|
||||
an existing upstream release) and fails loudly on a bad asset
|
||||
download/upload — a partial release never masquerades as success.
|
||||
4. `forker/check-unit.sh` — verifies the **Releases unit** is enabled
|
||||
(self-heals via the units API when the build exposes it; otherwise
|
||||
detects the 404 and prints the one-time UI fix).
|
||||
- `release.sh` = local build (if `build_cmd`/`build_script` set) + optional
|
||||
upstream-release mirror (metadata + assets via `forker/lib/provider.sh`).
|
||||
Idempotent: an existing release is skipped, not duplicated.
|
||||
- `runner-check.yml` — run once per repo to confirm a runner serves it.
|
||||
**Runners are repo-scoped on this Gitea build**: a runner registered on one
|
||||
repo does not serve another. Use a **shared** runner (or PATCH the runner
|
||||
to `"shared":true` — the units/runners APIs are missing here, so UI/DB).
|
||||
|
||||
## Known Gitea-build quirks (verified on git.lago.dev, Gitea 28.1.0)
|
||||
|
||||
- **Forks are created without the Releases unit**
|
||||
(`DefaultForkRepoUnits = [Code, PullRequests]`) → release assets 404 on the
|
||||
web download route (`context.RequireUnitReader`), the source tarball 404s
|
||||
too, while the API by-id works. Fix: enable the Releases unit
|
||||
(Settings → Repository, or DB `INSERT INTO repo_unit (repo_id, type) ... 4` —
|
||||
there is no units API on this build). `check-unit.sh` detects/fixes.
|
||||
**Prefer generating from this template over forking**: generated repos are
|
||||
not forks and get the full unit set (and Gitea only allows 1 fork of a
|
||||
repo per user).
|
||||
- **GitHub asset gotcha**: for a release addressed by *tag*, the asset
|
||||
`download_url` is **null** — the API `url` returns JSON metadata unless
|
||||
`Accept: application/octet-stream` is sent. `provider.sh` instead resolves
|
||||
to the **web download URL** (`github.com/.../releases/download/<tag>/<file>`),
|
||||
which is also unthrottled (the REST asset endpoint is 60 req/h
|
||||
unauthenticated — not enough to mirror ~200 assets).
|
||||
- Runner registration: the `gitea/act_runner` CLI (old and new) fails on this
|
||||
build ("instance address is empty"); runner creation via API is 405.
|
||||
Existing runners can be made shared via `PATCH /api/v1/admin/actions/runners/<id>`.
|
||||
- `actions/cache` timeouts on this build are handled with
|
||||
`continue-on-error: true` (cold fetch is still correct). The artifact cache
|
||||
service itself is NOT configured on this Gitea — every sync is a cold fetch
|
||||
(correct, slower; the cache steps are kept in case a backend is added).
|
||||
- **Per-job DNS flapping:** the ephemeral per-job container intermittently
|
||||
fails to resolve `git.lago.dev` on the fork push (the runner daemon's own
|
||||
network resolves fine). `sync.sh` therefore wraps every fork push in
|
||||
`push_once` — retry with backoff on transient network errors (resolve /
|
||||
connect / timeout), abort immediately on non-network failures.
|
||||
|
||||
## Editing the template vs. a mirror repo
|
||||
|
||||
- **Template** (this repo): edit on `forker` and `git push`. Mirror repos do
|
||||
**not** auto-track the template — sync them manually after a template
|
||||
change:
|
||||
- **Forked repos** (e.g. `Lago/photocraft`): the `forker` branch *is* a
|
||||
descendant of the template's, so a normal merge works:
|
||||
```
|
||||
git remote add template <template-url>
|
||||
git fetch template forker
|
||||
git checkout forker && git merge template/forker
|
||||
git push origin forker
|
||||
```
|
||||
- **Generated repos** (e.g. `Lago/pdfcraft`): the `forker` branch is an
|
||||
**unrelated snapshot** (no common ancestor — `git merge` fails with
|
||||
add/add conflicts). Reset it to the template and re-apply the single
|
||||
per-repo setting, then force-push:
|
||||
```
|
||||
git checkout forker
|
||||
git fetch template forker
|
||||
git reset --hard template/forker
|
||||
# re-apply this repo's .forker.yaml setting(s), e.g.:
|
||||
sed -i 's/^mirror_upstream_releases: false/mirror_upstream_releases: true/' .forker.yaml
|
||||
git commit -am "Adopt template; enable mirror_upstream_releases"
|
||||
git push --force origin forker
|
||||
```
|
||||
This is safe: `forker` holds only the machinery + config (the upstream
|
||||
content lives on the mirrored branches), so the snapshot's extra content
|
||||
is discarded by design.
|
||||
- **Per-repo config**: edit `.forker.yaml` in the UI on the `forker` branch.
|
||||
Pushing to `forker` triggers a re-sync.
|
||||
|
||||
## Local testing (without the runner)
|
||||
|
||||
```
|
||||
export UPSTREAM_URL=... UPSTREAM_TOKEN= # empty for public upstreams
|
||||
export GITEA_TOKEN=... GITEA_SERVER_URL=... GITEA_OWNER=... GITEA_REPO=...
|
||||
bash forker/sync.sh # full mirror (use a scratch repo!)
|
||||
bash forker/release.sh <tag>
|
||||
make check-unit
|
||||
```
|
||||
Test against a **scratch repo** you delete afterwards; never point the scripts
|
||||
at a real mirror while experimenting. `GITEA_TOKEN` from Actions is an API
|
||||
token (Bearer works for API + git); a *password* only works for basic auth —
|
||||
expect the Bearer API calls to fail when testing with a password.
|
||||
|
||||
## File map
|
||||
|
||||
- `forker/sync.sh` — mirror worker (fetch/push/prune + inline releases + unit check)
|
||||
- `forker/release.sh` — local build + upstream-release mirror, idempotent
|
||||
- `forker/check-unit.sh` — Releases unit detection/self-heal (exit 10 = missing)
|
||||
- `forker/lib/config.sh` — flat `.forker.yaml` parser
|
||||
- `forker/lib/provider.sh` — provider-agnostic releases API (github/gitea/codeberg)
|
||||
- `forker/runner-register.sh` — runner registration (see quirks above)
|
||||
- `.gitea/workflows/` — sync.yml (cron), release.yml (manual), runner-check.yml
|
||||
- `runner/docker-compose.yml` — gitea-act-runner in Docker (tracked; the local
|
||||
`runner/config/` token dir is gitignored)
|
||||
- `Makefile` — local targets (sync / release / mirror-releases / runner-check /
|
||||
runner-register / check-unit); `runner-check` queries the Gitea runner APIs
|
||||
- `docs/index.html` — architecture webpage (static)
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
Pluvia is an unofficial Steam client app for Android
|
||||
Copyright (C) 2024 Oxters Wyzgowski
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
Pluvia Copyright (C) 2024 Oxters Wyzgowski
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Repo Forker — convenience targets.
|
||||
# Most work happens in the Gitea Actions workflows; these targets are for local
|
||||
# use (dry-runs, runner setup) and for debugging on the runner.
|
||||
|
||||
CONFIG_FILE ?= .forker.yaml
|
||||
|
||||
.PHONY: help sync release mirror-releases runner-check runner-register check-unit
|
||||
|
||||
help:
|
||||
@echo "Repo Forker targets:"
|
||||
@echo " sync Run a manual sync (needs UPSTREAM_* + GITEA_* env)"
|
||||
@echo " release TAG=x Run a release for tag x"
|
||||
@echo " mirror-releases Mirror upstream releases for a tag (release.sh MIRROR)"
|
||||
@echo " runner-check Run the runner-check workflow logic locally"
|
||||
@echo " runner-register Register a shared gitea-act-runner (see README)"
|
||||
@echo " check-unit Verify the Releases unit is enabled (fork quirk)"
|
||||
|
||||
sync:
|
||||
bash forker/sync.sh
|
||||
|
||||
release:
|
||||
@test -n "$(TAG)" || (echo "make release TAG=<tag>"; exit 1)
|
||||
bash forker/release.sh "$(TAG)"
|
||||
|
||||
mirror-releases:
|
||||
@test -n "$(TAG)" || (echo "make mirror-releases TAG=<tag>"; exit 1)
|
||||
bash forker/release.sh "$(TAG)"
|
||||
|
||||
runner-check:
|
||||
@test -n "$(GITEA_SERVER_URL)" -a -n "$(GITEA_TOKEN)" -a -n "$(GITEA_OWNER)" -a -n "$(GITEA_REPO)" \
|
||||
|| { echo "needs GITEA_SERVER_URL/GITEA_TOKEN/GITEA_OWNER/GITEA_REPO (or run the workflow instead)"; exit 1; }
|
||||
@curl -sS --max-time 20 -H "Authorization: Bearer $(GITEA_TOKEN)" \
|
||||
"$(GITEA_SERVER_URL)/api/v1/repos/$(GITEA_OWNER)/$(GITEA_REPO)/actions/runners" > /tmp/rc_repo.json
|
||||
@curl -sS --max-time 20 -H "Authorization: Bearer $(GITEA_TOKEN)" \
|
||||
"$(GITEA_SERVER_URL)/api/v1/admin/actions/runners?limit=50" > /tmp/rc_shared.json || true
|
||||
@python3 -c 'import json; R=json.load(open("/tmp/rc_repo.json")).get("runners",[]); S=[r for r in json.load(open("/tmp/rc_shared.json")).get("runners",[]) if r.get("shared")]; print("Repo-scoped runners: "+(", ".join("%s (%s)"%(r["name"],r["status"]) for r in R) or "(none)")); print("Shared runners: "+(", ".join("%s (%s)"%(r["name"],r["status"]) for r in S) or "(none)")); print("OK: a runner serves this repo." if (R or S) else "WARNING: no runner (repo-scoped or shared) registered - cron runs will stay queued.")'
|
||||
@rm -f /tmp/rc_repo.json /tmp/rc_shared.json
|
||||
|
||||
runner-register:
|
||||
bash forker/runner-register.sh
|
||||
|
||||
check-unit:
|
||||
bash forker/check-unit.sh
|
||||
@@ -1,56 +1,221 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="artwork/droiddeck-banner-dark.svg">
|
||||
<img alt="DroidDeck" src="artwork/droiddeck-banner-light.svg" width="100%">
|
||||
</picture>
|
||||
</p>
|
||||
# Repo Forker
|
||||
|
||||
DroidDeck brings the SteamOS experience to Android: Valve's Steam client in Big Picture on your Adreno handheld, with Windows games through Valve's ARM64 Proton.
|
||||
> 📖 **Documentación y arquitectura interactiva:** [docs/index.html](docs/index.html) — qué es, cómo funciona, cómo crear un fork paso a paso, runner, config y limitaciones.
|
||||
|
||||
<p align="center"><a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20the%20community-5865F2?logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a></p>
|
||||
> 🖥️ **UI de gestión local (mirrors):** [ui/README.md](ui/README.md) — `cd ui && npm install && npm run build && node bin/repo-forker-ui.js` → http://127.0.0.1:8731. Crea/elimina/monitorea mirrors, paridad vs upstream, logs en vivo, cola del runner.
|
||||
|
||||
<p align="center"><img src="docs/releases/media/0.2.0/launch-into-steam.gif" width="80%" alt="Tapping DroidDeck on the Android home screen and landing in Steam Big Picture"></p>
|
||||
Turn **any** git repo (GitHub, Gitea, Codeberg, …) into a **live mirror on your
|
||||
Gitea** — all branches, all tags, full commit history — synced very
|
||||
periodically by a Gitea Actions runner (your "gitea worker"), with releases
|
||||
produced **locally on the runner** (and optionally mirrored from the upstream).
|
||||
|
||||
> Note: DroidDeck does not have a stand-alone website. Do not click on any download links from websites claiming to be the DroidDeck team.
|
||||
This repo is a **template**. You **fork** it once per upstream; the fork *is*
|
||||
the mirror. The upstream's content never touches the working tree: upstream
|
||||
objects live in a bare mirror (`.mirror/`, gitignored) and are pushed as refs
|
||||
so they show up in the Gitea UI.
|
||||
|
||||
## Requirements and install
|
||||
```
|
||||
Fork of this template (Lago/<upstream>)
|
||||
├── working tree (forker branch) ← the machinery: scripts, config, workflows
|
||||
├── .mirror/ ← bare mirror of the upstream (gitignored)
|
||||
└── refs: <upstream branches> + <tags> ← visible in the Gitea UI
|
||||
```
|
||||
|
||||
Use Android 9 or newer on a supported Adreno device (730 or newer, or 8xx). Adreno 6xx is experimental: DirectX 11 uses DXVK 2 and may run, and DirectX 12 games can still crash. Mali, Xclipse, PowerVR, and Adreno 710 are unsupported. No root is required. Allow about 3 GB for the runtime and 1.1 GB more for the desktop and emulators. Install the APK from [Releases](https://github.com/Droid-Deck/DroidDeck/releases), install the Linux runtime, then press **Play** and sign in. Steam downloads on first launch. Install **Desktop & apps** to use the desktop and emulators. The **Store** installs Linux apps and games from Flathub (ARM64 builds) with Flatpak; with additional options to install Appimages and set up scripts. **Stores** (Setup › Stores › "Show Stores in the rail") signs in to GOG, Epic Games and Amazon Games and downloads games into the Games storage. Epic keeps its direct API install path. Opening Epic Stores prepares Epic’s official Linux launcher preview. When installed, Epic games launched from DroidDeck use that client, and games installed in the client are imported into DroidDeck’s library and shortcuts. The x86-64 client runs through FEX on ARM and DroidDeck retains its Proton hooks; this preview and ARM setup are outside Epic’s listed Linux support. The cog on a store’s chip row sets its opening tab and download speed tier.
|
||||
## How it works
|
||||
|
||||
On Android 14 and newer, before Steam launches, you must turn on **Disable child process restrictions** in Developer options. If this option is not available in developer settings (Android 12 and 13 devices), first launch of Steam will present a "Fix it for me" button, which will help automate the setup process.
|
||||
1. **Sync (the worker).** A cron workflow runs every N minutes. `sync.sh` fetches
|
||||
all branches + tags + full history from the upstream into a true bare mirror
|
||||
(`.mirror/`), then pushes them onto this fork and **prunes** what the upstream
|
||||
deleted. The fork's current state is read via the Gitea API (not git state),
|
||||
so prune + change-detection work even when the workspace is wiped between
|
||||
runs. `actions/cache` restores `.mirror/` when possible → incremental fetches.
|
||||
2. **Release (local build).** When sync detects a **new tag**, it invokes
|
||||
`release.sh` inline: checkout the tag's tree, run your build command **on the
|
||||
runner**, publish the release (tag + assets) on this Gitea. (A tag-push can't
|
||||
trigger a workflow on its own — the tag points at an upstream commit whose
|
||||
tree has no `.gitea/workflows` — so sync does it.) Re-running is idempotent:
|
||||
an existing release is skipped, not duplicated.
|
||||
3. **Release (mirror, optional).** If enabled, the upstream's existing release
|
||||
(metadata + assets) is copied over via the provider API
|
||||
(GitHub / Gitea / Codeberg — auto-detected in `forker/lib/provider.sh`).
|
||||
|
||||
## Smart glasses
|
||||
## Quick start (3 steps)
|
||||
|
||||
Use **Setup → Smart glasses** for app-wide virtual-screen settings across DroidDeck menus, launchers, desktop sessions, and games. Supported VITURE, RayNeo, and XREAL connections provide 3DoF; Luma Ultra adds optional experimental 6DoF and stereo-assisted hand/Joy-Con tracking. Model support and SDK requirements differ: see the [smart-glasses support matrix](docs/smart-glasses-support.md) for supported devices, controls, setup, and limitations.
|
||||
### 1. Fork this template
|
||||
In the Gitea UI: **this repo → Fork** → name it after the upstream
|
||||
(e.g. `Lago/some-upstream`).
|
||||
|
||||
## Community
|
||||
### 2. Point it at the upstream (the "remote")
|
||||
In the fork: **Settings → Actions → Variables & Secrets**
|
||||
- **Variable** `UPSTREAM_URL` = `https://github.com/owner/repo.git` (any provider)
|
||||
- **Secret** `UPSTREAM_TOKEN` = *(optional — only for private upstreams.)*
|
||||
Public upstreams are mirrored **anonymously** and the tool never
|
||||
authenticates against them: the global/system git config and the
|
||||
credential helper are cut for all upstream git calls, so a stored
|
||||
`~/.git-credentials` entry is never used. Only set a token when the
|
||||
upstream is private (or you need a higher API rate for mirrored
|
||||
releases).
|
||||
|
||||
Join the [DroidDeck Discord](https://discord.gg/JRGAvawjsm) for help, Preview builds, and device reports. Bug reports go in its **#bug-reports** forum; attach the zip from **Share logs** (Setup, or the session drawer) so the logs come with it.
|
||||
Everything non-secret (which branches, how often, build command, artifacts) lives
|
||||
in **`.forker.yaml`** — edit it in the UI on the `forker` branch.
|
||||
|
||||
## Build
|
||||
> The `GITEA_*` values (server URL, owner, repo, token) are injected
|
||||
> automatically by Gitea Actions — you don't set them. (`GITEA_TOKEN` in the
|
||||
> workflow env block is Gitea's **built-in** Actions secret, not a
|
||||
> user-created secret — don't create one.)
|
||||
|
||||
Run `tools/build_local.sh` with Docker, Java 17, the Android SDK/NDK, Rust through rustup, GitHub CLI, Python 3, and `zstd` installed. It prepares the same native libraries, pinned components and audio sinks as CI, then checks the APK's assets, JNI exports and dependencies. The APK is at `app/build/outputs/apk/release/app-release.apk`. Set `DROIDDECK_PA13_SOURCE_DIR` to an existing PulseAudio 13.0 source directory to skip downloading it. Set `DROIDDECK_SIGNING_ENV` to a signing environment file to install over a release build; relative keystore paths resolve beside that file. To install on an attached device, run `tools/deploy_local.sh`.
|
||||
### 3. Make sure a runner serves this repo
|
||||
In this Gitea build, **runners are repo-scoped**: a runner registered on one
|
||||
repo does **not** serve another. So either:
|
||||
|
||||
After preparation, ordinary `./gradlew :app:assembleRelease` builds can reuse the verified inputs. If native sources, component pins or staged files change, packaging stops with instructions to rerun the helper. Generated audio stays under `app/build/`; the tracked base bundle is never modified. `./gradlew -PskipRust=true :app:testDebugUnitTest` needs no native preparation. For an APK without store engines, use `DROIDDECK_SKIP_RUST=1 tools/build_local.sh`; it omits cached engine libraries too.
|
||||
- **Shared runner (recommended, one-time):** register a single runner that serves
|
||||
**all** repos. See [Runner](#runner).
|
||||
- **Per-repo runner:** register a runner for this specific repo.
|
||||
|
||||
For the prepared Windows checkout, run `./tools/run_windows.ps1` (optionally with `-Serial <adb-serial>`), or select **DroidDeck XR** in Android Studio and run the **app** module on the connected phone. Machine-specific options live in the ignored `local.properties`: `droiddeck.python` selects a Python executable, `droiddeck.skipRust=true` omits the optional store download engines, and `droiddeck.debugApplicationIdSuffix=.xr` installs **DroidDeck XR Dev** alongside the signed release. The development app has its own runtime and Steam login. The local Java selection is in `.gradle/config.properties`.
|
||||
Then trigger **Settings → Actions → "Repo Forker — Runner check"** and confirm it
|
||||
completes. If sync runs stay *pending* for a long time, no runner is serving
|
||||
this repo.
|
||||
|
||||
`python tools/prepare_windows_runtime.py` restores this checkout's audited runtime inputs from the pinned CI APK, three locally rebuilt preload libraries, and the checksum-pinned Gamescope archive in `build/windows-setup/`. Start Docker Desktop's Linux engine first: preparation now rebuilds DroidDeck's ARM64 VR driver and Vulkan layer from current source and runs their native regression tests. The compiler image is built automatically on first use. Vulkan headers come from the NDK beside `--llvm-strip`, or from an explicit `--vk-include <NDK-sysroot-include>` directory.
|
||||
That's it. The cron sync starts pulling the upstream in, and releases are
|
||||
produced locally when tags appear. Note: with the template defaults
|
||||
(`build_cmd` empty, `mirror_upstream_releases: false`) there is nothing to
|
||||
build, so new tags are mirrored as **refs only** — set a `build_cmd` /
|
||||
`build_script` (or `mirror_upstream_releases: true`) for releases to appear.
|
||||
|
||||
To reuse that build, pass `--rebuilt-vr build/windows-setup/vr`. Preparation verifies its `vr-build.json` against the current Git revision, source files, Vulkan headers, output checksums, and ARM64 architecture; missing or stale builds fail instead of falling back to the donor's VR libraries. The script checks the actual donor CI merge tree, still rejects unrelated unaudited runtime changes, and records component provenance in `app/build/windows-runtime-provenance.json`. Preserve these ignored preparation files when rebuilding locally; `clean` removes the prepared assets and their verification manifest.
|
||||
## Configuration (`.forker.yaml`)
|
||||
|
||||
Run the helper and preload regression suite with `bash tools/test_local.sh`. On macOS it runs in Linux through Docker, matching the helpers' runtime and CI instead of compiling Linux preloads against macOS headers.
|
||||
| Key | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `token_user` | `oauth2` | *(unused — Bearer auth needs no username; retained for compatibility)* |
|
||||
| `mirror_tags` | `true` | Mirror all tags |
|
||||
| `mirror_prune` | `true` | Prune branches deleted upstream |
|
||||
| `mirror_branches` | `*` | `*` = all, or a comma list (`main,develop`) |
|
||||
| `on_new_tag` | `true` | Build+publish a release when a new tag is mirrored |
|
||||
| `mirror_upstream_releases` | `false` | Also copy the upstream's release (metadata + assets) |
|
||||
| `build_cmd` | — | Build command(s), `;`-separated, run in the tag's tree |
|
||||
| `build_script` | — | Path to a custom build script (overrides `build_cmd`) |
|
||||
| `artifacts` | — | Space-separated globs of files to attach to the release |
|
||||
|
||||
## Limits
|
||||
## Manual triggers
|
||||
|
||||
Compatibility and performance vary by device; hardware validation is limited. Desktop compositing uses software rendering. Firefox sandboxing is reduced under proot. Logs are kept app-private (`files/logs/`, the last 30 sessions); **Share logs** packs the newest session, with the stores and tool logs, into one scrubbed zip.
|
||||
- **Sync now:** Settings → Actions → *Repo Forker — Sync* → Run workflow.
|
||||
- **Release a tag:** Settings → Actions → *Repo Forker — Release* → Run workflow
|
||||
→ enter the tag.
|
||||
- **Check the runner:** Settings → Actions → *Repo Forker — Runner check*.
|
||||
|
||||
## Credits and licence
|
||||
Or from a machine that has the repo + env vars: `make sync`,
|
||||
`make release TAG=v1.2.3`.
|
||||
|
||||
GPL-3.0. Runtime, shim, input, and controller work build on WinNative and Bannerlator (maxjivi05). Epic Games and GOG support build on [Phobos’s](https://github.com/phobos665) adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl), respectively. LSFG frame generation is from the work of Camille LaVey and the [Eden](https://eden-emu.dev) emulator project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported to WinNative and DroidDeck by [@maxjivi05](https://github.com/maxjivi05); it needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders. x86 AppImages, and any whose own runtime cannot unpack them, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence. mmap ring-buffer controller input was developed by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)). See [LICENSE](LICENSE). Steam and Proton belong to Valve Corporation; this project is not affiliated with Valve.
|
||||
## Runner
|
||||
|
||||
XR glasses support builds on WinNative's VITURE glasses work. VITURE protocol details were checked against [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) by [@wheaney](https://github.com/wheaney), including the VITURE protocol header it ships, [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) by [@badicsalex](https://github.com/badicsalex) and the [go-macos/iokit VITURE package](https://pkg.go.dev/github.com/go-macos/iokit/viture); the optional VITURE SDK belongs to VITURE and is not included. RayNeo support adapts [@informalTechCode](https://github.com/informalTechCode)'s [RayNeo-Air-Series-3DoF-Scaffold](https://github.com/informalTechCode/RayNeo-Air-Series-3DoF-Scaffold) (Apache-2.0) and references [@verncat](https://github.com/verncat)'s [RayNeo-Air-3S-Pro-OpenVR](https://github.com/verncat/RayNeo-Air-3S-Pro-OpenVR) (MIT) and [Monado](https://gitlab.freedesktop.org/monado/monado) (BSL-1.0); see [docs/third-party/rayneo](docs/third-party/rayneo/README.md). XREAL 1S support references [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) and [xrealOneDeviceKit](https://github.com/wheaney/xrealOneDeviceKit) by @wheaney, [xreal_one_driver](https://github.com/rohitsangwan01/xreal_one_driver) by [@rohitsangwan01](https://github.com/rohitsangwan01) (MIT) and [xr-tools](https://github.com/0xcaff/xr-tools) by [@0xcaff](https://github.com/0xcaff). The REDMAGIC glasses-display findings draw on [@mekhontsev](https://github.com/mekhontsev)'s [MagicDesk investigation](https://github.com/mekhontsev/magicdesk/blob/main/docs/xr-resolution-fix.md) and [@Coding-BR](https://github.com/Coding-BR)'s [decompiled Nubia kernel](https://github.com/Coding-BR/android_kernel_nubia_sm8850_qwjujube). VITURE, RayNeo, XREAL and REDMAGIC are trademarks of their owners; this project is not affiliated with them.
|
||||
The sync (cron) and the local release build both need a **Gitea Actions runner**
|
||||
serving the repo. In this build, runners are **repo-scoped**, so the clean path
|
||||
is a **shared runner** registered once:
|
||||
|
||||
Joy-Con VR controllers port the arm model of Google's [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk) (Apache-2.0), adapt the hand skeleton of Valve's [OpenVR](https://github.com/ValveSoftware/openvr) `handskeletonsimulation` sample (BSD-3-Clause), which follows Moshi Turner's hand simulation in [Monado](https://gitlab.freedesktop.org/monado/monado), and use the Index controller offsets from Monado's `vive_poses.c` (BSL-1.0). Joy-Con behaviour was researched in Linux's [hid-nintendo](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-nintendo.c) driver by Daniel J. Ogorchock, [@dekuNukem](https://github.com/dekuNukem)'s [Nintendo_Switch_Reverse_Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering), [SDL](https://github.com/libsdl-org/SDL) and the Android Open Source Project, and checked against [ALVR](https://github.com/alvr-org/ALVR), [OpenComposite](https://gitlab.com/znixian/OpenOVR), [PSMoveSteamVRBridge](https://github.com/HipsterSloth/PSMoveSteamVRBridge), [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr), [@krnelpan1c](https://github.com/krnelpan1c)'s [Daydream-Controller-SteamVR](https://github.com/krnelpan1c/Daydream-Controller-SteamVR), [@yoyobuae](https://github.com/yoyobuae)'s [joyconvr](https://github.com/yoyobuae/joyconvr), [Moonlight](https://github.com/moonlight-stream/moonlight-android) and [Dolphin](https://github.com/dolphin-emu/dolphin); see [docs/third-party/joycon](docs/third-party/joycon/README.md). Nintendo Switch and Joy-Con are trademarks of Nintendo; this project is not affiliated with Nintendo.
|
||||
```bash
|
||||
# install gitea-act-runner (see the Gitea runner docs), then:
|
||||
GITEA_SERVER_URL=https://git.lago.dev \
|
||||
GITEA_TOKEN=<admin-token> \
|
||||
GITEA_OWNER=Lago GITEA_REPO=any \
|
||||
bash forker/runner-register.sh shared
|
||||
|
||||
Camera hand tracking runs Google's [MediaPipe](https://github.com/google-ai-edge/mediapipe) Tasks Vision library with its Pose Landmarker (Lite) model, BlazePose GHUM 3D, and its Hand Landmarker model (all Apache-2.0), on frames from AndroidX [CameraX](https://developer.android.com/jetpack/androidx/releases/camera) (Apache-2.0); MediaPipe's usage reports are switched off. The design was checked against [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr) camera app (MIT), and the short Joy-Con movements follow the accelerometer mode of the [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk)'s arm model, Eric Foxlin's zero-velocity updates and Frosio, Pedersini and Borghese's accelerometer autocalibration, and the camera and Joy-Con are joined by a Kalman filter (R. E. Kalman, 1960). Bare camera hands take their gestures after [ALVR](https://github.com/alvr-org/ALVR)'s `hand_gestures.rs` (MIT) and Meta Quest's menu pinch, with distances checked on photos from the [HaGRID](https://github.com/hukenovs/hagrid) gesture set (CC BY-SA 4.0, not included), fit the palm with Horn's quaternion method (1987) and smooth it with the 1€ filter (Casiez, Roussel and Vogel, 2012); the white glove model follows Valve's OpenVR render model reference and Index controller poses, is meshed with surface nets (Gibson, 1998; Mikola Lysenko) and blends and shades it with Inigo Quilez's smooth minimum and distance-field ambient occlusion, porting his polygon distance (MIT); see [docs/third-party/handtracking](docs/third-party/handtracking/README.md).
|
||||
# then start it (e.g. via docker, see runner/docker-compose.yml)
|
||||
gitea-act-runner run
|
||||
```
|
||||
|
||||
`forker/runner-register.sh` auto-generates a registration token via
|
||||
`POST /api/v1/admin/actions/runners/registration-token` (verified working on this
|
||||
instance) and registers either a **shared** runner or a **per-repo** one.
|
||||
|
||||
> The existing online runner on this instance (id 3, `496cfb9f4583`,
|
||||
> `ubuntu-latest/24.04/22.04`) is registered to `Lago/Tide` only — it will not
|
||||
> serve your forks. Register a shared runner (or one per repo) as above.
|
||||
|
||||
> **This Gitea build quirk (verified):** the `act_runner` CLI fails to
|
||||
> register ("instance address is empty") on both `gitea/act_runner:0.6.1`
|
||||
> and `0.2.13`, and the runner-creation API returns 405. The path that
|
||||
> **does** work: take an existing registered runner and PATCH it to shared:
|
||||
> ```bash
|
||||
> curl -X PATCH "$GITEA_SERVER_URL/api/v1/admin/actions/runners/<id>" \
|
||||
> -H "Authorization: Bearer $GITEA_TOKEN" \
|
||||
> -d '{"name":"gitea-runner-forker","labels":["ubuntu-latest"],"shared":true,"disabled":false}'
|
||||
> ```
|
||||
> then point a `gitea/act_runner:0.6.1` container at its config
|
||||
> (`runner/docker-compose.yml`).
|
||||
|
||||
## Repository layout
|
||||
|
||||
```
|
||||
repo-forker/
|
||||
├── .gitea/workflows/
|
||||
│ ├── sync.yml # cron: mirror upstream (the "worker"); restores .mirror cache
|
||||
│ ├── release.yml # MANUAL only (a tag push can't trigger it); see sync.sh
|
||||
│ └── runner-check.yml # verify a runner serves this repo
|
||||
├── forker/
|
||||
│ ├── sync.sh # true-mirror fetch + push + prune + inline new-tag release + unit check
|
||||
│ ├── release.sh # local build + publish release (± mirror upstream), idempotent
|
||||
│ ├── runner-register.sh # register a shared / per-repo runner
|
||||
│ ├── check-unit.sh # verify/fix the Releases unit (Gitea fork quirk)
|
||||
│ └── lib/
|
||||
│ ├── config.sh # load .forker.yaml
|
||||
│ └── provider.sh # detect provider + releases API (Gitea/GitHub/Codeberg)
|
||||
├── .mirror/ # bare mirror (gitignored, cached by the workflow)
|
||||
├── .forker.yaml # per-fork config (non-secret)
|
||||
├── Makefile
|
||||
├── runner/docker-compose.yml
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Notes & limitations
|
||||
|
||||
- **Releases are not git objects.** Git only carries the *tag*; release *assets*
|
||||
live on the Gitea. "Local release" = build on the runner + upload via the
|
||||
Gitea API. Mirroring upstream assets works anonymously for public upstreams
|
||||
(a token is only needed for private ones).
|
||||
- **Ephemeral workspace.** The Gitea runner wipes the workspace between runs.
|
||||
`sync.sh` is written to not depend on leftover git state: it re-reads the fork's
|
||||
current refs via the API every run. `actions/cache` on `.mirror/` makes the
|
||||
fetch incremental when it hits; a cold cache just means a full-history fetch
|
||||
(correct, slower).
|
||||
- **Tags point at upstream commits.** That's intentional — it keeps commit
|
||||
hashes identical to the upstream. It also means the workflow can't be
|
||||
triggered *by the tag* (the tag's tree has no workflows), so sync triggers
|
||||
releases inline.
|
||||
- **Provider differences** (releases API, token username) are isolated in
|
||||
`forker/lib/provider.sh`; the rest is provider-agnostic.
|
||||
- **Secrets stay out of the repo.** Upstream URL/token are Gitea Actions
|
||||
Variables/Secrets; the Gitea token is the built-in `GITEA_TOKEN`.
|
||||
- **Runner is the hard dependency.** Without a runner serving the repo, the cron
|
||||
sync and local builds won't run — run the *Runner check* first.
|
||||
- **Gitea forks ship without the Releases unit → asset downloads 404.**
|
||||
Root cause found on this instance (verified in the Gitea source + DB): a fork
|
||||
is created with `DefaultForkRepoUnits = [Code, PullRequests]` — **no
|
||||
Releases unit** — while normal repos get it. So release *assets* uploaded to
|
||||
a fork repo are listed in the API (by-id works) but the web
|
||||
`browser_download_url` returns 404 at the unit-permission check, and the
|
||||
release *source tarball* 404s too.
|
||||
**Detected + fixed:** `sync.sh` runs `check-unit.sh` at the end of every
|
||||
sync — it self-heals via the units API on builds that expose it, and on
|
||||
this build (no units API) it detects the 404 (confirming the API by-id
|
||||
path still works) and prints the exact one-time fix: UI → Settings →
|
||||
Repository → enable the **Releases** unit. `make check-unit` runs it
|
||||
standalone.
|
||||
|
||||
## Security notes
|
||||
|
||||
- **Upstreams are fetched anonymously by default.** `sync.sh` / `release.sh`
|
||||
cut `GIT_CONFIG_GLOBAL`/`GIT_CONFIG_SYSTEM` and the credential helper before
|
||||
any upstream git call, and add a Bearer header **only** when `UPSTREAM_TOKEN`
|
||||
is set. A stored `~/.git-credentials` entry is therefore *never* offered to
|
||||
`git fetch` — a public upstream is a pure anonymous fetch.
|
||||
- **`build_cmd` / `build_script` run with the tokens in the environment.**
|
||||
`release.sh` keeps `GITEA_TOKEN` and `UPSTREAM_TOKEN` set so it can fetch the
|
||||
tag's tree and publish assets. Any repo member can edit `.forker.yaml`, so a
|
||||
malicious `build_cmd` could exfiltrate both tokens. Treat `build_cmd` /
|
||||
`build_script` as **trusted code with credential access** — only put commands
|
||||
you (or the repo owners) trust there.
|
||||
- **Tokens briefly persist in the cached `.mirror/` git config.** The per-URL
|
||||
`http.<url>.extraHeader` Bearer header is written into `.mirror/config`, and
|
||||
`.mirror/` is the `actions/cache` path. The cache is repo-scoped (not
|
||||
committed), but a cache-service reader can read it until the next save
|
||||
overwrites it. The tokens are never written into the repo itself.
|
||||
@@ -0,0 +1,102 @@
|
||||
# TODO — a futuro
|
||||
|
||||
## [UI] Gestión local de mirrors (npx)
|
||||
|
||||
Una web local (arrancable con `npx`) para gestionar todo el ecosistema de
|
||||
Repo Forker desde un solo lugar, sin tocar API/curl/DB.
|
||||
|
||||
### Idea
|
||||
```
|
||||
npx repo-forker-ui # -> http://localhost:8731 (o el puerto libre)
|
||||
```
|
||||
El UI habla con la API de Gitea (con un token que el usuario pega una vez,
|
||||
guardado localmente — nunca en el repo) y ejecuta las mismas operaciones que
|
||||
los scripts, pero de forma guiada.
|
||||
|
||||
### Features (por prioridad)
|
||||
|
||||
**P0 — Gestión de mirrors (el corazón):**
|
||||
- **Crear un mirror**: pega la URL del upstream (GitHub/Gitea/Codeberg/otro)
|
||||
+ nombre → el UI hace lo que se hace hoy por API/curl:
|
||||
1. `POST /repos/{owner}/repo-forker/generate` con `git_content: true`
|
||||
2. crea la variable `UPSTREAM_URL` (`POST .../actions/variables/UPSTREAM_URL`)
|
||||
3. `PATCH` default branch → la del upstream (o `main`)
|
||||
4. activa `mirror_upstream_releases` en la rama `forker` (reset + re-apply,
|
||||
el procedimiento de AGENTS.md para repos generados)
|
||||
5. dispara el primer `sync.yml` (dispatch) y muestra el progreso
|
||||
- **Lista de mirrors**: todos los repos generados desde `repo-forker`
|
||||
(detectables por la rama `forker` + la variable `UPSTREAM_URL`), con:
|
||||
- estado del último `sync.yml` (green/red, timestamp, duración)
|
||||
- branches / tags / releases / assets (vs upstream — paridad)
|
||||
- unidades activas (Code/Issues/PR/Releases/...)
|
||||
- **Stats y gráficas** (por mirror y agregado):
|
||||
- timeline de runs (success/failure/queued) — sparkline de los últimos 7 días
|
||||
- tiempo de sync por run (cold vs incremental — la caché, cuando exista)
|
||||
- assets por release (barras), crecimiento de branches/tags
|
||||
- latencia de mirror: commits upstream sin replicar todavía
|
||||
- **Eliminar un mirror**: delete del repo (con confirmación + advertencia de
|
||||
lo que se pierde; el template queda intacto)
|
||||
- **Re-sincronizar / forzar**: dispatch manual de `sync.yml` / `release.yml` /
|
||||
`runner-check.yml` desde la UI
|
||||
- **Config per-repo**: editar `.forker.yaml` (los campos conocidos:
|
||||
`mirror_branches`, `mirror_tags`, `mirror_prune`, `mirror_upstream_releases`,
|
||||
`build_cmd`, `build_script`, `artifacts`, `on_new_tag`) con validación de
|
||||
esquema plano (el parser es grep — el UI debe mantenerlo plano)
|
||||
- **Variables & secrets**: listar/crear/borrar las Variables de Actions
|
||||
(`UPSTREAM_URL`, `UPSTREAM_TOKEN` opcional) — los secrets solo se crean,
|
||||
no se leen (la API no los devuelve)
|
||||
|
||||
**P1 — Observabilidad:**
|
||||
- **Cola del runner**: runs `queued`/`in_progress` en vivo (polling), con
|
||||
tiempo de espera — el runner es serial (maxParallel=1), así que una vista
|
||||
de "fila" es muy útil
|
||||
- **Logs en vivo** de un run (stream del log del job, con el
|
||||
`::group::`/`::notice::` de Gitea Actions renderizado)
|
||||
- **Diagnóstico de un run fallido**: extraer la línea de error del log y
|
||||
sugerir la causa (DNS flap, cache timeout, token, unidad Releases)
|
||||
- **Unidades**: ver/quitar/habilitar la unidad Releases (con fallback a DB
|
||||
cuando la API no existe — este build)
|
||||
- **Alerta** de mirror "desactualizado" (última sync > N min con runner idle)
|
||||
|
||||
**P2 — Extras:**
|
||||
- **Generar desde otros templates**: que el UI permita usar cualquier repo
|
||||
marcado `template: true` (no solo repo-forker)
|
||||
- **Import de config**: pegar un `.forker.yaml` y aplicarlo
|
||||
- **Export del estado**: snapshot JSON de todos los mirrors (para backups /
|
||||
re-crear después de una catástrofe)
|
||||
- **Comparador de paridad**: side-by-side upstream vs fork (branches/tags/
|
||||
releases) con diff visual (lo que falta se marca)
|
||||
|
||||
### Notas de diseño
|
||||
|
||||
- **Stack sugerido**: Vite + React (o SvelteKit) + Tailwind; el backend
|
||||
"npx" puede ser un thin server Node que solo hace proxy + auth al Gitea
|
||||
(el UI puede ser 100% client-side si el token se guarda en `localStorage`;
|
||||
el proxy solo evita CORS y esconde el token de los logs del navegador).
|
||||
- **Auth**: el usuario pega su token Gitea (o basic) una vez; se guarda en
|
||||
`~/.repo-forker/credentials` (chmod 600) o `localStorage` según el modo.
|
||||
NUNCA se sube al repo.
|
||||
- **Idempotencia**: todas las acciones de creación deben ser idempotentes
|
||||
(re-crear el mirror con el mismo nombre → "ya existe" + enlazar).
|
||||
- **No duplicar lógica**: las operaciones (generate, variable, default branch,
|
||||
forker reset+re-apply, dispatch) ya están probadas en esta sesión — el UI
|
||||
las reproduce tal cual, no inventa variantes.
|
||||
- **Modo offline**: la UI debe funcionar aunque el Gitea esté caído (los
|
||||
últimos datos cacheados + estado "offline").
|
||||
|
||||
### Criterio de "hecho" (P0)
|
||||
|
||||
1. `npx repo-forker-ui` arranca y se conecta a un Gitea (URL + token).
|
||||
2. Desde la UI: crear un mirror de un repo GitHub público → aparece en la
|
||||
lista con su primer sync en verde y paridad correcta.
|
||||
3. Eliminar un mirror desde la UI (con confirmación).
|
||||
4. Ver en la UI: últimos 20 runs de cada mirror, paridad de
|
||||
branches/tags/releases, y el log del último run.
|
||||
5. Re-sincronizar (dispatch) desde la UI.
|
||||
|
||||
### Estado: **A FUTURO — no empezar sin revisar esta spec**
|
||||
|
||||
La infraestructura ya soporta todo lo que el UI necesita (APIs de generate,
|
||||
variables, dispatch, runners, releases; scripts de sync con retry; `check-unit`;
|
||||
cron de limpieza en tizona). Faltan decisiones: stack, nombre del paquete,
|
||||
y si el modo "solo client-side con token en localStorage" es suficiente.
|
||||
@@ -1,327 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
||||
|
||||
// Machine-specific tooling and optional CI-prepared inputs stay out of version control.
|
||||
def localBuildOptions = new Properties()
|
||||
def localBuildOptionsFile = rootProject.layout.projectDirectory.file('local.properties')
|
||||
if (localBuildOptionsFile.asFile.exists()) {
|
||||
localBuildOptions.load(new StringReader(providers.fileContents(localBuildOptionsFile).asText.get()))
|
||||
}
|
||||
def pythonExecutable = project.findProperty('pythonExecutable')
|
||||
?: localBuildOptions.getProperty('droiddeck.python', 'python3')
|
||||
def vitureSdkDir = project.hasProperty('vitureSdkDir') ? project.property('vitureSdkDir') : localBuildOptions.getProperty('droiddeck.vitureSdk', '')
|
||||
def uvcDir = project.hasProperty('uvcDir') ? project.property('uvcDir') : localBuildOptions.getProperty('droiddeck.uvcDir', '')
|
||||
if (uvcDir) {
|
||||
['arm64-v8a/libusb.so', 'arm64-v8a/libuvc.a', 'include/libusb.h', 'include/libuvc/libuvc.h',
|
||||
'licenses/libusb-COPYING', 'licenses/libuvc-LICENSE.txt'].each { required ->
|
||||
if (!new File(uvcDir, required).isFile()) throw new GradleException("Incomplete UVC build: missing ${required}")
|
||||
}
|
||||
}
|
||||
if (vitureSdkDir) {
|
||||
['android/arm64-v8a/libglasses.so', 'android/arm64-v8a/libcarina_vio.so',
|
||||
'android/arm64-v8a/libcloud_protocol.so', 'include/viture_glasses_provider.h',
|
||||
'android/LICENSE', 'android/NOTICE'].each { required ->
|
||||
if (!new File(vitureSdkDir, required).isFile()) {
|
||||
throw new GradleException("Incomplete VITURE Android SDK: missing ${required}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def gitValue = { List<String> arguments ->
|
||||
try {
|
||||
def output = providers.exec {
|
||||
commandLine(['git'] + arguments)
|
||||
workingDir rootProject.projectDir
|
||||
ignoreExitValue = true
|
||||
}
|
||||
output.result.get().exitValue == 0 ? output.standardOutput.asText.get().trim() : null
|
||||
} catch (Exception ignored) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
def buildLabel = providers.environmentVariable('DROIDDECK_BUILD_LABEL').getOrNull()
|
||||
if (buildLabel == null || buildLabel.trim().isEmpty()) {
|
||||
def eventName = providers.environmentVariable('GITHUB_EVENT_NAME').getOrNull()
|
||||
def eventPath = providers.environmentVariable('GITHUB_EVENT_PATH').getOrNull()
|
||||
if (eventName == 'pull_request_target' && eventPath) {
|
||||
try {
|
||||
def eventFile = layout.file(providers.provider { new File(eventPath) })
|
||||
def eventText = providers.fileContents(eventFile).asText.get()
|
||||
def pullRequest = new groovy.json.JsonSlurper().parseText(eventText).pull_request
|
||||
if (pullRequest?.number && pullRequest?.head?.sha) {
|
||||
buildLabel = "pr${pullRequest.number} at ${pullRequest.head.sha.take(7)}"
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (buildLabel == null || buildLabel.trim().isEmpty()) {
|
||||
def branch = providers.environmentVariable('GITHUB_REF_NAME').getOrNull()
|
||||
?: gitValue(['branch', '--show-current']) ?: 'local'
|
||||
def commit = providers.environmentVariable('GITHUB_SHA').getOrNull()
|
||||
?.take(7) ?: gitValue(['rev-parse', '--short=7', 'HEAD']) ?: 'unknown'
|
||||
buildLabel = "${branch} at ${commit}"
|
||||
}
|
||||
}
|
||||
def buildOrigin = providers.environmentVariable('GITHUB_ACTIONS').getOrNull() == 'true' ? 'remote' : 'local'
|
||||
def treeState = providers.environmentVariable('DROIDDECK_BUILD_TREE_STATE').getOrNull()
|
||||
if (!(treeState in ['clean', 'dirty'])) {
|
||||
def status = gitValue(['status', '--porcelain'])
|
||||
treeState = status == null ? 'unknown' : (status.isEmpty() ? 'clean' : 'dirty')
|
||||
}
|
||||
buildLabel = "${buildOrigin} ${treeState} · ${buildLabel}"
|
||||
def escapedBuildLabel = buildLabel.replace('\\', '\\\\').replace('"', '\\"')
|
||||
|
||||
def sourceCommit = providers.environmentVariable('DROIDDECK_SOURCE_COMMIT').getOrNull()
|
||||
?: providers.environmentVariable('GITHUB_SHA').getOrNull() ?: gitValue(['rev-parse', 'HEAD']) ?: ''
|
||||
def prNumber = (providers.environmentVariable('DROIDDECK_PR_NUMBER').getOrNull() ?: '0').with { it.isInteger() ? it : '0' }
|
||||
def ciBuild = providers.environmentVariable('GITHUB_ACTIONS').getOrNull() == 'true'
|
||||
def releaseSigner = rootProject.file('keystore/release-signer.sha256').text.trim()
|
||||
def commitTime = (gitValue(['show', '-s', '--format=%ct', 'HEAD']) ?: '0').with { it.isLong() ? it : '0' }
|
||||
def desktopKde = rootProject.file('tools/desktop-kde/release.env').readLines()
|
||||
.findAll { it.contains('=') && !it.startsWith('#') }
|
||||
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
||||
def desktopRemovalSources = new groovy.json.JsonSlurper().parse(file('src/main/assets/desktop-removal/sources.json'))
|
||||
if (desktopRemovalSources.archives[desktopKde.DESKTOP_KDE_TAG] != desktopKde.DESKTOP_KDE_SHA256) {
|
||||
throw new GradleException('Desktop removal inventories do not match the pinned archive')
|
||||
}
|
||||
if (!file('src/main/assets/desktop-removal/versions.txt').readLines().contains(desktopKde.DESKTOP_KDE_TAG)) {
|
||||
throw new GradleException('Regenerate desktop removal inventories for ' + desktopKde.DESKTOP_KDE_TAG)
|
||||
}
|
||||
def variantSuffixes = rootProject.file('tools/release/variants.txt').readLines()
|
||||
.findAll { it.trim() && !it.startsWith('#') }
|
||||
.collect { def f = it.trim().split(/\s+/); "${f[1]}=${f[2] == '-' ? '' : f[2]}" }
|
||||
.join(';')
|
||||
|
||||
android {
|
||||
namespace 'com.droiddeck.launcher'
|
||||
compileSdk 34
|
||||
ndkVersion project.findProperty('ndkVersion') ?: '27.3.13750724'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.droiddeck.launcher"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
versionCode 14
|
||||
versionName "0.5.0"
|
||||
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
||||
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
|
||||
buildConfigField "int", "PR_NUMBER", "${prNumber}"
|
||||
buildConfigField "boolean", "CI_BUILD", "${ciBuild}"
|
||||
buildConfigField "String", "RELEASE_SIGNER", "\"${releaseSigner}\""
|
||||
buildConfigField "long", "COMMIT_TIME", "${commitTime}L * 1000L"
|
||||
buildConfigField "String", "VARIANT_SUFFIXES", "\"${variantSuffixes}\""
|
||||
buildConfigField "String", "SGDB_API_KEY", "\"${System.getenv("SGDB_API_KEY") ?: project.findProperty("sgdbApiKey") ?: ""}\""
|
||||
buildConfigField "String", "DESKTOP_KDE_TAG", "\"${desktopKde.DESKTOP_KDE_TAG}\""
|
||||
buildConfigField "String", "DESKTOP_KDE_URL", "\"https://github.com/${desktopKde.DESKTOP_KDE_REPO}/releases/download/${desktopKde.DESKTOP_KDE_TAG}/desktop-kde.tar.zst\""
|
||||
buildConfigField "String", "DESKTOP_KDE_SHA256", "\"${desktopKde.DESKTOP_KDE_SHA256}\""
|
||||
buildConfigField "long", "DESKTOP_KDE_SIZE", "${desktopKde.DESKTOP_KDE_SIZE}L"
|
||||
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DANDROID_STL=c++_shared'
|
||||
arguments "-DDROIDDECK_VITURE_SDK_DIR=${vitureSdkDir.toString().replace('\\', '/')}"
|
||||
arguments "-DDROIDDECK_UVC_DIR=${uvcDir.toString().replace('\\', '/')}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path 'src/main/cpp/CMakeLists.txt'
|
||||
version '3.22.1'
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
testkey {
|
||||
storeFile file("${rootDir}/keystore/testkey.p12")
|
||||
storeType "PKCS12"
|
||||
storePassword "android"
|
||||
keyAlias "testkey"
|
||||
keyPassword "android"
|
||||
enableV1Signing = true
|
||||
enableV2Signing = true
|
||||
enableV3Signing = true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.testkey
|
||||
def localSuffix = localBuildOptions.getProperty('droiddeck.debugApplicationIdSuffix')
|
||||
if (localSuffix) {
|
||||
applicationIdSuffix localSuffix
|
||||
resValue 'string', 'app_name', 'DroidDeck XR Dev'
|
||||
}
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.testkey
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
disable 'ExpiredTargetSdkVersion'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += ['META-INF/versions/9/OSGI-INF/MANIFEST.MF']
|
||||
}
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
pickFirsts += ['**/libtermux.so']
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
prefab true
|
||||
compose true
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.returnDefaultValues = true
|
||||
unitTests.includeAndroidResources = true
|
||||
unitTests.all {
|
||||
def logTarget = providers.systemProperty('robolectric.logging').orNull
|
||||
if (logTarget != null) systemProperty 'robolectric.logging', logTarget
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
}
|
||||
}
|
||||
|
||||
// Vendor binaries remain in the user's SDK directory; never vendor them into Git.
|
||||
if (vitureSdkDir) {
|
||||
android.sourceSets.main.jniLibs.srcDir(new File(vitureSdkDir, 'android'))
|
||||
def stageVitureNotices = tasks.register('stageVitureNotices', Copy) {
|
||||
from(new File(vitureSdkDir, 'android')) { include 'LICENSE', 'NOTICE' }
|
||||
into(layout.buildDirectory.dir('vitureAssets/licenses/viture'))
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(stageVitureNotices) }
|
||||
}
|
||||
|
||||
def stageSessionScripts = tasks.register('stageSessionScripts', Copy) {
|
||||
from(rootProject.file('tools/linuxfs/overlay')) {
|
||||
include 'usr/local/bin/droiddeck-*', 'usr/local/bin/steam-compatibility', 'usr/bin/**'
|
||||
}
|
||||
into(layout.projectDirectory.dir('src/main/assets/linuxfs'))
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(stageSessionScripts) }
|
||||
|
||||
def runtimeAssetsDir = layout.buildDirectory.dir('runtimeAssets')
|
||||
def stageRuntimeAssets = tasks.register('stageRuntimeAssets', Sync) {
|
||||
dependsOn(stageSessionScripts)
|
||||
from(layout.projectDirectory.dir('src/main/assets')) { exclude 'pulseaudio.tzst' }
|
||||
from(layout.buildDirectory.dir('prepared-assets'))
|
||||
into(runtimeAssetsDir)
|
||||
}
|
||||
android.sourceSets.main.assets.setSrcDirs([runtimeAssetsDir])
|
||||
if (vitureSdkDir) android.sourceSets.main.assets.srcDir(layout.buildDirectory.dir('vitureAssets'))
|
||||
if (uvcDir) {
|
||||
def stageUvcNotices = tasks.register('stageUvcNotices', Copy) {
|
||||
from(new File(uvcDir, 'licenses'))
|
||||
into(layout.buildDirectory.dir('uvcAssets/licenses/uvc'))
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(stageUvcNotices) }
|
||||
android.sourceSets.main.assets.srcDir(layout.buildDirectory.dir('uvcAssets'))
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(stageRuntimeAssets) }
|
||||
|
||||
def verifyRuntimeInputs = tasks.register('verifyRuntimeInputs', Exec) {
|
||||
mustRunAfter(stageSessionScripts, stageRuntimeAssets)
|
||||
workingDir rootProject.projectDir
|
||||
commandLine pythonExecutable, 'tools/release/runtime_inputs.py', 'verify'
|
||||
}
|
||||
tasks.configureEach { task ->
|
||||
if (task.name in ['packageDebug', 'packageRelease']) task.dependsOn(verifyRuntimeInputs)
|
||||
}
|
||||
|
||||
def rustCrateDir = layout.projectDirectory.dir('src/main/rust/stores')
|
||||
def rustJniLibsDir = layout.buildDirectory.dir('rustJniLibs')
|
||||
def skipRust = (project.findProperty('skipRust')
|
||||
?: localBuildOptions.getProperty('droiddeck.skipRust', 'false')).toString().toBoolean()
|
||||
def buildRustStores = tasks.register('buildRustStores', Exec) {
|
||||
description = 'Cross-compiles the store download engines (libdroiddeckstores.so) with cargo-ndk.'
|
||||
onlyIf { !skipRust }
|
||||
inputs.dir(rustCrateDir.dir('src'))
|
||||
inputs.files(rustCrateDir.file('Cargo.toml'), rustCrateDir.file('Cargo.lock'))
|
||||
inputs.property('ndkVersion', android.ndkVersion)
|
||||
if (!skipRust) inputs.property('rustToolchain', providers.exec {
|
||||
environment 'PATH', "${System.getProperty('user.home')}/.cargo/bin${File.pathSeparator}${System.getenv('PATH')}"
|
||||
commandLine 'rustup', 'run', 'stable', 'rustc', '-Vv'
|
||||
}.standardOutput.asText)
|
||||
outputs.dir(rustJniLibsDir)
|
||||
workingDir rustCrateDir
|
||||
def cargoBin = "${System.getProperty('user.home')}/.cargo/bin"
|
||||
environment 'PATH', "${cargoBin}${File.pathSeparator}${System.getenv('PATH')}"
|
||||
environment 'ANDROID_NDK_HOME', android.ndkDirectory.absolutePath
|
||||
environment 'CARGO_TERM_COLOR', 'never'
|
||||
if (!skipRust) environment 'RUSTC', providers.exec {
|
||||
commandLine 'rustup', 'which', '--toolchain', 'stable', 'rustc'
|
||||
}.standardOutput.asText.get().trim()
|
||||
commandLine 'rustup', 'run', 'stable', 'cargo', 'ndk', '--target', 'arm64-v8a', '--platform', '26',
|
||||
'--output-dir', rustJniLibsDir.get().asFile.absolutePath,
|
||||
'build', '--release', '--locked'
|
||||
}
|
||||
if (!skipRust) android.sourceSets.main.jniLibs.srcDir(rustJniLibsDir)
|
||||
tasks.named('preBuild').configure { dependsOn(buildRustStores) }
|
||||
|
||||
def verifyHandModel = tasks.register('verifyHandModel') {
|
||||
def models = ['hand_landmarker.task': 'fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1',
|
||||
'hand_landmarker_lite.task': '173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8']
|
||||
.collectEntries { name, hash -> [(file("src/main/assets/models/$name")): hash] }
|
||||
inputs.files(models.keySet())
|
||||
doLast {
|
||||
models.each { model, expected ->
|
||||
def actual = java.security.MessageDigest.getInstance('SHA-256').digest(model.bytes).encodeHex().toString()
|
||||
if (actual != expected) throw new GradleException("Hand Landmarker model checksum mismatch: ${model.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(verifyHandModel) }
|
||||
|
||||
dependencies {
|
||||
implementation 'org.opencv:opencv:4.13.0'
|
||||
implementation 'org.khronos.openxr:openxr_loader_for_android:1.1.49'
|
||||
implementation 'com.github.luben:zstd-jni:1.5.7-4@aar'
|
||||
implementation 'org.apache.commons:commons-compress:1.27.1'
|
||||
implementation 'org.tukaani:xz:1.10'
|
||||
implementation platform('androidx.compose:compose-bom:2024.02.00')
|
||||
implementation 'androidx.compose.ui:ui'
|
||||
implementation 'androidx.compose.material3:material3'
|
||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling'
|
||||
implementation 'androidx.activity:activity-compose:1.8.2'
|
||||
implementation 'androidx.compose.material:material-icons-extended'
|
||||
implementation 'io.coil-kt:coil-compose:2.6.0'
|
||||
implementation 'com.caverock:androidsvg-aar:1.4'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
||||
implementation 'com.flyfishxu:kadb-android:1.2.1'
|
||||
implementation 'com.termux.termux-app:terminal-view:0.118.0'
|
||||
implementation 'androidx.camera:camera-camera2:1.4.2'
|
||||
implementation 'androidx.camera:camera-lifecycle:1.4.2'
|
||||
implementation('com.google.mediapipe:tasks-vision:1.0.0') {
|
||||
exclude group: 'com.google.auto.value', module: 'auto-value'
|
||||
}
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.16.1'
|
||||
testImplementation 'androidx.compose.ui:ui-test-junit4'
|
||||
testRuntimeOnly 'com.github.luben:zstd-jni:1.5.7-4@jar'
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x401000" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="false" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:localeConfig="@xml/locales_config"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:hardwareAccelerated="true"
|
||||
android:largeHeap="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:appCategory="game"
|
||||
android:isGame="true">
|
||||
|
||||
<meta-data android:name="android.game_mode_config" android:resource="@xml/game_mode_config" />
|
||||
<service android:name=".glasses.LumaRgbCaptureService" android:exported="false"
|
||||
android:process=":rgb_diagnostic" />
|
||||
<meta-data android:name="com.oculus.supportedDevices" android:value="quest2|quest3|quest3s" />
|
||||
<activity android:name=".QuestXrActivity" android:exported="true" android:launchMode="singleTask"
|
||||
android:permission="android.permission.DUMP"
|
||||
android:resizeableActivity="false" android:screenOrientation="landscape"
|
||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|keyboard|navigation|uiMode"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
|
||||
<meta-data android:name="android.app.lib_name" android:value="droiddeckxr" />
|
||||
<intent-filter>
|
||||
<action android:name="com.droiddeck.launcher.XR" />
|
||||
<category android:name="com.oculus.intent.category.VR" />
|
||||
<category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|keyboard|keyboardHidden|navigation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
||||
<data android:scheme="droiddeck" android:host="game" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.droiddeck.launcher.LAUNCH_GAME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".HomeActivity"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:excludeFromRecents="true"
|
||||
android:noHistory="true"
|
||||
android:taskAffinity="${applicationId}.home"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".input.ControllerEditorActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/SessionTheme"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
|
||||
<activity
|
||||
android:name=".files.FileManagerActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".files.FilePickerActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".stores.StoreLoginActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".agent.AgentStartActivity"
|
||||
android:exported="true"
|
||||
android:excludeFromRecents="true"
|
||||
android:noHistory="true"
|
||||
android:permission="android.permission.DUMP"
|
||||
android:theme="@style/SessionTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".SessionActivity"
|
||||
android:exported="false"
|
||||
android:supportsPictureInPicture="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/SessionTheme"
|
||||
android:preferMinimalPostProcessing="true"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.SecondScreenActivity"
|
||||
android:exported="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:theme="@style/SessionTheme"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
|
||||
<activity
|
||||
android:name=".gpu.SteamVrRestartActivity"
|
||||
android:exported="false"
|
||||
android:process=":vr_recovery"
|
||||
android:taskAffinity="${applicationId}.vr_recovery"
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density"
|
||||
android:theme="@style/SessionTheme" />
|
||||
|
||||
<service
|
||||
android:name=".session.SessionService"
|
||||
android:exported="false"
|
||||
android:stopWithTask="false" />
|
||||
<service
|
||||
android:name=".runtime.RuntimeInstallService"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name=".core.WirelessAdbPairingService"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name=".stores.download.StoreDownloadService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="dataSync" />
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.logs"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/log_share_paths" />
|
||||
</provider>
|
||||
<provider
|
||||
android:name=".files.AppFilesProvider"
|
||||
android:authorities="${applicationId}.documents"
|
||||
android:exported="true"
|
||||
android:grantUriPermissions="true"
|
||||
android:permission="android.permission.MANAGE_DOCUMENTS">
|
||||
<intent-filter>
|
||||
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
|
||||
</intent-filter>
|
||||
</provider>
|
||||
<provider
|
||||
android:name=".agent.AgentBridgeProvider"
|
||||
android:authorities="${applicationId}.agent"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.DUMP"
|
||||
android:grantUriPermissions="false" />
|
||||
<activity android:name=".ui.SpatialTrackingActivity" android:exported="false" />
|
||||
<service
|
||||
android:name="com.google.android.datatransport.runtime.backends.TransportBackendDiscovery"
|
||||
tools:node="merge">
|
||||
<meta-data
|
||||
android:name="backend:com.google.android.datatransport.cct.CctBackendFactory"
|
||||
tools:node="remove" />
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,102 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"identity": "luma-ultra-base-v1",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"fisheye": false,
|
||||
"error": 1.1209395390660726,
|
||||
"verified": false,
|
||||
"k1": {
|
||||
"rows": 3,
|
||||
"cols": 3,
|
||||
"data": [
|
||||
226.0499636040297,
|
||||
0,
|
||||
321.62348950766386,
|
||||
0,
|
||||
228.36987999988767,
|
||||
242.2674105020684,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
"d1": {
|
||||
"rows": 5,
|
||||
"cols": 1,
|
||||
"data": [
|
||||
-0.28622915867944043,
|
||||
0.1194613930041054,
|
||||
0.007984341063494766,
|
||||
-0.0008220922923559441,
|
||||
-0.025579805296512992
|
||||
]
|
||||
},
|
||||
"k2": {
|
||||
"rows": 3,
|
||||
"cols": 3,
|
||||
"data": [
|
||||
240.3338202496282,
|
||||
0,
|
||||
320.8790079027563,
|
||||
0,
|
||||
241.14047924325277,
|
||||
260.45566640784716,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
"d2": {
|
||||
"rows": 5,
|
||||
"cols": 1,
|
||||
"data": [
|
||||
-0.27073208928390136,
|
||||
0.08065508519805098,
|
||||
-0.001460778493930769,
|
||||
-0.0003694718992635806,
|
||||
-0.011452505620454932
|
||||
]
|
||||
},
|
||||
"r": {
|
||||
"rows": 3,
|
||||
"cols": 3,
|
||||
"data": [
|
||||
0.900501479835182,
|
||||
0.04473903344740378,
|
||||
-0.43254537762047496,
|
||||
-0.08255720039597626,
|
||||
0.9941919046988283,
|
||||
-0.06904176485356042,
|
||||
0.4269442510181227,
|
||||
0.0978819468416306,
|
||||
0.8989648107712929
|
||||
]
|
||||
},
|
||||
"t": {
|
||||
"rows": 3,
|
||||
"cols": 1,
|
||||
"data": [
|
||||
-0.14117171913441395,
|
||||
0.0014051874404824838,
|
||||
-0.007555740272006347
|
||||
]
|
||||
},
|
||||
"cameraToHead": [
|
||||
-0.05607918,
|
||||
0.023585627,
|
||||
-0.07998472,
|
||||
0.01024512,
|
||||
0.9945703,
|
||||
0.005859665,
|
||||
-0.10339546
|
||||
],
|
||||
"deviceModel": "VITURE Luma Ultra",
|
||||
"cameraPair": "left0-right0",
|
||||
"sourceValidation": {
|
||||
"exportDate": "2026-10-16",
|
||||
"sourceDeviceVerified": true,
|
||||
"capturedViews": 25,
|
||||
"scope": "Starting geometry from one calibrated Luma Ultra; other units have not been individually validated."
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"archives": {
|
||||
"lxqt-r1": "c2bb860b3b1688287451e2495be5db313ec07f8c8af501dfac2768a9f417bc86",
|
||||
"desktop-kde-r1": "55747e75d0ec055ab7ea1e92a757f3be227cc3205bb9101f5b53cadef6318579",
|
||||
"desktop-kde-r2": "9ba832677b498654136c69d8c8330434d17e4d53cd099acac9bde3ba429b35bf",
|
||||
"emulators-r1": "a1f4806a9663d28f424b4cab1277e0ede80a92e69de5bc063cdc8b45af220164"
|
||||
},
|
||||
"desktopApplications": {
|
||||
"ark-26.08.1-1-aarch64.pkg.tar.xz": "93e2c2b75ff20cd29b4f312ed1979ef6f27255b93232b93bfcdb31239903c1d4",
|
||||
"breeze-6.7.5-1-aarch64.pkg.tar.xz": "1d7f4eb9d8d234caaea23621909f5233d19462c2f058afeeb54bed7b81bd03bd",
|
||||
"breeze-gtk-6.7.5-1-any.pkg.tar.xz": "a0f59bc4fc426879c8f8a97f6dcc707fb7d1b52913da5eb7e9db83777b6957b7",
|
||||
"breeze-icons-6.30.0-1-aarch64.pkg.tar.xz": "4bae4689032501156687a227024e56554820747644953c67fc8d2e2b6b0b045a",
|
||||
"dolphin-26.08.1-1-aarch64.pkg.tar.xz": "fef738ab8132d3eba1156b98c116699ce0a5efcb4cb462efbacdcf4c47f79a23",
|
||||
"firefox-157.0.1-1-aarch64.pkg.tar.xz": "d142fdb8a339a65eca7cea6a2bba5b29202386166abd9d59851d6757c9eb2163",
|
||||
"gwenview-26.08.1-1-aarch64.pkg.tar.xz": "a9dc7d5ab73fa677905d5a57248b1b9b404b6b16e862958cc7443d387f684a47",
|
||||
"kate-26.08.1-1-aarch64.pkg.tar.xz": "acf50710042746f243a3b219a1ae0f788e338f3dd9d75093e8bb671a618b83b6",
|
||||
"kde-cli-tools-6.7.5-1-aarch64.pkg.tar.xz": "af466398a912a994a97fadfe46aff401d88a90d7fdce7e843dc4218098fa38ac",
|
||||
"kde-gtk-config-6.7.5-1-aarch64.pkg.tar.xz": "ba6cb4cb01dbb3f2c247f2f6973ede3b64c0849f89340217b51dfbf11cb8cb5c",
|
||||
"kinfocenter-6.7.5-1-aarch64.pkg.tar.xz": "f3d5416db96b50f9a5b8a284d82ae21d834a8cce646010abdd7087491c399b0b",
|
||||
"konsole-26.08.1-1-aarch64.pkg.tar.xz": "1ecf87c0d11d620ebe4aeafb02788e0d5f4fe9019ad9c5d9f1011c43237dd5ec",
|
||||
"kscreen-6.7.5-1-aarch64.pkg.tar.xz": "8fbaa6fedf93edeba021a5416b551663654919b27c2ee237d696ec0b0ce7d5b7",
|
||||
"kwin-6.7.5-1-aarch64.pkg.tar.xz": "a7535710c74b90359f80306134b2b7581132cbac508dc84b7e07ef275cc8c3fe",
|
||||
"mpv-1:0.41.0-6-aarch64.pkg.tar.xz": "6c89d00736820210a3c7f32af4cf95d155191d463f9df8bd22137c45f30a554a",
|
||||
"plasma-desktop-6.7.5-1-aarch64.pkg.tar.xz": "b266dd42cea965b5ab1cc1ae600877e9d3bc83ec642c61fe1669c4457e641a55",
|
||||
"plasma-integration-6.7.5-1-aarch64.pkg.tar.xz": "daa96da14d9a4d12c0d9c0341e1be6836a9a437c469d61da5e9844d51e2606cf",
|
||||
"plasma-pa-6.7.5-1-aarch64.pkg.tar.xz": "02dbefe9d3e0069b2bb37cac2a6be18b8f0a1887c87704a0716e7a9268eadcd8",
|
||||
"plasma-workspace-6.7.5-1-aarch64.pkg.tar.xz": "3a1455857afaa9ccf342ab6167f0f15794ee9d248b0925398ea6f62f12730a86",
|
||||
"spectacle-1:6.7.5-1-aarch64.pkg.tar.xz": "0c9837412ea6119edef18bcb0a8fceb74634cb35be0ca78b3e1dd1ff2443866e",
|
||||
"systemsettings-6.7.5-1-aarch64.pkg.tar.xz": "b02b6a726857d5125c92d1ec95379216c7a3bc1f187a3b46e88c0d056b29ce70",
|
||||
"xdg-desktop-portal-kde-6.7.5-1-aarch64.pkg.tar.xz": "2c57d17d34d577023eb9cd7b0fca1ba9163549afe60450f6271aa148af099ef2"
|
||||
},
|
||||
"legacyApplications": {
|
||||
"featherpad-1.6.3-1-aarch64.pkg.tar.xz": "fcac55215815c0b712453f9bcc09abfe4b518e36025a111a7a7598ef04913f3d",
|
||||
"labwc-0.20.2-1-aarch64.pkg.tar.xz": "bcd4cc3945165b0fdd33c0117cd7b9dfd05cf8c327326c37f3c3a27ef23ee5ca",
|
||||
"lximage-qt-2.4.0-1-aarch64.pkg.tar.xz": "5d6bdd5472ea6bcb4b993b36df3ab7010bb2e62b36a78a649708fc9a52cb0928",
|
||||
"lxqt-config-2.4.0-1-aarch64.pkg.tar.xz": "4b601d798fc7689ee76787dbef8c8958c02429ee60248cd99d950c919dbefba5",
|
||||
"lxqt-panel-2.4.1-1-aarch64.pkg.tar.xz": "a141e0f8049e73f859d843510c6f45d6ed9087c990bcebf44f5f2430621024c4",
|
||||
"lxqt-qtplugin-2.4.0-3-aarch64.pkg.tar.xz": "61c8f828be73111ee0bd5e3163b0d64c2098dd0189710a190f42be11137695cf",
|
||||
"lxqt-runner-2.4.0-1-aarch64.pkg.tar.xz": "5afa74652a37366ea4e7774cf33379977582fbdca599cef1005ebf637cbcae4b",
|
||||
"lxqt-session-2.4.0-2-aarch64.pkg.tar.xz": "e9c7c8a0011859029622ad202e0d3826e4e5bc8d64659031f6efa211456ff6eb",
|
||||
"lxqt-themes-2.4.0-1-any.pkg.tar.xz": "7ea16c62a1fa70cdac13cb3f8fdcdaad299ae1f5bd514acfda671484755787bf",
|
||||
"lxqt-wayland-session-0.4.1-1-any.pkg.tar.xz": "cd8dc11f5035469d23b6bbd937a90593402428c43de37517412aa43fe1fc6b10",
|
||||
"papirus-icon-theme-20260801-1-any.pkg.tar.xz": "4aae3f47b800a60d6fd360e55adc581408ceaafc481c5a420a681741a3966510",
|
||||
"pcmanfm-qt-2.4.1-1-aarch64.pkg.tar.xz": "7ec1a6b39dd0e4055b39f0e2c0549ea263d83004e1b821fb9e42f1d7f5fff0f9",
|
||||
"qterminal-2.4.0-1-aarch64.pkg.tar.xz": "aa4adc9c9d47641b9452ec8d879038a9cb4762c3b6b5299045fac968fd0ed22d",
|
||||
"swaybg-1.2.2-1-aarch64.pkg.tar.xz": "a26caa16ca7d581b5ca05758677058b4b60af10dc8d83e447ad6824b762b48b8",
|
||||
"wlr-randr-0.5.0-1-aarch64.pkg.tar.xz": "58c3651c6a15dc8f95a310c7e225f759aa766be2fb3c0981a9a8b567854675b3"
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
desktop-kde-r1
|
||||
desktop-kde-r2
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"url": "https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",
|
||||
"sha256": "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1",
|
||||
"bytes": 7819105,
|
||||
"mediapipe": "com.google.mediapipe:tasks-vision:1.0.0",
|
||||
"opencv": "org.opencv:opencv:4.13.0",
|
||||
"documentation": "https://ai.google.dev/edge/mediapipe/solutions/vision/hand_landmarker",
|
||||
"runtime": "Two video-mode instances; CPU default; GPU requires separate performance acceptance"
|
||||
}
|
||||
Binary file not shown.
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"sha256": "173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8",
|
||||
"composition": "Lite palm detector and lite hand landmarks with matching Tasks tensor metadata and associated files from the full bundle",
|
||||
"palm_source": "https://storage.googleapis.com/mediapipe-assets/palm_detection_lite.tflite",
|
||||
"palm_source_sha256": "e9a4aaddf90dda56a87235303cf00e4c2d3fb28725f68fd88772997dac905c18",
|
||||
"landmark_source": "https://storage.googleapis.com/mediapipe-assets/hand_landmark_lite.tflite",
|
||||
"landmark_source_sha256": "d7fde8ac11f8ce03f8663775bfc323f4fc9f2a38062b4f4efa142874ef5b2a48",
|
||||
"metadata_source": "hand_landmarker.task",
|
||||
"metadata_source_sha256": "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1",
|
||||
"builder": "tools/build_hand_lite.py; mediapipe==0.10.21; deterministic ZIP_STORED bundle and embedded associated-file archives",
|
||||
"runtime": "com.google.mediapipe:tasks-vision:1.0.0; CPU by default; experimental stereo hand and wrist tracking"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -1,61 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
project(droiddeck C CXX)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wno-unused-function -Wimplicit-function-declaration")
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
|
||||
|
||||
add_subdirectory(adrenotools)
|
||||
|
||||
# DXVK's DXBC->SPIR-V translator is zlib licensed (vendored under thirdparty/dxbc).
|
||||
add_subdirectory(thirdparty/dxbc)
|
||||
|
||||
set(WINFG_UPSTREAM "v0.3.0")
|
||||
set(WINFG_CHAIN_SRC
|
||||
framegen/winfg/framegen.cpp
|
||||
framegen/winfg/framegen.hpp
|
||||
framegen/winfg/record_impl.inc
|
||||
framegen/winfg/config.hpp
|
||||
framegen/winfg/embedded_shaders.hpp
|
||||
framegen/winfg/winfg_engine.cpp
|
||||
)
|
||||
set(WINFG_HASH_INPUT "")
|
||||
foreach(f ${WINFG_CHAIN_SRC})
|
||||
file(SHA256 "${CMAKE_CURRENT_SOURCE_DIR}/${f}" _h)
|
||||
string(APPEND WINFG_HASH_INPUT "${_h}")
|
||||
endforeach()
|
||||
string(SHA256 WINFG_CHAIN_HASH_FULL "${WINFG_HASH_INPUT}")
|
||||
string(SUBSTRING "${WINFG_CHAIN_HASH_FULL}" 0 12 WINFG_CHAIN_HASH)
|
||||
message(STATUS "win-fg chain: ${WINFG_UPSTREAM} (src ${WINFG_CHAIN_HASH})")
|
||||
|
||||
add_subdirectory(waylandcomp)
|
||||
add_subdirectory(questxr)
|
||||
add_library(sdnative SHARED sdnative/sdnative.c)
|
||||
target_link_libraries(sdnative log)
|
||||
|
||||
add_library(deviceinfo SHARED deviceinfo/vkinfo.c)
|
||||
target_link_libraries(deviceinfo dl)
|
||||
|
||||
add_library(termux SHARED termux/termux.c)
|
||||
|
||||
# The optional proprietary SDK is supplied locally; its headers/libraries are not vendored.
|
||||
if(DROIDDECK_VITURE_SDK_DIR)
|
||||
add_library(droiddeck_viture SHARED viture/sdk_bridge.cpp)
|
||||
target_compile_features(droiddeck_viture PRIVATE cxx_std_17)
|
||||
target_include_directories(droiddeck_viture PRIVATE "${DROIDDECK_VITURE_SDK_DIR}/include")
|
||||
target_link_directories(droiddeck_viture PRIVATE "${DROIDDECK_VITURE_SDK_DIR}/android/${ANDROID_ABI}")
|
||||
target_link_libraries(droiddeck_viture PRIVATE glasses log)
|
||||
endif()
|
||||
|
||||
if(DROIDDECK_UVC_DIR)
|
||||
add_library(rgb_usb SHARED IMPORTED)
|
||||
set_target_properties(rgb_usb PROPERTIES IMPORTED_LOCATION "${DROIDDECK_UVC_DIR}/${ANDROID_ABI}/libusb.so")
|
||||
add_library(rgb_uvc STATIC IMPORTED)
|
||||
set_target_properties(rgb_uvc PROPERTIES IMPORTED_LOCATION "${DROIDDECK_UVC_DIR}/${ANDROID_ABI}/libuvc.a")
|
||||
add_library(droiddeck_uvc SHARED viture/uvc_bridge.cpp)
|
||||
target_compile_features(droiddeck_uvc PRIVATE cxx_std_17)
|
||||
target_include_directories(droiddeck_uvc PRIVATE "${DROIDDECK_UVC_DIR}/include")
|
||||
target_link_libraries(droiddeck_uvc PRIVATE rgb_uvc rgb_usb log)
|
||||
target_link_options(droiddeck_uvc PRIVATE -Wl,-z,max-page-size=16384)
|
||||
endif()
|
||||
@@ -1,4 +0,0 @@
|
||||
[submodule "lib/linkernsbypass"]
|
||||
path = lib/linkernsbypass
|
||||
url = https://github.com/Pipetto-crypto/liblinkernsbypass.git
|
||||
branch = master
|
||||
@@ -1,37 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if(NOT ${CMAKE_ANDROID_ARCH_ABI} STREQUAL arm64-v8a)
|
||||
message(FATAL_ERROR "Unsupported target architecture: ${CMAKE_ANDROID_ARCH_ABI}. Please make an issue on the repo!")
|
||||
endif()
|
||||
|
||||
project(adrenotools LANGUAGES CXX C)
|
||||
|
||||
set(GEN_INSTALL_TARGET OFF CACHE BOOL "")
|
||||
|
||||
add_subdirectory(lib/linkernsbypass)
|
||||
|
||||
set(LIB_SOURCES src/bcenabler.cpp
|
||||
src/driver.cpp
|
||||
include/adrenotools/bcenabler.h
|
||||
include/adrenotools/driver.h
|
||||
include/adrenotools/priv.h)
|
||||
|
||||
add_library(adrenotools ${LIB_SOURCES})
|
||||
|
||||
target_include_directories(adrenotools PUBLIC include)
|
||||
target_include_directories(adrenotools PRIVATE .)
|
||||
target_compile_options(adrenotools PRIVATE -Wall -Wextra)
|
||||
target_link_libraries(adrenotools android linkernsbypass)
|
||||
|
||||
add_subdirectory(src/hook)
|
||||
if (${BUILD_SHARED_LIBS})
|
||||
target_link_options(adrenotools PRIVATE "-Wl,-s,--exclude-libs,liblinkernsbypass.a")
|
||||
endif()
|
||||
if (${GEN_INSTALL_TARGET})
|
||||
configure_file(adrenotools.pc.in adrenotools.pc @ONLY)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/adrenotools.pc DESTINATION lib/pkgconfig)
|
||||
install(TARGETS adrenotools main_hook file_redirect_hook gsl_alloc_hook hook_impl)
|
||||
install(DIRECTORY include/
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
endif()
|
||||
@@ -1,24 +0,0 @@
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2021, Billy Laws
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,30 +0,0 @@
|
||||
### Adreno Tools
|
||||
A library for applying rootless Adreno GPU driver modifications/replacements. Currently supports loading custom GPU drivers such as [turnip](https://docs.mesa3d.org/android.html#building-using-the-android-ndk), enabling BCn textures and redirecting file operations to allow accessing shader dumps and modification of the [driver config file](https://gist.github.com/bylaws/04130932e2634d1c6a2a9729e3940d60) without root.
|
||||
|
||||
#### Documentation
|
||||
API is documented in the `include/adrenotools` headers.
|
||||
|
||||
#### Support
|
||||
Android 9+
|
||||
Arm64
|
||||
|
||||
Please create an issue if support for anything else is desired.
|
||||
|
||||
### FAQ
|
||||
|
||||
#### Is there an example project?
|
||||
|
||||
There is a simple bare-bones project [AdrenoToolsTest](https://github.com/darksylinc/AdrenoToolsTest) demonstrating how to get libadrenotools working.
|
||||
|
||||
#### How do I use this to update the drivers on my phone? Where's the apk?
|
||||
|
||||
You don't. This library is **not** for installing into Android and is **not** for end users.
|
||||
This library is aimed at other developers.
|
||||
|
||||
Each individual app must explicitly make use of libadrenotools in order to load custom drivers into an app / game.
|
||||
|
||||
#### How do I use this library to make \<favourite game\> use newer drivers?
|
||||
|
||||
See previous question. It's up to the game developer to add support & use this library.
|
||||
|
||||
You could contact them to so they add support for it; but that's out of our power.
|
||||
@@ -1,13 +0,0 @@
|
||||
prefix="@CMAKE_INSTALL_PREFIX@"
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: adrenotools
|
||||
Description:
|
||||
URL:
|
||||
Version: 1.0.0
|
||||
Libs: -L${libdir} -ladrenotools
|
||||
Libs.private:
|
||||
Requires.private:
|
||||
Cflags: -I${includedir}
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
aarch64-linux-gnu-gcc -c src/bcenabler_patch.s -o /tmp/patch.o
|
||||
aarch64-linux-gnu-objcopy -O binary -j .text /tmp/patch.o /tmp/patch.bin
|
||||
|
||||
bin2c -o gen/bcenabler_patch.h -n PatchRawData /tmp/patch.bin
|
||||
|
||||
rm /tmp/patch.o
|
||||
rm /tmp/patch.bin
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
const long int PatchRawData_size = 264;
|
||||
const unsigned char PatchRawData[264] = {
|
||||
0x1F, 0x0C, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0xE0, 0x08, 0x80, 0x52, 0x3E, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x14, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0xE0, 0x08, 0x80, 0x52, 0x3A, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x10, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x00, 0x09, 0x80, 0x52, 0x36, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x18, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x00, 0x09, 0x80, 0x52, 0x32, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x1C, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x40, 0x09, 0x80, 0x52, 0x2E, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x20, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x60, 0x09, 0x80, 0x52, 0x2A, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x24, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0xA0, 0x09, 0x80, 0x52, 0x26, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x28, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0xC0, 0x09, 0x80, 0x52, 0x22, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x2C, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x00, 0x0A, 0x80, 0x52, 0x1E, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x30, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x20, 0x0A, 0x80, 0x52, 0x1A, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x34, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x60, 0x0A, 0x80, 0x52, 0x16, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x38, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x80, 0x0A, 0x80, 0x52, 0x12, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x3C, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0xE0, 0x0B, 0x80, 0x52, 0x0E, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x40, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x00, 0x0C, 0x80, 0x52, 0x0A, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x44, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x40, 0x0C, 0x80, 0x52, 0x06, 0x00, 0x00, 0x14,
|
||||
0x1F, 0x48, 0x02, 0x71, 0x61, 0x00, 0x00, 0x54, 0x60, 0x0C, 0x80, 0x52, 0x02, 0x00, 0x00, 0x14,
|
||||
0x00, 0x00, 0x80, 0x52, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum adrenotools_bcn_type {
|
||||
ADRENOTOOLS_BCN_INCOMPATIBLE,
|
||||
ADRENOTOOLS_BCN_BLOB,
|
||||
ADRENOTOOLS_BCN_PATCH
|
||||
};
|
||||
|
||||
enum adrenotools_bcn_type adrenotools_get_bcn_type(uint32_t major, uint32_t minor, uint32_t vendorId);
|
||||
|
||||
bool adrenotools_patch_bcn(void *vkGetPhysicalDeviceFormatPropertiesFn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "priv.h"
|
||||
|
||||
void *adrenotools_open_libvulkan(int dlopenMode, int featureFlags, const char *tmpLibDir, const char *hookLibDir, const char *customDriverDir, const char *customDriverName, const char *fileRedirectDir, void **userMappingHandle);
|
||||
|
||||
bool adrenotools_import_user_mem(void *handle, void *hostPtr, uint64_t size);
|
||||
|
||||
bool adrenotools_mem_gpu_allocate(void *handle, uint64_t *size);
|
||||
|
||||
bool adrenotools_mem_cpu_map(void *handle, void *hostPtr, uint64_t size);
|
||||
|
||||
bool adrenotools_validate_gpu_mapping(void *handle);
|
||||
|
||||
void adrenotools_set_turbo(bool turbo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,22 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum {
|
||||
ADRENOTOOLS_DRIVER_CUSTOM = 1 << 0,
|
||||
ADRENOTOOLS_DRIVER_FILE_REDIRECT = 1 << 1,
|
||||
ADRENOTOOLS_DRIVER_GPU_MAPPING_IMPORT = 1 << 2,
|
||||
};
|
||||
|
||||
#define ADRENOTOOLS_GPU_MAPPING_SUCCEEDED_MAGIC 0xDEADBEEF
|
||||
|
||||
struct adrenotools_gpu_mapping {
|
||||
void *host_ptr;
|
||||
uint64_t gpu_addr;
|
||||
uint64_t size;
|
||||
uint64_t flags;
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if(NOT ${CMAKE_ANDROID_ARCH_ABI} STREQUAL arm64-v8a)
|
||||
message(FATAL_ERROR "Unsupported target architecture: ${CMAKE_ANDROID_ARCH_ABI}. Please make an issue on the repo!")
|
||||
endif()
|
||||
|
||||
project(linkernsbypass LANGUAGES CXX)
|
||||
|
||||
set(SOURCES android_linker_ns.cpp
|
||||
android_linker_ns.h
|
||||
elf_soname_patcher.cpp
|
||||
elf_soname_patcher.h)
|
||||
|
||||
add_library(linkernsbypass STATIC ${SOURCES})
|
||||
|
||||
|
||||
target_compile_options(linkernsbypass PRIVATE -Wall -Wextra)
|
||||
target_link_libraries(linkernsbypass android dl)
|
||||
target_include_directories(linkernsbypass PUBLIC .)
|
||||
@@ -1,24 +0,0 @@
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2021, Billy Laws
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,9 +0,0 @@
|
||||
### Android Linker Namespace Bypass Library
|
||||
Provides access to the hidden linker namespace functionality in Android 9+ and exposes an interface for hooking libraries similar to a runtime equivalent of `LD_PRELOAD`.
|
||||
See the `android_linker_ns.h` header for an API reference.
|
||||
|
||||
#### Support
|
||||
Android 9+
|
||||
Arm64
|
||||
|
||||
Android 8 and arm32 could be supported with some trivial changes, feel free to open an issue if you have a use for this library on either of them.
|
||||
@@ -1,178 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <android/dlext.h>
|
||||
#include <android/log.h>
|
||||
#include <android/api-level.h>
|
||||
#include <sys/mman.h>
|
||||
#include "elf_soname_patcher.h"
|
||||
#include "android_linker_ns.h"
|
||||
|
||||
using loader_android_create_namespace_t = android_namespace_t *(*)(const char *, const char *, const char *, uint64_t, const char *, android_namespace_t *, const void *);
|
||||
static loader_android_create_namespace_t loader_android_create_namespace;
|
||||
|
||||
static bool lib_loaded;
|
||||
|
||||
|
||||
bool linkernsbypass_load_status() {
|
||||
return lib_loaded;
|
||||
}
|
||||
|
||||
struct android_namespace_t *android_create_namespace(const char *name,
|
||||
const char *ld_library_path,
|
||||
const char *default_library_path,
|
||||
uint64_t type,
|
||||
const char *permitted_when_isolated_path,
|
||||
android_namespace_t *parent_namespace) {
|
||||
auto caller{__builtin_return_address(0)};
|
||||
return loader_android_create_namespace(name, ld_library_path, default_library_path, type,
|
||||
permitted_when_isolated_path, parent_namespace, caller);
|
||||
}
|
||||
|
||||
struct android_namespace_t *android_create_namespace_escape(const char *name,
|
||||
const char *ld_library_path,
|
||||
const char *default_library_path,
|
||||
uint64_t type,
|
||||
const char *permitted_when_isolated_path,
|
||||
android_namespace_t *parent_namespace) {
|
||||
auto caller{reinterpret_cast<void *>(&dlopen)};
|
||||
return loader_android_create_namespace(name, ld_library_path, default_library_path, type,
|
||||
permitted_when_isolated_path, parent_namespace, caller);
|
||||
}
|
||||
|
||||
android_get_exported_namespace_t android_get_exported_namespace;
|
||||
|
||||
android_link_namespaces_all_libs_t android_link_namespaces_all_libs;
|
||||
|
||||
android_link_namespaces_t android_link_namespaces;
|
||||
|
||||
bool linkernsbypass_link_namespace_to_default_all_libs(android_namespace_t *to) {
|
||||
static auto defaultNs{android_create_namespace_escape("default_copy", nullptr, nullptr, ANDROID_NAMESPACE_TYPE_SHARED, nullptr, nullptr)};
|
||||
return android_link_namespaces_all_libs(to, defaultNs);
|
||||
}
|
||||
|
||||
void *linkernsbypass_namespace_dlopen(const char *filename, int flags, android_namespace_t *ns) {
|
||||
android_dlextinfo extInfo{
|
||||
.flags = ANDROID_DLEXT_USE_NAMESPACE,
|
||||
.library_namespace = ns
|
||||
};
|
||||
|
||||
return android_dlopen_ext(filename, flags, &extInfo);
|
||||
}
|
||||
|
||||
#ifndef __NR_memfd_create
|
||||
#if defined(__aarch64__)
|
||||
#define __NR_memfd_create 279
|
||||
#else
|
||||
#error Unsupported target architecture!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void *linkernsbypass_namespace_dlopen_unique(const char *libPath, const char *libTargetDir, int flags, android_namespace_t *ns) {
|
||||
static std::array<char, PATH_MAX> PathBuf{};
|
||||
|
||||
static uint16_t TargetId{};
|
||||
|
||||
int libTargetFd{[&] () {
|
||||
if (libTargetDir) {
|
||||
snprintf(PathBuf.data(), PathBuf.size(), "%s/%d_patched.so", libTargetDir, TargetId);
|
||||
return open(PathBuf.data(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||
} else {
|
||||
errno = 0;
|
||||
int fd{static_cast<int>(syscall(__NR_memfd_create, libPath, 0))};
|
||||
if (errno == ENOSYS || fd < 0)
|
||||
return -1;
|
||||
else
|
||||
return fd;
|
||||
}
|
||||
}()};
|
||||
if (libTargetFd == -1)
|
||||
return nullptr;
|
||||
|
||||
std::array<char, 3> sonameOverwrite{};
|
||||
snprintf(sonameOverwrite.data(), sonameOverwrite.size(), "%03u", TargetId++);
|
||||
|
||||
if (!elf_soname_patch(libPath, libTargetFd, sonameOverwrite.data()))
|
||||
return nullptr;
|
||||
|
||||
android_dlextinfo hookExtInfo{
|
||||
.flags = ANDROID_DLEXT_USE_NAMESPACE | ANDROID_DLEXT_USE_LIBRARY_FD,
|
||||
.library_fd = libTargetFd,
|
||||
.library_namespace = ns
|
||||
};
|
||||
|
||||
snprintf(PathBuf.data(), PathBuf.size(), "/proc/self/fd/%d", libTargetFd);
|
||||
|
||||
return android_dlopen_ext(PathBuf.data(), flags, &hookExtInfo);
|
||||
}
|
||||
|
||||
static void *align_ptr(void *ptr) {
|
||||
return reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(ptr) & ~(getpagesize() - 1));
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void resolve_linker_symbols() {
|
||||
using loader_dlopen_t = void *(*)(const char *, int, const void *);
|
||||
|
||||
if (android_get_device_api_level() < 28)
|
||||
return;
|
||||
|
||||
auto loader_dlopen{[]() {
|
||||
union BranchLinked {
|
||||
uint32_t raw;
|
||||
|
||||
struct {
|
||||
int32_t offset : 26;
|
||||
uint8_t sig : 6;
|
||||
};
|
||||
|
||||
bool Verify() {
|
||||
return sig == 0x25;
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(BranchLinked) == 4, "BranchLinked is wrong size");
|
||||
|
||||
mprotect(align_ptr(reinterpret_cast<void *>(&dlopen)), getpagesize(), PROT_WRITE | PROT_READ | PROT_EXEC);
|
||||
|
||||
auto blInstr{reinterpret_cast<BranchLinked *>(&dlopen)};
|
||||
while (!blInstr->Verify())
|
||||
blInstr++;
|
||||
|
||||
return reinterpret_cast<loader_dlopen_t>(blInstr + blInstr->offset);
|
||||
}()};
|
||||
|
||||
mprotect(align_ptr(reinterpret_cast<void *>(&loader_dlopen)), getpagesize(), PROT_WRITE | PROT_READ | PROT_EXEC);
|
||||
|
||||
auto ldHandle{loader_dlopen("ld-android.so", RTLD_LAZY, reinterpret_cast<void *>(&dlopen))};
|
||||
if (!ldHandle)
|
||||
return;
|
||||
|
||||
android_link_namespaces_all_libs = reinterpret_cast<android_link_namespaces_all_libs_t>(dlsym(ldHandle, "__loader_android_link_namespaces_all_libs"));
|
||||
if (!android_link_namespaces_all_libs)
|
||||
return;
|
||||
|
||||
android_link_namespaces = reinterpret_cast<android_link_namespaces_t>(dlsym(ldHandle, "__loader_android_link_namespaces"));
|
||||
if (!android_link_namespaces)
|
||||
return;
|
||||
|
||||
auto libdlAndroidHandle{loader_dlopen("libdl_android.so", RTLD_LAZY, reinterpret_cast<void *>(&dlopen))};
|
||||
if (!libdlAndroidHandle)
|
||||
return;
|
||||
|
||||
loader_android_create_namespace = reinterpret_cast<loader_android_create_namespace_t>(dlsym(libdlAndroidHandle, "__loader_android_create_namespace"));
|
||||
if (!loader_android_create_namespace)
|
||||
return;
|
||||
|
||||
android_get_exported_namespace = reinterpret_cast<android_get_exported_namespace_t>(dlsym(libdlAndroidHandle, "__loader_android_get_exported_namespace"));
|
||||
if (!android_get_exported_namespace)
|
||||
return;
|
||||
|
||||
lib_loaded = true;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum {
|
||||
ANDROID_NAMESPACE_TYPE_REGULAR = 0,
|
||||
ANDROID_NAMESPACE_TYPE_ISOLATED = 1,
|
||||
ANDROID_NAMESPACE_TYPE_SHARED = 2,
|
||||
ANDROID_NAMESPACE_TYPE_EXEMPT_LIST_ENABLED = 0x08000000,
|
||||
ANDROID_NAMESPACE_TYPE_ALSO_USED_AS_ANONYMOUS = 0x10000000,
|
||||
ANDROID_NAMESPACE_TYPE_SHARED_ISOLATED = ANDROID_NAMESPACE_TYPE_SHARED | ANDROID_NAMESPACE_TYPE_ISOLATED,
|
||||
};
|
||||
|
||||
bool linkernsbypass_load_status();
|
||||
|
||||
struct android_namespace_t *android_create_namespace(const char *name,
|
||||
const char *ld_library_path,
|
||||
const char *default_library_path,
|
||||
uint64_t type,
|
||||
const char *permitted_when_isolated_path,
|
||||
struct android_namespace_t *parent_namespace);
|
||||
|
||||
struct android_namespace_t *android_create_namespace_escape(const char *name,
|
||||
const char *ld_library_path,
|
||||
const char *default_library_path,
|
||||
uint64_t type,
|
||||
const char *permitted_when_isolated_path,
|
||||
struct android_namespace_t *parent_namespace);
|
||||
|
||||
typedef struct android_namespace_t *(*android_get_exported_namespace_t)(const char *);
|
||||
extern android_get_exported_namespace_t android_get_exported_namespace;
|
||||
|
||||
typedef bool (*android_link_namespaces_all_libs_t)(struct android_namespace_t *, struct android_namespace_t *);
|
||||
extern android_link_namespaces_all_libs_t android_link_namespaces_all_libs;
|
||||
|
||||
typedef bool (*android_link_namespaces_t)(struct android_namespace_t *, struct android_namespace_t *, const char *);
|
||||
extern android_link_namespaces_t android_link_namespaces;
|
||||
|
||||
bool linkernsbypass_link_namespace_to_default_all_libs(struct android_namespace_t *to);
|
||||
|
||||
void *linkernsbypass_namespace_dlopen(const char *filename, int flags, struct android_namespace_t *ns);
|
||||
|
||||
void *linkernsbypass_namespace_dlopen_unique(const char *libPath, const char *libTargetDir, int flags, struct android_namespace_t *ns);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#include <initializer_list>
|
||||
#include <cstdint>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <link.h>
|
||||
#include <elf.h>
|
||||
#include "elf_soname_patcher.h"
|
||||
|
||||
bool elf_soname_patch(const char *libPath, int targetFd, const char *sonamePatch) {
|
||||
struct stat libStat{};
|
||||
if (stat(libPath, &libStat))
|
||||
return false;
|
||||
|
||||
if (ftruncate(targetFd, libStat.st_size) == -1)
|
||||
return false;
|
||||
|
||||
auto mappedLib{reinterpret_cast<uint8_t *>(mmap(nullptr, libStat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, targetFd, 0))};
|
||||
if (!mappedLib)
|
||||
return false;
|
||||
|
||||
int libFd{open(libPath, O_RDONLY)};
|
||||
if (libFd == false)
|
||||
return false;
|
||||
|
||||
if (read(libFd, mappedLib, libStat.st_size) != libStat.st_size)
|
||||
return false;
|
||||
|
||||
close(libFd);
|
||||
|
||||
auto eHdr{reinterpret_cast<ElfW(Ehdr) *>(mappedLib)};
|
||||
auto sHdrEntries{reinterpret_cast<ElfW(Shdr) *>(mappedLib + eHdr->e_shoff)};
|
||||
|
||||
for (ElfW(Half) i{}; i < eHdr->e_shnum; i++) {
|
||||
auto &sHdr{sHdrEntries[i]};
|
||||
if (sHdr.sh_type == SHT_DYNAMIC) {
|
||||
auto strTab{reinterpret_cast<char *>(mappedLib + sHdrEntries[sHdr.sh_link].sh_offset)};
|
||||
auto dynHdrEntries{reinterpret_cast<ElfW(Dyn) *>(mappedLib + sHdr.sh_offset)};
|
||||
|
||||
for (ElfW(Xword) k{}; k < (sHdr.sh_size / sHdr.sh_entsize); k++) {
|
||||
auto &dynHdrEntry{dynHdrEntries[k]};
|
||||
if (dynHdrEntry.d_tag == DT_SONAME) {
|
||||
char *soname{strTab + dynHdrEntry.d_un.d_val};
|
||||
|
||||
size_t charIdx{};
|
||||
for (; soname[charIdx] != 0 && sonamePatch[charIdx] != 0; charIdx++)
|
||||
soname[charIdx] = sonamePatch[charIdx];
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool elf_soname_patch(const char *elfPath, int targetFd, const char *newSoname);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,13 +0,0 @@
|
||||
linkernsbypass_files = files(['android_linker_ns.cpp', 'android_linker_ns.h', 'elf_soname_patcher.cpp', 'elf_soname_patcher.h'])
|
||||
linkernsbypass_inc = include_directories('.')
|
||||
|
||||
libdl_dep = cpp.find_library('dl')
|
||||
|
||||
linkernsbypass_lib = static_library (
|
||||
'linkernsbypass',
|
||||
linkernsbypass_files,
|
||||
c_args: (['-Wall', '-Wextra']),
|
||||
cpp_args: (['-Wall', '-Wextra']),
|
||||
include_directories: ([linkernsbypass_inc, adrenotools_inc]),
|
||||
dependencies: ([libandroid_dep, libdl_dep])
|
||||
)
|
||||
@@ -1,35 +0,0 @@
|
||||
project(
|
||||
'adrenotools',
|
||||
['cpp', 'c'],
|
||||
default_options : ['default_library=static']
|
||||
)
|
||||
|
||||
cpp = meson.get_compiler('cpp')
|
||||
c = meson.get_compiler('c')
|
||||
|
||||
adrenotools_inc = include_directories('include')
|
||||
|
||||
libandroid_dep = cpp.find_library('android')
|
||||
liblog_dep = c.find_library('log')
|
||||
|
||||
subdir('lib/linkernsbypass')
|
||||
|
||||
linkernsbypass_dep = declare_dependency(
|
||||
include_directories: linkernsbypass_inc,
|
||||
link_with: linkernsbypass_lib,
|
||||
link_args: '-Wl,-s,--exclude-libs,liblinkernsbypass.a'
|
||||
)
|
||||
|
||||
adrenotools_sources = ['src/bcenabler.cpp', 'src/driver.cpp', 'include/adrenotools/bcenabler.h', 'include/adrenotools/driver.h', 'include/adrenotools/priv.h']
|
||||
|
||||
adrenotools_lib = shared_library(
|
||||
'adrenotools',
|
||||
adrenotools_sources,
|
||||
c_args: (['-Wall', '-Wextra']),
|
||||
cpp_args: (['-Wall', '-Wextra']),
|
||||
include_directories: adrenotools_inc,
|
||||
dependencies: ([linkernsbypass_dep, libandroid_dep, liblog_dep]),
|
||||
install: true
|
||||
)
|
||||
|
||||
subdir('src/hook')
|
||||
@@ -1,120 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <adrenotools/bcenabler.h>
|
||||
#include "gen/bcenabler_patch.h"
|
||||
|
||||
enum adrenotools_bcn_type adrenotools_get_bcn_type(uint32_t major, uint32_t minor, uint32_t vendorId) {
|
||||
if (vendorId != 0x5143 || major != 512)
|
||||
return ADRENOTOOLS_BCN_INCOMPATIBLE;
|
||||
|
||||
if (minor >= 514)
|
||||
return ADRENOTOOLS_BCN_BLOB;
|
||||
|
||||
return ADRENOTOOLS_BCN_PATCH;
|
||||
}
|
||||
|
||||
static void *find_free_page(uintptr_t address) {
|
||||
std::ifstream procMaps("/proc/self/maps");
|
||||
|
||||
uintptr_t end{};
|
||||
|
||||
for (std::string line; std::getline(procMaps, line); ) {
|
||||
std::size_t addressSeparator{line.find('-')};
|
||||
uintptr_t start{std::strtoull(line.substr(0, addressSeparator).c_str(), nullptr, 16)};
|
||||
|
||||
if (end > address && start != end)
|
||||
return reinterpret_cast<void *>(end);
|
||||
|
||||
end = std::strtoull(line.substr(addressSeparator + 1, line.find( ' ')).c_str(), nullptr, 16);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void *align_ptr(void *ptr) {
|
||||
return reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(ptr) & ~(getpagesize() - 1));
|
||||
}
|
||||
|
||||
bool adrenotools_patch_bcn(void *vkGetPhysicalDeviceFormatPropertiesFn) {
|
||||
union Branch {
|
||||
struct {
|
||||
int32_t offset : 26;
|
||||
uint8_t sig : 6;
|
||||
};
|
||||
|
||||
uint32_t raw{};
|
||||
};
|
||||
static_assert(sizeof(Branch) == 4, "Branch size is invalid");
|
||||
|
||||
void *patchPage{find_free_page(reinterpret_cast<uintptr_t>(vkGetPhysicalDeviceFormatPropertiesFn))};
|
||||
if (!patchPage)
|
||||
return false;
|
||||
|
||||
void *ptr{mmap(patchPage, getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0)};
|
||||
if (ptr != patchPage)
|
||||
return false;
|
||||
|
||||
if (mprotect(align_ptr(vkGetPhysicalDeviceFormatPropertiesFn), getpagesize() * 2, PROT_WRITE | PROT_READ | PROT_EXEC))
|
||||
return false;
|
||||
|
||||
Branch *blInst{reinterpret_cast<Branch *>(vkGetPhysicalDeviceFormatPropertiesFn)};
|
||||
|
||||
constexpr uint8_t BranchLinkSignature{0x25};
|
||||
|
||||
while (blInst->sig != BranchLinkSignature)
|
||||
blInst++;
|
||||
|
||||
uint32_t *convFormatFn{reinterpret_cast<uint32_t *>(blInst) + blInst->offset};
|
||||
|
||||
if (mprotect(align_ptr(convFormatFn), getpagesize() * 2, PROT_WRITE | PROT_READ | PROT_EXEC))
|
||||
return false;
|
||||
|
||||
constexpr uint32_t ClearResultSignature{0x2a1f03e0};
|
||||
|
||||
uint32_t *clearResultPtr{convFormatFn};
|
||||
while (*clearResultPtr != ClearResultSignature)
|
||||
clearResultPtr++;
|
||||
|
||||
if (PatchRawData_size > getpagesize())
|
||||
return false;
|
||||
|
||||
memcpy(patchPage, PatchRawData, PatchRawData_size);
|
||||
|
||||
constexpr uint32_t PatchReturnFixupMagic{0xffffffff};
|
||||
constexpr uint8_t BranchSignature{0x5};
|
||||
|
||||
uint32_t *fixupTargetPtr{clearResultPtr + 1};
|
||||
auto *fixupPtr{reinterpret_cast<uint32_t *>(patchPage)};
|
||||
for (long unsigned int i{}; i < (PatchRawData_size / sizeof(uint32_t)); i++, fixupPtr++) {
|
||||
if (*fixupPtr == PatchReturnFixupMagic) {
|
||||
Branch branchToDriver{
|
||||
{
|
||||
.offset = static_cast<int32_t>((reinterpret_cast<intptr_t>(fixupTargetPtr) - reinterpret_cast<intptr_t>(fixupPtr)) / sizeof(int32_t)),
|
||||
.sig = BranchSignature,
|
||||
}
|
||||
};
|
||||
|
||||
*fixupPtr = branchToDriver.raw;
|
||||
}
|
||||
}
|
||||
|
||||
Branch branchToPatch{
|
||||
{
|
||||
.offset = static_cast<int32_t>((reinterpret_cast<intptr_t>(patchPage) - reinterpret_cast<intptr_t>(clearResultPtr)) / sizeof(int32_t)),
|
||||
.sig = BranchSignature,
|
||||
}
|
||||
};
|
||||
|
||||
*clearResultPtr = branchToPatch.raw;
|
||||
|
||||
asm volatile("ISB");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
cmp w0, 131
|
||||
bne .L2
|
||||
mov w0, 71
|
||||
b .L3
|
||||
.L2:
|
||||
cmp w0, 133
|
||||
bne .L4
|
||||
mov w0, 71
|
||||
b .L3
|
||||
.L4:
|
||||
cmp w0, 132
|
||||
bne .L5
|
||||
mov w0, 72
|
||||
b .L3
|
||||
.L5:
|
||||
cmp w0, 134
|
||||
bne .L6
|
||||
mov w0, 72
|
||||
b .L3
|
||||
.L6:
|
||||
cmp w0, 135
|
||||
bne .L7
|
||||
mov w0, 74
|
||||
b .L3
|
||||
.L7:
|
||||
cmp w0, 136
|
||||
bne .L8
|
||||
mov w0, 75
|
||||
b .L3
|
||||
.L8:
|
||||
cmp w0, 137
|
||||
bne .L9
|
||||
mov w0, 77
|
||||
b .L3
|
||||
.L9:
|
||||
cmp w0, 138
|
||||
bne .L10
|
||||
mov w0, 78
|
||||
b .L3
|
||||
.L10:
|
||||
cmp w0, 139
|
||||
bne .L11
|
||||
mov w0, 80
|
||||
b .L3
|
||||
.L11:
|
||||
cmp w0, 140
|
||||
bne .L12
|
||||
mov w0, 81
|
||||
b .L3
|
||||
.L12:
|
||||
cmp w0, 141
|
||||
bne .L13
|
||||
mov w0, 83
|
||||
b .L3
|
||||
.L13:
|
||||
cmp w0, 142
|
||||
bne .L14
|
||||
mov w0, 84
|
||||
b .L3
|
||||
.L14:
|
||||
cmp w0, 143
|
||||
bne .L15
|
||||
mov w0, 95
|
||||
b .L3
|
||||
.L15:
|
||||
cmp w0, 144
|
||||
bne .L16
|
||||
mov w0, 96
|
||||
b .L3
|
||||
.L16:
|
||||
cmp w0, 145
|
||||
bne .L17
|
||||
mov w0, 98
|
||||
b .L3
|
||||
.L17:
|
||||
cmp w0, 146
|
||||
bne .L18
|
||||
mov w0, 99
|
||||
b .L3
|
||||
.L18:
|
||||
mov w0, 0
|
||||
.L3:
|
||||
.word 0xffffffff
|
||||
@@ -1,224 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <android/api-level.h>
|
||||
#include <android/log.h>
|
||||
#include <android_linker_ns.h>
|
||||
#include "hook/kgsl.h"
|
||||
#include "hook/hook_impl_params.h"
|
||||
#include <adrenotools/driver.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void *adrenotools_open_libvulkan(int dlopenFlags, int featureFlags, const char *tmpLibDir, const char *hookLibDir, const char *customDriverDir, const char *customDriverName, const char *fileRedirectDir, void **userMappingHandle) {
|
||||
if (!linkernsbypass_load_status()) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "Could not load linkernsbypass\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (android_get_device_api_level() >= 29 && !tmpLibDir)
|
||||
tmpLibDir = nullptr;
|
||||
|
||||
if (!(featureFlags & ADRENOTOOLS_DRIVER_FILE_REDIRECT) && fileRedirectDir) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_FILE_REDIRECT present but no file redirect folder found\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!(featureFlags & ADRENOTOOLS_DRIVER_CUSTOM) && (customDriverDir || customDriverName)) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_CUSTOM present but no custom driver name or folder found\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!(featureFlags & ADRENOTOOLS_DRIVER_GPU_MAPPING_IMPORT) && userMappingHandle) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_GPU_MAPPING_IMPORT present but no user mapping handle found\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct stat buf{};
|
||||
|
||||
if (featureFlags & ADRENOTOOLS_DRIVER_CUSTOM) {
|
||||
if (!customDriverName || !customDriverDir) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_CUSTOM present but no custom driver name or folder parameter was specified\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (stat((std::string(customDriverDir) + customDriverName).c_str(), &buf) != 0) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_CUSTOM present but importable driver doesn't exist'\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (featureFlags & ADRENOTOOLS_DRIVER_FILE_REDIRECT) {
|
||||
if (!fileRedirectDir) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_REDIRECT_DIR present but no folder parameter was found\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (stat(fileRedirectDir, &buf) != 0) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "ADRENOTOOLS_DRIVER_REDIRECT_DIR present but specified redirect folder doesn't exist\n");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
auto hookNs{android_create_namespace("adrenotools-libvulkan", hookLibDir, nullptr, ANDROID_NAMESPACE_TYPE_SHARED, nullptr, nullptr)};
|
||||
|
||||
if (!linkernsbypass_link_namespace_to_default_all_libs(hookNs)) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "Failed to hook our namespace to the default one\n");
|
||||
return nullptr;
|
||||
}
|
||||
auto hookImpl{linkernsbypass_namespace_dlopen("libhook_impl.so", RTLD_NOW, hookNs)};
|
||||
if (!hookImpl) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "Couldn't preload the hook implementation\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto initHookParam{reinterpret_cast<void (*)(const void *)>(dlsym(hookImpl, "init_hook_param"))};
|
||||
if (!initHookParam) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "Couldn't init hook params\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto importMapping{[&]() -> adrenotools_gpu_mapping * {
|
||||
if (featureFlags & ADRENOTOOLS_DRIVER_GPU_MAPPING_IMPORT) {
|
||||
adrenotools_gpu_mapping *mapping{new adrenotools_gpu_mapping{}};
|
||||
*userMappingHandle = mapping;
|
||||
return mapping;
|
||||
} else {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "Memory mapping flag was not specified\n");
|
||||
return nullptr;
|
||||
}
|
||||
}()};
|
||||
|
||||
initHookParam(new HookImplParams(featureFlags, tmpLibDir, hookLibDir, customDriverDir, customDriverName, fileRedirectDir, importMapping));
|
||||
|
||||
if (!linkernsbypass_namespace_dlopen("libmain_hook.so", RTLD_GLOBAL, hookNs)) {
|
||||
__android_log_print( ANDROID_LOG_ERROR, "adrenotools", "Failed to load libvulkan into the isolated namespace\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return linkernsbypass_namespace_dlopen_unique("/system/lib64/libvulkan.so", tmpLibDir, dlopenFlags, hookNs);
|
||||
}
|
||||
|
||||
|
||||
bool adrenotools_import_user_mem(void *handle, void *hostPtr, uint64_t size) {
|
||||
auto importMapping{reinterpret_cast<adrenotools_gpu_mapping *>(handle)};
|
||||
|
||||
kgsl_gpuobj_import_useraddr addr{
|
||||
.virtaddr = reinterpret_cast<uint64_t>(hostPtr),
|
||||
};
|
||||
|
||||
kgsl_gpuobj_import userMemImport{
|
||||
.priv = reinterpret_cast<uint64_t>(&addr),
|
||||
.priv_len = size,
|
||||
.flags = KGSL_CACHEMODE_WRITEBACK << KGSL_CACHEMODE_SHIFT | KGSL_MEMFLAGS_IOCOHERENT,
|
||||
.type = KGSL_USER_MEM_TYPE_ADDR,
|
||||
|
||||
};
|
||||
|
||||
kgsl_gpuobj_info info{};
|
||||
|
||||
int kgslFd{open("/dev/kgsl-3d0", O_RDWR)};
|
||||
if (kgslFd < 0)
|
||||
return false;
|
||||
|
||||
int ret{ioctl(kgslFd, IOCTL_KGSL_GPUOBJ_IMPORT, &userMemImport)};
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
info.id = userMemImport.id;
|
||||
ret = ioctl(kgslFd, IOCTL_KGSL_GPUOBJ_INFO, &info);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
importMapping->host_ptr = hostPtr;
|
||||
importMapping->gpu_addr = info.gpuaddr;
|
||||
importMapping->size = size;
|
||||
importMapping->flags = 0xc2600;
|
||||
|
||||
close(kgslFd);
|
||||
return true;
|
||||
|
||||
err:
|
||||
close(kgslFd);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool adrenotools_mem_gpu_allocate(void *handle, uint64_t *size) {
|
||||
auto mapping{reinterpret_cast<adrenotools_gpu_mapping *>(handle)};
|
||||
|
||||
kgsl_gpuobj_alloc gpuobjAlloc{
|
||||
.size = *size,
|
||||
.flags = KGSL_CACHEMODE_WRITEBACK << KGSL_CACHEMODE_SHIFT | KGSL_MEMFLAGS_IOCOHERENT,
|
||||
};
|
||||
|
||||
kgsl_gpuobj_info info{};
|
||||
|
||||
int kgslFd{open("/dev/kgsl-3d0", O_RDWR)};
|
||||
if (kgslFd < 0)
|
||||
return false;
|
||||
|
||||
int ret{ioctl(kgslFd, IOCTL_KGSL_GPUOBJ_ALLOC, &gpuobjAlloc)};
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
*size = gpuobjAlloc.mmapsize;
|
||||
|
||||
info.id = gpuobjAlloc.id;
|
||||
|
||||
ret = ioctl(kgslFd, IOCTL_KGSL_GPUOBJ_INFO, &info);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
mapping->host_ptr = nullptr;
|
||||
mapping->gpu_addr = info.gpuaddr;
|
||||
mapping->size = *size;
|
||||
mapping->flags = 0xc2600;
|
||||
|
||||
close(kgslFd);
|
||||
return true;
|
||||
|
||||
err:
|
||||
close(kgslFd);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool adrenotools_mem_cpu_map(void *handle, void *hostPtr, uint64_t size) {
|
||||
auto mapping{reinterpret_cast<adrenotools_gpu_mapping *>(handle)};
|
||||
|
||||
int kgslFd{open("/dev/kgsl-3d0", O_RDWR)};
|
||||
if (kgslFd < 0)
|
||||
return false;
|
||||
|
||||
mapping->host_ptr = mmap(hostPtr, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, kgslFd, mapping->gpu_addr);
|
||||
close(kgslFd);
|
||||
return mapping->host_ptr != nullptr;
|
||||
}
|
||||
|
||||
bool adrenotools_validate_gpu_mapping(void *handle) {
|
||||
auto importMapping{reinterpret_cast<adrenotools_gpu_mapping *>(handle)};
|
||||
return importMapping->gpu_addr == ADRENOTOOLS_GPU_MAPPING_SUCCEEDED_MAGIC;
|
||||
}
|
||||
|
||||
void adrenotools_set_turbo(bool turbo) {
|
||||
uint32_t enable{turbo ? 0U : 1U};
|
||||
kgsl_device_getproperty prop{
|
||||
.type = KGSL_PROP_PWRCTRL,
|
||||
.value = reinterpret_cast<void *>(&enable),
|
||||
.sizebytes = sizeof(enable),
|
||||
};
|
||||
|
||||
int kgslFd{open("/dev/kgsl-3d0", O_RDWR)};
|
||||
if (kgslFd < 0)
|
||||
return;
|
||||
|
||||
ioctl(kgslFd, IOCTL_KGSL_SETPROPERTY, &prop);
|
||||
close (kgslFd);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
add_library(hook_impl SHARED hook_impl.cpp hook_impl.h hook_impl_params.h)
|
||||
|
||||
target_compile_options(hook_impl PRIVATE -Wall -Wextra)
|
||||
target_link_libraries(hook_impl linkernsbypass log)
|
||||
target_include_directories(hook_impl PRIVATE ../../include)
|
||||
set_target_properties(hook_impl PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_library(main_hook SHARED main_hook.c)
|
||||
|
||||
target_compile_options(main_hook PRIVATE -Wall -Wextra)
|
||||
target_link_options(main_hook PRIVATE -z global)
|
||||
target_link_libraries(main_hook hook_impl)
|
||||
set_target_properties(main_hook PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_library(file_redirect_hook SHARED file_redirect_hook.c)
|
||||
|
||||
target_compile_options(file_redirect_hook PRIVATE -Wall -Wextra)
|
||||
target_link_options(file_redirect_hook PRIVATE -z global)
|
||||
target_link_libraries(file_redirect_hook hook_impl)
|
||||
set_target_properties(file_redirect_hook PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
add_library(gsl_alloc_hook SHARED gsl_alloc_hook.c)
|
||||
|
||||
target_compile_options(gsl_alloc_hook PRIVATE -Wall -Wextra)
|
||||
target_link_options(gsl_alloc_hook PRIVATE -z global)
|
||||
target_link_libraries(gsl_alloc_hook hook_impl)
|
||||
set_target_properties(gsl_alloc_hook PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
@@ -1,5 +0,0 @@
|
||||
#include "hook_impl.h"
|
||||
|
||||
__attribute__((visibility("default"))) FILE *fopen(const char *filename, const char *mode) {
|
||||
return hook_fopen(filename, mode);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include "hook_impl.h"
|
||||
|
||||
__attribute__((visibility("default"))) int gsl_memory_alloc_pure(uint32_t size, uint32_t flags, void *memDesc) {
|
||||
return hook_gsl_memory_alloc_pure_64((uint64_t)size, flags, memDesc);
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) int gsl_memory_alloc_pure_64(uint64_t size, uint32_t flags, void *memDesc) {
|
||||
return hook_gsl_memory_alloc_pure_64(size, flags, memDesc);
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) int gsl_memory_free_pure(void *memDesc) {
|
||||
return hook_gsl_memory_free_pure(memDesc);
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <android_linker_ns.h>
|
||||
#include <android/dlext.h>
|
||||
#include <android/log.h>
|
||||
#include "kgsl.h"
|
||||
#include "hook_impl_params.h"
|
||||
#include "hook_impl.h"
|
||||
|
||||
#define TAG "hook_impl"
|
||||
#define LOGI(fmt, ...) __android_log_print(ANDROID_LOG_INFO, TAG, fmt, ##__VA_ARGS__)
|
||||
|
||||
const HookImplParams *hook_params;
|
||||
int (*gsl_memory_alloc_pure_sym)(uint32_t, uint32_t, void *);
|
||||
int (*gsl_memory_alloc_pure_64_sym)(uint64_t, uint32_t, void *);
|
||||
int (*gsl_memory_free_pure_sym)(void *);
|
||||
int kgsl_fd;
|
||||
|
||||
using gsl_memory_alloc_pure_t = decltype(gsl_memory_alloc_pure_sym);
|
||||
using gsl_memory_alloc_pure_64_t = decltype(gsl_memory_alloc_pure_64_sym);
|
||||
using gsl_memory_free_pure_t = decltype(gsl_memory_free_pure_sym);
|
||||
|
||||
__attribute__((visibility("default"))) void init_hook_param(const void *param) {
|
||||
hook_params = reinterpret_cast<const HookImplParams *>(param);
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void init_gsl(void *alloc, void *alloc64, void *free) {
|
||||
gsl_memory_alloc_pure_sym = reinterpret_cast<gsl_memory_alloc_pure_t>(alloc);
|
||||
gsl_memory_alloc_pure_64_sym = reinterpret_cast<gsl_memory_alloc_pure_64_t>(alloc64);
|
||||
gsl_memory_free_pure_sym = reinterpret_cast<gsl_memory_free_pure_t>(free);
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void *hook_android_dlopen_ext(const char *filename, int flags, const android_dlextinfo *extinfo) {
|
||||
auto fallback{[&]() {
|
||||
LOGI("hook_android_dlopen_ext: falling back!");
|
||||
return android_dlopen_ext(filename, flags, extinfo);
|
||||
}};
|
||||
|
||||
LOGI("hook_android_dlopen_ext: filename: %s", filename);
|
||||
|
||||
if (!strstr(filename, "vulkan."))
|
||||
return android_dlopen_ext(filename, flags, extinfo);
|
||||
|
||||
if (extinfo->library_namespace == nullptr || !(extinfo->flags & ANDROID_DLEXT_USE_NAMESPACE)) {
|
||||
LOGI("hook_android_dlopen_ext: hook failed: namespace not supplied!");
|
||||
return fallback();
|
||||
}
|
||||
|
||||
auto driverNs{android_create_namespace(filename, hook_params->customDriverDir.c_str(),
|
||||
hook_params->hookLibDir.c_str(), ANDROID_NAMESPACE_TYPE_SHARED,
|
||||
nullptr, extinfo->library_namespace)};
|
||||
if (!driverNs) {
|
||||
LOGI("hook_android_dlopen_ext: hook failed: namespace not supplied!");
|
||||
return fallback();
|
||||
}
|
||||
|
||||
android_link_namespaces(driverNs, nullptr, "libandroid.so");
|
||||
|
||||
auto hookImpl{linkernsbypass_namespace_dlopen("libhook_impl.so", RTLD_NOW, driverNs)};
|
||||
if (!hookImpl)
|
||||
return nullptr;
|
||||
|
||||
auto initHookParam{reinterpret_cast<void (*)(const void *)>(dlsym(hookImpl, "init_hook_param"))};
|
||||
if (!initHookParam)
|
||||
return nullptr;
|
||||
|
||||
initHookParam(hook_params);
|
||||
|
||||
if (hook_params->featureFlags & ADRENOTOOLS_DRIVER_FILE_REDIRECT) {
|
||||
if (!linkernsbypass_namespace_dlopen("libfile_redirect_hook.so", RTLD_GLOBAL, driverNs)) {
|
||||
LOGI("hook_android_dlopen_ext: hook failed: failed to apply libfopen_redirect_hook!");
|
||||
return fallback();
|
||||
}
|
||||
|
||||
LOGI("hook_android_dlopen_ext: applied libfile_redirect_hook");
|
||||
}
|
||||
|
||||
auto newExtinfo{*extinfo};
|
||||
newExtinfo.library_namespace = driverNs;
|
||||
|
||||
if (hook_params->featureFlags & ADRENOTOOLS_DRIVER_GPU_MAPPING_IMPORT) {
|
||||
if (!linkernsbypass_namespace_dlopen("libgsl_alloc_hook.so", RTLD_GLOBAL, driverNs)) {
|
||||
LOGI("hook_android_dlopen_ext: hook failed: failed to apply libgsl_alloc_hook!");
|
||||
return fallback();
|
||||
}
|
||||
|
||||
auto libgslHandle{android_dlopen_ext("vkbgsl.so", RTLD_NOW, &newExtinfo)};
|
||||
if (!libgslHandle) {
|
||||
libgslHandle = android_dlopen_ext("notgsl.so", RTLD_NOW, &newExtinfo);
|
||||
if (!libgslHandle)
|
||||
libgslHandle = android_dlopen_ext("libgsl.so", RTLD_NOW, &newExtinfo);
|
||||
}
|
||||
|
||||
if (libgslHandle) {
|
||||
gsl_memory_alloc_pure_sym = reinterpret_cast<decltype(gsl_memory_alloc_pure_sym)>(dlsym(libgslHandle, "gsl_memory_alloc_pure"));
|
||||
gsl_memory_alloc_pure_64_sym = reinterpret_cast<decltype(gsl_memory_alloc_pure_64_sym)>(dlsym(libgslHandle, "gsl_memory_alloc_pure_64"));
|
||||
gsl_memory_free_pure_sym = reinterpret_cast<decltype(gsl_memory_free_pure_sym)>(dlsym(libgslHandle, "gsl_memory_free_pure"));
|
||||
if ((gsl_memory_alloc_pure_sym || gsl_memory_alloc_pure_64_sym) && gsl_memory_free_pure_sym) {
|
||||
auto initGsl{reinterpret_cast<void (*)(gsl_memory_alloc_pure_t, gsl_memory_alloc_pure_64_t, gsl_memory_free_pure_t)>(dlsym(hookImpl, "init_gsl"))};
|
||||
if (!initGsl)
|
||||
return fallback();
|
||||
|
||||
initGsl(gsl_memory_alloc_pure_sym, gsl_memory_alloc_pure_64_sym, gsl_memory_free_pure_sym);
|
||||
LOGI("hook_android_dlopen_ext: applied libgsl_alloc_hook");
|
||||
hook_params->nextGpuMapping->gpu_addr = ADRENOTOOLS_GPU_MAPPING_SUCCEEDED_MAGIC;
|
||||
}
|
||||
}
|
||||
|
||||
if (!((gsl_memory_alloc_pure_sym || gsl_memory_alloc_pure_64_sym) && gsl_memory_free_pure_sym))
|
||||
LOGI("hook_android_dlopen_ext: hook failed: failed to apply libgsl_alloc_hook!");
|
||||
}
|
||||
|
||||
if (hook_params->featureFlags & ADRENOTOOLS_DRIVER_CUSTOM) {
|
||||
LOGI("hook_android_dlopen_ext: loading custom driver: %s%s", hook_params->customDriverDir.c_str(), hook_params->customDriverName.c_str());
|
||||
void *handle{android_dlopen_ext(hook_params->customDriverName.c_str(), flags, &newExtinfo)};
|
||||
if (!handle) {
|
||||
LOGI("hook_android_dlopen_ext: hook failed: failed to load custom driver: %s!", dlerror());
|
||||
return fallback();
|
||||
}
|
||||
|
||||
return handle;
|
||||
} else {
|
||||
LOGI("hook_android_dlopen_ext: loading default driver: %s", filename);
|
||||
return android_dlopen_ext(filename, flags, &newExtinfo);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void *hook_android_load_sphal_library(const char *filename, int flags) {
|
||||
LOGI("hook_android_load_sphal_library: filename: %s", filename);
|
||||
|
||||
for (const char *name : {"sphal", "vendor", "default"}) {
|
||||
if (auto vendorNs{android_get_exported_namespace(name)}) {
|
||||
android_dlextinfo dlextinfo{
|
||||
.flags = ANDROID_DLEXT_USE_NAMESPACE,
|
||||
.library_namespace = vendorNs,
|
||||
};
|
||||
|
||||
return hook_android_dlopen_ext(filename, flags, &dlextinfo);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) FILE *hook_fopen(const char *filename, const char *mode) {
|
||||
if (!strncmp("/proc", filename, 5) || !strncmp("/sys", filename, 4)) {
|
||||
LOGI("hook_fopen: passthrough: %s", filename);
|
||||
return fopen(filename, mode);
|
||||
}
|
||||
|
||||
auto replacement{hook_params->fileRedirectDir + filename};
|
||||
LOGI("hook_fopen: %s -> %s", filename, replacement.c_str());
|
||||
|
||||
return fopen(replacement.c_str(), mode);
|
||||
}
|
||||
|
||||
static constexpr uintptr_t GslMemDescImportedPrivMagic{0xdeadb33f};
|
||||
struct GslMemDesc {
|
||||
void *hostptr;
|
||||
uint64_t gpuaddr;
|
||||
uint64_t size;
|
||||
uint64_t flags;
|
||||
uintptr_t priv;
|
||||
};
|
||||
|
||||
__attribute__((visibility("default"))) int hook_gsl_memory_alloc_pure_64(uint64_t size, uint32_t flags, void *memDesc) {
|
||||
auto gslMemDesc{reinterpret_cast<GslMemDesc *>(memDesc)};
|
||||
if (hook_params->nextGpuMapping && hook_params->nextGpuMapping->size == size && (hook_params->nextGpuMapping->flags & flags) == hook_params->nextGpuMapping->flags) {
|
||||
auto &nextMapping{*hook_params->nextGpuMapping};
|
||||
|
||||
gslMemDesc->hostptr = nextMapping.host_ptr;
|
||||
gslMemDesc->gpuaddr = nextMapping.gpu_addr;
|
||||
gslMemDesc->size = nextMapping.size;
|
||||
gslMemDesc->flags = nextMapping.flags;
|
||||
gslMemDesc->priv = GslMemDescImportedPrivMagic;
|
||||
hook_params->nextGpuMapping->size = 0;
|
||||
hook_params->nextGpuMapping->gpu_addr = ADRENOTOOLS_GPU_MAPPING_SUCCEEDED_MAGIC;
|
||||
return 0;
|
||||
} else {
|
||||
if (gsl_memory_alloc_pure_64_sym)
|
||||
return gsl_memory_alloc_pure_64_sym(size, flags, gslMemDesc);
|
||||
else
|
||||
return gsl_memory_alloc_pure_sym((uint32_t)size, flags, gslMemDesc);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) int hook_gsl_memory_free_pure(void *memDesc) {
|
||||
auto gslMemDesc{reinterpret_cast<GslMemDesc *>(memDesc)};
|
||||
|
||||
if (gslMemDesc->priv == GslMemDescImportedPrivMagic) {
|
||||
if (!kgsl_fd)
|
||||
kgsl_fd = open("/dev/kgsl-3d0", O_RDWR);
|
||||
|
||||
kgsl_gpumem_get_info info{
|
||||
.gpuaddr = gslMemDesc->gpuaddr
|
||||
};
|
||||
|
||||
if (ioctl(kgsl_fd, IOCTL_KGSL_GPUMEM_GET_INFO, &info) < 0) {
|
||||
LOGI("IOCTL_KGSL_GPUMEM_GET_INFO failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
kgsl_gpuobj_free args{
|
||||
.id = info.id,
|
||||
};
|
||||
|
||||
if (ioctl(kgsl_fd, IOCTL_KGSL_GPUOBJ_FREE, &args) < 0)
|
||||
LOGI("IOCTL_KGSL_GPUOBJ_FREE failed");
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return gsl_memory_free_pure_sym(memDesc);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <android/dlext.h>
|
||||
|
||||
void init_hook_param(const void *param);
|
||||
|
||||
void init_gsl(void *alloc, void *alloc64, void *free);
|
||||
|
||||
void *hook_android_dlopen_ext(const char *filename, int flags, const android_dlextinfo *extinfo);
|
||||
|
||||
void *hook_android_load_sphal_library(const char *filename, int flags);
|
||||
|
||||
FILE *hook_fopen(const char *filename, const char *mode);
|
||||
|
||||
int hook_gsl_memory_alloc_pure_64(uint64_t size, uint32_t flags, void *memDesc);
|
||||
|
||||
int hook_gsl_memory_free_pure(void *memDesc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// Copyright © 2021 Billy Laws
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <adrenotools/priv.h>
|
||||
|
||||
struct HookImplParams {
|
||||
int featureFlags;
|
||||
std::string tmpLibDir;
|
||||
std::string hookLibDir;
|
||||
std::string customDriverDir;
|
||||
std::string customDriverName;
|
||||
std::string fileRedirectDir;
|
||||
adrenotools_gpu_mapping *nextGpuMapping;
|
||||
|
||||
HookImplParams(int featureFlags, const char *tmpLibDir, const char *hookLibDir, const char *customDriverDir,
|
||||
const char *customDriverName, const char *fileRedirectDir, adrenotools_gpu_mapping *nextGpuMapping)
|
||||
: featureFlags(featureFlags),
|
||||
tmpLibDir(tmpLibDir ? tmpLibDir : ""),
|
||||
hookLibDir(hookLibDir),
|
||||
customDriverDir(customDriverDir ? customDriverDir : ""),
|
||||
customDriverName(customDriverName ? customDriverName : ""),
|
||||
fileRedirectDir(fileRedirectDir ? fileRedirectDir : ""),
|
||||
nextGpuMapping(nextGpuMapping) {}
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,9 +0,0 @@
|
||||
#include "hook_impl.h"
|
||||
|
||||
__attribute__((visibility("default"))) void *android_dlopen_ext(const char *filename, int flags, const android_dlextinfo *extinfo) {
|
||||
return hook_android_dlopen_ext(filename, flags, extinfo);
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void *android_load_sphal_library(const char *filename, int flags) {
|
||||
return hook_android_load_sphal_library(filename, flags);
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
hook_impl_files = files(['hook_impl.cpp', 'hook_impl.h', 'hook_impl_params.h'])
|
||||
hook_impl_inc = include_directories('../../include')
|
||||
|
||||
|
||||
main_hook_files = files(['main_hook.c'])
|
||||
|
||||
file_redirect_hook_files = files(['file_redirect_hook.c'])
|
||||
|
||||
gsl_alloc_hook_files = files(['gsl_alloc_hook.c'])
|
||||
|
||||
hook_impl_lib = shared_library(
|
||||
'hook_impl',
|
||||
hook_impl_files,
|
||||
c_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
cpp_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
dependencies: ([linkernsbypass_dep, liblog_dep]),
|
||||
include_directories: ([hook_impl_inc]),
|
||||
install: true
|
||||
)
|
||||
|
||||
hook_impl_dep = declare_dependency(
|
||||
link_args: (['-z', 'global']),
|
||||
link_with: ([hook_impl_lib]),
|
||||
include_directories: hook_impl_inc,
|
||||
)
|
||||
|
||||
main_hook_lib = shared_library(
|
||||
'main_hook',
|
||||
main_hook_files,
|
||||
c_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
cpp_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
dependencies: ([hook_impl_dep]),
|
||||
install: true
|
||||
)
|
||||
|
||||
file_redirect_hook_lib = shared_library(
|
||||
'file_redirect_hook',
|
||||
file_redirect_hook_files,
|
||||
c_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
cpp_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
dependencies: ([hook_impl_dep]),
|
||||
install: true
|
||||
)
|
||||
|
||||
gsl_alloc_hook_lib = shared_library(
|
||||
'gsl_alloc_hook',
|
||||
gsl_alloc_hook_files,
|
||||
c_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
cpp_args: (['-fvisibility=hidden', '-Wall', '-Wextra']),
|
||||
dependencies: ([hook_impl_dep]),
|
||||
install: true
|
||||
)
|
||||
@@ -1,96 +0,0 @@
|
||||
# Android Driver Package Format
|
||||
|
||||
## Contents
|
||||
- `meta.json` that follows `Schema`
|
||||
- `<driver>.so` main driver shared library
|
||||
- `*.so` all libraries depended on by the main driver library, these must have their sonames altered if they wish to replace the system version of the library
|
||||
|
||||
## Example
|
||||
- `meta.json`:
|
||||
```json
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"name": "Qualcomm v615 Vulkan driver",
|
||||
"description": "Proprietary Vulkan driver for Adreno 6xx and Adreno 7xx",
|
||||
"author": "ByLaws",
|
||||
"packageVersion": "2",
|
||||
"vendor": "Qualcomm",
|
||||
"driverVersion": "0.615.0",
|
||||
"minApi": 27,
|
||||
"libraryName": "vulkan.ad0615.so"
|
||||
}
|
||||
```
|
||||
|
||||
- `vulkan.ad0615.so`: main patched driver
|
||||
- `notadreno_utils.so`, `notdmabufheap.so`, `notgsl.so`, `notllvm-glnext.so`, `notllvm-qgl.so`: patched-soname versions of libraries specific to each driver version
|
||||
- `android.hardware.graphics.mappershim.so`, `vendor.qti.hardware.display.mapperextensionsshim.so`, `vendor.qti.hardware.display.mappershim.so`: qtimapper-shim libs
|
||||
|
||||
## Creation
|
||||
I recommend running blob-patcher.py to patch a set of blobs from a device dump with mapper ver as 5, then copying in the qtimapper-shim files from the adrenotools releases page.
|
||||
```bash
|
||||
$ mkdir outpkg
|
||||
$ patch.py <device dump> outpkg vulkan.adreno.so vulkan.ad0615.so 1
|
||||
$ vim outpkg/meta.json
|
||||
$ cp qtimapper-shim-rel/* outpkg
|
||||
```
|
||||
|
||||
## Schema
|
||||
```json
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "ADPKG Schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"schemaVersion": {
|
||||
"type": "number",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "Qualcomm Adreno Driver"
|
||||
},
|
||||
"vendor": {
|
||||
"enum": [
|
||||
"Qualcomm",
|
||||
"Mesa"
|
||||
],
|
||||
},
|
||||
"driverVersion": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9]+.[0-9]+.[0-9]+(-.+)?$",
|
||||
"example": "512.604.0"
|
||||
},
|
||||
"author": {
|
||||
"type": "string",
|
||||
"example": "Billy Laws"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Additional description of the driver, this shouldn't contain redundant information that is already covered by the other fields such as the version and only denote details important for the user"
|
||||
},
|
||||
"packageVersion": {
|
||||
"type": "string",
|
||||
"example": "3029-bylaws"
|
||||
},
|
||||
"minApi": {
|
||||
"type": "number",
|
||||
"description": "The minimum Android API version required by the driver to function correctly",
|
||||
"example": 27
|
||||
},
|
||||
"libraryName": {
|
||||
"type": "string",
|
||||
"description": "The name of the main shared library object",
|
||||
"example": "vulkan.adreno.so"
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"schemaVersion",
|
||||
"name",
|
||||
"author",
|
||||
"packageVersion",
|
||||
"vendor",
|
||||
"driverVersion",
|
||||
"minApi",
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -1,7 +0,0 @@
|
||||
## Tools for working with the Adreno Vulkan blob
|
||||
|
||||
blob-patcher.py is a script for generating adrenotools loadable drivers from an extracted ROM zip
|
||||
qtimapper-shim allows newer drivers to work on devices that lack support for the new mapper HAL
|
||||
acc-shim allows for suppling arguments to the underlying LLVM-based shader compiler library
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
## Adreno Compiler Collection parameter shim
|
||||
|
||||
### TODO
|
||||
Make some sort of API for this so parameters can be changed through adrenotools in realtime.
|
||||
|
||||
### Compilation
|
||||
```
|
||||
$ sed -i 's/libllvm-glnext/notreal-glnext/g' libllvm-glnext.so
|
||||
$ mv libllvm-glnext.so notreal-glnext.so
|
||||
$ aarch64-linux-android28-clang vk_acc_shim.cpp -o notllvm-glnext.so --shared -fpic
|
||||
$ sed -i 's/libllvm-glnext/notllvm-glnext/g' vulkan.adreno.so
|
||||
```
|
||||
@@ -1,104 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
#include <android/log.h>
|
||||
|
||||
thread_local int satisfy_driver_emutls;
|
||||
|
||||
enum class OptionType : uint32_t {
|
||||
ArgsStringList = 1,
|
||||
QcArgsString = 4,
|
||||
OptLevelInt = 0x101,
|
||||
NoOptsInt = 0x10D,
|
||||
};
|
||||
|
||||
struct StringListVal {
|
||||
uint32_t len;
|
||||
const char **entry;
|
||||
};
|
||||
|
||||
struct Option
|
||||
{
|
||||
OptionType type;
|
||||
union {
|
||||
bool boolVal;
|
||||
int intVal;
|
||||
float floatVal;
|
||||
StringListVal *strVals;
|
||||
const char *strVal;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct OptionsSet
|
||||
{
|
||||
Option *options;
|
||||
uint32_t num;
|
||||
};
|
||||
|
||||
|
||||
int CompileHook(void *state, OptionsSet *opts);
|
||||
|
||||
decltype(CompileHook) *OrigCompile{};
|
||||
|
||||
int CompileHook(void *state, OptionsSet *opts) {
|
||||
constexpr size_t ReplacementOptsNum = 201;
|
||||
|
||||
Option replacementOpts[ReplacementOptsNum];
|
||||
uint32_t patchedOptNum{};
|
||||
|
||||
const char *argv[] = {"-help", "-help-hidden", "", NULL };
|
||||
StringListVal listVal{
|
||||
.len = 3,
|
||||
.entry = argv,
|
||||
};
|
||||
|
||||
replacementOpts[patchedOptNum++] = {
|
||||
.type = OptionType::ArgsStringList,
|
||||
.strVals = &listVal
|
||||
};
|
||||
|
||||
const char *opt ="Verbose=true Quiet=false";
|
||||
replacementOpts[patchedOptNum++] = {
|
||||
.type = OptionType::QcArgsString,
|
||||
.strVal = opt
|
||||
};
|
||||
|
||||
if (opts->num + patchedOptNum > ReplacementOptsNum)
|
||||
__builtin_trap();
|
||||
|
||||
memcpy(&replacementOpts[patchedOptNum], opts->options, sizeof(Option) * opts->num);
|
||||
|
||||
OptionsSet optList{
|
||||
.options = replacementOpts,
|
||||
.num = opts->num + patchedOptNum
|
||||
};
|
||||
|
||||
return OrigCompile(state, &optList);
|
||||
}
|
||||
|
||||
|
||||
struct LlvmInterface {
|
||||
uint32_t unk0[3];
|
||||
void *makeContext;
|
||||
void *delContext;
|
||||
decltype(CompileHook) *compile;
|
||||
void *unk;
|
||||
};
|
||||
|
||||
extern "C" int LoadACC(LlvmInterface *impl);
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) int LoadACC(LlvmInterface *impl) {
|
||||
void *hnd = dlopen("notreal-glnext.so", RTLD_NOW);
|
||||
|
||||
auto origLoadACC = reinterpret_cast<decltype(LoadACC) *>(dlsym(hnd, "LoadACC"));
|
||||
if (!origLoadACC)
|
||||
__builtin_trap();
|
||||
|
||||
int ret = origLoadACC(impl);
|
||||
|
||||
OrigCompile = impl->compile;
|
||||
impl->compile = &CompileHook;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import sys, os
|
||||
|
||||
def patch_lib_base(in_dir, out_dir, libs, in_name, out_name):
|
||||
with open(in_dir + in_name, "rb") as inf:
|
||||
with open(out_dir + out_name, "wb") as outf:
|
||||
content = inf.read()
|
||||
for lib in libs:
|
||||
print(out_name + ": repl:", lib[0], "->", lib[1])
|
||||
content = content.replace(lib[0].encode(), lib[1].encode())
|
||||
|
||||
content = content.replace(in_name.encode(), out_name.encode())
|
||||
outf.write(content);
|
||||
|
||||
def patch_lib(in_dir, out_dir, libs, name):
|
||||
patch_lib_base(in_dir, out_dir, libs, "lib" + name + ".so", "not" + name + ".so")
|
||||
|
||||
def patch_references(lib_dir, out_dir, vulkan_libname, vulkan_newname, shim_mapper):
|
||||
try:
|
||||
os.mkdir(out_dir)
|
||||
os.mkdir(out_dir + "/hw")
|
||||
except:
|
||||
pass
|
||||
|
||||
replacement_list = [("libgsl.so", "notgsl.so"), ("libllvm-glnext.so", "notllvm-glnext.so"), ("libdmabufheap.so", "notdmabufheap.so"), ("libadreno_utils.so", "notadreno_utils.so"), ("libllvm-qgl.so", "notllvm-qgl.so")]
|
||||
|
||||
if (shim_mapper < 2):
|
||||
replacement_list += [("vendor.qti.hardware.display.mapper@2.0.so", "vendor.qti.hardware.display.mappershim.so"),
|
||||
("android.hardware.graphics.mapper@2.0.so", "android.hardware.graphics.mappershim.so"),
|
||||
("vendor.qti.hardware.display.mapperextensions@1.0.so", "vendor.qti.hardware.display.mapperextensionsshim.so"),
|
||||
("vendor.qti.hardware.display.mapperextensions@1.1.so", "vendor.qti.hardware.display.mapperextensionsshim.so")]
|
||||
if (shim_mapper < 3):
|
||||
replacement_list += [("vendor.qti.hardware.display.mapper@3.0.so", "vendor.qti.hardware.display.mappershim.so"),
|
||||
("android.hardware.graphics.mapper@3.0.so", "android.hardware.graphics.mappershim.so")]
|
||||
if (shim_mapper < 4):
|
||||
replacement_list += [("vendor.qti.hardware.display.mapper@4.0.so", "vendor.qti.hardware.display.mappershim.so"),
|
||||
("android.hardware.graphics.mapper@4.0.so", "android.hardware.graphics.mappershim.so")]
|
||||
|
||||
for lib in ["gsl", "llvm-glnext", "dmabufheap", "adreno_utils", "llvm-qgl"]:
|
||||
try:
|
||||
patch_lib(lib_dir, out_dir, replacement_list, lib)
|
||||
except:
|
||||
pass
|
||||
|
||||
patch_lib_base(lib_dir + "/hw/", out_dir + "/hw/", replacement_list, vulkan_libname, vulkan_newname)
|
||||
|
||||
if (len(sys.argv)!= 6):
|
||||
print("<in> <out> <vk soname> <vk soname new> <device mapper ver>")
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
||||
root_path = sys.argv[1]
|
||||
out_path = sys.argv[2]
|
||||
vulkan_libname = sys.argv[3]
|
||||
vulkan_newname = sys.argv[4]
|
||||
shim_mapper = int(sys.argv[5])
|
||||
vendor_path = root_path + "/vendor/"
|
||||
|
||||
if (len(vulkan_newname) != len(vulkan_libname)):
|
||||
print("Errror")
|
||||
sys.exit()
|
||||
|
||||
for libdir in ["/lib64/", "/lib/"]:
|
||||
patch_references(vendor_path + libdir, out_path + libdir, vulkan_libname, vulkan_newname, shim_mapper)
|
||||
print("done!")
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
BasedOnStyle: Google
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: NOLINT:.*
|
||||
DerivePointerAlignment: false
|
||||
IndentWidth: 2
|
||||
PointerAlignment: Left
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
@@ -1,37 +0,0 @@
|
||||
cc_defaults {
|
||||
name: "shim_defaults",
|
||||
|
||||
srcs: [
|
||||
"shim.cpp",
|
||||
"ext/gr_utils.cpp",
|
||||
"ext/gr_adreno_info.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libcutils",
|
||||
"libhidlbase",
|
||||
"libhardware",
|
||||
"libutils",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-Wno-error",
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "vendor.qti.hardware.display.mappershim",
|
||||
defaults: ["shim_defaults"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "vendor.qti.hardware.display.mapperextensionsshim",
|
||||
defaults: ["shim_defaults"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.graphics.mappershim",
|
||||
defaults: ["shim_defaults"],
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
## QtiMapper-shim
|
||||
|
||||
A shim that translates between the IQtiMapper(2,3,4) API used by newer Adreno graphics drivers and gralloc1, which is the only available gralloc API on sdm845.
|
||||
|
||||
### Method
|
||||
|
||||
Exposes the same ABI as the newer mapper blobs and stubs enough functions to force the HAL to fallback to the 2.0 mapper/mapperextension API which is then shimmed with a passthrough to gralloc1. The blobs can then be patched to load the stub libs instead, see the blob-patcher script.
|
||||
The code is fairly ugly but functional enough for the purpose, some functions are missing and will need to be implemented in the case that the driver starts using them.
|
||||
|
||||
|
||||
### Building
|
||||
|
||||
Chuck into a lineage tree, then:
|
||||
```
|
||||
make vendor.qti.hardware.display.mappershim
|
||||
make vendor.qti.hardware.display.mapperextensionsshim
|
||||
make android.hardware.graphics.mappershim
|
||||
```
|
||||
and grab SOs out of outputs dir
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __QTIGRALLOCDEFS_H__
|
||||
#define __QTIGRALLOCDEFS_H__
|
||||
|
||||
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC (UINT32_C(1) << 28)
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_UNCACHED (UINT32_C(1) << 29)
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_10BIT (UINT32_C(1) << 30)
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY (UINT32_C(1) << 31)
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER 1ULL << 48
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_MM_HEAP 0
|
||||
#define GRALLOC_USAGE_PRIVATE_IOMMU_HEAP 0
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_WFD 1ULL << 51
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_HEIF (UINT32_C(1) << 27)
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_10BIT_TP 0
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI 1ULL << 49
|
||||
|
||||
#define GRALLOC_USAGE_PRIVATE_CDSP 1ULL << 50
|
||||
|
||||
#define HAL_PIXEL_FORMAT_RGBA_5551 6
|
||||
#define HAL_PIXEL_FORMAT_RGBA_4444 7
|
||||
#define HAL_PIXEL_FORMAT_NV12_ENCODEABLE 0x102
|
||||
#define HAL_PIXEL_FORMAT_NV21_ENCODEABLE 0x7FA30C00
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS 0x7FA30C04
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED 0x7FA30C03
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP 0x109
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO 0x7FA30C01
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_422_SP 0x10B
|
||||
#define HAL_PIXEL_FORMAT_R_8 0x10D
|
||||
#define HAL_PIXEL_FORMAT_RG_88 0x10E
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_444_SP 0x10F
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_444_SP 0x110
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_422_I 0x111
|
||||
#define HAL_PIXEL_FORMAT_BGRX_8888 0x112
|
||||
#define HAL_PIXEL_FORMAT_NV21_ZSL 0x113
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS 0x114
|
||||
#define HAL_PIXEL_FORMAT_BGR_565 0x115
|
||||
#define HAL_PIXEL_FORMAT_RAW8 0x123
|
||||
#define HAL_PIXEL_FORMAT_NV12_HEIF 0x116
|
||||
|
||||
#define HAL_PIXEL_FORMAT_ARGB_2101010 0x117
|
||||
#define HAL_PIXEL_FORMAT_RGBX_1010102 0x118
|
||||
#define HAL_PIXEL_FORMAT_XRGB_2101010 0x119
|
||||
#define HAL_PIXEL_FORMAT_BGRA_1010102 0x11A
|
||||
#define HAL_PIXEL_FORMAT_ABGR_2101010 0x11B
|
||||
#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
|
||||
#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x36
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC 0x124
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS 0x7FA30C0A
|
||||
|
||||
#define HAL_PIXEL_FORMAT_CbYCrY_422_I 0x120
|
||||
#define HAL_PIXEL_FORMAT_BGR_888 0x121
|
||||
|
||||
#define HAL_PIXEL_FORMAT_INTERLACE 0x180
|
||||
|
||||
#define HAL_PIXEL_FORMAT_NV12_LINEAR_FLEX 0x125
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX 0x126
|
||||
#define HAL_PIXEL_FORMAT_MULTIPLANAR_FLEX 0x127
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_2_BATCH 0x128
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_4_BATCH 0x129
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_8_BATCH 0x130
|
||||
|
||||
#define HAL_PIXEL_FORMAT_RGB888_UBWC_FSC 0x131
|
||||
#define HAL_PIXEL_FORMAT_RGB101010_UBWC_FSC 0x132
|
||||
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT 0x4C595559
|
||||
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT_COMPRESSED 0x43574259
|
||||
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x7FA30C09
|
||||
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
|
||||
|
||||
enum { BUFFER_TYPE_UI = 0, BUFFER_TYPE_VIDEO };
|
||||
|
||||
#endif
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
|
||||
#include "types/common.h"
|
||||
|
||||
using namespace android::hardware;
|
||||
using namespace android;
|
||||
|
||||
struct IBase : virtual public RefBase {
|
||||
virtual bool isRemote() const;
|
||||
|
||||
using interfaceChain_cb = std::function<void(const hidl_vec<hidl_string>& descriptors)>;
|
||||
virtual Return<void> interfaceChain(interfaceChain_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using interfaceDescriptor_cb = std::function<void(const hidl_string& descriptor)>;
|
||||
virtual Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getHashChain_cb = std::function<void(const hidl_vec<hidl_array<uint8_t, 32>>& hashchain)>;
|
||||
virtual Return<void> getHashChain(getHashChain_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> setHALInstrumentation() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<bool> linkToDeath(const sp<hidl_death_recipient>& recipient, uint64_t cookie) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> ping() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getDebugInfo_cb = std::function<void(const hidl::base::V1_0::DebugInfo& info)>;
|
||||
virtual Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> notifySyspropsChanged() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<bool> unlinkToDeath(const sp<hidl_death_recipient>& recipient) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
};
|
||||
@@ -1,339 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "gr_adreno_info.h"
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <dlfcn.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "gr_utils.h"
|
||||
#include "gralloc_priv.h"
|
||||
|
||||
using std::lock_guard;
|
||||
using std::mutex;
|
||||
|
||||
namespace gralloc {
|
||||
|
||||
AdrenoMemInfo* AdrenoMemInfo::s_instance = nullptr;
|
||||
|
||||
AdrenoMemInfo* AdrenoMemInfo::GetInstance() {
|
||||
static mutex s_lock;
|
||||
lock_guard<mutex> obj(s_lock);
|
||||
if (!s_instance) {
|
||||
s_instance = new AdrenoMemInfo();
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
AdrenoMemInfo::AdrenoMemInfo() {
|
||||
libadreno_utils_ = ::dlopen("libadreno_utils.so", RTLD_NOW);
|
||||
if (libadreno_utils_) {
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_aligned_width_and_height) =
|
||||
::dlsym(libadreno_utils_, "compute_aligned_width_and_height");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_fmt_aligned_width_and_height) =
|
||||
::dlsym(libadreno_utils_, "compute_fmt_aligned_width_and_height");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_padding) =
|
||||
::dlsym(libadreno_utils_, "compute_surface_padding");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_compressedfmt_aligned_width_and_height) =
|
||||
::dlsym(libadreno_utils_, "compute_compressedfmt_aligned_width_and_height");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_isUBWCSupportedByGpu) =
|
||||
::dlsym(libadreno_utils_, "isUBWCSupportedByGpu");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_get_gpu_pixel_alignment) =
|
||||
::dlsym(libadreno_utils_, "get_gpu_pixel_alignment");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_get_metadata_blob_size) =
|
||||
::dlsym(libadreno_utils_, "adreno_get_metadata_blob_size");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_init_memory_layout) =
|
||||
::dlsym(libadreno_utils_, "adreno_init_memory_layout");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_get_aligned_gpu_buffer_size) =
|
||||
::dlsym(libadreno_utils_, "adreno_get_aligned_gpu_buffer_size");
|
||||
} else {
|
||||
ALOGE(" Failed to load libadreno_utils.so");
|
||||
}
|
||||
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
property_get(DISABLE_UBWC_PROP, property, "0");
|
||||
if (!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
|
||||
!(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
|
||||
gfx_ubwc_disable_ = true;
|
||||
}
|
||||
|
||||
property_get(DISABLE_AHARDWAREBUFFER_PROP, property, "0");
|
||||
if (!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
|
||||
!(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
|
||||
gfx_ahardware_buffer_disable_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
AdrenoMemInfo::~AdrenoMemInfo() {
|
||||
if (libadreno_utils_) {
|
||||
::dlclose(libadreno_utils_);
|
||||
}
|
||||
}
|
||||
|
||||
void AdrenoMemInfo::AlignUnCompressedRGB(int width, int height, int format, int tile_enabled,
|
||||
unsigned int* aligned_w, unsigned int* aligned_h) {
|
||||
*aligned_w = (unsigned int)ALIGN(width, 32);
|
||||
*aligned_h = (unsigned int)ALIGN(height, 32);
|
||||
|
||||
int bpp = 4;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_BGR_888:
|
||||
bpp = 3;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
bpp = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int raster_mode = 0;
|
||||
int padding_threshold = 512;
|
||||
|
||||
|
||||
if (LINK_adreno_compute_fmt_aligned_width_and_height) {
|
||||
LINK_adreno_compute_fmt_aligned_width_and_height(
|
||||
width, height, 0 , GetGpuPixelFormat(format), 1 , tile_enabled,
|
||||
raster_mode, padding_threshold, reinterpret_cast<int*>(aligned_w),
|
||||
reinterpret_cast<int*>(aligned_h));
|
||||
} else if (LINK_adreno_compute_aligned_width_and_height) {
|
||||
LINK_adreno_compute_aligned_width_and_height(
|
||||
width, height, bpp, tile_enabled, raster_mode, padding_threshold,
|
||||
reinterpret_cast<int*>(aligned_w), reinterpret_cast<int*>(aligned_h));
|
||||
} else if (LINK_adreno_compute_padding) {
|
||||
int surface_tile_height = 1;
|
||||
*aligned_w = UINT(LINK_adreno_compute_padding(width, bpp, surface_tile_height, raster_mode,
|
||||
padding_threshold));
|
||||
ALOGW("%s: Warning!! Old GFX API is used to calculate stride", __FUNCTION__);
|
||||
} else {
|
||||
ALOGW(
|
||||
"%s: Warning!! Symbols compute_surface_padding and "
|
||||
"compute_fmt_aligned_width_and_height and "
|
||||
"compute_aligned_width_and_height not found",
|
||||
__FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
void AdrenoMemInfo::AlignCompressedRGB(int width, int height, int format, unsigned int* aligned_w,
|
||||
unsigned int* aligned_h) {
|
||||
if (LINK_adreno_compute_compressedfmt_aligned_width_and_height) {
|
||||
int bytesPerPixel = 0;
|
||||
int raster_mode = 0;
|
||||
int padding_threshold = 512;
|
||||
|
||||
|
||||
LINK_adreno_compute_compressedfmt_aligned_width_and_height(
|
||||
width, height, format, 0, raster_mode, padding_threshold, reinterpret_cast<int*>(aligned_w),
|
||||
reinterpret_cast<int*>(aligned_h), &bytesPerPixel);
|
||||
} else {
|
||||
*aligned_w = (unsigned int)ALIGN(width, 32);
|
||||
*aligned_h = (unsigned int)ALIGN(height, 32);
|
||||
ALOGW("%s: Warning!! compute_compressedfmt_aligned_width_and_height not found", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
bool AdrenoMemInfo::IsUBWCSupportedByGPU(int format) {
|
||||
if (!gfx_ubwc_disable_ && LINK_adreno_isUBWCSupportedByGpu) {
|
||||
ADRENOPIXELFORMAT gpu_format = GetGpuPixelFormat(format);
|
||||
return LINK_adreno_isUBWCSupportedByGpu(gpu_format);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t AdrenoMemInfo::GetGpuPixelAlignment() {
|
||||
if (LINK_adreno_get_gpu_pixel_alignment) {
|
||||
return LINK_adreno_get_gpu_pixel_alignment();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ADRENOPIXELFORMAT AdrenoMemInfo::GetGpuPixelFormat(int hal_format) {
|
||||
switch (hal_format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
return ADRENO_PIXELFORMAT_R8G8B8A8;
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
return ADRENO_PIXELFORMAT_R8G8B8X8;
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
return ADRENO_PIXELFORMAT_B8G8R8A8_UNORM;
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
return ADRENO_PIXELFORMAT_R8G8B8;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
return ADRENO_PIXELFORMAT_B5G6R5;
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
return ADRENO_PIXELFORMAT_R5G6B5;
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
return ADRENO_PIXELFORMAT_R5G5B5A1;
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
return ADRENO_PIXELFORMAT_R4G4B4A4;
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
return ADRENO_PIXELFORMAT_R10G10B10A2_UNORM;
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
return ADRENO_PIXELFORMAT_R10G10B10X2_UNORM;
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
return ADRENO_PIXELFORMAT_A2B10G10R10_UNORM;
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
return ADRENO_PIXELFORMAT_R16G16B16A16_FLOAT;
|
||||
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
|
||||
return ADRENO_PIXELFORMAT_NV12;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
|
||||
return ADRENO_PIXELFORMAT_NV12_EXT;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
|
||||
return ADRENO_PIXELFORMAT_TP10;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS:
|
||||
return ADRENO_PIXELFORMAT_P010;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_16:
|
||||
return ADRENO_PIXELFORMAT_D16_UNORM;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24:
|
||||
return ADRENO_PIXELFORMAT_D24_UNORM_X8_UINT;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
|
||||
return ADRENO_PIXELFORMAT_D24_UNORM_S8_UINT;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_32F:
|
||||
return ADRENO_PIXELFORMAT_D32_FLOAT;
|
||||
case HAL_PIXEL_FORMAT_STENCIL_8:
|
||||
return ADRENO_PIXELFORMAT_S8_UINT;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_4X4;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_4X4_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X4;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X4_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X6;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X6_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X6;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X6_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X8;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X8_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X6;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X6_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X8;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X8_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X10;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X10_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X10;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X10_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X12;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X12_SRGB;
|
||||
default:
|
||||
ALOGE("%s: No map for format: 0x%x", __FUNCTION__, hal_format);
|
||||
break;
|
||||
}
|
||||
|
||||
return ADRENO_PIXELFORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
uint32_t AdrenoMemInfo::AdrenoGetMetadataBlobSize() {
|
||||
if (LINK_adreno_get_metadata_blob_size) {
|
||||
return LINK_adreno_get_metadata_blob_size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AdrenoMemInfo::AdrenoInitMemoryLayout(void* metadata_blob, int width, int height, int depth,
|
||||
int format, int num_samples, int isUBWC, uint64_t usage,
|
||||
uint32_t num_planes) {
|
||||
if (LINK_adreno_init_memory_layout) {
|
||||
surface_tile_mode_t tile_mode = static_cast<surface_tile_mode_t>(isUBWC);
|
||||
return LINK_adreno_init_memory_layout(metadata_blob, width, height, depth,
|
||||
GetGpuPixelFormat(format), num_samples, tile_mode, usage,
|
||||
num_planes);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t AdrenoMemInfo::AdrenoGetAlignedGpuBufferSize(void* metadata_blob) {
|
||||
if (LINK_adreno_get_aligned_gpu_buffer_size) {
|
||||
return LINK_adreno_get_aligned_gpu_buffer_size(metadata_blob);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AdrenoMemInfo::AdrenoSizeAPIAvaliable() {
|
||||
if (gfx_ahardware_buffer_disable_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (LINK_adreno_get_metadata_blob_size && LINK_adreno_init_memory_layout &&
|
||||
LINK_adreno_get_aligned_gpu_buffer_size);
|
||||
}
|
||||
|
||||
bool AdrenoMemInfo::IsPISupportedByGPU(int format, uint64_t usage) {
|
||||
if (LINK_adreno_isPISupportedByGpu) {
|
||||
return LINK_adreno_isPISupportedByGpu(format, usage);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __GR_ADRENO_INFO_H__
|
||||
#define __GR_ADRENO_INFO_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace gralloc {
|
||||
|
||||
typedef enum {
|
||||
ADRENO_PIXELFORMAT_UNKNOWN = 0,
|
||||
ADRENO_PIXELFORMAT_R16G16B16A16_FLOAT = 10,
|
||||
ADRENO_PIXELFORMAT_R10G10B10A2_UNORM = 24,
|
||||
ADRENO_PIXELFORMAT_R8G8B8A8 = 28,
|
||||
ADRENO_PIXELFORMAT_R8G8B8A8_SRGB = 29,
|
||||
ADRENO_PIXELFORMAT_D32_FLOAT = 40,
|
||||
ADRENO_PIXELFORMAT_D24_UNORM_S8_UINT = 45,
|
||||
ADRENO_PIXELFORMAT_D16_UNORM = 55,
|
||||
ADRENO_PIXELFORMAT_B5G6R5 = 85,
|
||||
ADRENO_PIXELFORMAT_B5G5R5A1 = 86,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8_UNORM = 87,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8 = 90,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8_SRGB = 91,
|
||||
ADRENO_PIXELFORMAT_B8G8R8X8_SRGB = 93,
|
||||
ADRENO_PIXELFORMAT_NV12 = 103,
|
||||
ADRENO_PIXELFORMAT_P010 = 104,
|
||||
ADRENO_PIXELFORMAT_YUY2 = 107,
|
||||
ADRENO_PIXELFORMAT_B4G4R4A4 = 115,
|
||||
ADRENO_PIXELFORMAT_NV12_EXT = 506,
|
||||
ADRENO_PIXELFORMAT_R8G8B8X8 = 507,
|
||||
ADRENO_PIXELFORMAT_R8G8B8 = 508,
|
||||
ADRENO_PIXELFORMAT_A1B5G5R5 = 519,
|
||||
ADRENO_PIXELFORMAT_R8G8B8X8_SRGB = 520,
|
||||
ADRENO_PIXELFORMAT_R8G8B8_SRGB = 521,
|
||||
ADRENO_PIXELFORMAT_A2B10G10R10_UNORM = 532,
|
||||
ADRENO_PIXELFORMAT_R10G10B10X2_UNORM = 537,
|
||||
ADRENO_PIXELFORMAT_D24_UNORM_X8_UINT = 548,
|
||||
ADRENO_PIXELFORMAT_D24_UNORM = 549,
|
||||
ADRENO_PIXELFORMAT_D32_FLOAT_X24S8_UINT = 551,
|
||||
ADRENO_PIXELFORMAT_S8_UINT = 552,
|
||||
ADRENO_PIXELFORMAT_ASTC_4X4 = 568,
|
||||
ADRENO_PIXELFORMAT_ASTC_5X4 = 569,
|
||||
ADRENO_PIXELFORMAT_ASTC_5X5 = 570,
|
||||
ADRENO_PIXELFORMAT_ASTC_6X5 = 571,
|
||||
ADRENO_PIXELFORMAT_ASTC_6X6 = 572,
|
||||
ADRENO_PIXELFORMAT_ASTC_8X5 = 573,
|
||||
ADRENO_PIXELFORMAT_ASTC_8X6 = 574,
|
||||
ADRENO_PIXELFORMAT_ASTC_8X8 = 575,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X5 = 576,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X6 = 577,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X8 = 578,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X10 = 579,
|
||||
ADRENO_PIXELFORMAT_ASTC_12X10 = 580,
|
||||
ADRENO_PIXELFORMAT_ASTC_12X12 = 581,
|
||||
ADRENO_PIXELFORMAT_ASTC_4X4_SRGB = 582,
|
||||
ADRENO_PIXELFORMAT_ASTC_5X4_SRGB = 583,
|
||||
ADRENO_PIXELFORMAT_ASTC_5X5_SRGB = 584,
|
||||
ADRENO_PIXELFORMAT_ASTC_6X5_SRGB = 585,
|
||||
ADRENO_PIXELFORMAT_ASTC_6X6_SRGB = 586,
|
||||
ADRENO_PIXELFORMAT_ASTC_8X5_SRGB = 587,
|
||||
ADRENO_PIXELFORMAT_ASTC_8X6_SRGB = 588,
|
||||
ADRENO_PIXELFORMAT_ASTC_8X8_SRGB = 589,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X5_SRGB = 590,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X6_SRGB = 591,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X8_SRGB = 592,
|
||||
ADRENO_PIXELFORMAT_ASTC_10X10_SRGB = 593,
|
||||
ADRENO_PIXELFORMAT_ASTC_12X10_SRGB = 594,
|
||||
ADRENO_PIXELFORMAT_ASTC_12X12_SRGB = 595,
|
||||
|
||||
ADRENO_PIXELFORMAT_R5G6B5 = 610,
|
||||
ADRENO_PIXELFORMAT_R5G5B5A1 = 611,
|
||||
ADRENO_PIXELFORMAT_R4G4B4A4 = 612,
|
||||
ADRENO_PIXELFORMAT_UYVY = 614,
|
||||
ADRENO_PIXELFORMAT_NV21 = 619,
|
||||
ADRENO_PIXELFORMAT_Y8U8V8A8 = 620,
|
||||
ADRENO_PIXELFORMAT_Y8 = 625,
|
||||
ADRENO_PIXELFORMAT_TP10 = 654,
|
||||
} ADRENOPIXELFORMAT;
|
||||
|
||||
typedef enum {
|
||||
SURFACE_TILE_MODE_DISABLE = 0x0,
|
||||
SURFACE_TILE_MODE_ENABLE = 0x1
|
||||
} surface_tile_mode_t;
|
||||
|
||||
class AdrenoMemInfo {
|
||||
public:
|
||||
void GetAlignedWidthAndHeight(int width, int height, int format, int usage,
|
||||
unsigned int* aligned_w, unsigned int* aligned_h, bool ubwc_enabled,
|
||||
bool tile_enabled);
|
||||
|
||||
void AlignUnCompressedRGB(int width, int height, int format, int tileEnabled,
|
||||
unsigned int* aligned_w, unsigned int* aligned_h);
|
||||
|
||||
void AlignCompressedRGB(int width, int height, int format, unsigned int* aligned_w,
|
||||
unsigned int* aligned_h);
|
||||
|
||||
uint32_t GetGpuPixelAlignment();
|
||||
|
||||
bool IsUBWCSupportedByGPU(int format);
|
||||
|
||||
bool IsPISupportedByGPU(int format, uint64_t usage);
|
||||
ADRENOPIXELFORMAT GetGpuPixelFormat(int hal_format);
|
||||
|
||||
uint32_t AdrenoGetMetadataBlobSize();
|
||||
|
||||
int AdrenoInitMemoryLayout(void* metadata_blob, int width, int height, int depth, int format,
|
||||
int num_samples, int isUBWC, uint64_t usage, uint32_t num_planes);
|
||||
uint32_t AdrenoGetAlignedGpuBufferSize(void* metadata_blob);
|
||||
|
||||
bool AdrenoSizeAPIAvaliable();
|
||||
|
||||
static AdrenoMemInfo* GetInstance();
|
||||
|
||||
private:
|
||||
AdrenoMemInfo();
|
||||
~AdrenoMemInfo();
|
||||
int (*LINK_adreno_compute_padding)(int width, int bpp, int surface_tile_height,
|
||||
int screen_tile_height, int padding_threshold) = NULL;
|
||||
void (*LINK_adreno_compute_aligned_width_and_height)(int width, int height, int bpp,
|
||||
int tile_mode, int raster_mode,
|
||||
int padding_threshold, int* aligned_w,
|
||||
int* aligned_h) = NULL;
|
||||
void (*LINK_adreno_compute_fmt_aligned_width_and_height)(int width, int height, int plane_id,
|
||||
int format, int num_samples,
|
||||
int tile_mode, int raster_mode,
|
||||
int padding_threshold, int* aligned_w,
|
||||
int* aligned_h) = NULL;
|
||||
void (*LINK_adreno_compute_compressedfmt_aligned_width_and_height)(
|
||||
int width, int height, int format, int tile_mode, int raster_mode, int padding_threshold,
|
||||
int* aligned_w, int* aligned_h, int* bpp) = NULL;
|
||||
int (*LINK_adreno_isUBWCSupportedByGpu)(ADRENOPIXELFORMAT format) = NULL;
|
||||
unsigned int (*LINK_adreno_get_gpu_pixel_alignment)() = NULL;
|
||||
|
||||
uint32_t (*LINK_adreno_get_metadata_blob_size)() = NULL;
|
||||
int (*LINK_adreno_init_memory_layout)(void* metadata_blob, int width, int height, int depth,
|
||||
ADRENOPIXELFORMAT format, int num_samples,
|
||||
surface_tile_mode_t tile_mode, uint64_t usage,
|
||||
uint32_t num_planes) = NULL;
|
||||
uint32_t (*LINK_adreno_get_aligned_gpu_buffer_size)(void* metadata_blob) = NULL;
|
||||
int (*LINK_adreno_isPISupportedByGpu)(int format, uint64_t usage) = NULL;
|
||||
|
||||
bool gfx_ubwc_disable_ = false;
|
||||
bool gfx_ahardware_buffer_disable_ = false;
|
||||
void* libadreno_utils_ = NULL;
|
||||
|
||||
static AdrenoMemInfo* s_instance;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
|
||||
* Not a Contribution
|
||||
*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __GR_PRIV_HANDLE_H__
|
||||
#define __GR_PRIV_HANDLE_H__
|
||||
|
||||
#include <hardware/gralloc.h>
|
||||
#include <hardware/gralloc1.h>
|
||||
#include <log/log.h>
|
||||
#ifdef __cplusplus
|
||||
#include <cinttypes>
|
||||
#endif
|
||||
|
||||
#define GRALLOC1_FUNCTION_PERFORM 0x00001000
|
||||
|
||||
#define DBG_HANDLE false
|
||||
|
||||
typedef gralloc1_error_t (*GRALLOC1_PFN_PERFORM)(gralloc1_device_t* device, int operation, ...);
|
||||
|
||||
#define PRIV_HANDLE_CONST(exp) static_cast<const private_handle_t*>(exp)
|
||||
|
||||
#pragma pack(push, 4)
|
||||
#ifdef __cplusplus
|
||||
struct private_handle_t : public native_handle_t {
|
||||
#else
|
||||
struct private_handle_t {
|
||||
native_handle_t nativeHandle;
|
||||
#endif
|
||||
enum {
|
||||
PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
|
||||
PRIV_FLAGS_USES_ION = 0x00000008,
|
||||
PRIV_FLAGS_NEEDS_FLUSH = 0x00000020,
|
||||
PRIV_FLAGS_INTERNAL_ONLY = 0x00000040,
|
||||
PRIV_FLAGS_NON_CPU_WRITER = 0x00000080,
|
||||
PRIV_FLAGS_CACHED = 0x00000200,
|
||||
PRIV_FLAGS_SECURE_BUFFER = 0x00000400,
|
||||
PRIV_FLAGS_EXTERNAL_ONLY = 0x00002000,
|
||||
PRIV_FLAGS_PROTECTED_BUFFER = 0x00004000,
|
||||
PRIV_FLAGS_VIDEO_ENCODER = 0x00010000,
|
||||
PRIV_FLAGS_CAMERA_WRITE = 0x00020000,
|
||||
PRIV_FLAGS_CAMERA_READ = 0x00040000,
|
||||
PRIV_FLAGS_HW_COMPOSER = 0x00080000,
|
||||
PRIV_FLAGS_HW_TEXTURE = 0x00100000,
|
||||
PRIV_FLAGS_ITU_R_601 = 0x00200000,
|
||||
PRIV_FLAGS_ITU_R_601_FR = 0x00400000,
|
||||
PRIV_FLAGS_ITU_R_709 = 0x00800000,
|
||||
PRIV_FLAGS_SECURE_DISPLAY = 0x01000000,
|
||||
PRIV_FLAGS_TILE_RENDERED = 0x02000000,
|
||||
PRIV_FLAGS_CPU_RENDERED = 0x04000000,
|
||||
PRIV_FLAGS_UBWC_ALIGNED = 0x08000000,
|
||||
PRIV_FLAGS_DISP_CONSUMER = 0x10000000,
|
||||
PRIV_FLAGS_CLIENT_ALLOCATED = 0x20000000,
|
||||
PRIV_FLAGS_UBWC_ALIGNED_PI = 0x40000000,
|
||||
};
|
||||
|
||||
int fd;
|
||||
int fd_metadata;
|
||||
|
||||
int magic;
|
||||
int flags;
|
||||
int width;
|
||||
int height;
|
||||
int unaligned_width;
|
||||
int unaligned_height;
|
||||
int format;
|
||||
int buffer_type;
|
||||
unsigned int layer_count;
|
||||
uint64_t id;
|
||||
uint64_t usage;
|
||||
|
||||
unsigned int size;
|
||||
unsigned int offset;
|
||||
unsigned int offset_metadata;
|
||||
uint64_t base;
|
||||
uint64_t base_metadata;
|
||||
uint64_t gpuaddr;
|
||||
#ifdef __cplusplus
|
||||
static const int kNumFds = 2;
|
||||
static const int kMagic = 'gmsm';
|
||||
|
||||
static inline int NumInts() {
|
||||
return ((sizeof(private_handle_t) - sizeof(native_handle_t)) / sizeof(int)) - kNumFds;
|
||||
}
|
||||
|
||||
private_handle_t(int fd, int meta_fd, int flags, int width, int height, int uw, int uh,
|
||||
int format, int buf_type, unsigned int size, uint64_t usage = 0)
|
||||
: fd(fd),
|
||||
fd_metadata(meta_fd),
|
||||
magic(kMagic),
|
||||
flags(flags),
|
||||
width(width),
|
||||
height(height),
|
||||
unaligned_width(uw),
|
||||
unaligned_height(uh),
|
||||
format(format),
|
||||
buffer_type(buf_type),
|
||||
layer_count(1),
|
||||
id(0),
|
||||
usage(usage),
|
||||
size(size),
|
||||
offset(0),
|
||||
offset_metadata(0),
|
||||
base(0),
|
||||
base_metadata(0),
|
||||
gpuaddr(0) {
|
||||
version = static_cast<int>(sizeof(native_handle));
|
||||
numInts = NumInts();
|
||||
numFds = kNumFds;
|
||||
}
|
||||
|
||||
private_handle_t(int fd, unsigned int size, int usage, int buf_type, int format, int w, int h)
|
||||
: private_handle_t(fd, -1, PRIV_FLAGS_CLIENT_ALLOCATED, w, h, 0, 0, format, buf_type, size,
|
||||
static_cast<uint64_t>(usage)) {}
|
||||
|
||||
~private_handle_t() {
|
||||
magic = 0;
|
||||
ALOGE_IF(DBG_HANDLE, "Deleting buffer handle %p", this);
|
||||
}
|
||||
|
||||
static int validate(const native_handle* h) {
|
||||
auto* hnd = static_cast<const private_handle_t*>(h);
|
||||
if (!h || h->version != sizeof(native_handle) || h->numInts != NumInts() ||
|
||||
h->numFds != kNumFds) {
|
||||
ALOGE("Invalid gralloc handle (at %p): ver(%d/%zu) ints(%d/%d) fds(%d/%d)", h,
|
||||
h ? h->version : -1, sizeof(native_handle), h ? h->numInts : -1, NumInts(),
|
||||
h ? h->numFds : -1, kNumFds);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (hnd->magic != kMagic) {
|
||||
ALOGE("handle = %p invalid magic(%c%c%c%c/%c%c%c%c)", hnd,
|
||||
hnd ? (((hnd->magic >> 24) & 0xFF) ? ((hnd->magic >> 24) & 0xFF) : '-') : '?',
|
||||
hnd ? (((hnd->magic >> 16) & 0xFF) ? ((hnd->magic >> 16) & 0xFF) : '-') : '?',
|
||||
hnd ? (((hnd->magic >> 8) & 0xFF) ? ((hnd->magic >> 8) & 0xFF) : '-') : '?',
|
||||
hnd ? (((hnd->magic >> 0) & 0xFF) ? ((hnd->magic >> 0) & 0xFF) : '-') : '?',
|
||||
(kMagic >> 24) & 0xFF, (kMagic >> 16) & 0xFF, (kMagic >> 8) & 0xFF,
|
||||
(kMagic >> 0) & 0xFF);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Dump(const private_handle_t* hnd) {
|
||||
ALOGD("handle id:%" PRIu64
|
||||
" wxh:%dx%d uwxuh:%dx%d size: %d fd:%d fd_meta:%d flags:0x%x "
|
||||
"usage:0x%" PRIx64 " format:0x%x layer_count: %d",
|
||||
hnd->id, hnd->width, hnd->height, hnd->unaligned_width, hnd->unaligned_height, hnd->size,
|
||||
hnd->fd, hnd->fd_metadata, hnd->flags, hnd->usage, hnd->format, hnd->layer_count);
|
||||
}
|
||||
|
||||
int GetUnalignedWidth() const { return unaligned_width; }
|
||||
|
||||
int GetUnalignedHeight() const { return unaligned_height; }
|
||||
|
||||
int GetColorFormat() const { return format; }
|
||||
|
||||
unsigned int GetLayerCount() const { return layer_count; }
|
||||
|
||||
int GetStride() const {
|
||||
return width;
|
||||
}
|
||||
|
||||
uint64_t GetUsage() const { return usage; }
|
||||
|
||||
uint64_t GetBackingstore() const { return id; }
|
||||
#endif
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
@@ -1,639 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "gr_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "gr_adreno_info.h"
|
||||
|
||||
#define ASTC_BLOCK_SIZE 16
|
||||
|
||||
#ifndef COLOR_FMT_P010_UBWC
|
||||
#define COLOR_FMT_P010_UBWC 9
|
||||
#endif
|
||||
|
||||
namespace gralloc {
|
||||
|
||||
bool IsUncompressedRGBFormat(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
case HAL_PIXEL_FORMAT_R_8:
|
||||
case HAL_PIXEL_FORMAT_RG_88:
|
||||
case HAL_PIXEL_FORMAT_BGRX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ARGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XRGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XBGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
case HAL_PIXEL_FORMAT_BGR_888:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsCompressedRGBFormat(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t GetBppForUncompressedRGB(int format) {
|
||||
uint32_t bpp = 0;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
bpp = 8;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ARGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XRGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XBGR_2101010:
|
||||
bpp = 4;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_BGR_888:
|
||||
bpp = 3;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
bpp = 2;
|
||||
break;
|
||||
default:
|
||||
ALOGE("Error : %s New format request = 0x%x", __FUNCTION__, format);
|
||||
break;
|
||||
}
|
||||
|
||||
return bpp;
|
||||
}
|
||||
|
||||
bool CpuCanAccess(uint64_t usage) {
|
||||
return CpuCanRead(usage) || CpuCanWrite(usage);
|
||||
}
|
||||
|
||||
bool CpuCanRead(uint64_t usage) {
|
||||
if (usage & BufferUsage::CPU_READ_MASK) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CpuCanWrite(uint64_t usage) {
|
||||
if (usage & BufferUsage::CPU_WRITE_MASK) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t GetDataAlignment(int format, uint64_t usage) {
|
||||
uint32_t align = UINT(getpagesize());
|
||||
if (format == HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED) {
|
||||
align = SIZE_8K;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::PROTECTED) {
|
||||
if ((usage & BufferUsage::CAMERA_OUTPUT) || (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY)) {
|
||||
align = SZ_2M;
|
||||
} else {
|
||||
align = SECURE_ALIGN;
|
||||
}
|
||||
}
|
||||
|
||||
return align;
|
||||
}
|
||||
|
||||
bool IsGPUFlagSupported(uint64_t usage) {
|
||||
bool ret = true;
|
||||
if ((usage & BufferUsage::GPU_MIPMAP_COMPLETE)) {
|
||||
ALOGE("GPU_MIPMAP_COMPLETE not supported");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::GPU_CUBE_MAP)) {
|
||||
ALOGE("GPU_CUBE_MAP not supported");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int GetSize(const BufferInfo& info, unsigned int alignedw, unsigned int alignedh) {
|
||||
unsigned int size = 0;
|
||||
int format = info.format;
|
||||
int width = info.width;
|
||||
int height = info.height;
|
||||
uint64_t usage = info.usage;
|
||||
|
||||
if (!IsGPUFlagSupported(usage)) {
|
||||
ALOGE("Unsupported GPU usage flags present 0x%" PRIx64, usage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsUBwcEnabled(format, usage)) {
|
||||
size = GetUBwcSize(width, height, format, alignedw, alignedh);
|
||||
} else if (IsUncompressedRGBFormat(format)) {
|
||||
uint32_t bpp = GetBppForUncompressedRGB(format);
|
||||
size = alignedw * alignedh * bpp;
|
||||
} else if (IsCompressedRGBFormat(format)) {
|
||||
size = alignedw * alignedh * ASTC_BLOCK_SIZE;
|
||||
} else {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RAW16:
|
||||
case HAL_PIXEL_FORMAT_Y16:
|
||||
size = alignedw * alignedh * 2;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RAW10:
|
||||
case HAL_PIXEL_FORMAT_RAW12:
|
||||
size = ALIGN(alignedw * alignedh, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RAW8:
|
||||
case HAL_PIXEL_FORMAT_Y8:
|
||||
size = alignedw * alignedh * 1;
|
||||
break;
|
||||
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO:
|
||||
size = ALIGN(alignedw * alignedh, SIZE_4K);
|
||||
size += (unsigned int)ALIGN(2 * ALIGN(width / 2, 32) * ALIGN(height / 2, 32), SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
|
||||
|
||||
|
||||
|
||||
size = ALIGN(alignedw * alignedh, SIZE_8K);
|
||||
size += ALIGN(alignedw * (unsigned int)ALIGN(height / 2, 32), SIZE_8K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
if ((format == HAL_PIXEL_FORMAT_YV12) && ((width & 1) || (height & 1))) {
|
||||
ALOGE("w or h is odd for the YV12 format");
|
||||
return 0;
|
||||
}
|
||||
size = alignedw * alignedh + (ALIGN(alignedw / 2, 16) * (alignedh / 2)) * 2;
|
||||
size = ALIGN(size, (unsigned int)SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
||||
size = ALIGN((alignedw * alignedh) + (alignedw * alignedh) / 2 + 1, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010:
|
||||
size = ALIGN((alignedw * alignedh * 2) + (alignedw * alignedh) + 1, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_422_SP:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_422_I:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_422_I:
|
||||
case HAL_PIXEL_FORMAT_CbYCrY_422_I:
|
||||
if (width & 1) {
|
||||
ALOGE("width is odd for the YUV422_SP format");
|
||||
return 0;
|
||||
}
|
||||
size = ALIGN(alignedw * alignedh * 2, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_BLOB:
|
||||
case HAL_PIXEL_FORMAT_RAW_OPAQUE:
|
||||
if (height != 1) {
|
||||
ALOGE("%s: Buffers with HAL_PIXEL_FORMAT_BLOB must have height 1 ", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
size = (unsigned int)width;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_NV21_ZSL:
|
||||
size = ALIGN((alignedw * alignedh) + (alignedw * alignedh) / 2, SIZE_4K);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Unrecognized pixel format: 0x%x", __FUNCTION__, format);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
auto align = GetDataAlignment(format, usage);
|
||||
size = ALIGN(size, align) * info.layer_count;
|
||||
return size;
|
||||
}
|
||||
|
||||
bool IsUBwcFormat(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsUBwcSupported(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_16:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_32F:
|
||||
case HAL_PIXEL_FORMAT_STENCIL_8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsUBwcPISupported(int format, uint64_t usage) {
|
||||
if (usage & BufferUsage::COMPOSER_OVERLAY || !(usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC: {
|
||||
if ((usage & BufferUsage::GPU_TEXTURE) || (usage & BufferUsage::GPU_RENDER_TARGET)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
return AdrenoMemInfo::GetInstance()->IsPISupportedByGPU(format, usage);
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsUBwcEnabled(int format, uint64_t usage) {
|
||||
if (IsUBwcFormat(format)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) ||
|
||||
(usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI) ||
|
||||
(usage & BufferUsage::COMPOSER_CLIENT_TARGET)) &&
|
||||
IsUBwcSupported(format)) {
|
||||
bool enable = true;
|
||||
if ((usage & BufferUsage::GPU_TEXTURE) || (usage & BufferUsage::GPU_RENDER_TARGET)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
enable = AdrenoMemInfo::GetInstance()->IsUBWCSupportedByGPU(format);
|
||||
}
|
||||
}
|
||||
|
||||
if (enable && !(CpuCanAccess(usage))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GetRgbUBwcBlockSize(uint32_t bpp, int* block_width, int* block_height) {
|
||||
*block_width = 0;
|
||||
*block_height = 0;
|
||||
|
||||
switch (bpp) {
|
||||
case 2:
|
||||
case 4:
|
||||
*block_width = 16;
|
||||
*block_height = 4;
|
||||
break;
|
||||
case 8:
|
||||
*block_width = 8;
|
||||
*block_height = 4;
|
||||
break;
|
||||
case 16:
|
||||
*block_width = 4;
|
||||
*block_height = 4;
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Unsupported bpp: %d", __FUNCTION__, bpp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int GetRgbUBwcMetaBufferSize(int width, int height, uint32_t bpp) {
|
||||
unsigned int size = 0;
|
||||
int meta_width, meta_height;
|
||||
int block_width, block_height;
|
||||
|
||||
GetRgbUBwcBlockSize(bpp, &block_width, &block_height);
|
||||
if (!block_width || !block_height) {
|
||||
ALOGE("%s: Unsupported bpp: %d", __FUNCTION__, bpp);
|
||||
return size;
|
||||
}
|
||||
|
||||
meta_height = ALIGN(((height + block_height - 1) / block_height), 16);
|
||||
|
||||
meta_width = ALIGN(((width + block_width - 1) / block_width), 64);
|
||||
|
||||
size = (unsigned int)ALIGN((meta_width * meta_height), 4096);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned int GetUBwcSize(int width, int height, int format, unsigned int alignedw,
|
||||
unsigned int alignedh) {
|
||||
unsigned int size = 0;
|
||||
uint32_t bpp = 0;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
bpp = GetBppForUncompressedRGB(format);
|
||||
size = alignedw * alignedh * bpp;
|
||||
size += GetRgbUBwcMetaBufferSize(width, height, bpp);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Unsupported pixel format: 0x%x", __FUNCTION__, format);
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned int GetRgbMetaSize(int format, uint32_t width, uint32_t height, uint64_t usage) {
|
||||
unsigned int meta_size = 0;
|
||||
if (!IsUBwcEnabled(format, usage)) {
|
||||
return meta_size;
|
||||
}
|
||||
uint32_t bpp = GetBppForUncompressedRGB(format);
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
meta_size = GetRgbUBwcMetaBufferSize(width, height, bpp);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s:Unsupported RGB format: 0x%x", __FUNCTION__, format);
|
||||
break;
|
||||
}
|
||||
return meta_size;
|
||||
}
|
||||
|
||||
bool CanUseAdrenoForSize(int buffer_type, uint64_t usage) {
|
||||
if (buffer_type == BUFFER_TYPE_VIDEO || !GetAdrenoSizeAPIStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::PROTECTED) &&
|
||||
((usage & BufferUsage::CAMERA_OUTPUT) || (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetAdrenoSizeAPIStatus() {
|
||||
AdrenoMemInfo* adreno_mem_info = AdrenoMemInfo::GetInstance();
|
||||
if (adreno_mem_info) {
|
||||
return adreno_mem_info->AdrenoSizeAPIAvaliable();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UseUncached(int format, uint64_t usage) {
|
||||
if ((usage & GRALLOC_USAGE_PRIVATE_UNCACHED) || (usage & BufferUsage::PROTECTED)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::CPU_READ_MASK) == static_cast<uint64_t>(BufferUsage::CPU_READ_RARELY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::CPU_WRITE_MASK) ==
|
||||
static_cast<uint64_t>(BufferUsage::CPU_WRITE_RARELY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::SENSOR_DIRECT_DATA) || (usage & BufferUsage::GPU_DATA_BUFFER)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format && IsUBwcEnabled(format, usage)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t GetHandleFlags(int format, uint64_t usage) {
|
||||
uint64_t priv_flags = 0;
|
||||
|
||||
if (usage & BufferUsage::VIDEO_ENCODER) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_VIDEO_ENCODER;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::CAMERA_OUTPUT) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CAMERA_WRITE;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::CAMERA_INPUT) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CAMERA_READ;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::COMPOSER_OVERLAY) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_DISP_CONSUMER;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::GPU_TEXTURE) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_HW_TEXTURE;
|
||||
}
|
||||
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_SECURE_DISPLAY;
|
||||
}
|
||||
|
||||
if (IsUBwcEnabled(format, usage)) {
|
||||
if (IsUBwcPISupported(format, usage)) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED_PI;
|
||||
} else {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage & (BufferUsage::CPU_READ_MASK | BufferUsage::CPU_WRITE_MASK)) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CPU_RENDERED;
|
||||
}
|
||||
|
||||
if ((usage & (BufferUsage::VIDEO_ENCODER | BufferUsage::VIDEO_DECODER |
|
||||
BufferUsage::CAMERA_OUTPUT | BufferUsage::GPU_RENDER_TARGET))) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_NON_CPU_WRITER;
|
||||
}
|
||||
|
||||
if (!UseUncached(format, usage)) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CACHED;
|
||||
}
|
||||
|
||||
return priv_flags;
|
||||
}
|
||||
|
||||
int GetImplDefinedFormat(uint64_t usage, int format) {
|
||||
int gr_format = format;
|
||||
|
||||
if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED ||
|
||||
format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
if ((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC || usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI) &&
|
||||
format != HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC;
|
||||
} else if (usage & BufferUsage::VIDEO_ENCODER) {
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ENCODEABLE;
|
||||
} else if (usage & GRALLOC_USAGE_PRIVATE_HEIF) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV12_HEIF;
|
||||
} else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS;
|
||||
} else {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV12_ENCODEABLE;
|
||||
}
|
||||
} else if (usage & BufferUsage::CAMERA_INPUT) {
|
||||
if (usage & BufferUsage::CAMERA_OUTPUT) {
|
||||
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL;
|
||||
} else {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCrCb_420_SP;
|
||||
}
|
||||
} else if (usage & BufferUsage::CAMERA_OUTPUT) {
|
||||
if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL;
|
||||
} else {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS;
|
||||
}
|
||||
} else if (usage & BufferUsage::COMPOSER_OVERLAY) {
|
||||
gr_format = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
} else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL;
|
||||
}
|
||||
}
|
||||
|
||||
return gr_format;
|
||||
}
|
||||
|
||||
bool HasAlphaComponent(int32_t format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ARGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void GetRGBPlaneInfo(const BufferInfo& info, int32_t format, int32_t width, int32_t height,
|
||||
int32_t , int* plane_count, PlaneLayoutInfo* plane_info) {
|
||||
uint64_t usage = info.usage;
|
||||
*plane_count = 1;
|
||||
uint32_t bpp = 0;
|
||||
if (IsUncompressedRGBFormat(format)) {
|
||||
bpp = GetBppForUncompressedRGB(format);
|
||||
}
|
||||
plane_info->component =
|
||||
(PlaneComponent)(PLANE_COMPONENT_R | PLANE_COMPONENT_G | PLANE_COMPONENT_B);
|
||||
if (HasAlphaComponent(format)) {
|
||||
plane_info->component = (PlaneComponent)(plane_info->component | PLANE_COMPONENT_A);
|
||||
}
|
||||
plane_info->size = GetSize(info, width, height);
|
||||
plane_info->step = bpp;
|
||||
plane_info->offset = GetRgbMetaSize(format, width, height, usage);
|
||||
plane_info->h_subsampling = 0;
|
||||
plane_info->v_subsampling = 0;
|
||||
plane_info->stride = width;
|
||||
plane_info->stride_bytes = width * plane_info->step;
|
||||
plane_info->scanlines = height;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2016,2018-2019, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __GR_UTILS_H__
|
||||
#define __GR_UTILS_H__
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
#include "types/common.h"
|
||||
|
||||
#define SZ_2M 0x200000
|
||||
#define SZ_1M 0x100000
|
||||
#define SZ_4K 0x1000
|
||||
|
||||
#define SIZE_4K 4096
|
||||
#define SIZE_8K 8192
|
||||
|
||||
#ifdef SLAVE_SIDE_CP
|
||||
#define SECURE_ALIGN SZ_1M
|
||||
#else
|
||||
#define SECURE_ALIGN SZ_4K
|
||||
#endif
|
||||
|
||||
#define INT(exp) static_cast<int>(exp)
|
||||
#define UINT(exp) static_cast<unsigned int>(exp)
|
||||
|
||||
using android::hardware::graphics::common::V1_1::BufferUsage;
|
||||
|
||||
namespace gralloc {
|
||||
struct BufferInfo {
|
||||
BufferInfo(int w, int h, int f, uint64_t usage = 0)
|
||||
: width(w), height(h), format(f), layer_count(1), usage(usage) {}
|
||||
int width;
|
||||
int height;
|
||||
int format;
|
||||
int layer_count;
|
||||
uint64_t usage;
|
||||
};
|
||||
|
||||
template <class Type1, class Type2>
|
||||
inline Type1 ALIGN(Type1 x, Type2 align) {
|
||||
return (Type1)((x + (Type1)align - 1) & ~((Type1)align - 1));
|
||||
}
|
||||
|
||||
enum PlaneComponent {
|
||||
PLANE_COMPONENT_Y = 1 << 0,
|
||||
PLANE_COMPONENT_Cb = 1 << 1,
|
||||
PLANE_COMPONENT_Cr = 1 << 2,
|
||||
|
||||
PLANE_COMPONENT_R = 1 << 10,
|
||||
PLANE_COMPONENT_G = 1 << 11,
|
||||
PLANE_COMPONENT_B = 1 << 12,
|
||||
|
||||
PLANE_COMPONENT_A = 1 << 20,
|
||||
|
||||
PLANE_COMPONENT_RAW = 1 << 30,
|
||||
|
||||
PLANE_COMPONENT_META = 1 << 31,
|
||||
};
|
||||
|
||||
struct PlaneLayoutInfo {
|
||||
PlaneComponent component;
|
||||
|
||||
uint32_t h_subsampling;
|
||||
|
||||
uint32_t v_subsampling;
|
||||
|
||||
uint32_t offset;
|
||||
|
||||
int32_t step;
|
||||
|
||||
int32_t stride;
|
||||
|
||||
int32_t stride_bytes;
|
||||
|
||||
int32_t scanlines;
|
||||
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
bool IsCompressedRGBFormat(int format);
|
||||
bool IsUncompressedRGBFormat(int format);
|
||||
uint32_t GetBppForUncompressedRGB(int format);
|
||||
bool CpuCanAccess(uint64_t usage);
|
||||
bool CpuCanRead(uint64_t usage);
|
||||
bool CpuCanWrite(uint64_t usage);
|
||||
unsigned int GetSize(const BufferInfo& d, unsigned int alignedw, unsigned int alignedh);
|
||||
void GetRGBPlaneInfo(const BufferInfo& info, int32_t format, int32_t width, int32_t height,
|
||||
int32_t flags, int* plane_count, PlaneLayoutInfo* plane_info);
|
||||
unsigned int GetRgbMetaSize(int format, uint32_t width, uint32_t height, uint64_t usage);
|
||||
bool IsUBwcFormat(int format);
|
||||
bool IsUBwcSupported(int format);
|
||||
bool IsUBwcPISupported(int format, uint64_t usage);
|
||||
bool IsUBwcEnabled(int format, uint64_t usage);
|
||||
void GetRgbUBwcBlockSize(uint32_t bpp, int* block_width, int* block_height);
|
||||
unsigned int GetRgbUBwcMetaBufferSize(int width, int height, uint32_t bpp);
|
||||
unsigned int GetUBwcSize(int width, int height, int format, unsigned int alignedw,
|
||||
unsigned int alignedh);
|
||||
uint32_t GetDataAlignment(int format, uint64_t usage);
|
||||
bool CanUseAdrenoForSize(int buffer_type, uint64_t usage);
|
||||
bool GetAdrenoSizeAPIStatus();
|
||||
bool UseUncached(int format, uint64_t usage);
|
||||
uint64_t GetHandleFlags(int format, uint64_t usage);
|
||||
int GetImplDefinedFormat(uint64_t usage, int format);
|
||||
int GetCustomFormatFlags(int format, uint64_t usage, int* custom_format, uint64_t* priv_flags);
|
||||
bool IsGPUFlagSupported(uint64_t usage);
|
||||
bool HasAlphaComponent(int32_t format);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2021, The Linux Foundation. All rights reserved.
|
||||
* Not a Contribution
|
||||
*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __GRALLOC_PRIV_H__
|
||||
#define __GRALLOC_PRIV_H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "QtiGrallocDefs.h"
|
||||
#include "gr_priv_handle.h"
|
||||
|
||||
|
||||
#define GRALLOC_PROP_PREFIX "vendor.gralloc."
|
||||
#define GRALLOC_PROP(prop_name) GRALLOC_PROP_PREFIX prop_name
|
||||
|
||||
#define DISABLE_UBWC_PROP GRALLOC_PROP("disable_ubwc")
|
||||
#define DISABLE_AHARDWAREBUFFER_PROP GRALLOC_PROP("disable_ahardware_buffer")
|
||||
#define ENABLE_FB_UBWC_PROP GRALLOC_PROP("enable_fb_ubwc")
|
||||
#define MAP_FB_MEMORY_PROP GRALLOC_PROP("map_fb_memory")
|
||||
#define USE_SYSTEM_HEAP_FOR_SENSORS GRALLOC_PROP("use_system_heap_for_sensors")
|
||||
|
||||
#define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
|
||||
inline int roundUpToPageSize(int x) {
|
||||
return (x + (getpagesize() - 1)) & ~(getpagesize() - 1);
|
||||
}
|
||||
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ADSP_HEAP GRALLOC_USAGE_PRIVATE_ADSP_HEAP
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC GRALLOC_USAGE_PRIVATE_ALLOC_UBWC
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_UNCACHED GRALLOC_USAGE_PRIVATE_UNCACHED
|
||||
#define GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_MM_HEAP GRALLOC_USAGE_PRIVATE_MM_HEAP
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT GRALLOC_USAGE_PRIVATE_10BIT
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
|
||||
#define GRALLOC1_CONSUMER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_VIDEO_NV21_ENCODER GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER
|
||||
|
||||
#define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1
|
||||
#define GRALLOC_MODULE_PERFORM_GET_STRIDE 2
|
||||
#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE 3
|
||||
#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE 4
|
||||
#define GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES 5
|
||||
#define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6
|
||||
#define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7
|
||||
#define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8
|
||||
#define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9
|
||||
#define GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS 10
|
||||
#define GRALLOC_MODULE_PERFORM_GET_IGC 11
|
||||
#define GRALLOC_MODULE_PERFORM_SET_IGC 12
|
||||
#define GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE 13
|
||||
#define GRALLOC1_MODULE_PERFORM_GET_BUFFER_SIZE_AND_DIMENSIONS 14
|
||||
#define GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG 15
|
||||
#define GRALLOC_MODULE_PERFORM_GET_GRAPHICS_METADATA 16
|
||||
|
||||
#define HAL_IGC_NOT_SPECIFIED 0
|
||||
#define HAL_IGC_s_RGB 1
|
||||
|
||||
#define HAL_CSC_ITU_R_601 0
|
||||
#define HAL_CSC_ITU_R_601_FR 1
|
||||
#define HAL_CSC_ITU_R_709 2
|
||||
#define HAL_CSC_ITU_R_709_FR 3
|
||||
#define HAL_CSC_ITU_R_2020 4
|
||||
#define HAL_CSC_ITU_R_2020_FR 5
|
||||
|
||||
enum {
|
||||
HAL_NO_3D = 0x0,
|
||||
HAL_3D_SIDE_BY_SIDE_L_R = 0x1,
|
||||
HAL_3D_SIDE_BY_SIDE_R_L = 0x2,
|
||||
HAL_3D_TOP_BOTTOM = 0x4,
|
||||
HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000,
|
||||
};
|
||||
|
||||
enum {
|
||||
LAYOUT_INTERLACED_FLAG = 1 << 0,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,183 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2022, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include "types/mapper.h"
|
||||
|
||||
namespace vendor::qti::hardware::display::mapperextensions::V1_0 {
|
||||
struct IQtiMapperExtensions;
|
||||
}
|
||||
|
||||
namespace android::hardware::graphics::mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
struct BufferDescriptorInfo final {
|
||||
uint32_t width __attribute__((aligned(4)));
|
||||
uint32_t height __attribute__((aligned(4)));
|
||||
uint32_t layerCount __attribute__((aligned(4)));
|
||||
graphics::common::V1_0::PixelFormat format __attribute__((aligned(4)));
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> usage __attribute__((aligned(8)));
|
||||
};
|
||||
|
||||
struct Rect final {
|
||||
int32_t left __attribute__((aligned(4)));
|
||||
int32_t top __attribute__((aligned(4)));
|
||||
int32_t width __attribute__((aligned(4)));
|
||||
int32_t height __attribute__((aligned(4)));
|
||||
};
|
||||
|
||||
static sp<IMapper> getService(const std::string& , const bool );
|
||||
};
|
||||
|
||||
}
|
||||
namespace V3_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
static sp<IMapper> getService(const std::string& , const bool );
|
||||
};
|
||||
|
||||
}
|
||||
namespace V4_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
static sp<IMapper> getService(const std::string& , const bool );
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace vendor::qti::hardware::display::mapper {
|
||||
namespace V4_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V4_0::IMapper>& ,
|
||||
bool );
|
||||
};
|
||||
|
||||
}
|
||||
namespace V3_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V3_0::IMapper>& ,
|
||||
bool );
|
||||
};
|
||||
|
||||
}
|
||||
namespace V2_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
using createDescriptor_cb = std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const hidl_vec<uint32_t>& descriptor)>;
|
||||
virtual Return<void> createDescriptor(
|
||||
const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo& descriptorInfo,
|
||||
createDescriptor_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using importBuffer_cb = std::function<void(graphics::mapper::V2_0::Error error, void* buffer)>;
|
||||
virtual Return<void> importBuffer(const hidl_handle& rawHandle, importBuffer_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<graphics::mapper::V2_0::Error> freeBuffer(void* buffer) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using lock_cb = std::function<void(graphics::mapper::V2_0::Error error, void* data)>;
|
||||
virtual Return<void> lock(void* buffer,
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> cpuUsage,
|
||||
const graphics::mapper::V2_0::IMapper::Rect& accessRegion,
|
||||
const hidl_handle& acquireFence, lock_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using lockYCbCr_cb = std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const graphics::mapper::V2_0::YCbCrLayout& layout)>;
|
||||
virtual Return<void> lockYCbCr(void* buffer,
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> cpuUsage,
|
||||
const graphics::mapper::V2_0::IMapper::Rect& accessRegion,
|
||||
const hidl_handle& acquireFence, lockYCbCr_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using unlock_cb =
|
||||
std::function<void(graphics::mapper::V2_0::Error error, const hidl_handle& releaseFence)>;
|
||||
virtual Return<void> unlock(void* buffer, unlock_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<graphics::mapper::V2_0::Error> validateBufferSize(
|
||||
void* buffer, const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo& descriptorInfo,
|
||||
uint32_t stride) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getTransportSize_cb =
|
||||
std::function<void(graphics::mapper::V2_0::Error error, uint32_t numFds, uint32_t numInts)>;
|
||||
virtual Return<void> getTransportSize(void* buffer, getTransportSize_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using createDescriptor_2_1_cb = std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const hidl_vec<uint32_t>& descriptor)>;
|
||||
virtual Return<void> createDescriptor_2_1(
|
||||
const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo& descriptorInfo,
|
||||
createDescriptor_2_1_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getMapperExtensions_cb =
|
||||
std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const ::android::sp<::vendor::qti::hardware::display::mapperextensions::
|
||||
V1_0::IQtiMapperExtensions>& extensions)>;
|
||||
virtual Return<void> getMapperExtensions(getMapperExtensions_cb _hidl_cb);
|
||||
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V2_0::IMapper>& ,
|
||||
bool );
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2022, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
#include "types/mapperextensions.h"
|
||||
|
||||
namespace vendor::qti::hardware::display::mapperextensions {
|
||||
namespace V1_0 {
|
||||
|
||||
struct IQtiMapperExtensions : public IBase {
|
||||
IQtiMapperExtensions(){};
|
||||
};
|
||||
|
||||
}
|
||||
namespace V1_1 {
|
||||
using Error = V1_0::Error;
|
||||
using PlaneLayout = V1_0::PlaneLayout;
|
||||
|
||||
struct IQtiMapperExtensions : public IBase {
|
||||
IQtiMapperExtensions();
|
||||
|
||||
gralloc1_device_t* gralloc;
|
||||
GRALLOC1_PFN_PERFORM perform;
|
||||
|
||||
using getMapSecureBufferFlag_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, bool mapSecureBuffer)>;
|
||||
virtual ::android::hardware::Return<void> getMapSecureBufferFlag(
|
||||
void* buffer, getMapSecureBufferFlag_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getInterlacedFlag_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, bool interlaced)>;
|
||||
virtual ::android::hardware::Return<void> getInterlacedFlag(void* buffer,
|
||||
getInterlacedFlag_cb _hidl_cb);
|
||||
|
||||
using getCustomDimensions_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t stride, int32_t height)>;
|
||||
virtual ::android::hardware::Return<void> getCustomDimensions(void* buffer,
|
||||
getCustomDimensions_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getRgbDataAddress_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, void* rgb_data)>;
|
||||
virtual ::android::hardware::Return<void> getRgbDataAddress(void* buffer,
|
||||
getRgbDataAddress_cb _hidl_cb);
|
||||
|
||||
using calculateBufferAttributes_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t aligned_width, int32_t aligned_height, bool ubwc_enabled)>;
|
||||
virtual ::android::hardware::Return<void> calculateBufferAttributes(
|
||||
int32_t width, int32_t height, int32_t format, uint64_t usage,
|
||||
calculateBufferAttributes_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getColorSpace_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t color_space)>;
|
||||
virtual ::android::hardware::Return<void> getColorSpace(void* buffer, getColorSpace_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getYuvPlaneInfo_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
const ::android::hardware::hidl_vec<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout>& layout)>;
|
||||
virtual ::android::hardware::Return<void> getYuvPlaneInfo(void* buffer,
|
||||
getYuvPlaneInfo_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual ::android::hardware::Return<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error>
|
||||
setSingleBufferMode(void* buffer, bool enable) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getCustomFormatFlags_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t format, uint64_t priv_flags)>;
|
||||
virtual ::android::hardware::Return<void> getCustomFormatFlags(int32_t format, uint64_t usage,
|
||||
getCustomFormatFlags_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getFd_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t fd)>;
|
||||
virtual ::android::hardware::Return<void> getFd(void* buffer, getFd_cb _hidl_cb);
|
||||
|
||||
using getWidth_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t width)>;
|
||||
virtual ::android::hardware::Return<void> getWidth(void* buffer, getWidth_cb _hidl_cb);
|
||||
|
||||
using getHeight_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t height)>;
|
||||
virtual ::android::hardware::Return<void> getHeight(void* buffer, getHeight_cb _hidl_cb);
|
||||
|
||||
using getOffset_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t offset)>;
|
||||
virtual ::android::hardware::Return<void> getOffset(void* buffer, getOffset_cb _hidl_cb);
|
||||
|
||||
using getSize_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t size)>;
|
||||
virtual ::android::hardware::Return<void> getSize(void* buffer, getSize_cb _hidl_cb);
|
||||
|
||||
using getUnalignedWidth_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t unaligned_width)>;
|
||||
virtual ::android::hardware::Return<void> getUnalignedWidth(void* buffer,
|
||||
getUnalignedWidth_cb _hidl_cb);
|
||||
|
||||
using getUnalignedHeight_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t unaligned_height)>;
|
||||
virtual ::android::hardware::Return<void> getUnalignedHeight(void* buffer,
|
||||
getUnalignedHeight_cb _hidl_cb);
|
||||
|
||||
using getLayerCount_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t layer_count)>;
|
||||
virtual ::android::hardware::Return<void> getLayerCount(void* buffer, getLayerCount_cb _hidl_cb);
|
||||
|
||||
using getId_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t id)>;
|
||||
virtual ::android::hardware::Return<void> getId(void* buffer, getId_cb _hidl_cb);
|
||||
|
||||
using getUsageFlags_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t usage)>;
|
||||
virtual ::android::hardware::Return<void> getUsageFlags(void* buffer, getUsageFlags_cb _hidl_cb);
|
||||
|
||||
using getFormat_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t format)>;
|
||||
virtual ::android::hardware::Return<void> getFormat(void* buffer, getFormat_cb _hidl_cb);
|
||||
|
||||
using getPrivateFlags_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t flags)>;
|
||||
virtual ::android::hardware::Return<void> getPrivateFlags(void* buffer,
|
||||
getPrivateFlags_cb _hidl_cb);
|
||||
|
||||
using getSurfaceMetadata_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, void* metadata)>;
|
||||
virtual ::android::hardware::Return<void> getSurfaceMetadata(void* buffer,
|
||||
getSurfaceMetadata_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getFormatLayout_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t size,
|
||||
const ::android::hardware::hidl_vec<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout>& plane_info)>;
|
||||
virtual ::android::hardware::Return<void> getFormatLayout(int32_t format, uint64_t usage,
|
||||
int32_t flags, int32_t width,
|
||||
int32_t height,
|
||||
getFormatLayout_cb _hidl_cb);
|
||||
|
||||
virtual ::android::hardware::Return<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error>
|
||||
getSurfaceMetadata_V1(void* buffer, void* metadata) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
static Return<sp<IQtiMapperExtensions>> castFrom(
|
||||
android::sp<V1_0::IQtiMapperExtensions> const& , bool );
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,216 +0,0 @@
|
||||
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
||||
#define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace graphics {
|
||||
namespace mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
enum class Error : int32_t;
|
||||
struct YCbCrLayout;
|
||||
|
||||
enum class Error : int32_t {
|
||||
NONE = 0,
|
||||
BAD_DESCRIPTOR = 1,
|
||||
BAD_BUFFER = 2,
|
||||
BAD_VALUE = 3,
|
||||
NO_RESOURCES = 5,
|
||||
UNSUPPORTED = 7,
|
||||
};
|
||||
|
||||
typedef ::android::hardware::hidl_vec<uint32_t> BufferDescriptor;
|
||||
|
||||
struct YCbCrLayout final {
|
||||
void* y;
|
||||
void* cb;
|
||||
void* cr;
|
||||
uint32_t yStride;
|
||||
uint32_t cStride;
|
||||
uint32_t chromaStep;
|
||||
};
|
||||
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(::android::hardware::graphics::mapper::V2_0::Error o);
|
||||
|
||||
constexpr int32_t operator|(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const int32_t lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const int32_t lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t& operator|=(int32_t& v,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t& operator&=(int32_t& v,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::android::hardware::graphics::mapper::V2_0::YCbCrLayout& o);
|
||||
|
||||
|
||||
template <>
|
||||
inline std::string toString<::android::hardware::graphics::mapper::V2_0::Error>(int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<::android::hardware::graphics::mapper::V2_0::Error> flipped =
|
||||
0;
|
||||
bool first = true;
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::NONE) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::NONE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NONE";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::NONE;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_DESCRIPTOR";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_BUFFER";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_VALUE";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NO_RESOURCES";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "UNSUPPORTED";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(::android::hardware::graphics::mapper::V2_0::Error o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::NONE) {
|
||||
return "NONE";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR) {
|
||||
return "BAD_DESCRIPTOR";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER) {
|
||||
return "BAD_BUFFER";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE) {
|
||||
return "BAD_VALUE";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES) {
|
||||
return "NO_RESOURCES";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED) {
|
||||
return "UNSUPPORTED";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::android::hardware::graphics::mapper::V2_0::YCbCrLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".y = ";
|
||||
os += ::android::hardware::toString(o.y);
|
||||
os += ", .cb = ";
|
||||
os += ::android::hardware::toString(o.cb);
|
||||
os += ", .cr = ";
|
||||
os += ::android::hardware::toString(o.cr);
|
||||
os += ", .yStride = ";
|
||||
os += ::android::hardware::toString(o.yStride);
|
||||
os += ", .cStride = ";
|
||||
os += ::android::hardware::toString(o.cStride);
|
||||
os += ", .chromaStep = ";
|
||||
os += ::android::hardware::toString(o.chromaStep);
|
||||
os += "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::android::hardware::graphics::mapper::V2_0::Error, 6>
|
||||
hidl_enum_values<::android::hardware::graphics::mapper::V2_0::Error> = {
|
||||
::android::hardware::graphics::mapper::V2_0::Error::NONE,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,656 +0,0 @@
|
||||
#ifndef HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
||||
#define HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
namespace vendor {
|
||||
namespace qti {
|
||||
namespace hardware {
|
||||
namespace display {
|
||||
namespace mapperextensions {
|
||||
namespace V1_0 {
|
||||
|
||||
enum class Error : int32_t;
|
||||
struct YCbCrLayout;
|
||||
enum class PlaneComponent : uint32_t;
|
||||
enum class Flags : int32_t;
|
||||
struct PlaneLayout;
|
||||
|
||||
enum class Error : int32_t {
|
||||
NONE = 0,
|
||||
BAD_BUFFER = 2,
|
||||
NO_RESOURCES = 5,
|
||||
UNSUPPORTED = 7,
|
||||
};
|
||||
|
||||
struct YCbCrLayout final {
|
||||
void* y;
|
||||
void* cb;
|
||||
void* cr;
|
||||
uint32_t yStride;
|
||||
uint32_t cStride;
|
||||
uint32_t chromaStep;
|
||||
};
|
||||
|
||||
enum class PlaneComponent : uint32_t {
|
||||
PLANE_COMPONENT_Y = 1u ,
|
||||
PLANE_COMPONENT_Cb = 2u ,
|
||||
PLANE_COMPONENT_Cr = 4u ,
|
||||
PLANE_COMPONENT_R = 1024u ,
|
||||
PLANE_COMPONENT_G = 2048u ,
|
||||
PLANE_COMPONENT_B = 4096u ,
|
||||
PLANE_COMPONENT_A = 1048576u ,
|
||||
PLANE_COMPONENT_RAW = 1073741824u ,
|
||||
PLANE_COMPONENT_META = 2147483648u ,
|
||||
};
|
||||
|
||||
enum class Flags : int32_t {
|
||||
LAYOUT_INTERLACED_FLAG = 1 ,
|
||||
};
|
||||
|
||||
struct PlaneLayout final {
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>
|
||||
component __attribute__((aligned(4)));
|
||||
uint32_t h_subsampling __attribute__((aligned(4)));
|
||||
uint32_t v_subsampling __attribute__((aligned(4)));
|
||||
uint32_t offset __attribute__((aligned(4)));
|
||||
int32_t pixel_increment __attribute__((aligned(4)));
|
||||
int32_t stride __attribute__((aligned(4)));
|
||||
int32_t stride_bytes __attribute__((aligned(4)));
|
||||
int32_t scanlines __attribute__((aligned(4)));
|
||||
uint32_t size __attribute__((aligned(4)));
|
||||
};
|
||||
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
component) == 0,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
h_subsampling) == 4,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
v_subsampling) == 8,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
offset) == 12,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
pixel_increment) == 16,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
stride) == 20,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
stride_bytes) == 24,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
scanlines) == 28,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
size) == 32,
|
||||
"wrong offset");
|
||||
static_assert(sizeof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout) == 36,
|
||||
"wrong size");
|
||||
static_assert(__alignof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout) == 4,
|
||||
"wrong alignment");
|
||||
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error o);
|
||||
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t& operator|=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t& operator&=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout& o);
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(uint32_t o);
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent o);
|
||||
|
||||
constexpr uint32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator|(
|
||||
const uint32_t lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(lhs | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const uint32_t rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr uint32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator&(
|
||||
const uint32_t lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(lhs & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const uint32_t rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr uint32_t& operator|=(
|
||||
uint32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent e) {
|
||||
v |= static_cast<uint32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr uint32_t& operator&=(
|
||||
uint32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent e) {
|
||||
v &= static_cast<uint32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags o);
|
||||
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t& operator|=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t& operator&=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& o);
|
||||
static inline bool operator==(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs);
|
||||
static inline bool operator!=(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs);
|
||||
|
||||
|
||||
template <>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::Error>(
|
||||
int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error>
|
||||
flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE) ==
|
||||
static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NONE";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER) ==
|
||||
static_cast<int32_t>(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_BUFFER";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES) ==
|
||||
static_cast<int32_t>(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NO_RESOURCES";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED) ==
|
||||
static_cast<int32_t>(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "UNSUPPORTED";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE) {
|
||||
return "NONE";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER) {
|
||||
return "BAD_BUFFER";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES) {
|
||||
return "NO_RESOURCES";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED) {
|
||||
return "UNSUPPORTED";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".y = ";
|
||||
os += ::android::hardware::toString(o.y);
|
||||
os += ", .cb = ";
|
||||
os += ::android::hardware::toString(o.cb);
|
||||
os += ", .cr = ";
|
||||
os += ::android::hardware::toString(o.cr);
|
||||
os += ", .yStride = ";
|
||||
os += ::android::hardware::toString(o.yStride);
|
||||
os += ", .cStride = ";
|
||||
os += ::android::hardware::toString(o.cStride);
|
||||
os += ", .chromaStep = ";
|
||||
os += ::android::hardware::toString(o.chromaStep);
|
||||
os += "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
inline std::string
|
||||
toString<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>(uint32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>
|
||||
flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Y) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_Y)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Y";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_Cb)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Cb";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_Cr)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Cr";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_R) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_R)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_R";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_G) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_G)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_G";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_B) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_B)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_B";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_A) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_A)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_A";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_RAW)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_RAW";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_META)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_META";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y) {
|
||||
return "PLANE_COMPONENT_Y";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb) {
|
||||
return "PLANE_COMPONENT_Cb";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr) {
|
||||
return "PLANE_COMPONENT_Cr";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R) {
|
||||
return "PLANE_COMPONENT_R";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G) {
|
||||
return "PLANE_COMPONENT_G";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B) {
|
||||
return "PLANE_COMPONENT_B";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A) {
|
||||
return "PLANE_COMPONENT_A";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW) {
|
||||
return "PLANE_COMPONENT_RAW";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META) {
|
||||
return "PLANE_COMPONENT_META";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<uint32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags>(
|
||||
int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags>
|
||||
flipped = 0;
|
||||
bool first = true;
|
||||
if ((o &
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG) ==
|
||||
static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::
|
||||
LAYOUT_INTERLACED_FLAG)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "LAYOUT_INTERLACED_FLAG";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG) {
|
||||
return "LAYOUT_INTERLACED_FLAG";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".component = ";
|
||||
os += ::vendor::qti::hardware::display::mapperextensions::V1_0::toString<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>(o.component);
|
||||
os += ", .h_subsampling = ";
|
||||
os += ::android::hardware::toString(o.h_subsampling);
|
||||
os += ", .v_subsampling = ";
|
||||
os += ::android::hardware::toString(o.v_subsampling);
|
||||
os += ", .offset = ";
|
||||
os += ::android::hardware::toString(o.offset);
|
||||
os += ", .pixel_increment = ";
|
||||
os += ::android::hardware::toString(o.pixel_increment);
|
||||
os += ", .stride = ";
|
||||
os += ::android::hardware::toString(o.stride);
|
||||
os += ", .stride_bytes = ";
|
||||
os += ::android::hardware::toString(o.stride_bytes);
|
||||
os += ", .scanlines = ";
|
||||
os += ::android::hardware::toString(o.scanlines);
|
||||
os += ", .size = ";
|
||||
os += ::android::hardware::toString(o.size);
|
||||
os += "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline bool operator==(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs) {
|
||||
if (lhs.component != rhs.component) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.h_subsampling != rhs.h_subsampling) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.v_subsampling != rhs.v_subsampling) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.offset != rhs.offset) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.pixel_increment != rhs.pixel_increment) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.stride != rhs.stride) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.stride_bytes != rhs.stride_bytes) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.scanlines != rhs.scanlines) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.size != rhs.size) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool operator!=(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::Error, 4>
|
||||
hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::Error> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent, 9>
|
||||
hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags, 1>
|
||||
hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,471 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2022, The Linux Foundation. All rights reserved.
|
||||
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "qtimapper-shim"
|
||||
|
||||
#include <android/hidl/base/1.0/BpHwBase.h>
|
||||
#include <dlfcn.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <log/log.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include "ext/common.h"
|
||||
#include "ext/gr_utils.h"
|
||||
#include "ext/mapper.h"
|
||||
#include "ext/mapperextensions.h"
|
||||
|
||||
using namespace android::hardware;
|
||||
using namespace android;
|
||||
|
||||
extern "C" uint64_t __attribute__((weak)) atrace_get_enabled_tags() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace android::hardware::details {
|
||||
void __attribute__((weak)) return_status::onValueRetrieval() const {}
|
||||
}
|
||||
|
||||
bool IBase::isRemote() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
sp<graphics::mapper::V2_0::IMapper> (*Mapper20GetService)(const std::string&, const bool);
|
||||
sp<graphics::mapper::V3_0::IMapper> (*Mapper30GetService)(const std::string&, const bool);
|
||||
sp<graphics::mapper::V4_0::IMapper> (*Mapper40GetService)(const std::string&, const bool);
|
||||
|
||||
Return<sp<vendor::qti::hardware::display::mapper::V2_0::IQtiMapper>> (*QtiMapper20CastFrom)(
|
||||
const sp<graphics::mapper::V2_0::IMapper>&, bool);
|
||||
Return<sp<vendor::qti::hardware::display::mapper::V3_0::IQtiMapper>> (*QtiMapper30CastFrom)(
|
||||
const sp<graphics::mapper::V3_0::IMapper>&, bool);
|
||||
Return<sp<vendor::qti::hardware::display::mapper::V4_0::IQtiMapper>> (*QtiMapper40CastFrom)(
|
||||
const sp<graphics::mapper::V4_0::IMapper>&, bool);
|
||||
|
||||
Return<sp<vendor::qti::hardware::display::mapperextensions::V1_1::IQtiMapperExtensions>> (
|
||||
*MapperExtensions11CastFrom)(
|
||||
const sp<vendor::qti::hardware::display::mapperextensions::V1_0::IQtiMapperExtensions>&, bool);
|
||||
|
||||
__attribute__((constructor)) static void initShim() {
|
||||
void* qtiMapper40Hnd =
|
||||
dlopen("vendor.qti.hardware.display.mapper@4.0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (qtiMapper40Hnd) {
|
||||
void* mapper40Hnd = dlopen("android.hardware.graphics.mapper@4.0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (mapper40Hnd) {
|
||||
Mapper40GetService = reinterpret_cast<decltype(Mapper40GetService)>(
|
||||
dlsym(mapper40Hnd,
|
||||
"_ZN7android8hardware8graphics6mapper4V4_07IMapper10getServiceERKNSt3__112basic_"
|
||||
"stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEb"));
|
||||
QtiMapper40CastFrom = reinterpret_cast<decltype(QtiMapper40CastFrom)>(dlsym(
|
||||
qtiMapper40Hnd,
|
||||
"_ZN6vendor3qti8hardware7display6mapper4V4_010IQtiMapper8castFromERKN7android2spINS6_"
|
||||
"8hardware8graphics6mapper4V4_07IMapperEEEb"));
|
||||
|
||||
ALOGD("%s: Mapper 4.0 present", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void* qtiMapper30Hnd =
|
||||
dlopen("vendor.qti.hardware.display.mapper@3.0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (qtiMapper30Hnd) {
|
||||
void* mapper30Hnd = dlopen("android.hardware.graphics.mapper@3.0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (mapper30Hnd) {
|
||||
Mapper30GetService = reinterpret_cast<decltype(Mapper30GetService)>(
|
||||
dlsym(mapper30Hnd,
|
||||
"_ZN7android8hardware8graphics6mapper4V3_07IMapper10getServiceERKNSt3__112basic_"
|
||||
"stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEb"));
|
||||
QtiMapper30CastFrom = reinterpret_cast<decltype(QtiMapper30CastFrom)>(dlsym(
|
||||
qtiMapper30Hnd,
|
||||
"_ZN6vendor3qti8hardware7display6mapper4V3_010IQtiMapper8castFromERKN7android2spINS6_"
|
||||
"8hardware8graphics6mapper4V3_07IMapperEEEb"));
|
||||
ALOGD("%s: Mapper 3.0 present", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void* qtiMapper20Hnd =
|
||||
dlopen("vendor.qti.hardware.display.mapper@2.0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (qtiMapper20Hnd) {
|
||||
void* mapper20Hnd = dlopen("android.hardware.graphics.mapper@2.0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (mapper20Hnd) {
|
||||
Mapper20GetService = reinterpret_cast<decltype(Mapper20GetService)>(
|
||||
dlsym(mapper20Hnd,
|
||||
"_ZN7android8hardware8graphics6mapper4V2_07IMapper10getServiceERKNSt3__112basic_"
|
||||
"stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEb"));
|
||||
QtiMapper20CastFrom = reinterpret_cast<decltype(QtiMapper20CastFrom)>(dlsym(
|
||||
qtiMapper20Hnd,
|
||||
"_ZN6vendor3qti8hardware7display6mapper4V2_010IQtiMapper8castFromERKN7android2spINS6_"
|
||||
"8hardware8graphics6mapper4V2_07IMapperEEEb"));
|
||||
ALOGD("%s: Mapper 2.0 present", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void* mapperExtensions11Hnd =
|
||||
dlopen("vendor.qti.hardware.display.mapperextensions@1.1.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (mapperExtensions11Hnd) {
|
||||
MapperExtensions11CastFrom = reinterpret_cast<decltype(MapperExtensions11CastFrom)>(dlsym(
|
||||
mapperExtensions11Hnd,
|
||||
"_ZN6vendor3qti8hardware7display16mapperextensions4V1_"
|
||||
"120IQtiMapperExtensions8castFromERKN7android2spINS3_4V1_020IQtiMapperExtensionsEEEb"));
|
||||
ALOGD("%s: Mapper Extensions 1.1 present", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
namespace android::hardware::graphics::mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
sp<IMapper> IMapper::getService(const std::string& serviceName, const bool getStub) {
|
||||
if (Mapper20GetService) return Mapper20GetService(serviceName, getStub);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
namespace V3_0 {
|
||||
|
||||
sp<IMapper> IMapper::getService(const std::string& serviceName, const bool getStub) {
|
||||
if (Mapper30GetService) return Mapper30GetService(serviceName, getStub);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
namespace V4_0 {
|
||||
|
||||
sp<IMapper> IMapper::getService(const std::string& serviceName, const bool getStub) {
|
||||
if (Mapper40GetService) return Mapper40GetService(serviceName, getStub);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
namespace vendor::qti::hardware::display {
|
||||
namespace mapper {
|
||||
namespace V4_0 {
|
||||
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V4_0::IMapper>& parent,
|
||||
bool emitError) {
|
||||
if (QtiMapper40CastFrom) return QtiMapper40CastFrom(parent, emitError);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
namespace V3_0 {
|
||||
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V3_0::IMapper>& parent,
|
||||
bool emitError) {
|
||||
if (QtiMapper30CastFrom) return QtiMapper30CastFrom(parent, emitError);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
namespace V2_0 {
|
||||
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V2_0::IMapper>& parent,
|
||||
bool emitError) {
|
||||
if (QtiMapper20CastFrom) return QtiMapper20CastFrom(parent, emitError);
|
||||
|
||||
return new IQtiMapper();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapper::getMapperExtensions(getMapperExtensions_cb _hidl_cb) {
|
||||
sp<mapperextensions::V1_0::IQtiMapperExtensions> ext{
|
||||
new mapperextensions::V1_0::IQtiMapperExtensions()};
|
||||
_hidl_cb(graphics::mapper::V2_0::Error::NONE, ext);
|
||||
return Void();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
namespace mapperextensions {
|
||||
namespace V1_1 {
|
||||
|
||||
IQtiMapperExtensions::IQtiMapperExtensions() {
|
||||
ALOGI("IQtiMapperExtensions shim active");
|
||||
|
||||
hw_module_t const* module;
|
||||
if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module)) {
|
||||
ALOGE("Failed to open gralloc module!");
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
if (gralloc1_open(module, &gralloc)) {
|
||||
ALOGE("Failed to open gralloc HAL!");
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
perform = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
|
||||
gralloc->getFunction(gralloc, GRALLOC1_FUNCTION_PERFORM));
|
||||
if (!perform) {
|
||||
ALOGE("Failed to get gralloc perform helper!");
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
ALOGD("Opened gralloc1 HAL");
|
||||
}
|
||||
|
||||
Return<sp<IQtiMapperExtensions>> IQtiMapperExtensions::castFrom(
|
||||
android::sp<V1_0::IQtiMapperExtensions> const& parent, bool emitError) {
|
||||
if (MapperExtensions11CastFrom) return MapperExtensions11CastFrom(parent, emitError);
|
||||
return new IQtiMapperExtensions();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getRgbDataAddress(void* buffer, getRgbDataAddress_cb _hidl_cb) {
|
||||
void* rgb_data = nullptr;
|
||||
|
||||
auto err = perform(gralloc, GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS, buffer, &rgb_data)
|
||||
? Error::BAD_BUFFER
|
||||
: Error::NONE;
|
||||
_hidl_cb(err, rgb_data);
|
||||
|
||||
ALOGV("%s: err: %d rgb_data: %p", __func__, err, rgb_data);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getInterlacedFlag(void* buffer, getInterlacedFlag_cb _hidl_cb) {
|
||||
int flag = 0;
|
||||
auto perform = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
|
||||
gralloc->getFunction(gralloc, GRALLOC1_FUNCTION_PERFORM));
|
||||
auto err = perform(gralloc, GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG, buffer, &flag)
|
||||
? Error::BAD_BUFFER
|
||||
: Error::NONE;
|
||||
_hidl_cb(err, flag);
|
||||
ALOGV("%s: err: %d flag: %d", __func__, err, flag);
|
||||
return Void();
|
||||
}
|
||||
Return<void> IQtiMapperExtensions::getFd(void* buffer, getFd_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int fd = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
fd = hnd->fd;
|
||||
}
|
||||
hidl_cb(err, fd);
|
||||
ALOGV("%s: fd: %d", __func__, fd);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getWidth(void* buffer, getWidth_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int width = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
width = hnd->width;
|
||||
}
|
||||
hidl_cb(err, width);
|
||||
ALOGV("%s: width: %d", __func__, width);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getHeight(void* buffer, getHeight_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int height = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
height = hnd->height;
|
||||
}
|
||||
hidl_cb(err, height);
|
||||
ALOGV("%s: height: %d", __func__, height);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getFormat(void* buffer, getFormat_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int format = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
format = hnd->format;
|
||||
}
|
||||
hidl_cb(err, format);
|
||||
|
||||
ALOGV("%s: format: %d", __func__, format);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getPrivateFlags(void* buffer, getPrivateFlags_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int flags = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
flags = hnd->flags;
|
||||
}
|
||||
hidl_cb(err, flags);
|
||||
ALOGV("%s: flags: %d", __func__, flags);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getUnalignedWidth(void* buffer, getUnalignedWidth_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int unaligned_width = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
unaligned_width = hnd->unaligned_width;
|
||||
}
|
||||
hidl_cb(err, unaligned_width);
|
||||
|
||||
ALOGV("%s: unaligned_width: %u", __func__, unaligned_width);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getUnalignedHeight(void* buffer, getUnalignedHeight_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int unaligned_height = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
unaligned_height = hnd->unaligned_height;
|
||||
}
|
||||
hidl_cb(err, unaligned_height);
|
||||
ALOGV("%s: unaligned_height: %u", __func__, unaligned_height);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getLayerCount(void* buffer, getLayerCount_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
unsigned int layer_count = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
layer_count = hnd->layer_count;
|
||||
}
|
||||
hidl_cb(err, layer_count);
|
||||
ALOGV("%s: layer_count: %u", __func__, layer_count);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getId(void* buffer, getId_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
uint64_t id = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
id = hnd->id;
|
||||
}
|
||||
hidl_cb(err, id);
|
||||
ALOGV("%s: id: %" PRIu64, __func__, id);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getUsageFlags(void* buffer, getUsageFlags_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
uint64_t usage = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
usage = hnd->usage;
|
||||
}
|
||||
hidl_cb(err, usage);
|
||||
ALOGV("%s: usage: %" PRIu64, __func__, usage);
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getSize(void* buffer, getSize_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
unsigned int size = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
size = hnd->size;
|
||||
}
|
||||
hidl_cb(err, size);
|
||||
ALOGV("%s: size: %u", __func__, size);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getOffset(void* buffer, getOffset_cb hidl_cb) {
|
||||
auto err = Error::BAD_BUFFER;
|
||||
unsigned int offset = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = Error::NONE;
|
||||
offset = hnd->offset;
|
||||
}
|
||||
hidl_cb(err, offset);
|
||||
ALOGV("%s: offset: %u", __func__, offset);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getFormatLayout(int32_t format, uint64_t usage, int32_t flags,
|
||||
int32_t width, int32_t height,
|
||||
getFormatLayout_cb _hidl_cb) {
|
||||
hidl_vec<PlaneLayout> plane_info;
|
||||
unsigned int alignedw = 0, alignedh = 0, tile_enabled = 0;
|
||||
int plane_count = 0;
|
||||
uint64_t size = 0;
|
||||
int custom_format = gralloc::GetImplDefinedFormat(usage, format);
|
||||
gralloc::BufferInfo info(width, height, custom_format, usage);
|
||||
|
||||
auto err = perform(gralloc, GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES, width, height, custom_format,
|
||||
usage, usage, &alignedw, &alignedh, &tile_enabled)
|
||||
? Error::BAD_BUFFER
|
||||
: Error::NONE;
|
||||
if (err != Error::NONE) {
|
||||
_hidl_cb(err, 0, plane_info);
|
||||
return Void();
|
||||
}
|
||||
|
||||
size = gralloc::GetSize(info, alignedw, alignedh);
|
||||
gralloc::PlaneLayoutInfo plane_layout[8] = {};
|
||||
|
||||
if (gralloc::IsUncompressedRGBFormat(custom_format) ||
|
||||
gralloc::IsCompressedRGBFormat(custom_format)) {
|
||||
gralloc::GetRGBPlaneInfo(info, custom_format, alignedw, alignedh, flags, &plane_count,
|
||||
plane_layout);
|
||||
} else {
|
||||
ALOGE("%s: unsupported format %d", __func__, format);
|
||||
err = Error::BAD_BUFFER;
|
||||
_hidl_cb(err, size, plane_info);
|
||||
return Void();
|
||||
}
|
||||
|
||||
plane_info.resize(plane_count);
|
||||
for (int i = 0; i < plane_count; i++) {
|
||||
plane_info[i].component = plane_layout[i].component;
|
||||
plane_info[i].h_subsampling = plane_layout[i].h_subsampling;
|
||||
plane_info[i].v_subsampling = plane_layout[i].v_subsampling;
|
||||
plane_info[i].offset = plane_layout[i].offset;
|
||||
plane_info[i].pixel_increment = plane_layout[i].step;
|
||||
plane_info[i].stride = plane_layout[i].stride;
|
||||
plane_info[i].stride_bytes = plane_layout[i].stride_bytes;
|
||||
plane_info[i].scanlines = plane_layout[i].scanlines;
|
||||
plane_info[i].size = plane_layout[i].size;
|
||||
}
|
||||
|
||||
_hidl_cb(err, size, plane_info);
|
||||
return Void();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
#include <dlfcn.h>
|
||||
#include <jni.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define VK_NO_PROTOTYPES
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#define LINE(...) do { if (used < sizeof(out)) used += snprintf(out + used, sizeof(out) - used, __VA_ARGS__); } while (0)
|
||||
|
||||
static const char *const EXTENSIONS[] = {
|
||||
"VK_EXT_robustness2", "VK_EXT_transform_feedback", "VK_EXT_custom_border_color",
|
||||
"VK_KHR_dynamic_rendering", "VK_EXT_extended_dynamic_state3", "VK_EXT_descriptor_indexing",
|
||||
"VK_KHR_timeline_semaphore", "VK_EXT_mesh_shader", "VK_KHR_ray_query",
|
||||
};
|
||||
|
||||
static const char *type_name(VkPhysicalDeviceType type) {
|
||||
switch (type) {
|
||||
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: return "integrated GPU";
|
||||
case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: return "discrete GPU";
|
||||
case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: return "virtual GPU";
|
||||
case VK_PHYSICAL_DEVICE_TYPE_CPU: return "CPU";
|
||||
default: return "other";
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_droiddeck_launcher_gpu_VulkanInfo_nativeQuery(JNIEnv *env, jclass clazz) {
|
||||
static char out[4096];
|
||||
size_t used = 0;
|
||||
out[0] = 0;
|
||||
void *lib = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
|
||||
if (!lib) { LINE("error=no Vulkan loader\n"); return (*env)->NewStringUTF(env, out); }
|
||||
PFN_vkGetInstanceProcAddr gipa = (PFN_vkGetInstanceProcAddr) dlsym(lib, "vkGetInstanceProcAddr");
|
||||
PFN_vkCreateInstance create = gipa ? (PFN_vkCreateInstance) gipa(NULL, "vkCreateInstance") : NULL;
|
||||
PFN_vkEnumerateInstanceVersion instanceVersion = gipa ? (PFN_vkEnumerateInstanceVersion) gipa(NULL, "vkEnumerateInstanceVersion") : NULL;
|
||||
if (!create) { LINE("error=no vkCreateInstance\n"); dlclose(lib); return (*env)->NewStringUTF(env, out); }
|
||||
uint32_t loader = VK_API_VERSION_1_0;
|
||||
if (instanceVersion) instanceVersion(&loader);
|
||||
LINE("loader=%u.%u.%u\n", VK_API_VERSION_MAJOR(loader), VK_API_VERSION_MINOR(loader), VK_API_VERSION_PATCH(loader));
|
||||
|
||||
VkApplicationInfo app = { .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .pApplicationName = "DroidDeck device info",
|
||||
.apiVersion = loader >= VK_API_VERSION_1_1 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0 };
|
||||
VkInstanceCreateInfo info = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pApplicationInfo = &app };
|
||||
VkInstance instance = VK_NULL_HANDLE;
|
||||
if (create(&info, NULL, &instance) != VK_SUCCESS) { LINE("error=vkCreateInstance failed\n"); dlclose(lib); return (*env)->NewStringUTF(env, out); }
|
||||
|
||||
#define GET(name) PFN_##name name = (PFN_##name) gipa(instance, #name)
|
||||
GET(vkDestroyInstance); GET(vkEnumeratePhysicalDevices); GET(vkGetPhysicalDeviceProperties);
|
||||
GET(vkGetPhysicalDeviceProperties2); GET(vkGetPhysicalDeviceMemoryProperties);
|
||||
GET(vkEnumerateDeviceExtensionProperties); GET(vkGetPhysicalDeviceFeatures);
|
||||
uint32_t count = 1;
|
||||
VkPhysicalDevice device = VK_NULL_HANDLE;
|
||||
VkResult listed = vkEnumeratePhysicalDevices ? vkEnumeratePhysicalDevices(instance, &count, &device) : VK_ERROR_INITIALIZATION_FAILED;
|
||||
if ((listed != VK_SUCCESS && listed != VK_INCOMPLETE) || count == 0 || !device || !vkGetPhysicalDeviceProperties) {
|
||||
LINE("error=no Vulkan device\n");
|
||||
} else {
|
||||
VkPhysicalDeviceProperties p;
|
||||
vkGetPhysicalDeviceProperties(device, &p);
|
||||
LINE("device=%s\n", p.deviceName);
|
||||
LINE("type=%s\n", type_name(p.deviceType));
|
||||
LINE("api=%u.%u.%u\n", VK_API_VERSION_MAJOR(p.apiVersion), VK_API_VERSION_MINOR(p.apiVersion), VK_API_VERSION_PATCH(p.apiVersion));
|
||||
LINE("driver_version=%u.%u.%u\n", p.driverVersion >> 22, (p.driverVersion >> 12) & 0x3ff, p.driverVersion & 0xfff);
|
||||
LINE("vendor_id=0x%04x\ndevice_id=0x%08x\n", p.vendorID, p.deviceID);
|
||||
LINE("max_image_2d=%u\n", p.limits.maxImageDimension2D);
|
||||
|
||||
uint32_t extCount = 0;
|
||||
if (vkEnumerateDeviceExtensionProperties) vkEnumerateDeviceExtensionProperties(device, NULL, &extCount, NULL);
|
||||
static VkExtensionProperties exts[512];
|
||||
if (extCount > 512) extCount = 512;
|
||||
if (extCount && vkEnumerateDeviceExtensionProperties) vkEnumerateDeviceExtensionProperties(device, NULL, &extCount, exts);
|
||||
int driverProps = p.apiVersion >= VK_API_VERSION_1_2;
|
||||
for (uint32_t i = 0; i < extCount; i++)
|
||||
if (!strcmp(exts[i].extensionName, "VK_KHR_driver_properties")) driverProps = 1;
|
||||
if (driverProps && vkGetPhysicalDeviceProperties2) {
|
||||
VkPhysicalDeviceDriverProperties driver = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES };
|
||||
VkPhysicalDeviceProperties2 p2 = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &driver };
|
||||
vkGetPhysicalDeviceProperties2(device, &p2);
|
||||
LINE("driver_name=%s\n", driver.driverName);
|
||||
LINE("driver_info=%s\n", driver.driverInfo);
|
||||
LINE("conformance=%u.%u.%u.%u\n", driver.conformanceVersion.major, driver.conformanceVersion.minor,
|
||||
driver.conformanceVersion.subminor, driver.conformanceVersion.patch);
|
||||
}
|
||||
LINE("extension_count=%u\n", extCount);
|
||||
for (size_t e = 0; e < sizeof(EXTENSIONS) / sizeof(*EXTENSIONS); e++) {
|
||||
int has = 0;
|
||||
for (uint32_t i = 0; i < extCount && !has; i++) has = !strcmp(exts[i].extensionName, EXTENSIONS[e]);
|
||||
LINE("ext.%s=%s\n", EXTENSIONS[e], has ? "yes" : "no");
|
||||
}
|
||||
if (vkGetPhysicalDeviceFeatures) {
|
||||
VkPhysicalDeviceFeatures f;
|
||||
vkGetPhysicalDeviceFeatures(device, &f);
|
||||
LINE("geometry_shader=%s\ntessellation_shader=%s\ntexture_bc=%s\n",
|
||||
f.geometryShader ? "yes" : "no", f.tessellationShader ? "yes" : "no", f.textureCompressionBC ? "yes" : "no");
|
||||
}
|
||||
if (vkGetPhysicalDeviceMemoryProperties) {
|
||||
VkPhysicalDeviceMemoryProperties m;
|
||||
vkGetPhysicalDeviceMemoryProperties(device, &m);
|
||||
VkDeviceSize largest = 0;
|
||||
for (uint32_t i = 0; i < m.memoryHeapCount; i++)
|
||||
if ((m.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) && m.memoryHeaps[i].size > largest) largest = m.memoryHeaps[i].size;
|
||||
LINE("device_heap_mb=%llu\n", (unsigned long long) (largest >> 20));
|
||||
}
|
||||
}
|
||||
if (vkDestroyInstance) vkDestroyInstance(instance, NULL);
|
||||
dlclose(lib);
|
||||
return (*env)->NewStringUTF(env, out);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Loaded 100 of 1785 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user