73 Commits

Author SHA1 Message Date
Lu Hui
052b22ef8b revyos_defconfig: enable nfs kernel server support 2023-09-11 20:15:56 +08:00
Lu Hui
cc197e94ce riscv: dts: add lpi4a laptop device tree 2023-09-11 18:35:35 +08:00
Lu Hui
46e0a824e1 riscv: dts: add cluster device tree 2023-09-11 18:35:18 +08:00
Mingzheng Xing
f72e7cd077 feat: update gpu to Linux_SDK_V1.2.1
This version update involves a lot of content, so the previous version
has been deleted and the new version has been re-merged into the kernel.

The configuration file for the GPU driver originates from a previous
version.

Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
2023-09-06 12:31:53 +08:00
Lu Hui
807db9d981 Revert "revyos_defconfig: enable usb uas driver"
This reverts commit 07167b855f.

this commit cause some usb stroage device not working,disable
this driver from being compiled into the kernel until the cause
of the device not working is found.
2023-09-04 17:15:41 +08:00
Lu Hui
07167b855f revyos_defconfig: enable usb uas driver 2023-08-28 11:31:23 +08:00
Lu Hui
342da2ebbd revyos_defconfig: enable TCP congestion control 2023-08-28 11:31:23 +08:00
Han Gao
0504ee67e5 fix: revert es7210&es8156
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-19 15:26:40 +08:00
Han Gao
4d36214794 chore: sync sdk v1.2.1 config
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-19 15:26:40 +08:00
Han Gao
8e0c3eb23d chore: sync sdk v1.2.1 es7210&es8156
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-19 15:26:40 +08:00
Han Gao
3e585776f5 chore: sync sdk v1.2.1 dts
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-19 15:26:40 +08:00
thead_admin
afef388b8e Linux_SDK_V1.2.1
Signed-off-by: thead_admin <occ_thead@service.alibaba.com>
2023-08-19 15:26:40 +08:00
Martin Rodriguez Reboredo
a26b2d282c kbuild: Add skip_encoding_btf_enum64 option to pahole
New pahole (version 1.24) generates by default new BTF_KIND_ENUM64 BTF tag,
which is not supported by stable kernel.

As a result the kernel with CONFIG_DEBUG_INFO_BTF option will fail to
compile with following error:

  BTFIDS  vmlinux
FAILED: load BTF from vmlinux: Invalid argument

New pahole provides --skip_encoding_btf_enum64 option to skip BTF_KIND_ENUM64
generation and produce BTF supported by stable kernel.

Adding this option to scripts/pahole-flags.sh.

This change does not have equivalent commit in linus tree, because linus tree
has support for BTF_KIND_ENUM64 tag, so it does not need to be disabled.

Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-17 14:14:35 +08:00
Jiri Olsa
0bd99ce376 kbuild: Unify options for BTF generation for vmlinux and modules
commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8 upstream.

[skipped --btf_gen_floats option in pahole-flags.sh, skipped
Makefile.modfinal change, because there's no BTF kmod support,
squashing in 'exit 0' change from merge commit fc02cb2b37fe]

Using new PAHOLE_FLAGS variable to pass extra arguments to
pahole for both vmlinux and modules BTF data generation.

Adding new scripts/pahole-flags.sh script that detect and
prints pahole options.

[ fixed issues found by kernel test robot ]

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211029125729.70002-1-jolsa@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-17 14:14:35 +08:00
Andrii Nakryiko
3ddef5a969 kbuild: skip per-CPU BTF generation for pahole v1.18-v1.21
commit a0b8200d06ad6450c179407baa5f0f52f8cfcc97 upstream.

[small context changes due to missing floats support in 5.10]

Commit "mm/page_alloc: convert per-cpu list protection to local_lock" will
introduce a zero-sized per-CPU variable, which causes pahole to generate
invalid BTF.  Only pahole versions 1.18 through 1.21 are impacted, as
before 1.18 pahole doesn't know anything about per-CPU variables, and 1.22
contains the proper fix for the issue.

Luckily, pahole 1.18 got --skip_encoding_btf_vars option disabling BTF
generation for per-CPU variables in anticipation of some unanticipated
problems.  So use this escape hatch to disable per-CPU var BTF info on
those problematic pahole versions.  Users relying on availability of
per-CPU var BTFs would need to upgrade to pahole 1.22+, but everyone won't
notice any regressions.

Link: https://lkml.kernel.org/r/20210530002536.3193829-1-andrii@kernel.org
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Michal Suchanek <msuchanek@suse.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-17 14:14:35 +08:00
Javier Martinez Canillas
8b0b779b76 kbuild: Quote OBJCOPY var to avoid a pahole call break the build
commit ff2e6efda0d5c51b33e2bcc0b0b981ac0a0ef214 upstream.

[backported for dependency, skipped Makefile.modfinal change,
because module BTF is not supported in 5.10]

The ccache tool can be used to speed up cross-compilation, by calling the
compiler and binutils through ccache. For example, following should work:

    $ export ARCH=arm64 CROSS_COMPILE="ccache aarch64-linux-gnu-"

    $ make M=drivers/gpu/drm/rockchip/

but pahole fails to extract the BTF info from DWARF, breaking the build:

      CC [M]  drivers/gpu/drm/rockchip//rockchipdrm.mod.o
      LD [M]  drivers/gpu/drm/rockchip//rockchipdrm.ko
      BTF [M] drivers/gpu/drm/rockchip//rockchipdrm.ko
    aarch64-linux-gnu-objcopy: invalid option -- 'J'
    Usage: aarch64-linux-gnu-objcopy [option(s)] in-file [out-file]
     Copies a binary file, possibly transforming it in the process
    ...
    make[1]: *** [scripts/Makefile.modpost:156: __modpost] Error 2
    make: *** [Makefile:1866: modules] Error 2

this fails because OBJCOPY is set to "ccache aarch64-linux-gnu-copy" and
later pahole is executed with the following command line:

    LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@

which gets expanded to:

    LLVM_OBJCOPY=ccache aarch64-linux-gnu-objcopy pahole -J ...

instead of:

    LLVM_OBJCOPY="ccache aarch64-linux-gnu-objcopy" pahole -J ...

Fixes: 5f9ae91f7c0d ("kbuild: Build kernel module BTFs if BTF is enabled and pahole supports it")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/bpf/20210526215228.3729875-1-javierm@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-17 14:14:35 +08:00
Ilya Leoshkevich
c70e925ac5 bpf: Generate BTF_KIND_FLOAT when linking vmlinux
commit db16c1fe92d7ba7d39061faef897842baee2c887  upstream.

[backported for dependency only extra_paholeopt variable setup and
usage, we don't want floats generated in 5.10]

pahole v1.21 supports the --btf_gen_floats flag, which makes it
generate the information about the floating-point types [1].

Adjust link-vmlinux.sh to pass this flag to pahole in case it's
supported, which is determined using a simple version check.

[1] https://lore.kernel.org/dwarves/YHRiXNX1JUF2Az0A@kernel.org/

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210413190043.21918-1-iii@linux.ibm.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-17 14:14:35 +08:00
NekoRouter
c130cdb21f Add USB Modem (CDC ACM) support 2023-08-07 18:20:20 +08:00
NekoRouter
765b9ada52 Add usb-serial defconfig 2023-08-07 18:20:20 +08:00
Han Gao
8631d2c44f chore: dtb_install in /boot
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 03:02:54 +08:00
Icenowy Zheng
c56347a43e add lpi4a 16g dtb
Co-authored-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 03:02:54 +08:00
Han Gao
827be31621 feat: update gpu sdk1.2.0
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 02:42:20 +08:00
Han Gao
8eac2d9ff9 fix: revert lpi4a dts for Speaker
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 01:27:02 +08:00
Han Gao
d2d4e58f6d fix: revert es7210.c/h es8156.c
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 01:27:02 +08:00
Han Gao
3360d12ccb feat: sync light kernel config
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 01:27:02 +08:00
jianghai
c99828ab6f eth: gmac: adapt to support DMA 32-bit in skb 2023-08-02 01:27:02 +08:00
Han Gao
7d38ead3b4 feat: update SDK1.2.0
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-08-02 01:27:02 +08:00
Han Gao
66f9d7c397 chore: fixed version rule of kernel
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-07-19 17:01:53 +08:00
Mingzheng Xing
9e49618e75 driver: add npu-ax3386-gpl
Add a new driver npu-ax3386-gpl, default compile as module.
The default generated modules are:
- vha.ko
- img_mem.ko
- vha_info.ko

Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
2023-07-19 02:15:19 +08:00
Han Gao
6324bd2198 feat: build linux-perf-thead
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-07-19 00:09:24 +08:00
Han Gao
16fdf152d1 feat: package deb
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-07-19 00:09:24 +08:00
Han Gao
0683ead841 feat: remove compression for riscv Image
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-07-14 20:33:46 +08:00
Han Gao
1dd9935a28 fix: remove p2p0 ifname
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-07-14 00:58:41 +08:00
Han Gao
b989adf3aa fix: remove debug config
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-07-14 00:58:41 +08:00
Mingzheng Xing
8cf226ab71 Kernel: Enable binfmt_misc module
Enable binfmt_misc module as the kernel module.
2023-07-11 00:49:19 +08:00
忘怀
42de796933 Input: joystick - fix Kconfig warning for JOYSTICK_ADC
[ Upstream commit 6100a19c4fcfe154dd32f8a8ef4e8c0b1f607c75 ]

Fix a Kconfig warning for JOYSTICK_ADC by also selecting
IIO_BUFFER.

WARNING: unmet direct dependencies detected for IIO_BUFFER_CB
  Depends on [n]: IIO [=y] && IIO_BUFFER [=n]
  Selected by [y]:
  - JOYSTICK_ADC [=y] && INPUT [=y] && INPUT_JOYSTICK [=y] && IIO [=y]

Fixes: 2c2b364fddd5 ("Input: joystick - add ADC attached joystick driver.")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20221104201238.31628-1-rdunlap@infradead.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-04 15:20:54 +08:00
Han Gao
387b686325 chore: remove CONFIG_VECTOR_0_7 for workflow
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-26 16:02:44 +08:00
Han Gao
7a3658a807 chore: remove CONFIG_VECTOR_0_7
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-26 16:02:44 +08:00
Han Gao
7feb2daff6 feat: riscv: vector: No need T-head toolchain to build kernel with CONFIG_VECTOR
from:
bced4a86e6

Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-26 16:02:44 +08:00
Han Gao
0a18500133 chore: restore only support v0p7
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-26 16:02:44 +08:00
Han Gao
87260fc991 chore: remove img_module in workflow
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-25 23:04:18 +08:00
Mingzheng Xing
772a291a5a Kernel: Add new driver configs
Add kernel configs for the following drivers:
- vpu-vc8000d-kernel
- vpu-vc8000e-kernel
- video_memory
- gpu_bxm_4_64-kernel
2023-06-25 23:04:18 +08:00
Mingzheng Xing
77c3f5c0d0 Kernel: Add gpu_bxm img-rogue driver 2023-06-25 23:04:18 +08:00
Mingzheng Xing
3eeff2b39d Kernel: Add video memory driver 2023-06-25 23:04:18 +08:00
Mingzheng Xing
06b8b8d9f0 Kernel: Add vc8000d and vc8000e driver 2023-06-25 23:04:18 +08:00
Han Gao
9c58afc7ad fix: gpu-viv build failed in gcc-13
fix _QuerySignal function signature

Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-24 19:48:34 +08:00
Han Gao
ded657fd09 fix: fix perf build
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-24 18:18:46 +08:00
Han Gao
93e7aec675 fix: fix ci kernel config
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-24 18:18:46 +08:00
Han Gao
231409c0ed fix: fix build for binutils 2.38 or later
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-24 18:18:46 +08:00
Han Gao
1c1a707b48 feat: add maintain toolchains compile
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-06-24 18:18:46 +08:00
NekoRouter
7a1ebd4adb Add HDMI I2S config
From Sipeed, This should enable HDMI Audio
2023-06-14 19:20:55 +08:00
NekoRouter
b4474f7737 Add exfat config 2023-05-23 19:13:47 +08:00
Han Gao
bb4691fe55 chore: rename perf to perf-thead
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-05-10 16:56:06 +08:00
Han Gao
0fcd24710d chore: add commit-id
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-05-10 16:31:59 +08:00
Han Gao
e495db816c feat: ci build perf
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-05-10 16:31:59 +08:00
Icenowy Zheng
0b23488d7c riscv: dts: thead: lpi4a: change fan PWM frequency
The fan PWM is originally running at 1kHz, which leads to some annoying
noise.

Lower it to 100Hz now.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-10 14:51:02 +08:00
Icenowy Zheng
f158bc369f drm: verisilicon: fix fbcon
Always map the GEM object, because it may expect different page
attributes than the fixed map by kernel.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-08 18:06:22 +08:00
Icenowy Zheng
a396c98059 drm/dc8200: disable gamma lut now
It seems to have dependency issue.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-08 18:06:22 +08:00
Han Gao
ca43e11e3d fix: fix iotop not working
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-05-08 16:28:01 +08:00
Icenowy Zheng
135fd54dd3 riscv: dts: thead: lpi4a: really remove mipi screen
The previous patch wrongly added again the code to be removed instead of
really removing them.

Fix this.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-02 01:51:09 +08:00
Icenowy Zheng
493de61386 ci: run on pull requests
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-02 01:51:09 +08:00
Icenowy Zheng
3d7b6b56c3 riscv: defconfig: revyos: enable kernel PWM fan
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-02 01:51:09 +08:00
Icenowy Zheng
5d620ffde0 riscv: dts: thead: lpi4a: add PWM Fan
Two trip points at 50C and 60C are added, for enabling the fan and
making the fan full.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2023-05-02 01:51:09 +08:00
Han Gao
2a5d72be62 Add kernel build ci
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-04-28 22:11:12 +08:00
Han Gao
8688f6fac3 remove mipi screen
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-04-28 21:20:45 +08:00
Mingzheng Xing
fba465199e RISC-V: Enable container related kernel configs
A new revyos_defconfig has been added to the arch riscv, enabling
the kernel to support containers.
All kernel configs have been verified through the testing script[1]
provided by Docker.

[1] https://github.com/moby/moby/blob/master/contrib/check-config.sh
2023-04-28 20:42:03 +08:00
Han Gao
7b352f5ac2 set cpu_max_frq 1.848GHz
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2023-04-12 03:05:33 +00:00
t61230
3a0e6fabe8 set cpu_max_frq 1.992GHz 2023-04-06 13:28:10 +08:00
t61230
5e2a0b4b3a 8G ddr 2023-04-06 13:28:05 +08:00
t61230
d01df48030 sync audio patch 2023-04-06 13:27:59 +08:00
t61230
29f55ef165 remove audio pcal9554b 2023-04-06 13:27:53 +08:00
t61230
3024960f77 cpufreq to 2GHz 2023-04-06 13:27:48 +08:00
t61230
e042a6fabe pca9557 2023-04-06 13:27:42 +08:00
759 changed files with 373919 additions and 973 deletions

103
.github/workflows/kernel.yml vendored Normal file
View File

@@ -0,0 +1,103 @@
name: revyos-kernel-build
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
env:
xuetie_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282
toolchain_file_name: Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
ARCH: riscv
board: lpi4a
jobs:
kernel:
strategy:
fail-fast: false
matrix:
include:
- name: thead-gcc
toolchain_tripe: riscv64-unknown-linux-gnu-
- name: gcc-12
toolchain_tripe: riscv64-linux-gnu-
runs-on: ubuntu-22.04
env:
CROSS_COMPILE: ${{ matrix.toolchain_tripe }}
steps:
- name: Install software
run: |
sudo apt update && \
sudo apt install -y gdisk dosfstools g++-12-riscv64-linux-gnu build-essential \
libncurses-dev gawk flex bison openssl libssl-dev tree \
dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf device-tree-compiler \
devscripts
sudo update-alternatives --install \
/usr/bin/riscv64-linux-gnu-gcc riscv64-gcc /usr/bin/riscv64-linux-gnu-gcc-12 10
sudo update-alternatives --install \
/usr/bin/riscv64-linux-gnu-g++ riscv64-g++ /usr/bin/riscv64-linux-gnu-g++-12 10
- name: Checkout kernel
uses: actions/checkout@v3
with:
path: 'kernel'
- name: Configure toolchains
run: |
mkdir rootfs && mkdir rootfs/boot
if [ x"${{ matrix.name }}" = x"thead-gcc" ]; then
wget ${xuetie_toolchain}/${toolchain_file_name}
tar -xvf ${toolchain_file_name} -C /opt
fi
- name: Compile Kernel && Install
run: |
export PATH="/opt/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin:$PATH"
pushd kernel
make revyos_defconfig
export KDEB_PKGVERSION="$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)"
if [ x"${{ matrix.name }}" = x"gcc-12" ]; then
echo "CONFIG_THEAD_ISA=n" >> .config
elif [ x"${{ matrix.name }}" = x"thead-gcc" ]; then
echo "CONFIG_THEAD_ISA=y" >> .config
fi
make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}"
make -j$(nproc) dtbs
# if [ x"$(cat .config | grep CONFIG_MODULES=y)" = x"CONFIG_MODULES=y" ]; then
# sudo make INSTALL_MOD_PATH=${GITHUB_WORKSPACE}/rootfs/ modules_install -j$(nproc)
# fi
# sudo make INSTALL_PATH=${GITHUB_WORKSPACE}/rootfs/boot install -j$(nproc)
# Copy deb
sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/rootfs/
# build perf & install
# make LDFLAGS=-static NO_LIBELF=1 NO_JVMTI=1 VF=1 -C tools/perf/
# sudo mkdir -p ${GITHUB_WORKSPACE}/rootfs/sbin/
# sudo cp -v tools/perf/perf ${GITHUB_WORKSPACE}/rootfs/sbin/perf-thead
# Install Kernel
# sudo cp -v arch/riscv/boot/Image ${GITHUB_WORKSPACE}/rootfs/boot/
# record commit-id
git rev-parse HEAD > kernel-commitid
sudo cp -v kernel-commitid ${GITHUB_WORKSPACE}/rootfs/boot/
# Install DTB
sudo cp -v arch/riscv/boot/dts/thead/{light-lpi4a.dtb,light-lpi4a-16gb.dtb} ${GITHUB_WORKSPACE}/rootfs/boot/
popd
- name: compress
run: tar -zcvf thead-kernel-${{ matrix.name }}.tar.gz rootfs
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: thead-kernel-${{ matrix.name }}.tar.gz
path: thead-kernel-${{ matrix.name }}.tar.gz
retention-days: 30

View File

@@ -480,6 +480,8 @@ LZ4 = lz4
XZ = xz
ZSTD = zstd
PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh)
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
NOSTDINC_FLAGS :=
@@ -534,6 +536,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
export PAHOLE_FLAGS
# Files to ignore in find ... statements

View File

@@ -393,42 +393,14 @@ config FPU
If you don't know what to do here, say Y.
config VECTOR
bool "VECTOR support"
default n
choice VECTOR_VERSION
prompt "Vector Version"
depends on VECTOR
default VECTOR_1_0
config VECTOR_1_0
bool "VECTOR 1.0 support"
help
Say N here if you want to disable all vector 1.0 related procedure
in the kernel.
If you don't know what to do here, say Y.
config VECTOR_0_7
bool "VECTOR 0.7 support"
default y
help
Say N here if you want to disable all vector 0.7 related procedure
in the kernel.
If you don't know what to do here, say Y.
endchoice
config VLEN_256
bool "VECTOR VLEN 256"
depends on VECTOR
default n
config VECTOR_EMU
bool "VECTOR e64 emulate for c906 v1"
depends on VECTOR
default n
config THEAD_ISA
bool "T-HEAD extension ISA in AFLAGS with -march=_xtheadc"
default n

View File

@@ -48,25 +48,20 @@ endif
endif
# ISA string setting
riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd
riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
riscv-march-$(CONFIG_VECTOR) := $(riscv-march-y)v0p7
riscv-march-$(CONFIG_THEAD_ISA) := $(riscv-march-y)_xtheadc
# Newer binutils versions default to ISA spec version 20191213 which moves some
# instructions from the I extension to the Zicsr and Zifencei extensions.
toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei)
riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei
riscv-march-cflags-$(CONFIG_ARCH_RV32I) := rv32ima
riscv-march-cflags-$(CONFIG_ARCH_RV64I) := rv64ima
riscv-march-cflags-$(CONFIG_RISCV_ISA_C) := $(riscv-march-cflags-y)c
riscv-march-aflags-$(CONFIG_ARCH_RV32I) := rv32ima
riscv-march-aflags-$(CONFIG_ARCH_RV64I) := rv64ima
riscv-march-aflags-$(CONFIG_FPU) := $(riscv-march-aflags-y)fd
riscv-march-aflags-$(CONFIG_RISCV_ISA_C) := $(riscv-march-aflags-y)c
riscv-march-aflags-$(CONFIG_VECTOR_1_0) := $(riscv-march-aflags-y)v
riscv-march-aflags-$(CONFIG_VECTOR_0_7) := $(riscv-march-aflags-y)v0p7
riscv-march-aflags-$(CONFIG_THEAD_ISA) := $(riscv-march-aflags-y)_xtheadc
KBUILD_CFLAGS += -march=$(riscv-march-cflags-y) -Wa,-march=$(riscv-march-aflags-y)
KBUILD_AFLAGS += -march=$(riscv-march-aflags-y)
KBUILD_CFLAGS += -march=$(subst _xtheadc,,$(subst v0p7,,$(subst fd,,$(riscv-march-y))))
KBUILD_AFLAGS += -march=$(riscv-march-y)
KBUILD_CFLAGS += -mno-save-restore
KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
@@ -124,7 +119,7 @@ endif
ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_KENDRYTE),yy)
KBUILD_IMAGE := $(boot)/loader.bin
else
KBUILD_IMAGE := $(boot)/Image.gz
KBUILD_IMAGE := $(boot)/Image
endif
BOOT_TARGETS := Image Image.gz loader loader.bin

View File

@@ -29,7 +29,8 @@ dtb-$(CONFIG_SOC_THEAD) += light-a-val-full.dtb
dtb-$(CONFIG_SOC_THEAD) += light-ant-ref.dtb
dtb-$(CONFIG_SOC_THEAD) += light-ant-discrete.dtb
dtb-$(CONFIG_SOC_THEAD) += light-beagle.dtb
dtb-$(CONFIG_SOC_THEAD) += light-lpi4a.dtb light-lpi4a-ddr2G.dtb
dtb-$(CONFIG_SOC_THEAD) += light-lpi4a.dtb light-lpi4a-ddr2G.dtb light-lpi4a-16gb.dtb
dtb-$(CONFIG_SOC_THEAD) += light-lpi4a-cluster.dtb light-lpi4a-cluster-16gb.dtb
dtb-$(CONFIG_SOC_THEAD) += light-a-ref.dtb light-a-ref-dsi0.dtb light-a-ref-dsi0-hdmi.dtb
dtb-$(CONFIG_SOC_THEAD) += light-b-ref.dtb
dtb-$(CONFIG_SOC_THEAD) += light-a-val-crash.dtb light-b-product-crash.dtb light-ant-ref-crash.dtb light-ant-discrete-crash.dtb
@@ -40,3 +41,4 @@ dtb-$(CONFIG_SOC_THEAD) += light-a-val-android.dtb
dtb-$(CONFIG_SOC_THEAD) += fire-emu.dtb fire-emu-crash.dtb
dtb-$(CONFIG_SOC_THEAD) += fire-emu-soc-base.dtb fire-emu-soc-c910x4.dtb fire-emu-gpu-dpu-dsi0.dtb fire-emu-vi-dsp-vo.dtb fire-emu-vi-vp-vo.dtb
dtb-$(CONFIG_SOC_THEAD) += fire-emu-soc-base-sec.dtb
dtb-$(CONFIG_SOC_THEAD) += light-lpi4a-laptop.dtb

View File

@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2022 Alibaba Group Holding Limited.
*/
#include "light-lpi4a-ref.dts"
/ {
model = "T-HEAD Light Lichee Pi 4A configuration for 16GB DDR board";
compatible = "thead,light-val", "thead,light-lpi4a", "thead,light";
memory@0 {
device_type = "memory";
reg = <0x0 0x200000 0x3 0xffe00000>;
};
};
&cmamem {
alloc-ranges = <0x3 0xe4000000 0 0x14000000>; // [0x3E400_0000 ~ 0x3F800_0000]
};

View File

@@ -0,0 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2023 Sipeed.
*/
#include "light-lpi4a-16gb.dts"
/ {
model = "T-HEAD Light Lichee Pi 4A configuration for 16GB DDR board on Cluster";
};
&audio_i2c0 {
status = "disabled";
};
&audio_i2c1 {
status = "disabled";
};
&lightsound {
status = "disabled";
};
&reg_usb_hub_vdd1v2 {
/delete-property/ gpio;
};

View File

@@ -0,0 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2023 Sipeed.
*/
#include "light-lpi4a.dts"
/ {
model = "T-HEAD Light Lichee Pi 4A configuration for 8GB DDR board on Cluster";
};
&audio_i2c0 {
status = "disabled";
};
&audio_i2c1 {
status = "disabled";
};
&lightsound {
status = "disabled";
};
&reg_usb_hub_vdd1v2 {
/delete-property/ gpio;
};

View File

@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2023 Sipeed.
*/
#include "light-lpi4a.dts"
/ {
model = "T-HEAD Light Lichee Pi 4A configuration for 8GB DDR board use on laptop";
power-keys {
compatible = "gpio-keys";
key-lid {
label = "lid status";
linux,code = <KEY_DISPLAY_OFF>;
debounce-interval = <1>;
gpios = <&gpio1_porta 5 0x1>;
};
};
};

View File

@@ -1524,21 +1524,6 @@
status = "okay";
};
&dpu_enc0 {
status = "okay";
ports {
/* output */
port@1 {
reg = <1>;
enc0_out: endpoint {
remote-endpoint = <&dsi0_in>;
};
};
};
};
&dpu_enc1 {
ports {
/delete-node/ port@0;
@@ -1549,48 +1534,6 @@
status = "okay";
};
&dsi0 {
status = "okay";
};
&dhost_0 {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dsi0_in: endpoint {
remote-endpoint = <&enc0_out>;
};
};
port@1 {
reg = <1>;
dsi0_out: endpoint {
remote-endpoint = <&panel0_in>;
};
};
};
panel0@0 {
compatible = "himax,hx8394";
reg = <0>;
backlight = <&lcd0_backlight>;
reset-gpio = <&pcal6408ahk_d 7 1>; /* active low */
hsvcc-supply = <&soc_vdd18_lcd0_en_reg>;
vspn3v3-supply = <&soc_vdd33_lcd0_en_reg>;
port {
panel0_in: endpoint {
remote-endpoint = <&dsi0_out>;
};
};
};
};
&disp1_out {
remote-endpoint = <&hdmi_tx_in>;
};

View File

@@ -3,10 +3,6 @@ CONFIG_POSIX_MQUEUE=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_CGROUPS=y
@@ -338,7 +334,6 @@ CONFIG_OVERLAY_FS=y
CONFIG_LOCKUP_DETECTOR=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
CONFIG_SCHED_INFO=y
CONFIG_PM=y
# CONFIG_SUSPEND is not set
# CONFIG_PM_SLEEP is not set

View File

@@ -0,0 +1,454 @@
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_CGROUPS=y
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
CONFIG_NAMESPACES=y
CONFIG_USER_NS=y
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
# CONFIG_BUG is not set
CONFIG_BPF_SYSCALL=y
CONFIG_PERF_EVENTS=y
CONFIG_FORCE_MAX_ZONEORDER=15
CONFIG_SOC_SIFIVE=y
CONFIG_SOC_THEAD=y
CONFIG_SMP=y
CONFIG_VECTOR=y
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
CONFIG_CPUFREQ_DT=y
CONFIG_RISV_THEAD_LIGHT_CPUFREQ=y
# CONFIG_SUSPEND is not set
CONFIG_PM=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_LIGHT_AON_PD=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_BLK_DEV_THROTTLING=y
CONFIG_BINFMT_MISC=m
CONFIG_CMA=y
CONFIG_CMA_DEBUGFS=y
CONFIG_CMA_AREAS=16
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_XFRM_USER=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPVTI=y
CONFIG_INET_ESP=y
CONFIG_NETFILTER=y
CONFIG_BRIDGE_NETFILTER=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_TFTP=y
CONFIG_NETFILTER_XT_CONNMARK=y
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_IPVS=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=m
CONFIG_TCP_CONG_BBR=m
CONFIG_IP_VS=y
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_NFCT=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_NAT=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_REDIRECT=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_NAT=y
CONFIG_BRIDGE=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_VLAN_8021Q=y
CONFIG_NET_SCHED=y
CONFIG_NET_CLS_CGROUP=y
CONFIG_VSOCKETS=y
# CONFIG_VSOCKETS_LOOPBACK is not set
CONFIG_VIRTIO_VSOCKETS=y
CONFIG_NETLINK_DIAG=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_BT=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_RTL3WIRE=y
CONFIG_CFG80211=y
CONFIG_RFKILL=y
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_PCI=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_MTD=y
CONFIG_MTD_TESTS=m
CONFIG_MTD_BLOCK=y
CONFIG_MTD_SLRAM=m
CONFIG_MTD_PHRAM=m
CONFIG_MTD_SPI_NAND=y
CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_UBI=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_VIRTIO_BLK=y
CONFIG_LIGHT_DSMART_CARD=y
CONFIG_EEPROM_AT24=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_NETDEVICES=y
CONFIG_DUMMY=y
CONFIG_MACVLAN=y
CONFIG_IPVLAN=y
CONFIG_VXLAN=y
CONFIG_TUN=y
CONFIG_VETH=y
CONFIG_VIRTIO_NET=y
CONFIG_MACB=y
CONFIG_STMMAC_ETH=y
CONFIG_STMMAC_RX_ZERO_COPY=y
CONFIG_DWMAC_LIGHT=y
CONFIG_MICROSEMI_PHY=y
CONFIG_REALTEK_PHY=y
CONFIG_USB_USBNET=m
# CONFIG_USB_NET_AX8817X is not set
# CONFIG_USB_NET_AX88179_178A is not set
# CONFIG_USB_NET_NET1080 is not set
CONFIG_RTL8723DS=y
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_GOODIX=y
CONFIG_INPUT_MISC=y
CONFIG_INPUT_UINPUT=y
CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=6
CONFIG_SERIAL_8250_RUNTIME_UARTS=6
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_SPI=y
CONFIG_SPI_DW_QUAD=y
CONFIG_SPI_DESIGNWARE=y
CONFIG_SPI_DW_MMIO=y
CONFIG_SPI_SPIDEV=y
# CONFIG_PTP_1588_CLOCK is not set
CONFIG_PINCTRL=y
CONFIG_GPIOLIB=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_DWAPB=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_POWER_SUPPLY=y
CONFIG_SENSORS_MR75203=y
CONFIG_SENSORS_PWM_FAN=y
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_THERMAL_EMULATION=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_OPEN_TIMEOUT=32
CONFIG_WATCHDOG_PRETIMEOUT_GOV=y
CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP=y
CONFIG_DW_WATCHDOG=y
CONFIG_LIGHT_PMIC_WATCHDOG=y
CONFIG_ABX500_CORE=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_MEDIA_SUPPORT=y
# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set
# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set
CONFIG_MEDIA_USB_SUPPORT=y
CONFIG_USB_VIDEO_CLASS=m
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_VIDEO_ASPEED=y
CONFIG_V4L_MEM2MEM_DRIVERS=y
# CONFIG_MEDIA_TUNER_SIMPLE is not set
# CONFIG_MEDIA_TUNER_TDA18250 is not set
# CONFIG_MEDIA_TUNER_TDA8290 is not set
# CONFIG_MEDIA_TUNER_TDA827X is not set
# CONFIG_MEDIA_TUNER_TDA18271 is not set
# CONFIG_MEDIA_TUNER_TDA9887 is not set
# CONFIG_MEDIA_TUNER_TEA5761 is not set
# CONFIG_MEDIA_TUNER_TEA5767 is not set
# CONFIG_MEDIA_TUNER_MSI001 is not set
# CONFIG_MEDIA_TUNER_MT20XX is not set
# CONFIG_MEDIA_TUNER_MT2060 is not set
# CONFIG_MEDIA_TUNER_MT2063 is not set
# CONFIG_MEDIA_TUNER_MT2266 is not set
# CONFIG_MEDIA_TUNER_MT2131 is not set
# CONFIG_MEDIA_TUNER_QT1010 is not set
# CONFIG_MEDIA_TUNER_XC2028 is not set
# CONFIG_MEDIA_TUNER_XC5000 is not set
# CONFIG_MEDIA_TUNER_XC4000 is not set
# CONFIG_MEDIA_TUNER_MXL5005S is not set
# CONFIG_MEDIA_TUNER_MXL5007T is not set
# CONFIG_MEDIA_TUNER_MC44S803 is not set
# CONFIG_MEDIA_TUNER_MAX2165 is not set
# CONFIG_MEDIA_TUNER_TDA18218 is not set
# CONFIG_MEDIA_TUNER_FC0011 is not set
# CONFIG_MEDIA_TUNER_FC0012 is not set
# CONFIG_MEDIA_TUNER_FC0013 is not set
# CONFIG_MEDIA_TUNER_TDA18212 is not set
# CONFIG_MEDIA_TUNER_E4000 is not set
# CONFIG_MEDIA_TUNER_FC2580 is not set
# CONFIG_MEDIA_TUNER_M88RS6000T is not set
# CONFIG_MEDIA_TUNER_TUA9001 is not set
# CONFIG_MEDIA_TUNER_SI2157 is not set
# CONFIG_MEDIA_TUNER_IT913X is not set
# CONFIG_MEDIA_TUNER_R820T is not set
# CONFIG_MEDIA_TUNER_MXL301RF is not set
# CONFIG_MEDIA_TUNER_QM1D1C0042 is not set
# CONFIG_MEDIA_TUNER_QM1D1B0004 is not set
CONFIG_DRM=y
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_PANEL_ILITEK_ILI9881C=y
CONFIG_DRM_PANEL_ILI9881D=y
CONFIG_DRM_PANEL_HX8394=y
CONFIG_DRM_VERISILICON=y
CONFIG_DRM_POWERVR_ROGUE=m
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_LOGO=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_USB_AUDIO=m
CONFIG_SND_SOC=y
CONFIG_SND_SOC_THEAD_LIGHT=y
CONFIG_SND_SOC_AW87519=y
CONFIG_SND_SOC_BT_SCO=y
CONFIG_SND_SOC_ES7210=y
CONFIG_SND_SOC_ES8156=y
CONFIG_SND_SOC_WM8960=y
CONFIG_SND_SIMPLE_CARD=y
CONFIG_SND_AUDIO_GRAPH_CARD=y
CONFIG_UHID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_ACM=m
CONFIG_USB_STORAGE=y
CONFIG_USB_STORAGE_SDDR09=y
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_DWC3=m
CONFIG_USB_DWC3_HOST=y
# CONFIG_USB_DWC3_OF_SIMPLE is not set
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_SIMPLE=m
CONFIG_USB_SERIAL_AIRCABLE=m
CONFIG_USB_SERIAL_ARK3116=m
CONFIG_USB_SERIAL_BELKIN=m
CONFIG_USB_SERIAL_CH341=m
CONFIG_USB_SERIAL_WHITEHEAT=m
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
CONFIG_USB_SERIAL_CP210X=m
CONFIG_USB_SERIAL_CYPRESS_M8=m
CONFIG_USB_SERIAL_EMPEG=m
CONFIG_USB_SERIAL_FTDI_SIO=m
CONFIG_USB_SERIAL_VISOR=m
CONFIG_USB_SERIAL_IPAQ=m
CONFIG_USB_SERIAL_IR=m
CONFIG_USB_SERIAL_EDGEPORT=m
CONFIG_USB_SERIAL_EDGEPORT_TI=m
CONFIG_USB_SERIAL_F81232=m
CONFIG_USB_SERIAL_F8153X=m
CONFIG_USB_SERIAL_GARMIN=m
CONFIG_USB_SERIAL_IPW=m
CONFIG_USB_SERIAL_IUU=m
CONFIG_USB_SERIAL_KEYSPAN_PDA=m
CONFIG_USB_SERIAL_KEYSPAN=m
CONFIG_USB_SERIAL_KLSI=m
CONFIG_USB_SERIAL_KOBIL_SCT=m
CONFIG_USB_SERIAL_MCT_U232=m
CONFIG_USB_SERIAL_METRO=m
CONFIG_USB_SERIAL_MOS7720=m
CONFIG_USB_SERIAL_MOS7840=m
CONFIG_USB_SERIAL_MXUPORT=m
CONFIG_USB_SERIAL_NAVMAN=m
CONFIG_USB_SERIAL_PL2303=m
CONFIG_USB_SERIAL_OTI6858=m
CONFIG_USB_SERIAL_QCAUX=m
CONFIG_USB_SERIAL_QUALCOMM=m
CONFIG_USB_SERIAL_SPCP8X5=m
CONFIG_USB_SERIAL_SIERRAWIRELESS=m
CONFIG_USB_SERIAL_SYMBOL=m
CONFIG_USB_SERIAL_TI=m
CONFIG_USB_SERIAL_CYBERJACK=m
CONFIG_USB_SERIAL_XIRCOM=m
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_SERIAL_OMNINET=m
CONFIG_USB_SERIAL_OPTICON=m
CONFIG_USB_SERIAL_XSENS_MT=m
CONFIG_USB_SERIAL_WISHBONE=m
CONFIG_USB_SERIAL_SSU100=m
CONFIG_USB_SERIAL_QT2=m
CONFIG_USB_SERIAL_UPD78F0730=m
CONFIG_USB_SERIAL_DEBUG=m
CONFIG_USB_GADGET=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_ZERO=m
CONFIG_USB_ETH=m
CONFIG_USB_ETH_EEM=y
CONFIG_USB_G_NCM=m
CONFIG_USB_MASS_STORAGE=m
CONFIG_USB_G_SERIAL=m
CONFIG_USB_G_MULTI=m
CONFIG_USB_G_MULTI_CDC=y
CONFIG_USB_ROLE_SWITCH=m
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_OF_DWCMSHC=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_XGENE=y
CONFIG_DMADEVICES=y
CONFIG_DW_AXI_DMAC=y
CONFIG_DMATEST=y
CONFIG_SW_SYNC=y
CONFIG_UDMABUF=y
CONFIG_DMABUF_SELFTESTS=m
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_KHV_MMIO=y
CONFIG_VHOST_NET=y
CONFIG_VHOST_VSOCK=y
CONFIG_STAGING=y
CONFIG_STAGING_MEDIA=y
CONFIG_CLK_LIGHT_FM=y
CONFIG_HWSPINLOCK=y
CONFIG_HWSPINLOCK_LIGHT=y
CONFIG_HWSPINLOCK_LIGHT_TEST=m
CONFIG_MAILBOX=y
CONFIG_RPMSG=y
CONFIG_RPMSG_CHAR=y
CONFIG_RPMSG_VIRTIO=y
CONFIG_RPMSG_THEAD_LIGHT=y
CONFIG_EXTCON=y
CONFIG_IIO=y
CONFIG_IIO_SW_DEVICE=y
CONFIG_PWM=y
CONFIG_PWM_LIGHT=y
CONFIG_NVMEM_THEAD_LIGHT_EFUSE=y
CONFIG_TEE=y
CONFIG_OPTEE=y
CONFIG_OPTEE_BENCHMARK=y
CONFIG_LIGHT_GPU_VIV=m
# CONFIG_LIGHT_NET is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_EXFAT_FS=m
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HUGETLBFS=y
CONFIG_JFFS2_FS=y
CONFIG_UBIFS_FS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_NFS_V4_2=y
CONFIG_ROOT_NFS=y
CONFIG_NFSD=m
CONFIG_NFSD_V4=y
CONFIG_9P_FS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_SECURITY=y
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_APPARMOR=y
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_DH=y
CONFIG_CRYPTO_CURVE25519=y
CONFIG_CRYPTO_CHACHA20POLY1305=y
CONFIG_CRYPTO_OFB=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_SHA3=y
CONFIG_CRYPTO_SM3=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_SM4=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_USER_API_RNG=y
CONFIG_CRYPTO_USER_API_AEAD=y
CONFIG_DMA_CMA=y
CONFIG_DMA_PERNUMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=32
CONFIG_PRINTK_TIME=y
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DEBUG_INFO=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
# CONFIG_RCU_TRACE is not set

View File

@@ -26,19 +26,11 @@
#define SR_VS_OFF _AC(0x00000000, UL)
#if (defined(CONFIG_VECTOR_1_0) && defined(__THEAD_VERSION__))
#define SR_VS _AC(0x00000600, UL) /* Vector Status */
#define SR_VS_INITIAL _AC(0x00000200, UL)
#define SR_VS_CLEAN _AC(0x00000400, UL)
#define SR_VS_DIRTY _AC(0x00000600, UL)
#else
#define SR_VS _AC(0x01800000, UL) /* Vector Status */
#define SR_VS_INITIAL _AC(0x00800000, UL)
#define SR_VS_CLEAN _AC(0x01000000, UL)
#define SR_VS_DIRTY _AC(0x01800000, UL)
#endif
#define SR_XS _AC(0x00018000, UL) /* Extension Status */
#define SR_XS_OFF _AC(0x00000000, UL)
#define SR_XS_INITIAL _AC(0x00008000, UL)

View File

@@ -20,14 +20,6 @@
#include <asm/csr.h>
#include <asm/asm-offsets.h>
#if (defined(CONFIG_VECTOR_1_0) && defined(__THEAD_VERSION__))
#define V_ST vse8.v
#define V_LD vle8.v
#else
#define V_ST vsb.v
#define V_LD vlb.v
#endif
ENTRY(__vstate_save)
li a2, TASK_THREAD_V0
add a0, a0, a2
@@ -46,81 +38,14 @@ ENTRY(__vstate_save)
csrr t0, CSR_VTYPE
sd t0, TASK_THREAD_VTYPE_V0(a0)
#ifdef CONFIG_VLEN_256
vsetvli t0, x0, e8,m1
V_ST v0, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v1, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v2, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v3, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v4, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v5, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v6, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v7, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v8, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v9, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v10, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v11, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v12, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v13, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v14, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v15, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v16, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v17, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v18, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v19, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v20, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v21, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v22, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v23, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v24, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v25, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v26, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v27, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v28, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v29, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v30, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_ST v31, (a0)
#else
vsetvli t0, x0, e8,m8
V_ST v0, (a0)
.word 0x003072d7 /* vsetvli t0, x0, e8,m8 */
.word 0x02050027 /* vsb.v v0, (a0) */
addi a0, a0, RISCV_VECTOR_VLENB*8
V_ST v8, (a0)
.word 0x02050427 /* vsb.v v8, (a0) */
addi a0, a0, RISCV_VECTOR_VLENB*8
V_ST v16, (a0)
.word 0x02050827 /* vsb.v v16, (a0) */
addi a0, a0, RISCV_VECTOR_VLENB*8
V_ST v24, (a0)
#endif
.word 0x02050c27 /* vsb.v v24, (a0) */
csrc sstatus, t1
ret
@@ -134,81 +59,14 @@ ENTRY(__vstate_restore)
li t1, (SR_VS | SR_FS)
csrs sstatus, t1
#ifdef CONFIG_VLEN_256
vsetvli t0, x0, e8,m1
V_LD v0, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v1, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v2, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v3, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v4, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v5, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v6, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v7, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v8, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v9, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v10, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v11, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v12, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v13, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v14, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v15, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v16, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v17, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v18, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v19, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v20, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v21, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v22, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v23, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v24, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v25, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v26, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v27, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v28, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v29, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v30, (a0)
addi a0, a0, RISCV_VECTOR_VLENB
V_LD v31, (a0)
#else
vsetvli t0, x0, e8,m8
V_LD v0, (a0)
.word 0x003072d7 /* vsetvli t0, x0, e8,m8 */
.word 0x12050007 /* vlb.v v0, (a0) */
addi a0, a0, RISCV_VECTOR_VLENB*8
V_LD v8, (a0)
.word 0x12050407 /* vlb.v v8, (a0) */
addi a0, a0, RISCV_VECTOR_VLENB*8
V_LD v16, (a0)
.word 0x12050807 /* vlb.v v16, (a0) */
addi a0, a0, RISCV_VECTOR_VLENB*8
V_LD v24, (a0)
#endif
.word 0x12050c07 /* vlb.v v24, (a0) */
mv a0, t2
ld t0, TASK_THREAD_VSTART_V0(a0)
@@ -219,16 +77,9 @@ ENTRY(__vstate_restore)
csrw CSR_VXRM, t0
ld t0, TASK_THREAD_VL_V0(a0)
ld t2, TASK_THREAD_VTYPE_V0(a0)
#ifdef CONFIG_VECTOR_EMU
srli t3, t2, 63
bne t3,zero,1f
#endif
vsetvl t3, t0, t2
#ifdef CONFIG_VECTOR_EMU
j 2f
1: vsetvli zero,zero,e64,m2,d1
2:
#endif
.word 0x8072fe57 /* vsetvl t3, t0, t2 */
csrc sstatus, t1
ret
ENDPROC(__vstate_restore)

View File

@@ -8,6 +8,7 @@ source "drivers/eisa/Kconfig"
source "drivers/pci/Kconfig"
source "drivers/pcmcia/Kconfig"
source "drivers/rapidio/Kconfig"
source "drivers/nna/Kconfig"
source "drivers/base/Kconfig"

View File

@@ -45,6 +45,9 @@ obj-$(CONFIG_VIRTIO) += virtio/
obj-$(CONFIG_VDPA) += vdpa/
obj-$(CONFIG_XEN) += xen/
# npu-ax3386-gpl driver
obj-y += nna/
# regulators early, since some subsystems rely on them to initialize
obj-$(CONFIG_REGULATOR) += regulator/

View File

@@ -34,7 +34,7 @@ enum LIGHT_MPW_CPUFREQ_CLKS {
};
#define LIGHT_MPW_CPUFREQ_CLK_NUM 4
#define LIGHT_CPUFREQ_THRE 1500000
#define LIGHT_CPUFREQ_THRE 2000000
#define LIGHT_C910_BUS_CLK_SYNC BIT(11)
#define LIGHT_C910_BUS_CLK_RATIO_MASK 0x700
#define LIGHT_C910_BUS_CLK_DIV_RATIO_2 0x100

View File

@@ -394,6 +394,8 @@ source "drivers/gpu/drm/xlnx/Kconfig"
source "drivers/gpu/drm/verisilicon/Kconfig"
source "drivers/gpu/drm/img-rogue/Kconfig"
# Keep legacy drivers last
menuconfig DRM_LEGACY

View File

@@ -57,6 +57,8 @@ drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/
obj-$(CONFIG_DRM_POWERVR_ROGUE) += img-rogue/
obj-$(CONFIG_DRM) += drm.o
obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o

View File

@@ -0,0 +1,24 @@
config DRM_POWERVR_ROGUE
tristate "PowerVR Rogue"
depends on HAS_IOMEM
depends on DRM
select DRM_KMS_HELPER
select PM_DEVFREQ
select DEVFREQ_GOV_SIMPLE_ONDEMAND
select PM_OPP
select DEVFREQ_THERMAL
select SYNC_FILE
help
Driver for PowerVR Rogue graphics hardware.
Say Y here if your SoC contains a PowerVR Rogue GPU. For more
information, see <http://www.imgtec.com/powervr/>.
config DRM_POWERVR_ROGUE_DEBUG
bool "Enable PowerVR Rogue debug features"
depends on DRM_POWERVR_ROGUE
default n
help
Add additional debug features to the PowerVR Rogue driver.
To build a matching userspace, enable the following build options:
BUILD=debug SUPPORT_PAGE_FAULT_DEBUG=1 PVRSRV_ENABLE_GPU_MEMORY_INFO=1

View File

@@ -0,0 +1,19 @@
img_basedir := drivers/gpu/drm/img-rogue
include $(img_basedir)/config_kernel.mk
obj-$(CONFIG_DRM_POWERVR_ROGUE) += pvrsrvkm.o
ccflags-y += \
-include config_kernel.h \
-I$(img_basedir)/include/drm \
-I$(img_basedir) \
-I$(img_basedir)/include \
-I$(img_basedir)/km \
-I$(img_basedir)/system \
-D__linux__
include $(img_basedir)/pvrsrvkm.mk
obj-$(CONFIG_DRM_POWERVR_ROGUE) += drm_nulldisp.o
drm_nulldisp-y += drm_nulldisp_drv.o drm_nulldisp_netlink.o drm_netlink_gem.o drm_nulldisp_gem.o

View File

@@ -0,0 +1,422 @@
/*************************************************************************/ /*!
@File
@Title Host memory management implementation for Linux
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/string.h>
#include "img_defs.h"
#include "allocmem.h"
#include "pvr_debug.h"
#include "process_stats.h"
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
#include "pvrsrv.h"
#endif
#include "osfunc.h"
/*
* When memory statistics are disabled, memory records are used instead.
* In order for these to work, the PID of the process that requested the
* allocation needs to be stored at the end of the kmalloc'd memory, making
* sure 4 extra bytes are allocated to fit the PID.
*
* There is no need for this extra allocation when memory statistics are
* enabled, since all allocations are tracked in DebugFS mem_area files.
*/
#if defined(PVRSRV_ENABLE_PROCESS_STATS) && !defined(PVRSRV_ENABLE_MEMORY_STATS)
#define ALLOCMEM_MEMSTATS_PADDING sizeof(IMG_UINT32)
#else
#define ALLOCMEM_MEMSTATS_PADDING 0UL
#endif
/* How many times kmalloc can fail before the allocation threshold is reduced */
static const IMG_UINT32 g_ui32kmallocFailLimit = 10;
/* How many kmalloc failures happened since the last allocation threshold change */
static IMG_UINT32 g_ui32kmallocFailCount = 0;
/* Current kmalloc threshold value in bytes */
static IMG_UINT32 g_ui32kmallocThreshold = PVR_LINUX_KMALLOC_ALLOCATION_THRESHOLD;
/* Spinlock used so that the global variables above may not be modified by more than 1 thread at a time */
static DEFINE_SPINLOCK(kmalloc_lock);
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
static DEFINE_SPINLOCK(kmalloc_leak_lock);
static IMG_UINT32 g_ui32kmallocLeakCounter = 0;
#endif
static inline void OSTryDecreaseKmallocThreshold(void)
{
unsigned long flags;
spin_lock_irqsave(&kmalloc_lock, flags);
g_ui32kmallocFailCount++;
if (g_ui32kmallocFailCount >= g_ui32kmallocFailLimit)
{
g_ui32kmallocFailCount = 0;
if (g_ui32kmallocThreshold > PAGE_SIZE)
{
g_ui32kmallocThreshold >>= 1;
printk(KERN_INFO "Threshold is now set to %d\n", g_ui32kmallocThreshold);
}
}
spin_unlock_irqrestore(&kmalloc_lock, flags);
}
static inline void OSResetKmallocFailCount(void)
{
unsigned long flags;
spin_lock_irqsave(&kmalloc_lock, flags);
g_ui32kmallocFailCount = 0;
spin_unlock_irqrestore(&kmalloc_lock, flags);
}
static inline void _pvr_vfree(const void* pvAddr)
{
#if defined(DEBUG)
/* Size harder to come by for vmalloc and since vmalloc allocates
* a whole number of pages, poison the minimum size known to have
* been allocated.
*/
OSCachedMemSet((void*)pvAddr, PVRSRV_POISON_ON_ALLOC_VALUE,
PAGE_SIZE);
#endif
vfree(pvAddr);
}
static inline void _pvr_kfree(const void* pvAddr)
{
#if defined(DEBUG)
/* Poison whole memory block */
OSCachedMemSet((void*)pvAddr, PVRSRV_POISON_ON_ALLOC_VALUE,
ksize(pvAddr));
#endif
kfree(pvAddr);
}
static inline void _pvr_alloc_stats_add(void *pvAddr, IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS)
{
#if !defined(PVRSRV_ENABLE_PROCESS_STATS)
PVR_UNREFERENCED_PARAMETER(pvAddr);
#else
if (!is_vmalloc_addr(pvAddr))
{
#if defined(PVRSRV_ENABLE_MEMORY_STATS)
IMG_CPU_PHYADDR sCpuPAddr;
sCpuPAddr.uiAddr = 0;
PVRSRVStatsAddMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_KMALLOC,
pvAddr,
sCpuPAddr,
ksize(pvAddr),
NULL,
OSGetCurrentClientProcessIDKM()
DEBUG_MEMSTATS_ARGS);
#else
{
/* Store the PID in the final additional 4 bytes allocated */
IMG_UINT32 *puiTemp = IMG_OFFSET_ADDR(pvAddr, ksize(pvAddr) - ALLOCMEM_MEMSTATS_PADDING);
*puiTemp = OSGetCurrentClientProcessIDKM();
}
PVRSRVStatsIncrMemAllocStat(PVRSRV_MEM_ALLOC_TYPE_KMALLOC, ksize(pvAddr), OSGetCurrentClientProcessIDKM());
#endif /* defined(PVRSRV_ENABLE_MEMORY_STATS) */
}
else
{
#if defined(PVRSRV_ENABLE_MEMORY_STATS)
IMG_CPU_PHYADDR sCpuPAddr;
sCpuPAddr.uiAddr = 0;
PVRSRVStatsAddMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
pvAddr,
sCpuPAddr,
((ui32Size + PAGE_SIZE-1) & ~(PAGE_SIZE-1)),
NULL,
OSGetCurrentClientProcessIDKM()
DEBUG_MEMSTATS_ARGS);
#else
PVRSRVStatsIncrMemAllocStatAndTrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
((ui32Size + PAGE_SIZE-1) & ~(PAGE_SIZE-1)),
(IMG_UINT64)(uintptr_t) pvAddr,
OSGetCurrentClientProcessIDKM());
#endif /* defined(PVRSRV_ENABLE_MEMORY_STATS) */
}
#endif /* !defined(PVRSRV_ENABLE_PROCESS_STATS) */
}
static inline void _pvr_alloc_stats_remove(void *pvAddr)
{
#if !defined(PVRSRV_ENABLE_PROCESS_STATS)
PVR_UNREFERENCED_PARAMETER(pvAddr);
#else
if (!is_vmalloc_addr(pvAddr))
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
{
IMG_UINT32 *puiTemp = IMG_OFFSET_ADDR(pvAddr, ksize(pvAddr) - ALLOCMEM_MEMSTATS_PADDING);
PVRSRVStatsDecrMemKAllocStat(ksize(pvAddr), *puiTemp);
}
#else
PVRSRVStatsRemoveMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_KMALLOC,
(IMG_UINT64)(uintptr_t) pvAddr,
OSGetCurrentClientProcessIDKM());
#endif
}
else
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
PVRSRVStatsDecrMemAllocStatAndUntrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
(IMG_UINT64)(uintptr_t) pvAddr);
#else
PVRSRVStatsRemoveMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
(IMG_UINT64)(uintptr_t) pvAddr,
OSGetCurrentClientProcessIDKM());
#endif
}
#endif /* !defined(PVRSRV_ENABLE_PROCESS_STATS) */
}
void *(OSAllocMem)(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS)
{
void *pvRet = NULL;
if ((ui32Size + ALLOCMEM_MEMSTATS_PADDING) <= g_ui32kmallocThreshold)
{
pvRet = kmalloc(ui32Size + ALLOCMEM_MEMSTATS_PADDING, GFP_KERNEL);
if (pvRet == NULL)
{
OSTryDecreaseKmallocThreshold();
}
else
{
OSResetKmallocFailCount();
}
}
if (pvRet == NULL)
{
pvRet = vmalloc(ui32Size);
}
if (pvRet != NULL)
{
_pvr_alloc_stats_add(pvRet, ui32Size DEBUG_MEMSTATS_ARGS);
}
return pvRet;
}
void *(OSAllocZMem)(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS)
{
void *pvRet = NULL;
if ((ui32Size + ALLOCMEM_MEMSTATS_PADDING) <= g_ui32kmallocThreshold)
{
pvRet = kzalloc(ui32Size + ALLOCMEM_MEMSTATS_PADDING, GFP_KERNEL);
if (pvRet == NULL)
{
OSTryDecreaseKmallocThreshold();
}
else
{
OSResetKmallocFailCount();
}
}
if (pvRet == NULL)
{
pvRet = vzalloc(ui32Size);
}
if (pvRet != NULL)
{
_pvr_alloc_stats_add(pvRet, ui32Size DEBUG_MEMSTATS_ARGS);
}
return pvRet;
}
/*
* The parentheses around OSFreeMem prevent the macro in allocmem.h from
* applying, as it would break the function's definition.
*/
void (OSFreeMem)(void *pvMem)
{
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
unsigned long flags;
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
if (psPVRSRVData)
{
IMG_UINT32 ui32kmallocLeakMax = psPVRSRVData->sMemLeakIntervals.ui32OSAlloc;
spin_lock_irqsave(&kmalloc_leak_lock, flags);
g_ui32kmallocLeakCounter++;
if (ui32kmallocLeakMax && (g_ui32kmallocLeakCounter >= ui32kmallocLeakMax))
{
g_ui32kmallocLeakCounter = 0;
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
PVR_DPF((PVR_DBG_WARNING,
"%s: Skipped freeing of pointer 0x%p to trigger memory leak.",
__func__,
pvMem));
return;
}
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
}
#endif
if (pvMem != NULL)
{
_pvr_alloc_stats_remove(pvMem);
if (!is_vmalloc_addr(pvMem))
{
_pvr_kfree(pvMem);
}
else
{
_pvr_vfree(pvMem);
}
}
}
void *OSAllocMemNoStats(IMG_UINT32 ui32Size)
{
void *pvRet = NULL;
if (ui32Size <= g_ui32kmallocThreshold)
{
pvRet = kmalloc(ui32Size, GFP_KERNEL);
if (pvRet == NULL)
{
OSTryDecreaseKmallocThreshold();
}
else
{
OSResetKmallocFailCount();
}
}
if (pvRet == NULL)
{
pvRet = vmalloc(ui32Size);
}
return pvRet;
}
void *OSAllocZMemNoStats(IMG_UINT32 ui32Size)
{
void *pvRet = NULL;
if (ui32Size <= g_ui32kmallocThreshold)
{
pvRet = kzalloc(ui32Size, GFP_KERNEL);
if (pvRet == NULL)
{
OSTryDecreaseKmallocThreshold();
}
else
{
OSResetKmallocFailCount();
}
}
if (pvRet == NULL)
{
pvRet = vzalloc(ui32Size);
}
return pvRet;
}
/*
* The parentheses around OSFreeMemNoStats prevent the macro in allocmem.h from
* applying, as it would break the function's definition.
*/
void (OSFreeMemNoStats)(void *pvMem)
{
#if defined(DEBUG) && defined(SUPPORT_VALIDATION)
unsigned long flags;
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
if (psPVRSRVData)
{
IMG_UINT32 ui32kmallocLeakMax = psPVRSRVData->sMemLeakIntervals.ui32OSAlloc;
spin_lock_irqsave(&kmalloc_leak_lock, flags);
g_ui32kmallocLeakCounter++;
if (ui32kmallocLeakMax && (g_ui32kmallocLeakCounter >= ui32kmallocLeakMax))
{
g_ui32kmallocLeakCounter = 0;
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
PVR_DPF((PVR_DBG_WARNING,
"%s: Skipped freeing of pointer 0x%p to trigger memory leak.",
__func__,
pvMem));
return;
}
spin_unlock_irqrestore(&kmalloc_leak_lock, flags);
}
#endif
if (pvMem != NULL)
{
if (!is_vmalloc_addr(pvMem))
{
_pvr_kfree(pvMem);
}
else
{
_pvr_vfree(pvMem);
}
}
}

View File

@@ -0,0 +1,224 @@
/*************************************************************************/ /*!
@File allocmem.h
@Title memory allocation header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Memory-Allocation API definitions
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef ALLOCMEM_H
#define ALLOCMEM_H
#include "img_types.h"
#include "pvr_debug.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*
* PVRSRV_ENABLE_PROCESS_STATS enables process statistics regarding events,
* resources and memory across all processes
* PVRSRV_ENABLE_MEMORY_STATS enables recording of Linux kernel memory
* allocations, provided that PVRSRV_ENABLE_PROCESS_STATS is enabled
* - Output can be found in:
* /(sys/kernel/debug|proc)/pvr/proc_stats/[live|retired]_pids_stats/mem_area
* PVRSRV_DEBUG_LINUX_MEMORY_STATS provides more details about memory
* statistics in conjunction with PVRSRV_ENABLE_MEMORY_STATS
* PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON is defined to encompass both memory
* allocation statistics functionalities described above in a single macro
*/
#if defined(PVRSRV_ENABLE_PROCESS_STATS) && defined(PVRSRV_ENABLE_MEMORY_STATS) && defined(PVRSRV_DEBUG_LINUX_MEMORY_STATS) && defined(DEBUG)
#define PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
#endif
/*
* When using detailed memory allocation statistics, the line number and
* file name where the allocation happened are also provided.
* When this feature is not used, these parameters are not needed.
*/
#if defined(PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON)
#define DEBUG_MEMSTATS_PARAMS ,void *pvAllocFromFile, IMG_UINT32 ui32AllocFromLine
#define DEBUG_MEMSTATS_ARGS ,pvAllocFromFile, ui32AllocFromLine
#define DEBUG_MEMSTATS_UNREF (void)pvAllocFromFile; (void)ui32AllocFromLine;
#define DEBUG_MEMSTATS_VALUES ,__FILE__, __LINE__
#else
#define DEBUG_MEMSTATS_PARAMS /*!<
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
* build option. */
#define DEBUG_MEMSTATS_ARGS /*!<
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
* build option. */
#define DEBUG_MEMSTATS_UNREF /*!<
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
* build option. */
#define DEBUG_MEMSTATS_VALUES /*!<
* Used for PVRSRV_DEBUG_LINUX_MEMORY_STATS_ON
* build option. */
#endif
/**************************************************************************/ /*!
@Function OSAllocMem
@Description Allocates CPU memory. Contents are uninitialized.
If passed a size of zero, function should not assert,
but just return a NULL pointer.
@Input ui32Size Size of required allocation (in bytes)
@Return Pointer to allocated memory on success.
Otherwise NULL.
*/ /**************************************************************************/
#if defined(DOXYGEN)
void *OSAllocMem(IMG_UINT32 ui32Size);
#else
void *OSAllocMem(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS);
#define OSAllocMem(_size) (OSAllocMem)((_size) DEBUG_MEMSTATS_VALUES)
#endif
/**************************************************************************/ /*!
@Function OSAllocZMem
@Description Allocates CPU memory and initializes the contents to zero.
If passed a size of zero, function should not assert,
but just return a NULL pointer.
@Input ui32Size Size of required allocation (in bytes)
@Return Pointer to allocated memory on success.
Otherwise NULL.
*/ /**************************************************************************/
#if defined(DOXYGEN)
void *OSAllocZMem(IMG_UINT32 ui32Size);
#else
void *OSAllocZMem(IMG_UINT32 ui32Size DEBUG_MEMSTATS_PARAMS);
#define OSAllocZMem(_size) (OSAllocZMem)((_size) DEBUG_MEMSTATS_VALUES)
#endif
/**************************************************************************/ /*!
@Function OSAllocMemNoStats
@Description Allocates CPU memory. Contents are uninitialized.
If passed a size of zero, function should not assert,
but just return a NULL pointer.
The allocated memory is not accounted for by process stats.
Process stats are an optional feature (enabled only when
PVRSRV_ENABLE_PROCESS_STATS is defined) which track the amount
of memory allocated to help in debugging. Where this is not
required, OSAllocMem() and OSAllocMemNoStats() equate to
the same operation.
@Input ui32Size Size of required allocation (in bytes)
@Return Pointer to allocated memory on success.
Otherwise NULL.
*/ /**************************************************************************/
void *OSAllocMemNoStats(IMG_UINT32 ui32Size);
/**************************************************************************/ /*!
@Function OSAllocZMemNoStats
@Description Allocates CPU memory and initializes the contents to zero.
If passed a size of zero, function should not assert,
but just return a NULL pointer.
The allocated memory is not accounted for by process stats.
Process stats are an optional feature (enabled only when
PVRSRV_ENABLE_PROCESS_STATS is defined) which track the amount
of memory allocated to help in debugging. Where this is not
required, OSAllocZMem() and OSAllocZMemNoStats() equate to
the same operation.
@Input ui32Size Size of required allocation (in bytes)
@Return Pointer to allocated memory on success.
Otherwise NULL.
*/ /**************************************************************************/
void *OSAllocZMemNoStats(IMG_UINT32 ui32Size);
/**************************************************************************/ /*!
@Function OSFreeMem
@Description Frees previously allocated CPU memory.
@Input pvCpuVAddr Pointer to the memory to be freed.
@Return None.
*/ /**************************************************************************/
void OSFreeMem(void *pvCpuVAddr);
/**************************************************************************/ /*!
@Function OSFreeMemNoStats
@Description Frees previously allocated CPU memory.
The freed memory does not update the figures in process stats.
Process stats are an optional feature (enabled only when
PVRSRV_ENABLE_PROCESS_STATS is defined) which track the amount
of memory allocated to help in debugging. Where this is not
required, OSFreeMem() and OSFreeMemNoStats() equate to the
same operation.
@Input pvCpuVAddr Pointer to the memory to be freed.
@Return None.
*/ /**************************************************************************/
void OSFreeMemNoStats(void *pvCpuVAddr);
/*
* These macros allow us to catch double-free bugs on DEBUG builds and
* prevent crashes on RELEASE builds.
*/
/*! @cond Doxygen_Suppress */
#if defined(DEBUG)
#define double_free_sentinel ((void *)&OSFreeMem)
#define ALLOCMEM_ASSERT(exp) PVR_ASSERT(exp)
#else
#define double_free_sentinel NULL
#define ALLOCMEM_ASSERT(exp) do {} while (0)
#endif
/*! @endcond */
/*! Frees memory allocated by OSAllocMem(). */
#define OSFreeMem(_ptr) do { \
ALLOCMEM_ASSERT((_ptr) != double_free_sentinel); \
(OSFreeMem)(_ptr); \
(_ptr) = double_free_sentinel; \
MSC_SUPPRESS_4127 \
} while (0)
/*! Frees memory allocated by OSAllocMemNoStats(). */
#define OSFreeMemNoStats(_ptr) do { \
ALLOCMEM_ASSERT((_ptr) != double_free_sentinel); \
(OSFreeMemNoStats)(_ptr); \
(_ptr) = double_free_sentinel; \
MSC_SUPPRESS_4127 \
} while (0)
#if defined(__cplusplus)
}
#endif
#endif /* ALLOCMEM_H */
/******************************************************************************
End of file (allocmem.h)
******************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,151 @@
/*************************************************************************/ /*!
@File cache_km.h
@Title CPU cache management header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef CACHE_KM_H
#define CACHE_KM_H
#if defined(__linux__)
#include <linux/version.h>
#else
#define KERNEL_VERSION
#endif
#include "pvrsrv_error.h"
#include "os_cpu_cache.h"
#include "img_types.h"
#include "cache_ops.h"
#include "device.h"
#include "pmr.h"
typedef IMG_UINT32 PVRSRV_CACHE_OP_ADDR_TYPE; /*!< Represents CPU address type required for CPU d-cache maintenance */
#define PVRSRV_CACHE_OP_ADDR_TYPE_VIRTUAL 0x1 /*!< Operation requires CPU virtual address only */
#define PVRSRV_CACHE_OP_ADDR_TYPE_PHYSICAL 0x2 /*!< Operation requires CPU physical address only */
#define PVRSRV_CACHE_OP_ADDR_TYPE_BOTH 0x3 /*!< Operation requires both CPU virtual & physical addresses */
#include "connection_server.h"
/*
* CacheOpInit() & CacheOpDeInit()
*
* This must be called to initialise the KM cache maintenance framework.
* This is called early during the driver/module (un)loading phase.
*/
PVRSRV_ERROR CacheOpInit(void);
void CacheOpDeInit(void);
/*
* CacheOpInit2() & CacheOpDeInit2()
*
* This must be called to initialise the UM cache maintenance framework.
* This is called when the driver is loaded/unloaded from the kernel.
*/
PVRSRV_ERROR CacheOpInit2(void);
void CacheOpDeInit2(void);
/*
* CacheOpExec()
*
* This is the primary CPU data-cache maintenance interface and it is
* always guaranteed to be synchronous; the arguments supplied must be
* pre-validated for performance reasons else the d-cache maintenance
* operation might cause the underlying OS kernel to fault.
*/
PVRSRV_ERROR CacheOpExec(PPVRSRV_DEVICE_NODE psDevNode,
void *pvVirtStart,
void *pvVirtEnd,
IMG_CPU_PHYADDR sCPUPhysStart,
IMG_CPU_PHYADDR sCPUPhysEnd,
PVRSRV_CACHE_OP uiCacheOp);
/*
* CacheOpValExec()
*
* Same as CacheOpExec(), except arguments are _Validated_ before being
* presented to the underlying OS kernel for CPU data-cache maintenance.
* The uiAddress is the start CPU virtual address for the to-be d-cache
* maintained PMR, it can be NULL in which case a remap will be performed
* internally, if required for cache maintenance. This is primarily used
* as the services client bridge call handler for synchronous user-mode
* cache maintenance requests.
*/
PVRSRV_ERROR CacheOpValExec(PMR *psPMR,
IMG_UINT64 uiAddress,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
PVRSRV_CACHE_OP uiCacheOp);
/*
* CacheOpQueue()
*
* This is the secondary cache maintenance interface and it is not
* guaranteed to be synchronous in that requests could be deferred
* and executed asynchronously. This interface is primarily meant
* as services client bridge call handler. Both uiInfoPgGFSeqNum
* and ui32[Current,Next]FenceSeqNum implements an internal client
* server queueing protocol so making use of this interface outside
* of services client is not recommended and should not be done.
*/
PVRSRV_ERROR CacheOpQueue(CONNECTION_DATA *psConnection,
PPVRSRV_DEVICE_NODE psDevNode,
IMG_UINT32 ui32OpCount,
PMR **ppsPMR,
IMG_UINT64 *puiAddress,
IMG_DEVMEM_OFFSET_T *puiOffset,
IMG_DEVMEM_SIZE_T *puiSize,
PVRSRV_CACHE_OP *puiCacheOp,
IMG_UINT32 ui32OpTimeline);
/*
* CacheOpLog()
*
* This is used for logging client cache maintenance operations that
* was executed in user-space.
*/
PVRSRV_ERROR CacheOpLog(PMR *psPMR,
IMG_UINT64 uiAddress,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
IMG_UINT64 ui64StartTime,
IMG_UINT64 ui64EndTime,
PVRSRV_CACHE_OP uiCacheOp);
#endif /* CACHE_KM_H */

View File

@@ -0,0 +1,61 @@
/*************************************************************************/ /*!
@File
@Title Services cache management header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Defines for cache management which are visible internally
and externally
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef CACHE_OPS_H
#define CACHE_OPS_H
#include "img_types.h"
/*!
* @Defgroup CPUCacheAPIs
* @{
*/
#define CACHE_BATCH_MAX (8U)
#define MAX_DMA_OPS (34)
typedef IMG_UINT32 PVRSRV_CACHE_OP; /*!< Type represents cache maintenance operation */
#define PVRSRV_CACHE_OP_NONE 0x0U /*!< No operation */
#define PVRSRV_CACHE_OP_CLEAN 0x1U /*!< Flush w/o invalidate */
#define PVRSRV_CACHE_OP_INVALIDATE 0x2U /*!< Invalidate w/o flush */
#define PVRSRV_CACHE_OP_FLUSH 0x3U /*!< Flush w/ invalidate */
/*! @} End of Defgroup CPUCacheAPIs */
#endif /* CACHE_OPS_H */

View File

@@ -0,0 +1,80 @@
/*******************************************************************************
@File
@Title Client bridge header for cache
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for cache
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_CACHE_BRIDGE_H
#define CLIENT_CACHE_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_cache_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpQueue(IMG_HANDLE hBridge,
IMG_UINT32 ui32NumCacheOps,
IMG_HANDLE * phPMR,
IMG_UINT64 * pui64Address,
IMG_DEVMEM_OFFSET_T * puiOffset,
IMG_DEVMEM_SIZE_T * puiSize,
PVRSRV_CACHE_OP * piuCacheOp,
IMG_UINT32 ui32OpTimeline);
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpExec(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_UINT64 ui64Address,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize, PVRSRV_CACHE_OP iuCacheOp);
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpLog(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_UINT64 ui64Address,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
IMG_INT64 i64StartTime,
IMG_INT64 i64EndTime, PVRSRV_CACHE_OP iuCacheOp);
#endif /* CLIENT_CACHE_BRIDGE_H */

View File

@@ -0,0 +1,112 @@
/*******************************************************************************
@File
@Title Direct client bridge for cache
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for cache
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_cache_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "cache_ops.h"
#include "cache_km.h"
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpQueue(IMG_HANDLE hBridge,
IMG_UINT32 ui32NumCacheOps,
IMG_HANDLE * phPMR,
IMG_UINT64 * pui64Address,
IMG_DEVMEM_OFFSET_T * puiOffset,
IMG_DEVMEM_SIZE_T * puiSize,
PVRSRV_CACHE_OP * piuCacheOp,
IMG_UINT32 ui32OpTimeline)
{
PVRSRV_ERROR eError;
PMR **psPMRInt;
psPMRInt = (PMR **) phPMR;
eError =
CacheOpQueue(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32NumCacheOps,
psPMRInt, pui64Address, puiOffset, puiSize, piuCacheOp, ui32OpTimeline);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpExec(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_UINT64 ui64Address,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize, PVRSRV_CACHE_OP iuCacheOp)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = CacheOpValExec(psPMRInt, ui64Address, uiOffset, uiSize, iuCacheOp);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeCacheOpLog(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_UINT64 ui64Address,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
IMG_INT64 i64StartTime,
IMG_INT64 i64EndTime, PVRSRV_CACHE_OP iuCacheOp)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError =
CacheOpLog(psPMRInt,
ui64Address, uiOffset, uiSize, i64StartTime, i64EndTime, iuCacheOp);
return eError;
}

View File

@@ -0,0 +1,111 @@
/*******************************************************************************
@File
@Title Client bridge header for devicememhistory
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for devicememhistory
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_DEVICEMEMHISTORY_BRIDGE_H
#define CLIENT_DEVICEMEMHISTORY_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_devicememhistory_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMap(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_DEVMEM_SIZE_T uiOffset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut);
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmap(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_DEVMEM_SIZE_T uiOffset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut);
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMapVRange(IMG_HANDLE hBridge,
IMG_DEV_VIRTADDR sBaseDevVAddr,
IMG_UINT32 ui32ui32StartPage,
IMG_UINT32 ui32NumPages,
IMG_DEVMEM_SIZE_T uiAllocSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut);
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmapVRange(IMG_HANDLE hBridge,
IMG_DEV_VIRTADDR sBaseDevVAddr,
IMG_UINT32 ui32ui32StartPage,
IMG_UINT32 ui32NumPages,
IMG_DEVMEM_SIZE_T uiAllocSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut);
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistorySparseChange(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_DEVMEM_SIZE_T uiOffset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 * pui32AllocPageIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 * pui32FreePageIndices,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut);
#endif /* CLIENT_DEVICEMEMHISTORY_BRIDGE_H */

View File

@@ -0,0 +1,194 @@
/*******************************************************************************
@File
@Title Direct client bridge for devicememhistory
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for devicememhistory
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_devicememhistory_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "img_types.h"
#include "img_defs.h"
#include "devicemem_typedefs.h"
#include "devicemem_history_server.h"
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMap(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_DEVMEM_SIZE_T uiOffset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError =
DevicememHistoryMapKM(psPMRInt,
uiOffset,
sDevVAddr,
uiSize,
puiText,
ui32Log2PageSize, ui32AllocationIndex, pui32AllocationIndexOut);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmap(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_DEVMEM_SIZE_T uiOffset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError =
DevicememHistoryUnmapKM(psPMRInt,
uiOffset,
sDevVAddr,
uiSize,
puiText,
ui32Log2PageSize, ui32AllocationIndex, pui32AllocationIndexOut);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryMapVRange(IMG_HANDLE hBridge,
IMG_DEV_VIRTADDR sBaseDevVAddr,
IMG_UINT32 ui32ui32StartPage,
IMG_UINT32 ui32NumPages,
IMG_DEVMEM_SIZE_T uiAllocSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut)
{
PVRSRV_ERROR eError;
eError =
DevicememHistoryMapVRangeKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
sBaseDevVAddr,
ui32ui32StartPage,
ui32NumPages,
uiAllocSize,
puiText,
ui32Log2PageSize,
ui32AllocationIndex, pui32AllocationIndexOut);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistoryUnmapVRange(IMG_HANDLE hBridge,
IMG_DEV_VIRTADDR sBaseDevVAddr,
IMG_UINT32 ui32ui32StartPage,
IMG_UINT32 ui32NumPages,
IMG_DEVMEM_SIZE_T uiAllocSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut)
{
PVRSRV_ERROR eError;
eError =
DevicememHistoryUnmapVRangeKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
sBaseDevVAddr,
ui32ui32StartPage,
ui32NumPages,
uiAllocSize,
puiText,
ui32Log2PageSize,
ui32AllocationIndex, pui32AllocationIndexOut);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevicememHistorySparseChange(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_DEVMEM_SIZE_T uiOffset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR * puiText,
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 * pui32AllocPageIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 * pui32FreePageIndices,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 * pui32AllocationIndexOut)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError =
DevicememHistorySparseChangeKM(psPMRInt,
uiOffset,
sDevVAddr,
uiSize,
puiText,
ui32Log2PageSize,
ui32AllocPageCount,
pui32AllocPageIndices,
ui32FreePageCount,
pui32FreePageIndices,
ui32AllocationIndex, pui32AllocationIndexOut);
return eError;
}

View File

@@ -0,0 +1,71 @@
/*******************************************************************************
@File
@Title Client bridge header for htbuffer
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for htbuffer
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_HTBUFFER_BRIDGE_H
#define CLIENT_HTBUFFER_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_htbuffer_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeHTBControl(IMG_HANDLE hBridge,
IMG_UINT32 ui32NumGroups,
IMG_UINT32 * pui32GroupEnable,
IMG_UINT32 ui32LogLevel,
IMG_UINT32 ui32EnablePID,
IMG_UINT32 ui32LogMode, IMG_UINT32 ui32OpMode);
IMG_INTERNAL PVRSRV_ERROR BridgeHTBLog(IMG_HANDLE hBridge,
IMG_UINT32 ui32PID,
IMG_UINT32 ui32TID,
IMG_UINT64 ui64TimeStamp,
IMG_UINT32 ui32SF,
IMG_UINT32 ui32NumArgs, IMG_UINT32 * pui32Args);
#endif /* CLIENT_HTBUFFER_BRIDGE_H */

View File

@@ -0,0 +1,85 @@
/*******************************************************************************
@File
@Title Direct client bridge for htbuffer
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for htbuffer
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_htbuffer_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "devicemem_typedefs.h"
#include "htbuffer_types.h"
#include "htbserver.h"
IMG_INTERNAL PVRSRV_ERROR BridgeHTBControl(IMG_HANDLE hBridge,
IMG_UINT32 ui32NumGroups,
IMG_UINT32 * pui32GroupEnable,
IMG_UINT32 ui32LogLevel,
IMG_UINT32 ui32EnablePID,
IMG_UINT32 ui32LogMode, IMG_UINT32 ui32OpMode)
{
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError =
HTBControlKM(ui32NumGroups,
pui32GroupEnable, ui32LogLevel, ui32EnablePID, ui32LogMode, ui32OpMode);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeHTBLog(IMG_HANDLE hBridge,
IMG_UINT32 ui32PID,
IMG_UINT32 ui32TID,
IMG_UINT64 ui64TimeStamp,
IMG_UINT32 ui32SF,
IMG_UINT32 ui32NumArgs, IMG_UINT32 * pui32Args)
{
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = HTBLogKM(ui32PID, ui32TID, ui64TimeStamp, ui32SF, ui32NumArgs, pui32Args);
return eError;
}

View File

@@ -0,0 +1,265 @@
/*******************************************************************************
@File
@Title Client bridge header for mm
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for mm
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_MM_BRIDGE_H
#define CLIENT_MM_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_mm_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgePMRExportPMR(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_HANDLE * phPMRExport,
IMG_UINT64 * pui64Size,
IMG_UINT32 * pui32Log2Contig,
IMG_UINT64 * pui64Password);
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnexportPMR(IMG_HANDLE hBridge, IMG_HANDLE hPMRExport);
IMG_INTERNAL PVRSRV_ERROR BridgePMRGetUID(IMG_HANDLE hBridge,
IMG_HANDLE hPMR, IMG_UINT64 * pui64UID);
IMG_INTERNAL PVRSRV_ERROR BridgePMRMakeLocalImportHandle(IMG_HANDLE hBridge,
IMG_HANDLE hBuffer, IMG_HANDLE * phExtMem);
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnmakeLocalImportHandle(IMG_HANDLE hBridge, IMG_HANDLE hExtMem);
IMG_INTERNAL PVRSRV_ERROR BridgePMRImportPMR(IMG_HANDLE hBridge,
IMG_HANDLE hPMRExport,
IMG_UINT64 ui64uiPassword,
IMG_UINT64 ui64uiSize,
IMG_UINT32 ui32uiLog2Contig, IMG_HANDLE * phPMR);
IMG_INTERNAL PVRSRV_ERROR BridgePMRLocalImportPMR(IMG_HANDLE hBridge,
IMG_HANDLE hExtHandle,
IMG_HANDLE * phPMR,
IMG_DEVMEM_SIZE_T * puiSize,
IMG_DEVMEM_ALIGN_T * puiAlign);
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnrefPMR(IMG_HANDLE hBridge, IMG_HANDLE hPMR);
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnrefUnlockPMR(IMG_HANDLE hBridge, IMG_HANDLE hPMR);
IMG_INTERNAL PVRSRV_ERROR BridgePhysmemNewRamBackedPMR(IMG_HANDLE hBridge,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_SIZE_T uiChunkSize,
IMG_UINT32 ui32NumPhysChunks,
IMG_UINT32 ui32NumVirtChunks,
IMG_UINT32 * pui32MappingTable,
IMG_UINT32 ui32Log2PageSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_UINT32 ui32AnnotationLength,
const IMG_CHAR * puiAnnotation,
IMG_PID ui32PID,
IMG_HANDLE * phPMRPtr,
IMG_UINT32 ui32PDumpFlags,
PVRSRV_MEMALLOCFLAGS_T * puiOutFlags);
IMG_INTERNAL PVRSRV_ERROR BridgePhysmemNewRamBackedLockedPMR(IMG_HANDLE hBridge,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_SIZE_T uiChunkSize,
IMG_UINT32 ui32NumPhysChunks,
IMG_UINT32 ui32NumVirtChunks,
IMG_UINT32 * pui32MappingTable,
IMG_UINT32 ui32Log2PageSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_UINT32 ui32AnnotationLength,
const IMG_CHAR * puiAnnotation,
IMG_PID ui32PID,
IMG_HANDLE * phPMRPtr,
IMG_UINT32 ui32PDumpFlags,
PVRSRV_MEMALLOCFLAGS_T * puiOutFlags);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntPin(IMG_HANDLE hBridge, IMG_HANDLE hPMR);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnpin(IMG_HANDLE hBridge, IMG_HANDLE hPMR);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntPinValidate(IMG_HANDLE hBridge,
IMG_HANDLE hMapping, IMG_HANDLE hPMR);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnpinInvalidate(IMG_HANDLE hBridge,
IMG_HANDLE hMapping, IMG_HANDLE hPMR);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntCtxCreate(IMG_HANDLE hBridge,
IMG_BOOL bbKernelMemoryCtx,
IMG_HANDLE * phDevMemServerContext,
IMG_HANDLE * phPrivData,
IMG_UINT32 * pui32CPUCacheLineSize);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntCtxDestroy(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemServerContext);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntHeapCreate(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR sHeapBaseAddr,
IMG_DEVMEM_SIZE_T uiHeapLength,
IMG_UINT32 ui32Log2DataPageSize,
IMG_HANDLE * phDevmemHeapPtr);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntHeapDestroy(IMG_HANDLE hBridge, IMG_HANDLE hDevmemHeap);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntMapPMR(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemServerHeap,
IMG_HANDLE hReservation,
IMG_HANDLE hPMR,
PVRSRV_MEMALLOCFLAGS_T uiMapFlags,
IMG_HANDLE * phMapping);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnmapPMR(IMG_HANDLE hBridge, IMG_HANDLE hMapping);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntReserveRange(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemServerHeap,
IMG_DEV_VIRTADDR sAddress,
IMG_DEVMEM_SIZE_T uiLength,
IMG_HANDLE * phReservation);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnreserveRange(IMG_HANDLE hBridge,
IMG_HANDLE hReservation);
IMG_INTERNAL PVRSRV_ERROR BridgeChangeSparseMem(IMG_HANDLE hBridge,
IMG_HANDLE hSrvDevMemHeap,
IMG_HANDLE hPMR,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 * pui32AllocPageIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 * pui32FreePageIndices,
IMG_UINT32 ui32SparseFlags,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_UINT64 ui64CPUVAddr);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntMapPages(IMG_HANDLE hBridge,
IMG_HANDLE hReservation,
IMG_HANDLE hPMR,
IMG_UINT32 ui32PageCount,
IMG_UINT32 ui32PhysicalPgOffset,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_DEV_VIRTADDR sDevVAddr);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnmapPages(IMG_HANDLE hBridge,
IMG_HANDLE hReservation,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_UINT32 ui32PageCount);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIsVDevAddrValid(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR sAddress);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemFlushDevSLCRange(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR sAddress,
IMG_DEVMEM_SIZE_T uiSize,
IMG_BOOL bInvalidate);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemInvalidateFBSCTable(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_UINT64 ui64FBSCEntries);
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapConfigCount(IMG_HANDLE hBridge,
IMG_UINT32 * pui32NumHeapConfigs);
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapCount(IMG_HANDLE hBridge,
IMG_UINT32 ui32HeapConfigIndex,
IMG_UINT32 * pui32NumHeaps);
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapConfigName(IMG_HANDLE hBridge,
IMG_UINT32 ui32HeapConfigIndex,
IMG_UINT32 ui32HeapConfigNameBufSz,
IMG_CHAR * puiHeapConfigName);
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapDetails(IMG_HANDLE hBridge,
IMG_UINT32 ui32HeapConfigIndex,
IMG_UINT32 ui32HeapIndex,
IMG_UINT32 ui32HeapNameBufSz,
IMG_CHAR * puiHeapNameOut,
IMG_DEV_VIRTADDR * psDevVAddrBase,
IMG_DEVMEM_SIZE_T * puiHeapLength,
IMG_DEVMEM_SIZE_T * puiReservedRegionLength,
IMG_UINT32 * pui32Log2DataPageSizeOut,
IMG_UINT32 * pui32Log2ImportAlignmentOut);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntRegisterPFNotifyKM(IMG_HANDLE hBridge,
IMG_HANDLE hDevm,
IMG_UINT32 ui32PID, IMG_BOOL bRegister);
IMG_INTERNAL PVRSRV_ERROR BridgeGetMaxPhysHeapCount(IMG_HANDLE hBridge,
IMG_UINT32 * pui32PhysHeapCount);
IMG_INTERNAL PVRSRV_ERROR BridgePhysHeapGetMemInfo(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PVRSRV_PHYS_HEAP * peaPhysHeapID,
PHYS_HEAP_MEM_STATS * pasapPhysHeapMemStats);
IMG_INTERNAL PVRSRV_ERROR BridgeGetDefaultPhysicalHeap(IMG_HANDLE hBridge,
PVRSRV_PHYS_HEAP * peHeap);
IMG_INTERNAL PVRSRV_ERROR BridgeGetHeapPhysMemUsage(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PHYS_HEAP_MEM_STATS * pasapPhysHeapMemStats);
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemGetFaultAddress(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR * psFaultAddress);
IMG_INTERNAL PVRSRV_ERROR BridgePVRSRVUpdateOOMStats(IMG_HANDLE hBridge,
IMG_UINT32 ui32ui32StatType, IMG_PID ui32pid);
IMG_INTERNAL PVRSRV_ERROR BridgePhysHeapGetMemInfoPkd(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PVRSRV_PHYS_HEAP * peaPhysHeapID,
PHYS_HEAP_MEM_STATS_PKD *
psapPhysHeapMemStats);
IMG_INTERNAL PVRSRV_ERROR BridgeGetHeapPhysMemUsagePkd(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PHYS_HEAP_MEM_STATS_PKD *
psapPhysHeapMemStats);
#endif /* CLIENT_MM_BRIDGE_H */

View File

@@ -0,0 +1,804 @@
/*******************************************************************************
@File
@Title Direct client bridge for mm
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for mm
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_mm_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "pvrsrv_memallocflags.h"
#include "pvrsrv_memalloc_physheap.h"
#include "devicemem_typedefs.h"
#include "pvrsrv_memalloc_physheap.h"
#include "devicemem.h"
#include "devicemem_server.h"
#include "pmr.h"
#include "devicemem_heapcfg.h"
#include "physmem.h"
#include "devicemem_utils.h"
#include "process_stats.h"
IMG_INTERNAL PVRSRV_ERROR BridgePMRExportPMR(IMG_HANDLE hBridge,
IMG_HANDLE hPMR,
IMG_HANDLE * phPMRExport,
IMG_UINT64 * pui64Size,
IMG_UINT32 * pui32Log2Contig,
IMG_UINT64 * pui64Password)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PMR_EXPORT *psPMRExportInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = PMRExportPMR(psPMRInt, &psPMRExportInt, pui64Size, pui32Log2Contig, pui64Password);
*phPMRExport = psPMRExportInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnexportPMR(IMG_HANDLE hBridge, IMG_HANDLE hPMRExport)
{
PVRSRV_ERROR eError;
PMR_EXPORT *psPMRExportInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRExportInt = (PMR_EXPORT *) hPMRExport;
eError = PMRUnexportPMR(psPMRExportInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRGetUID(IMG_HANDLE hBridge,
IMG_HANDLE hPMR, IMG_UINT64 * pui64UID)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = PMRGetUID(psPMRInt, pui64UID);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRMakeLocalImportHandle(IMG_HANDLE hBridge,
IMG_HANDLE hBuffer, IMG_HANDLE * phExtMem)
{
PVRSRV_ERROR eError;
PMR *psBufferInt;
PMR *psExtMemInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psBufferInt = (PMR *) hBuffer;
eError = PMRMakeLocalImportHandle(psBufferInt, &psExtMemInt);
*phExtMem = psExtMemInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnmakeLocalImportHandle(IMG_HANDLE hBridge, IMG_HANDLE hExtMem)
{
PVRSRV_ERROR eError;
PMR *psExtMemInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psExtMemInt = (PMR *) hExtMem;
eError = PMRUnmakeLocalImportHandle(psExtMemInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRImportPMR(IMG_HANDLE hBridge,
IMG_HANDLE hPMRExport,
IMG_UINT64 ui64uiPassword,
IMG_UINT64 ui64uiSize,
IMG_UINT32 ui32uiLog2Contig, IMG_HANDLE * phPMR)
{
PVRSRV_ERROR eError;
PMR_EXPORT *psPMRExportInt;
PMR *psPMRInt = NULL;
psPMRExportInt = (PMR_EXPORT *) hPMRExport;
eError =
PhysmemImportPMR(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
psPMRExportInt,
ui64uiPassword, ui64uiSize, ui32uiLog2Contig, &psPMRInt);
*phPMR = psPMRInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRLocalImportPMR(IMG_HANDLE hBridge,
IMG_HANDLE hExtHandle,
IMG_HANDLE * phPMR,
IMG_DEVMEM_SIZE_T * puiSize,
IMG_DEVMEM_ALIGN_T * puiAlign)
{
PVRSRV_ERROR eError;
PMR *psExtHandleInt;
PMR *psPMRInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psExtHandleInt = (PMR *) hExtHandle;
eError = PMRLocalImportPMR(psExtHandleInt, &psPMRInt, puiSize, puiAlign);
*phPMR = psPMRInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnrefPMR(IMG_HANDLE hBridge, IMG_HANDLE hPMR)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = PMRUnrefPMR(psPMRInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePMRUnrefUnlockPMR(IMG_HANDLE hBridge, IMG_HANDLE hPMR)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = PMRUnrefUnlockPMR(psPMRInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePhysmemNewRamBackedPMR(IMG_HANDLE hBridge,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_SIZE_T uiChunkSize,
IMG_UINT32 ui32NumPhysChunks,
IMG_UINT32 ui32NumVirtChunks,
IMG_UINT32 * pui32MappingTable,
IMG_UINT32 ui32Log2PageSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_UINT32 ui32AnnotationLength,
const IMG_CHAR * puiAnnotation,
IMG_PID ui32PID,
IMG_HANDLE * phPMRPtr,
IMG_UINT32 ui32PDumpFlags,
PVRSRV_MEMALLOCFLAGS_T * puiOutFlags)
{
PVRSRV_ERROR eError;
PMR *psPMRPtrInt = NULL;
eError =
PhysmemNewRamBackedPMR_direct(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
uiSize,
uiChunkSize,
ui32NumPhysChunks,
ui32NumVirtChunks,
pui32MappingTable,
ui32Log2PageSize,
uiFlags,
ui32AnnotationLength,
puiAnnotation,
ui32PID, &psPMRPtrInt, ui32PDumpFlags, puiOutFlags);
*phPMRPtr = psPMRPtrInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePhysmemNewRamBackedLockedPMR(IMG_HANDLE hBridge,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_SIZE_T uiChunkSize,
IMG_UINT32 ui32NumPhysChunks,
IMG_UINT32 ui32NumVirtChunks,
IMG_UINT32 * pui32MappingTable,
IMG_UINT32 ui32Log2PageSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_UINT32 ui32AnnotationLength,
const IMG_CHAR * puiAnnotation,
IMG_PID ui32PID,
IMG_HANDLE * phPMRPtr,
IMG_UINT32 ui32PDumpFlags,
PVRSRV_MEMALLOCFLAGS_T * puiOutFlags)
{
PVRSRV_ERROR eError;
PMR *psPMRPtrInt = NULL;
eError =
PhysmemNewRamBackedLockedPMR(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
uiSize,
uiChunkSize,
ui32NumPhysChunks,
ui32NumVirtChunks,
pui32MappingTable,
ui32Log2PageSize,
uiFlags,
ui32AnnotationLength,
puiAnnotation,
ui32PID, &psPMRPtrInt, ui32PDumpFlags, puiOutFlags);
*phPMRPtr = psPMRPtrInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntPin(IMG_HANDLE hBridge, IMG_HANDLE hPMR)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = DevmemIntPin(psPMRInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnpin(IMG_HANDLE hBridge, IMG_HANDLE hPMR)
{
PVRSRV_ERROR eError;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRInt = (PMR *) hPMR;
eError = DevmemIntUnpin(psPMRInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntPinValidate(IMG_HANDLE hBridge,
IMG_HANDLE hMapping, IMG_HANDLE hPMR)
{
PVRSRV_ERROR eError;
DEVMEMINT_MAPPING *psMappingInt;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psMappingInt = (DEVMEMINT_MAPPING *) hMapping;
psPMRInt = (PMR *) hPMR;
eError = DevmemIntPinValidate(psMappingInt, psPMRInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnpinInvalidate(IMG_HANDLE hBridge,
IMG_HANDLE hMapping, IMG_HANDLE hPMR)
{
PVRSRV_ERROR eError;
DEVMEMINT_MAPPING *psMappingInt;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psMappingInt = (DEVMEMINT_MAPPING *) hMapping;
psPMRInt = (PMR *) hPMR;
eError = DevmemIntUnpinInvalidate(psMappingInt, psPMRInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntCtxCreate(IMG_HANDLE hBridge,
IMG_BOOL bbKernelMemoryCtx,
IMG_HANDLE * phDevMemServerContext,
IMG_HANDLE * phPrivData,
IMG_UINT32 * pui32CPUCacheLineSize)
{
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevMemServerContextInt = NULL;
IMG_HANDLE hPrivDataInt = NULL;
eError =
DevmemIntCtxCreate(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
bbKernelMemoryCtx,
&psDevMemServerContextInt, &hPrivDataInt, pui32CPUCacheLineSize);
*phDevMemServerContext = psDevMemServerContextInt;
*phPrivData = hPrivDataInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntCtxDestroy(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemServerContext)
{
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmemServerContextInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemServerContextInt = (DEVMEMINT_CTX *) hDevmemServerContext;
eError = DevmemIntCtxDestroy(psDevmemServerContextInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntHeapCreate(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR sHeapBaseAddr,
IMG_DEVMEM_SIZE_T uiHeapLength,
IMG_UINT32 ui32Log2DataPageSize,
IMG_HANDLE * phDevmemHeapPtr)
{
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmemCtxInt;
DEVMEMINT_HEAP *psDevmemHeapPtrInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
eError =
DevmemIntHeapCreate(psDevmemCtxInt,
sHeapBaseAddr,
uiHeapLength, ui32Log2DataPageSize, &psDevmemHeapPtrInt);
*phDevmemHeapPtr = psDevmemHeapPtrInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntHeapDestroy(IMG_HANDLE hBridge, IMG_HANDLE hDevmemHeap)
{
PVRSRV_ERROR eError;
DEVMEMINT_HEAP *psDevmemHeapInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemHeapInt = (DEVMEMINT_HEAP *) hDevmemHeap;
eError = DevmemIntHeapDestroy(psDevmemHeapInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntMapPMR(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemServerHeap,
IMG_HANDLE hReservation,
IMG_HANDLE hPMR,
PVRSRV_MEMALLOCFLAGS_T uiMapFlags,
IMG_HANDLE * phMapping)
{
PVRSRV_ERROR eError;
DEVMEMINT_HEAP *psDevmemServerHeapInt;
DEVMEMINT_RESERVATION *psReservationInt;
PMR *psPMRInt;
DEVMEMINT_MAPPING *psMappingInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemServerHeapInt = (DEVMEMINT_HEAP *) hDevmemServerHeap;
psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
psPMRInt = (PMR *) hPMR;
eError =
DevmemIntMapPMR(psDevmemServerHeapInt,
psReservationInt, psPMRInt, uiMapFlags, &psMappingInt);
*phMapping = psMappingInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnmapPMR(IMG_HANDLE hBridge, IMG_HANDLE hMapping)
{
PVRSRV_ERROR eError;
DEVMEMINT_MAPPING *psMappingInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psMappingInt = (DEVMEMINT_MAPPING *) hMapping;
eError = DevmemIntUnmapPMR(psMappingInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntReserveRange(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemServerHeap,
IMG_DEV_VIRTADDR sAddress,
IMG_DEVMEM_SIZE_T uiLength,
IMG_HANDLE * phReservation)
{
PVRSRV_ERROR eError;
DEVMEMINT_HEAP *psDevmemServerHeapInt;
DEVMEMINT_RESERVATION *psReservationInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemServerHeapInt = (DEVMEMINT_HEAP *) hDevmemServerHeap;
eError =
DevmemIntReserveRange(psDevmemServerHeapInt, sAddress, uiLength, &psReservationInt);
*phReservation = psReservationInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnreserveRange(IMG_HANDLE hBridge, IMG_HANDLE hReservation)
{
PVRSRV_ERROR eError;
DEVMEMINT_RESERVATION *psReservationInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
eError = DevmemIntUnreserveRange(psReservationInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeChangeSparseMem(IMG_HANDLE hBridge,
IMG_HANDLE hSrvDevMemHeap,
IMG_HANDLE hPMR,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 * pui32AllocPageIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 * pui32FreePageIndices,
IMG_UINT32 ui32SparseFlags,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_DEV_VIRTADDR sDevVAddr, IMG_UINT64 ui64CPUVAddr)
{
PVRSRV_ERROR eError;
DEVMEMINT_HEAP *psSrvDevMemHeapInt;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSrvDevMemHeapInt = (DEVMEMINT_HEAP *) hSrvDevMemHeap;
psPMRInt = (PMR *) hPMR;
eError =
DevmemIntChangeSparse(psSrvDevMemHeapInt,
psPMRInt,
ui32AllocPageCount,
pui32AllocPageIndices,
ui32FreePageCount,
pui32FreePageIndices,
ui32SparseFlags, uiFlags, sDevVAddr, ui64CPUVAddr);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntMapPages(IMG_HANDLE hBridge,
IMG_HANDLE hReservation,
IMG_HANDLE hPMR,
IMG_UINT32 ui32PageCount,
IMG_UINT32 ui32PhysicalPgOffset,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_DEV_VIRTADDR sDevVAddr)
{
PVRSRV_ERROR eError;
DEVMEMINT_RESERVATION *psReservationInt;
PMR *psPMRInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
psPMRInt = (PMR *) hPMR;
eError =
DevmemIntMapPages(psReservationInt,
psPMRInt, ui32PageCount, ui32PhysicalPgOffset, uiFlags, sDevVAddr);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntUnmapPages(IMG_HANDLE hBridge,
IMG_HANDLE hReservation,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_UINT32 ui32PageCount)
{
PVRSRV_ERROR eError;
DEVMEMINT_RESERVATION *psReservationInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psReservationInt = (DEVMEMINT_RESERVATION *) hReservation;
eError = DevmemIntUnmapPages(psReservationInt, sDevVAddr, ui32PageCount);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIsVDevAddrValid(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR sAddress)
{
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmemCtxInt;
psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
eError =
DevmemIntIsVDevAddrValid(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
psDevmemCtxInt, sAddress);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemFlushDevSLCRange(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR sAddress,
IMG_DEVMEM_SIZE_T uiSize,
IMG_BOOL bInvalidate)
{
#if defined(RGX_SRV_SLC_RANGEBASED_CFI_SUPPORTED)
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmemCtxInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
eError = DevmemIntFlushDevSLCRange(psDevmemCtxInt, sAddress, uiSize, bInvalidate);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hDevmemCtx);
PVR_UNREFERENCED_PARAMETER(sAddress);
PVR_UNREFERENCED_PARAMETER(uiSize);
PVR_UNREFERENCED_PARAMETER(bInvalidate);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemInvalidateFBSCTable(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_UINT64 ui64FBSCEntries)
{
#if defined(RGX_FEATURE_FBCDC)
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmemCtxInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
eError = DevmemIntInvalidateFBSCTable(psDevmemCtxInt, ui64FBSCEntries);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hDevmemCtx);
PVR_UNREFERENCED_PARAMETER(ui64FBSCEntries);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapConfigCount(IMG_HANDLE hBridge,
IMG_UINT32 * pui32NumHeapConfigs)
{
PVRSRV_ERROR eError;
eError =
HeapCfgHeapConfigCount(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
pui32NumHeapConfigs);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapCount(IMG_HANDLE hBridge,
IMG_UINT32 ui32HeapConfigIndex,
IMG_UINT32 * pui32NumHeaps)
{
PVRSRV_ERROR eError;
eError =
HeapCfgHeapCount(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32HeapConfigIndex, pui32NumHeaps);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapConfigName(IMG_HANDLE hBridge,
IMG_UINT32 ui32HeapConfigIndex,
IMG_UINT32 ui32HeapConfigNameBufSz,
IMG_CHAR * puiHeapConfigName)
{
PVRSRV_ERROR eError;
eError =
HeapCfgHeapConfigName(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32HeapConfigIndex, ui32HeapConfigNameBufSz, puiHeapConfigName);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeHeapCfgHeapDetails(IMG_HANDLE hBridge,
IMG_UINT32 ui32HeapConfigIndex,
IMG_UINT32 ui32HeapIndex,
IMG_UINT32 ui32HeapNameBufSz,
IMG_CHAR * puiHeapNameOut,
IMG_DEV_VIRTADDR * psDevVAddrBase,
IMG_DEVMEM_SIZE_T * puiHeapLength,
IMG_DEVMEM_SIZE_T * puiReservedRegionLength,
IMG_UINT32 * pui32Log2DataPageSizeOut,
IMG_UINT32 * pui32Log2ImportAlignmentOut)
{
PVRSRV_ERROR eError;
eError =
HeapCfgHeapDetails(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32HeapConfigIndex,
ui32HeapIndex,
ui32HeapNameBufSz,
puiHeapNameOut,
psDevVAddrBase,
puiHeapLength,
puiReservedRegionLength,
pui32Log2DataPageSizeOut, pui32Log2ImportAlignmentOut);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemIntRegisterPFNotifyKM(IMG_HANDLE hBridge,
IMG_HANDLE hDevm,
IMG_UINT32 ui32PID, IMG_BOOL bRegister)
{
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psDevmInt = (DEVMEMINT_CTX *) hDevm;
eError = DevmemIntRegisterPFNotifyKM(psDevmInt, ui32PID, bRegister);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeGetMaxPhysHeapCount(IMG_HANDLE hBridge,
IMG_UINT32 * pui32PhysHeapCount)
{
PVRSRV_ERROR eError;
eError =
PVRSRVGetMaxPhysHeapCountKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
pui32PhysHeapCount);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePhysHeapGetMemInfo(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PVRSRV_PHYS_HEAP * peaPhysHeapID,
PHYS_HEAP_MEM_STATS * pasapPhysHeapMemStats)
{
PVRSRV_ERROR eError;
eError =
PVRSRVPhysHeapGetMemInfoKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32PhysHeapCount, peaPhysHeapID, pasapPhysHeapMemStats);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeGetDefaultPhysicalHeap(IMG_HANDLE hBridge,
PVRSRV_PHYS_HEAP * peHeap)
{
PVRSRV_ERROR eError;
eError =
PVRSRVGetDefaultPhysicalHeapKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge), peHeap);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeGetHeapPhysMemUsage(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PHYS_HEAP_MEM_STATS * pasapPhysHeapMemStats)
{
PVRSRV_ERROR eError;
eError =
PVRSRVGetHeapPhysMemUsageKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32PhysHeapCount, pasapPhysHeapMemStats);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeDevmemGetFaultAddress(IMG_HANDLE hBridge,
IMG_HANDLE hDevmemCtx,
IMG_DEV_VIRTADDR * psFaultAddress)
{
PVRSRV_ERROR eError;
DEVMEMINT_CTX *psDevmemCtxInt;
psDevmemCtxInt = (DEVMEMINT_CTX *) hDevmemCtx;
eError =
DevmemIntGetFaultAddress(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
psDevmemCtxInt, psFaultAddress);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgePVRSRVUpdateOOMStats(IMG_HANDLE hBridge,
IMG_UINT32 ui32ui32StatType, IMG_PID ui32pid)
{
#if defined(PVRSRV_ENABLE_PROCESS_STATS)
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = PVRSRVServerUpdateOOMStats(ui32ui32StatType, ui32pid);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(ui32ui32StatType);
PVR_UNREFERENCED_PARAMETER(ui32pid);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgePhysHeapGetMemInfoPkd(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PVRSRV_PHYS_HEAP * peaPhysHeapID,
PHYS_HEAP_MEM_STATS_PKD *
psapPhysHeapMemStats)
{
PVRSRV_ERROR eError;
eError =
PVRSRVPhysHeapGetMemInfoPkdKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32PhysHeapCount, peaPhysHeapID, psapPhysHeapMemStats);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeGetHeapPhysMemUsagePkd(IMG_HANDLE hBridge,
IMG_UINT32 ui32PhysHeapCount,
PHYS_HEAP_MEM_STATS_PKD *
psapPhysHeapMemStats)
{
PVRSRV_ERROR eError;
eError =
PVRSRVGetHeapPhysMemUsagePkdKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
ui32PhysHeapCount, psapPhysHeapMemStats);
return eError;
}

View File

@@ -0,0 +1,93 @@
/*******************************************************************************
@File
@Title Client bridge header for pvrtl
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for pvrtl
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_PVRTL_BRIDGE_H
#define CLIENT_PVRTL_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_pvrtl_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeTLOpenStream(IMG_HANDLE hBridge,
const IMG_CHAR * puiName,
IMG_UINT32 ui32Mode,
IMG_HANDLE * phSD, IMG_HANDLE * phTLPMR);
IMG_INTERNAL PVRSRV_ERROR BridgeTLCloseStream(IMG_HANDLE hBridge, IMG_HANDLE hSD);
IMG_INTERNAL PVRSRV_ERROR BridgeTLAcquireData(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 * pui32ReadOffset,
IMG_UINT32 * pui32ReadLen);
IMG_INTERNAL PVRSRV_ERROR BridgeTLReleaseData(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 ui32ReadOffset, IMG_UINT32 ui32ReadLen);
IMG_INTERNAL PVRSRV_ERROR BridgeTLDiscoverStreams(IMG_HANDLE hBridge,
const IMG_CHAR * puiNamePattern,
IMG_UINT32 ui32Size,
IMG_CHAR * puiStreams,
IMG_UINT32 * pui32NumFound);
IMG_INTERNAL PVRSRV_ERROR BridgeTLReserveStream(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 * pui32BufferOffset,
IMG_UINT32 ui32Size,
IMG_UINT32 ui32SizeMin,
IMG_UINT32 * pui32Available);
IMG_INTERNAL PVRSRV_ERROR BridgeTLCommitStream(IMG_HANDLE hBridge,
IMG_HANDLE hSD, IMG_UINT32 ui32ReqSize);
IMG_INTERNAL PVRSRV_ERROR BridgeTLWriteData(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 ui32Size, IMG_BYTE * pui8Data);
#endif /* CLIENT_PVRTL_BRIDGE_H */

View File

@@ -0,0 +1,175 @@
/*******************************************************************************
@File
@Title Direct client bridge for pvrtl
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for pvrtl
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_pvrtl_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "devicemem_typedefs.h"
#include "pvrsrv_tlcommon.h"
#include "tlserver.h"
IMG_INTERNAL PVRSRV_ERROR BridgeTLOpenStream(IMG_HANDLE hBridge,
const IMG_CHAR * puiName,
IMG_UINT32 ui32Mode,
IMG_HANDLE * phSD, IMG_HANDLE * phTLPMR)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt = NULL;
PMR *psTLPMRInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = TLServerOpenStreamKM(puiName, ui32Mode, &psSDInt, &psTLPMRInt);
*phSD = psSDInt;
*phTLPMR = psTLPMRInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLCloseStream(IMG_HANDLE hBridge, IMG_HANDLE hSD)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSDInt = (TL_STREAM_DESC *) hSD;
eError = TLServerCloseStreamKM(psSDInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLAcquireData(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 * pui32ReadOffset,
IMG_UINT32 * pui32ReadLen)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSDInt = (TL_STREAM_DESC *) hSD;
eError = TLServerAcquireDataKM(psSDInt, pui32ReadOffset, pui32ReadLen);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLReleaseData(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 ui32ReadOffset, IMG_UINT32 ui32ReadLen)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSDInt = (TL_STREAM_DESC *) hSD;
eError = TLServerReleaseDataKM(psSDInt, ui32ReadOffset, ui32ReadLen);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLDiscoverStreams(IMG_HANDLE hBridge,
const IMG_CHAR * puiNamePattern,
IMG_UINT32 ui32Size,
IMG_CHAR * puiStreams, IMG_UINT32 * pui32NumFound)
{
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = TLServerDiscoverStreamsKM(puiNamePattern, ui32Size, puiStreams, pui32NumFound);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLReserveStream(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 * pui32BufferOffset,
IMG_UINT32 ui32Size,
IMG_UINT32 ui32SizeMin, IMG_UINT32 * pui32Available)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSDInt = (TL_STREAM_DESC *) hSD;
eError =
TLServerReserveStreamKM(psSDInt,
pui32BufferOffset, ui32Size, ui32SizeMin, pui32Available);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLCommitStream(IMG_HANDLE hBridge,
IMG_HANDLE hSD, IMG_UINT32 ui32ReqSize)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSDInt = (TL_STREAM_DESC *) hSD;
eError = TLServerCommitStreamKM(psSDInt, ui32ReqSize);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeTLWriteData(IMG_HANDLE hBridge,
IMG_HANDLE hSD,
IMG_UINT32 ui32Size, IMG_BYTE * pui8Data)
{
PVRSRV_ERROR eError;
TL_STREAM_DESC *psSDInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSDInt = (TL_STREAM_DESC *) hSD;
eError = TLServerWriteDataKM(psSDInt, ui32Size, pui8Data);
return eError;
}

View File

@@ -0,0 +1,89 @@
/*******************************************************************************
@File
@Title Client bridge header for ri
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for ri
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_RI_BRIDGE_H
#define CLIENT_RI_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_ri_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeRIWritePMREntry(IMG_HANDLE hBridge, IMG_HANDLE hPMRHandle);
IMG_INTERNAL PVRSRV_ERROR BridgeRIWriteMEMDESCEntry(IMG_HANDLE hBridge,
IMG_HANDLE hPMRHandle,
IMG_UINT32 ui32TextBSize,
const IMG_CHAR * puiTextB,
IMG_UINT64 ui64Offset,
IMG_UINT64 ui64Size,
IMG_BOOL bIsImport,
IMG_BOOL bIsSuballoc, IMG_HANDLE * phRIHandle);
IMG_INTERNAL PVRSRV_ERROR BridgeRIWriteProcListEntry(IMG_HANDLE hBridge,
IMG_UINT32 ui32TextBSize,
const IMG_CHAR * puiTextB,
IMG_UINT64 ui64Size,
IMG_UINT64 ui64DevVAddr,
IMG_HANDLE * phRIHandle);
IMG_INTERNAL PVRSRV_ERROR BridgeRIUpdateMEMDESCAddr(IMG_HANDLE hBridge,
IMG_HANDLE hRIHandle, IMG_DEV_VIRTADDR sAddr);
IMG_INTERNAL PVRSRV_ERROR BridgeRIDeleteMEMDESCEntry(IMG_HANDLE hBridge, IMG_HANDLE hRIHandle);
IMG_INTERNAL PVRSRV_ERROR BridgeRIDumpList(IMG_HANDLE hBridge, IMG_HANDLE hPMRHandle);
IMG_INTERNAL PVRSRV_ERROR BridgeRIDumpAll(IMG_HANDLE hBridge);
IMG_INTERNAL PVRSRV_ERROR BridgeRIDumpProcess(IMG_HANDLE hBridge, IMG_PID ui32Pid);
IMG_INTERNAL PVRSRV_ERROR BridgeRIWritePMREntryWithOwner(IMG_HANDLE hBridge,
IMG_HANDLE hPMRHandle, IMG_PID ui32Owner);
#endif /* CLIENT_RI_BRIDGE_H */

View File

@@ -0,0 +1,182 @@
/*******************************************************************************
@File
@Title Direct client bridge for ri
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for ri
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_ri_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "ri_typedefs.h"
#include "ri_server.h"
IMG_INTERNAL PVRSRV_ERROR BridgeRIWritePMREntry(IMG_HANDLE hBridge, IMG_HANDLE hPMRHandle)
{
PVRSRV_ERROR eError;
PMR *psPMRHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRHandleInt = (PMR *) hPMRHandle;
eError = RIWritePMREntryKM(psPMRHandleInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIWriteMEMDESCEntry(IMG_HANDLE hBridge,
IMG_HANDLE hPMRHandle,
IMG_UINT32 ui32TextBSize,
const IMG_CHAR * puiTextB,
IMG_UINT64 ui64Offset,
IMG_UINT64 ui64Size,
IMG_BOOL bIsImport,
IMG_BOOL bIsSuballoc, IMG_HANDLE * phRIHandle)
{
PVRSRV_ERROR eError;
PMR *psPMRHandleInt;
RI_HANDLE psRIHandleInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRHandleInt = (PMR *) hPMRHandle;
eError =
RIWriteMEMDESCEntryKM(psPMRHandleInt,
ui32TextBSize,
puiTextB,
ui64Offset, ui64Size, bIsImport, bIsSuballoc, &psRIHandleInt);
*phRIHandle = psRIHandleInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIWriteProcListEntry(IMG_HANDLE hBridge,
IMG_UINT32 ui32TextBSize,
const IMG_CHAR * puiTextB,
IMG_UINT64 ui64Size,
IMG_UINT64 ui64DevVAddr,
IMG_HANDLE * phRIHandle)
{
PVRSRV_ERROR eError;
RI_HANDLE psRIHandleInt = NULL;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError =
RIWriteProcListEntryKM(ui32TextBSize, puiTextB, ui64Size, ui64DevVAddr, &psRIHandleInt);
*phRIHandle = psRIHandleInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIUpdateMEMDESCAddr(IMG_HANDLE hBridge,
IMG_HANDLE hRIHandle, IMG_DEV_VIRTADDR sAddr)
{
PVRSRV_ERROR eError;
RI_HANDLE psRIHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psRIHandleInt = (RI_HANDLE) hRIHandle;
eError = RIUpdateMEMDESCAddrKM(psRIHandleInt, sAddr);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIDeleteMEMDESCEntry(IMG_HANDLE hBridge, IMG_HANDLE hRIHandle)
{
PVRSRV_ERROR eError;
RI_HANDLE psRIHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psRIHandleInt = (RI_HANDLE) hRIHandle;
eError = RIDeleteMEMDESCEntryKM(psRIHandleInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIDumpList(IMG_HANDLE hBridge, IMG_HANDLE hPMRHandle)
{
PVRSRV_ERROR eError;
PMR *psPMRHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRHandleInt = (PMR *) hPMRHandle;
eError = RIDumpListKM(psPMRHandleInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIDumpAll(IMG_HANDLE hBridge)
{
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = RIDumpAllKM();
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIDumpProcess(IMG_HANDLE hBridge, IMG_PID ui32Pid)
{
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = RIDumpProcessKM(ui32Pid);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeRIWritePMREntryWithOwner(IMG_HANDLE hBridge,
IMG_HANDLE hPMRHandle, IMG_PID ui32Owner)
{
PVRSRV_ERROR eError;
PMR *psPMRHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psPMRHandleInt = (PMR *) hPMRHandle;
eError = RIWritePMREntryWithOwnerKM(psPMRHandleInt, ui32Owner);
return eError;
}

View File

@@ -0,0 +1,102 @@
/*******************************************************************************
@File
@Title Client bridge header for sync
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for sync
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_SYNC_BRIDGE_H
#define CLIENT_SYNC_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_sync_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeAllocSyncPrimitiveBlock(IMG_HANDLE hBridge,
IMG_HANDLE * phSyncHandle,
IMG_UINT32 * pui32SyncPrimVAddr,
IMG_UINT32 * pui32SyncPrimBlockSize,
IMG_HANDLE * phhSyncPMR);
IMG_INTERNAL PVRSRV_ERROR BridgeFreeSyncPrimitiveBlock(IMG_HANDLE hBridge, IMG_HANDLE hSyncHandle);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimSet(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Index, IMG_UINT32 ui32Value);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDump(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle, IMG_UINT32 ui32Offset);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDumpValue(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDumpPol(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Offset,
IMG_UINT32 ui32Value,
IMG_UINT32 ui32Mask,
PDUMP_POLL_OPERATOR eOperator,
PDUMP_FLAGS_T uiPDumpFlags);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDumpCBP(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Offset,
IMG_DEVMEM_OFFSET_T uiWriteOffset,
IMG_DEVMEM_SIZE_T uiPacketSize,
IMG_DEVMEM_SIZE_T uiBufferSize);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncAllocEvent(IMG_HANDLE hBridge,
IMG_BOOL bServerSync,
IMG_UINT32 ui32FWAddr,
IMG_UINT32 ui32ClassNameSize,
const IMG_CHAR * puiClassName);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncFreeEvent(IMG_HANDLE hBridge, IMG_UINT32 ui32FWAddr);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncCheckpointSignalledPDumpPol(IMG_HANDLE hBridge,
PVRSRV_FENCE hFence);
#endif /* CLIENT_SYNC_BRIDGE_H */

View File

@@ -0,0 +1,262 @@
/*******************************************************************************
@File
@Title Direct client bridge for sync
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for sync
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_sync_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "pdump.h"
#include "pdumpdefs.h"
#include "devicemem_typedefs.h"
#include "pvrsrv_sync_km.h"
#include <powervr/pvrsrv_sync_ext.h>
#include "sync.h"
#include "sync_server.h"
#include "pdump.h"
#include "pvrsrv_sync_km.h"
#include "sync_fallback_server.h"
#include "sync_checkpoint.h"
IMG_INTERNAL PVRSRV_ERROR BridgeAllocSyncPrimitiveBlock(IMG_HANDLE hBridge,
IMG_HANDLE * phSyncHandle,
IMG_UINT32 * pui32SyncPrimVAddr,
IMG_UINT32 * pui32SyncPrimBlockSize,
IMG_HANDLE * phhSyncPMR)
{
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt = NULL;
PMR *pshSyncPMRInt = NULL;
eError =
PVRSRVAllocSyncPrimitiveBlockKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
&psSyncHandleInt,
pui32SyncPrimVAddr,
pui32SyncPrimBlockSize, &pshSyncPMRInt);
*phSyncHandle = psSyncHandleInt;
*phhSyncPMR = pshSyncPMRInt;
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeFreeSyncPrimitiveBlock(IMG_HANDLE hBridge, IMG_HANDLE hSyncHandle)
{
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSyncHandleInt = (SYNC_PRIMITIVE_BLOCK *) hSyncHandle;
eError = PVRSRVFreeSyncPrimitiveBlockKM(psSyncHandleInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimSet(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Index, IMG_UINT32 ui32Value)
{
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSyncHandleInt = (SYNC_PRIMITIVE_BLOCK *) hSyncHandle;
eError = PVRSRVSyncPrimSetKM(psSyncHandleInt, ui32Index, ui32Value);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDump(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle, IMG_UINT32 ui32Offset)
{
#if defined(PDUMP)
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSyncHandleInt = (SYNC_PRIMITIVE_BLOCK *) hSyncHandle;
eError = PVRSRVSyncPrimPDumpKM(psSyncHandleInt, ui32Offset);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hSyncHandle);
PVR_UNREFERENCED_PARAMETER(ui32Offset);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDumpValue(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value)
{
#if defined(PDUMP)
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSyncHandleInt = (SYNC_PRIMITIVE_BLOCK *) hSyncHandle;
eError = PVRSRVSyncPrimPDumpValueKM(psSyncHandleInt, ui32Offset, ui32Value);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hSyncHandle);
PVR_UNREFERENCED_PARAMETER(ui32Offset);
PVR_UNREFERENCED_PARAMETER(ui32Value);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDumpPol(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Offset,
IMG_UINT32 ui32Value,
IMG_UINT32 ui32Mask,
PDUMP_POLL_OPERATOR eOperator,
PDUMP_FLAGS_T uiPDumpFlags)
{
#if defined(PDUMP)
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSyncHandleInt = (SYNC_PRIMITIVE_BLOCK *) hSyncHandle;
eError =
PVRSRVSyncPrimPDumpPolKM(psSyncHandleInt,
ui32Offset, ui32Value, ui32Mask, eOperator, uiPDumpFlags);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hSyncHandle);
PVR_UNREFERENCED_PARAMETER(ui32Offset);
PVR_UNREFERENCED_PARAMETER(ui32Value);
PVR_UNREFERENCED_PARAMETER(ui32Mask);
PVR_UNREFERENCED_PARAMETER(eOperator);
PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncPrimPDumpCBP(IMG_HANDLE hBridge,
IMG_HANDLE hSyncHandle,
IMG_UINT32 ui32Offset,
IMG_DEVMEM_OFFSET_T uiWriteOffset,
IMG_DEVMEM_SIZE_T uiPacketSize,
IMG_DEVMEM_SIZE_T uiBufferSize)
{
#if defined(PDUMP)
PVRSRV_ERROR eError;
SYNC_PRIMITIVE_BLOCK *psSyncHandleInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
psSyncHandleInt = (SYNC_PRIMITIVE_BLOCK *) hSyncHandle;
eError =
PVRSRVSyncPrimPDumpCBPKM(psSyncHandleInt,
ui32Offset, uiWriteOffset, uiPacketSize, uiBufferSize);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hSyncHandle);
PVR_UNREFERENCED_PARAMETER(ui32Offset);
PVR_UNREFERENCED_PARAMETER(uiWriteOffset);
PVR_UNREFERENCED_PARAMETER(uiPacketSize);
PVR_UNREFERENCED_PARAMETER(uiBufferSize);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncAllocEvent(IMG_HANDLE hBridge,
IMG_BOOL bServerSync,
IMG_UINT32 ui32FWAddr,
IMG_UINT32 ui32ClassNameSize,
const IMG_CHAR * puiClassName)
{
PVRSRV_ERROR eError;
eError =
PVRSRVSyncAllocEventKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
bServerSync, ui32FWAddr, ui32ClassNameSize, puiClassName);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncFreeEvent(IMG_HANDLE hBridge, IMG_UINT32 ui32FWAddr)
{
PVRSRV_ERROR eError;
eError = PVRSRVSyncFreeEventKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge), ui32FWAddr);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncCheckpointSignalledPDumpPol(IMG_HANDLE hBridge,
PVRSRV_FENCE hFence)
{
#if defined(PDUMP)
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(hBridge);
eError = PVRSRVSyncCheckpointSignalledPDumpPolKM(hFence);
return eError;
#else
PVR_UNREFERENCED_PARAMETER(hBridge);
PVR_UNREFERENCED_PARAMETER(hFence);
return PVRSRV_ERROR_NOT_IMPLEMENTED;
#endif
}

View File

@@ -0,0 +1,68 @@
/*******************************************************************************
@File
@Title Client bridge header for synctracking
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Exports the client bridge functions for synctracking
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef CLIENT_SYNCTRACKING_BRIDGE_H
#define CLIENT_SYNCTRACKING_BRIDGE_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#if defined(PVR_INDIRECT_BRIDGE_CLIENTS)
#include "pvr_bridge_client.h"
#include "pvr_bridge.h"
#endif
#include "common_synctracking_bridge.h"
IMG_INTERNAL PVRSRV_ERROR BridgeSyncRecordRemoveByHandle(IMG_HANDLE hBridge, IMG_HANDLE hhRecord);
IMG_INTERNAL PVRSRV_ERROR BridgeSyncRecordAdd(IMG_HANDLE hBridge,
IMG_HANDLE * phhRecord,
IMG_HANDLE hhServerSyncPrimBlock,
IMG_UINT32 ui32ui32FwBlockAddr,
IMG_UINT32 ui32ui32SyncOffset,
IMG_BOOL bbServerSync,
IMG_UINT32 ui32ClassNameSize,
const IMG_CHAR * puiClassName);
#endif /* CLIENT_SYNCTRACKING_BRIDGE_H */

View File

@@ -0,0 +1,92 @@
/*******************************************************************************
@File
@Title Direct client bridge for synctracking
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements the client side of the bridge for synctracking
which is used in calls from Server context.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#include "client_synctracking_bridge.h"
#include "img_defs.h"
#include "pvr_debug.h"
/* Module specific includes */
#include "sync.h"
#include "sync_server.h"
IMG_INTERNAL PVRSRV_ERROR BridgeSyncRecordRemoveByHandle(IMG_HANDLE hBridge, IMG_HANDLE hhRecord)
{
PVRSRV_ERROR eError;
SYNC_RECORD_HANDLE pshRecordInt;
PVR_UNREFERENCED_PARAMETER(hBridge);
pshRecordInt = (SYNC_RECORD_HANDLE) hhRecord;
eError = PVRSRVSyncRecordRemoveByHandleKM(pshRecordInt);
return eError;
}
IMG_INTERNAL PVRSRV_ERROR BridgeSyncRecordAdd(IMG_HANDLE hBridge,
IMG_HANDLE * phhRecord,
IMG_HANDLE hhServerSyncPrimBlock,
IMG_UINT32 ui32ui32FwBlockAddr,
IMG_UINT32 ui32ui32SyncOffset,
IMG_BOOL bbServerSync,
IMG_UINT32 ui32ClassNameSize,
const IMG_CHAR * puiClassName)
{
PVRSRV_ERROR eError;
SYNC_RECORD_HANDLE pshRecordInt = NULL;
SYNC_PRIMITIVE_BLOCK *pshServerSyncPrimBlockInt;
pshServerSyncPrimBlockInt = (SYNC_PRIMITIVE_BLOCK *) hhServerSyncPrimBlock;
eError =
PVRSRVSyncRecordAddKM(NULL, (PVRSRV_DEVICE_NODE *) ((void *)hBridge),
&pshRecordInt,
pshServerSyncPrimBlockInt,
ui32ui32FwBlockAddr,
ui32ui32SyncOffset,
bbServerSync, ui32ClassNameSize, puiClassName);
*phhRecord = pshRecordInt;
return eError;
}

View File

@@ -0,0 +1,126 @@
/*******************************************************************************
@File
@Title Common bridge header for cache
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for cache
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_CACHE_BRIDGE_H
#define COMMON_CACHE_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "cache_ops.h"
#define PVRSRV_BRIDGE_CACHE_CMD_FIRST 0
#define PVRSRV_BRIDGE_CACHE_CACHEOPQUEUE PVRSRV_BRIDGE_CACHE_CMD_FIRST+0
#define PVRSRV_BRIDGE_CACHE_CACHEOPEXEC PVRSRV_BRIDGE_CACHE_CMD_FIRST+1
#define PVRSRV_BRIDGE_CACHE_CACHEOPLOG PVRSRV_BRIDGE_CACHE_CMD_FIRST+2
#define PVRSRV_BRIDGE_CACHE_CMD_LAST (PVRSRV_BRIDGE_CACHE_CMD_FIRST+2)
/*******************************************
CacheOpQueue
*******************************************/
/* Bridge in structure for CacheOpQueue */
typedef struct PVRSRV_BRIDGE_IN_CACHEOPQUEUE_TAG
{
PVRSRV_CACHE_OP *piuCacheOp;
IMG_UINT64 *pui64Address;
IMG_DEVMEM_OFFSET_T *puiOffset;
IMG_DEVMEM_SIZE_T *puiSize;
IMG_HANDLE *phPMR;
IMG_UINT32 ui32NumCacheOps;
IMG_UINT32 ui32OpTimeline;
} __packed PVRSRV_BRIDGE_IN_CACHEOPQUEUE;
/* Bridge out structure for CacheOpQueue */
typedef struct PVRSRV_BRIDGE_OUT_CACHEOPQUEUE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_CACHEOPQUEUE;
/*******************************************
CacheOpExec
*******************************************/
/* Bridge in structure for CacheOpExec */
typedef struct PVRSRV_BRIDGE_IN_CACHEOPEXEC_TAG
{
IMG_UINT64 ui64Address;
IMG_DEVMEM_OFFSET_T uiOffset;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMR;
PVRSRV_CACHE_OP iuCacheOp;
} __packed PVRSRV_BRIDGE_IN_CACHEOPEXEC;
/* Bridge out structure for CacheOpExec */
typedef struct PVRSRV_BRIDGE_OUT_CACHEOPEXEC_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_CACHEOPEXEC;
/*******************************************
CacheOpLog
*******************************************/
/* Bridge in structure for CacheOpLog */
typedef struct PVRSRV_BRIDGE_IN_CACHEOPLOG_TAG
{
IMG_INT64 i64EndTime;
IMG_INT64 i64StartTime;
IMG_UINT64 ui64Address;
IMG_DEVMEM_OFFSET_T uiOffset;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMR;
PVRSRV_CACHE_OP iuCacheOp;
} __packed PVRSRV_BRIDGE_IN_CACHEOPLOG;
/* Bridge out structure for CacheOpLog */
typedef struct PVRSRV_BRIDGE_OUT_CACHEOPLOG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_CACHEOPLOG;
#endif /* COMMON_CACHE_BRIDGE_H */

View File

@@ -0,0 +1,114 @@
/*******************************************************************************
@File
@Title Common bridge header for cmm
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for cmm
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_CMM_BRIDGE_H
#define COMMON_CMM_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "devicemem_typedefs.h"
#define PVRSRV_BRIDGE_CMM_CMD_FIRST 0
#define PVRSRV_BRIDGE_CMM_DEVMEMINTEXPORTCTX PVRSRV_BRIDGE_CMM_CMD_FIRST+0
#define PVRSRV_BRIDGE_CMM_DEVMEMINTUNEXPORTCTX PVRSRV_BRIDGE_CMM_CMD_FIRST+1
#define PVRSRV_BRIDGE_CMM_DEVMEMINTACQUIREREMOTECTX PVRSRV_BRIDGE_CMM_CMD_FIRST+2
#define PVRSRV_BRIDGE_CMM_CMD_LAST (PVRSRV_BRIDGE_CMM_CMD_FIRST+2)
/*******************************************
DevmemIntExportCtx
*******************************************/
/* Bridge in structure for DevmemIntExportCtx */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTEXPORTCTX_TAG
{
IMG_HANDLE hContext;
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTEXPORTCTX;
/* Bridge out structure for DevmemIntExportCtx */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTEXPORTCTX_TAG
{
IMG_HANDLE hContextExport;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTEXPORTCTX;
/*******************************************
DevmemIntUnexportCtx
*******************************************/
/* Bridge in structure for DevmemIntUnexportCtx */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTUNEXPORTCTX_TAG
{
IMG_HANDLE hContextExport;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTUNEXPORTCTX;
/* Bridge out structure for DevmemIntUnexportCtx */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTUNEXPORTCTX_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTUNEXPORTCTX;
/*******************************************
DevmemIntAcquireRemoteCtx
*******************************************/
/* Bridge in structure for DevmemIntAcquireRemoteCtx */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTACQUIREREMOTECTX_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTACQUIREREMOTECTX;
/* Bridge out structure for DevmemIntAcquireRemoteCtx */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTACQUIREREMOTECTX_TAG
{
IMG_HANDLE hContext;
IMG_HANDLE hPrivData;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTACQUIREREMOTECTX;
#endif /* COMMON_CMM_BRIDGE_H */

View File

@@ -0,0 +1,185 @@
/*******************************************************************************
@File
@Title Common bridge header for devicememhistory
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for devicememhistory
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_DEVICEMEMHISTORY_BRIDGE_H
#define COMMON_DEVICEMEMHISTORY_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "img_types.h"
#include "img_defs.h"
#include "devicemem_typedefs.h"
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST 0
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DEVICEMEMHISTORYMAP PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST+0
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DEVICEMEMHISTORYUNMAP PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST+1
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DEVICEMEMHISTORYMAPVRANGE PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST+2
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DEVICEMEMHISTORYUNMAPVRANGE PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST+3
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_DEVICEMEMHISTORYSPARSECHANGE PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST+4
#define PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_LAST (PVRSRV_BRIDGE_DEVICEMEMHISTORY_CMD_FIRST+4)
/*******************************************
DevicememHistoryMap
*******************************************/
/* Bridge in structure for DevicememHistoryMap */
typedef struct PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYMAP_TAG
{
IMG_DEV_VIRTADDR sDevVAddr;
IMG_DEVMEM_SIZE_T uiOffset;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMR;
const IMG_CHAR *puiText;
IMG_UINT32 ui32AllocationIndex;
IMG_UINT32 ui32Log2PageSize;
} __packed PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYMAP;
/* Bridge out structure for DevicememHistoryMap */
typedef struct PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYMAP_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32AllocationIndexOut;
} __packed PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYMAP;
/*******************************************
DevicememHistoryUnmap
*******************************************/
/* Bridge in structure for DevicememHistoryUnmap */
typedef struct PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYUNMAP_TAG
{
IMG_DEV_VIRTADDR sDevVAddr;
IMG_DEVMEM_SIZE_T uiOffset;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMR;
const IMG_CHAR *puiText;
IMG_UINT32 ui32AllocationIndex;
IMG_UINT32 ui32Log2PageSize;
} __packed PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYUNMAP;
/* Bridge out structure for DevicememHistoryUnmap */
typedef struct PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYUNMAP_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32AllocationIndexOut;
} __packed PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYUNMAP;
/*******************************************
DevicememHistoryMapVRange
*******************************************/
/* Bridge in structure for DevicememHistoryMapVRange */
typedef struct PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYMAPVRANGE_TAG
{
IMG_DEV_VIRTADDR sBaseDevVAddr;
IMG_DEVMEM_SIZE_T uiAllocSize;
const IMG_CHAR *puiText;
IMG_UINT32 ui32AllocationIndex;
IMG_UINT32 ui32Log2PageSize;
IMG_UINT32 ui32NumPages;
IMG_UINT32 ui32ui32StartPage;
} __packed PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYMAPVRANGE;
/* Bridge out structure for DevicememHistoryMapVRange */
typedef struct PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYMAPVRANGE_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32AllocationIndexOut;
} __packed PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYMAPVRANGE;
/*******************************************
DevicememHistoryUnmapVRange
*******************************************/
/* Bridge in structure for DevicememHistoryUnmapVRange */
typedef struct PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYUNMAPVRANGE_TAG
{
IMG_DEV_VIRTADDR sBaseDevVAddr;
IMG_DEVMEM_SIZE_T uiAllocSize;
const IMG_CHAR *puiText;
IMG_UINT32 ui32AllocationIndex;
IMG_UINT32 ui32Log2PageSize;
IMG_UINT32 ui32NumPages;
IMG_UINT32 ui32ui32StartPage;
} __packed PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYUNMAPVRANGE;
/* Bridge out structure for DevicememHistoryUnmapVRange */
typedef struct PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYUNMAPVRANGE_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32AllocationIndexOut;
} __packed PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYUNMAPVRANGE;
/*******************************************
DevicememHistorySparseChange
*******************************************/
/* Bridge in structure for DevicememHistorySparseChange */
typedef struct PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYSPARSECHANGE_TAG
{
IMG_DEV_VIRTADDR sDevVAddr;
IMG_DEVMEM_SIZE_T uiOffset;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMR;
IMG_UINT32 *pui32AllocPageIndices;
IMG_UINT32 *pui32FreePageIndices;
const IMG_CHAR *puiText;
IMG_UINT32 ui32AllocPageCount;
IMG_UINT32 ui32AllocationIndex;
IMG_UINT32 ui32FreePageCount;
IMG_UINT32 ui32Log2PageSize;
} __packed PVRSRV_BRIDGE_IN_DEVICEMEMHISTORYSPARSECHANGE;
/* Bridge out structure for DevicememHistorySparseChange */
typedef struct PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYSPARSECHANGE_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32AllocationIndexOut;
} __packed PVRSRV_BRIDGE_OUT_DEVICEMEMHISTORYSPARSECHANGE;
#endif /* COMMON_DEVICEMEMHISTORY_BRIDGE_H */

View File

@@ -0,0 +1,153 @@
/*******************************************************************************
@File
@Title Common bridge header for di
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for di
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_DI_BRIDGE_H
#define COMMON_DI_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "pvrsrv_tlcommon.h"
#include "pvr_dicommon.h"
#define PVRSRV_BRIDGE_DI_CMD_FIRST 0
#define PVRSRV_BRIDGE_DI_DICREATECONTEXT PVRSRV_BRIDGE_DI_CMD_FIRST+0
#define PVRSRV_BRIDGE_DI_DIDESTROYCONTEXT PVRSRV_BRIDGE_DI_CMD_FIRST+1
#define PVRSRV_BRIDGE_DI_DIREADENTRY PVRSRV_BRIDGE_DI_CMD_FIRST+2
#define PVRSRV_BRIDGE_DI_DIWRITEENTRY PVRSRV_BRIDGE_DI_CMD_FIRST+3
#define PVRSRV_BRIDGE_DI_DILISTALLENTRIES PVRSRV_BRIDGE_DI_CMD_FIRST+4
#define PVRSRV_BRIDGE_DI_CMD_LAST (PVRSRV_BRIDGE_DI_CMD_FIRST+4)
/*******************************************
DICreateContext
*******************************************/
/* Bridge in structure for DICreateContext */
typedef struct PVRSRV_BRIDGE_IN_DICREATECONTEXT_TAG
{
IMG_CHAR *puiStreamName;
} __packed PVRSRV_BRIDGE_IN_DICREATECONTEXT;
/* Bridge out structure for DICreateContext */
typedef struct PVRSRV_BRIDGE_OUT_DICREATECONTEXT_TAG
{
IMG_HANDLE hContext;
IMG_CHAR *puiStreamName;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DICREATECONTEXT;
/*******************************************
DIDestroyContext
*******************************************/
/* Bridge in structure for DIDestroyContext */
typedef struct PVRSRV_BRIDGE_IN_DIDESTROYCONTEXT_TAG
{
IMG_HANDLE hContext;
} __packed PVRSRV_BRIDGE_IN_DIDESTROYCONTEXT;
/* Bridge out structure for DIDestroyContext */
typedef struct PVRSRV_BRIDGE_OUT_DIDESTROYCONTEXT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DIDESTROYCONTEXT;
/*******************************************
DIReadEntry
*******************************************/
/* Bridge in structure for DIReadEntry */
typedef struct PVRSRV_BRIDGE_IN_DIREADENTRY_TAG
{
IMG_UINT64 ui64Offset;
IMG_UINT64 ui64Size;
IMG_HANDLE hContext;
const IMG_CHAR *puiEntryPath;
} __packed PVRSRV_BRIDGE_IN_DIREADENTRY;
/* Bridge out structure for DIReadEntry */
typedef struct PVRSRV_BRIDGE_OUT_DIREADENTRY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DIREADENTRY;
/*******************************************
DIWriteEntry
*******************************************/
/* Bridge in structure for DIWriteEntry */
typedef struct PVRSRV_BRIDGE_IN_DIWRITEENTRY_TAG
{
IMG_HANDLE hContext;
const IMG_CHAR *puiEntryPath;
const IMG_CHAR *puiValue;
IMG_UINT32 ui32ValueSize;
} __packed PVRSRV_BRIDGE_IN_DIWRITEENTRY;
/* Bridge out structure for DIWriteEntry */
typedef struct PVRSRV_BRIDGE_OUT_DIWRITEENTRY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DIWRITEENTRY;
/*******************************************
DIListAllEntries
*******************************************/
/* Bridge in structure for DIListAllEntries */
typedef struct PVRSRV_BRIDGE_IN_DILISTALLENTRIES_TAG
{
IMG_HANDLE hContext;
} __packed PVRSRV_BRIDGE_IN_DILISTALLENTRIES;
/* Bridge out structure for DIListAllEntries */
typedef struct PVRSRV_BRIDGE_OUT_DILISTALLENTRIES_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DILISTALLENTRIES;
#endif /* COMMON_DI_BRIDGE_H */

View File

@@ -0,0 +1,150 @@
/*******************************************************************************
@File
@Title Common bridge header for dmabuf
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for dmabuf
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_DMABUF_BRIDGE_H
#define COMMON_DMABUF_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "pvrsrv_memallocflags.h"
#define PVRSRV_BRIDGE_DMABUF_CMD_FIRST 0
#define PVRSRV_BRIDGE_DMABUF_PHYSMEMIMPORTDMABUF PVRSRV_BRIDGE_DMABUF_CMD_FIRST+0
#define PVRSRV_BRIDGE_DMABUF_PHYSMEMIMPORTDMABUFLOCKED PVRSRV_BRIDGE_DMABUF_CMD_FIRST+1
#define PVRSRV_BRIDGE_DMABUF_PHYSMEMEXPORTDMABUF PVRSRV_BRIDGE_DMABUF_CMD_FIRST+2
#define PVRSRV_BRIDGE_DMABUF_PHYSMEMIMPORTSPARSEDMABUF PVRSRV_BRIDGE_DMABUF_CMD_FIRST+3
#define PVRSRV_BRIDGE_DMABUF_CMD_LAST (PVRSRV_BRIDGE_DMABUF_CMD_FIRST+3)
/*******************************************
PhysmemImportDmaBuf
*******************************************/
/* Bridge in structure for PhysmemImportDmaBuf */
typedef struct PVRSRV_BRIDGE_IN_PHYSMEMIMPORTDMABUF_TAG
{
const IMG_CHAR *puiName;
IMG_INT ifd;
IMG_UINT32 ui32NameSize;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_PHYSMEMIMPORTDMABUF;
/* Bridge out structure for PhysmemImportDmaBuf */
typedef struct PVRSRV_BRIDGE_OUT_PHYSMEMIMPORTDMABUF_TAG
{
IMG_DEVMEM_ALIGN_T uiAlign;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMRPtr;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PHYSMEMIMPORTDMABUF;
/*******************************************
PhysmemImportDmaBufLocked
*******************************************/
/* Bridge in structure for PhysmemImportDmaBufLocked */
typedef struct PVRSRV_BRIDGE_IN_PHYSMEMIMPORTDMABUFLOCKED_TAG
{
const IMG_CHAR *puiName;
IMG_INT ifd;
IMG_UINT32 ui32NameSize;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_PHYSMEMIMPORTDMABUFLOCKED;
/* Bridge out structure for PhysmemImportDmaBufLocked */
typedef struct PVRSRV_BRIDGE_OUT_PHYSMEMIMPORTDMABUFLOCKED_TAG
{
IMG_DEVMEM_ALIGN_T uiAlign;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMRPtr;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PHYSMEMIMPORTDMABUFLOCKED;
/*******************************************
PhysmemExportDmaBuf
*******************************************/
/* Bridge in structure for PhysmemExportDmaBuf */
typedef struct PVRSRV_BRIDGE_IN_PHYSMEMEXPORTDMABUF_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_PHYSMEMEXPORTDMABUF;
/* Bridge out structure for PhysmemExportDmaBuf */
typedef struct PVRSRV_BRIDGE_OUT_PHYSMEMEXPORTDMABUF_TAG
{
PVRSRV_ERROR eError;
IMG_INT iFd;
} __packed PVRSRV_BRIDGE_OUT_PHYSMEMEXPORTDMABUF;
/*******************************************
PhysmemImportSparseDmaBuf
*******************************************/
/* Bridge in structure for PhysmemImportSparseDmaBuf */
typedef struct PVRSRV_BRIDGE_IN_PHYSMEMIMPORTSPARSEDMABUF_TAG
{
IMG_DEVMEM_SIZE_T uiChunkSize;
IMG_UINT32 *pui32MappingTable;
const IMG_CHAR *puiName;
IMG_INT ifd;
IMG_UINT32 ui32NameSize;
IMG_UINT32 ui32NumPhysChunks;
IMG_UINT32 ui32NumVirtChunks;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_PHYSMEMIMPORTSPARSEDMABUF;
/* Bridge out structure for PhysmemImportSparseDmaBuf */
typedef struct PVRSRV_BRIDGE_OUT_PHYSMEMIMPORTSPARSEDMABUF_TAG
{
IMG_DEVMEM_ALIGN_T uiAlign;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMRPtr;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PHYSMEMIMPORTSPARSEDMABUF;
#endif /* COMMON_DMABUF_BRIDGE_H */

View File

@@ -0,0 +1,104 @@
/*******************************************************************************
@File
@Title Common bridge header for htbuffer
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for htbuffer
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_HTBUFFER_BRIDGE_H
#define COMMON_HTBUFFER_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "devicemem_typedefs.h"
#include "htbuffer_types.h"
#define PVRSRV_BRIDGE_HTBUFFER_CMD_FIRST 0
#define PVRSRV_BRIDGE_HTBUFFER_HTBCONTROL PVRSRV_BRIDGE_HTBUFFER_CMD_FIRST+0
#define PVRSRV_BRIDGE_HTBUFFER_HTBLOG PVRSRV_BRIDGE_HTBUFFER_CMD_FIRST+1
#define PVRSRV_BRIDGE_HTBUFFER_CMD_LAST (PVRSRV_BRIDGE_HTBUFFER_CMD_FIRST+1)
/*******************************************
HTBControl
*******************************************/
/* Bridge in structure for HTBControl */
typedef struct PVRSRV_BRIDGE_IN_HTBCONTROL_TAG
{
IMG_UINT32 *pui32GroupEnable;
IMG_UINT32 ui32EnablePID;
IMG_UINT32 ui32LogLevel;
IMG_UINT32 ui32LogMode;
IMG_UINT32 ui32NumGroups;
IMG_UINT32 ui32OpMode;
} __packed PVRSRV_BRIDGE_IN_HTBCONTROL;
/* Bridge out structure for HTBControl */
typedef struct PVRSRV_BRIDGE_OUT_HTBCONTROL_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_HTBCONTROL;
/*******************************************
HTBLog
*******************************************/
/* Bridge in structure for HTBLog */
typedef struct PVRSRV_BRIDGE_IN_HTBLOG_TAG
{
IMG_UINT64 ui64TimeStamp;
IMG_UINT32 *pui32Args;
IMG_UINT32 ui32NumArgs;
IMG_UINT32 ui32PID;
IMG_UINT32 ui32SF;
IMG_UINT32 ui32TID;
} __packed PVRSRV_BRIDGE_IN_HTBLOG;
/* Bridge out structure for HTBLog */
typedef struct PVRSRV_BRIDGE_OUT_HTBLOG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_HTBLOG;
#endif /* COMMON_HTBUFFER_BRIDGE_H */

View File

@@ -0,0 +1,879 @@
/*******************************************************************************
@File
@Title Common bridge header for mm
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for mm
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_MM_BRIDGE_H
#define COMMON_MM_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "pvrsrv_memallocflags.h"
#include "pvrsrv_memalloc_physheap.h"
#include "devicemem_typedefs.h"
#define PVRSRV_BRIDGE_MM_CMD_FIRST 0
#define PVRSRV_BRIDGE_MM_PMREXPORTPMR PVRSRV_BRIDGE_MM_CMD_FIRST+0
#define PVRSRV_BRIDGE_MM_PMRUNEXPORTPMR PVRSRV_BRIDGE_MM_CMD_FIRST+1
#define PVRSRV_BRIDGE_MM_PMRGETUID PVRSRV_BRIDGE_MM_CMD_FIRST+2
#define PVRSRV_BRIDGE_MM_PMRMAKELOCALIMPORTHANDLE PVRSRV_BRIDGE_MM_CMD_FIRST+3
#define PVRSRV_BRIDGE_MM_PMRUNMAKELOCALIMPORTHANDLE PVRSRV_BRIDGE_MM_CMD_FIRST+4
#define PVRSRV_BRIDGE_MM_PMRIMPORTPMR PVRSRV_BRIDGE_MM_CMD_FIRST+5
#define PVRSRV_BRIDGE_MM_PMRLOCALIMPORTPMR PVRSRV_BRIDGE_MM_CMD_FIRST+6
#define PVRSRV_BRIDGE_MM_PMRUNREFPMR PVRSRV_BRIDGE_MM_CMD_FIRST+7
#define PVRSRV_BRIDGE_MM_PMRUNREFUNLOCKPMR PVRSRV_BRIDGE_MM_CMD_FIRST+8
#define PVRSRV_BRIDGE_MM_PHYSMEMNEWRAMBACKEDPMR PVRSRV_BRIDGE_MM_CMD_FIRST+9
#define PVRSRV_BRIDGE_MM_PHYSMEMNEWRAMBACKEDLOCKEDPMR PVRSRV_BRIDGE_MM_CMD_FIRST+10
#define PVRSRV_BRIDGE_MM_DEVMEMINTPIN PVRSRV_BRIDGE_MM_CMD_FIRST+11
#define PVRSRV_BRIDGE_MM_DEVMEMINTUNPIN PVRSRV_BRIDGE_MM_CMD_FIRST+12
#define PVRSRV_BRIDGE_MM_DEVMEMINTPINVALIDATE PVRSRV_BRIDGE_MM_CMD_FIRST+13
#define PVRSRV_BRIDGE_MM_DEVMEMINTUNPININVALIDATE PVRSRV_BRIDGE_MM_CMD_FIRST+14
#define PVRSRV_BRIDGE_MM_DEVMEMINTCTXCREATE PVRSRV_BRIDGE_MM_CMD_FIRST+15
#define PVRSRV_BRIDGE_MM_DEVMEMINTCTXDESTROY PVRSRV_BRIDGE_MM_CMD_FIRST+16
#define PVRSRV_BRIDGE_MM_DEVMEMINTHEAPCREATE PVRSRV_BRIDGE_MM_CMD_FIRST+17
#define PVRSRV_BRIDGE_MM_DEVMEMINTHEAPDESTROY PVRSRV_BRIDGE_MM_CMD_FIRST+18
#define PVRSRV_BRIDGE_MM_DEVMEMINTMAPPMR PVRSRV_BRIDGE_MM_CMD_FIRST+19
#define PVRSRV_BRIDGE_MM_DEVMEMINTUNMAPPMR PVRSRV_BRIDGE_MM_CMD_FIRST+20
#define PVRSRV_BRIDGE_MM_DEVMEMINTRESERVERANGE PVRSRV_BRIDGE_MM_CMD_FIRST+21
#define PVRSRV_BRIDGE_MM_DEVMEMINTUNRESERVERANGE PVRSRV_BRIDGE_MM_CMD_FIRST+22
#define PVRSRV_BRIDGE_MM_CHANGESPARSEMEM PVRSRV_BRIDGE_MM_CMD_FIRST+23
#define PVRSRV_BRIDGE_MM_DEVMEMINTMAPPAGES PVRSRV_BRIDGE_MM_CMD_FIRST+24
#define PVRSRV_BRIDGE_MM_DEVMEMINTUNMAPPAGES PVRSRV_BRIDGE_MM_CMD_FIRST+25
#define PVRSRV_BRIDGE_MM_DEVMEMISVDEVADDRVALID PVRSRV_BRIDGE_MM_CMD_FIRST+26
#define PVRSRV_BRIDGE_MM_DEVMEMFLUSHDEVSLCRANGE PVRSRV_BRIDGE_MM_CMD_FIRST+27
#define PVRSRV_BRIDGE_MM_DEVMEMINVALIDATEFBSCTABLE PVRSRV_BRIDGE_MM_CMD_FIRST+28
#define PVRSRV_BRIDGE_MM_HEAPCFGHEAPCONFIGCOUNT PVRSRV_BRIDGE_MM_CMD_FIRST+29
#define PVRSRV_BRIDGE_MM_HEAPCFGHEAPCOUNT PVRSRV_BRIDGE_MM_CMD_FIRST+30
#define PVRSRV_BRIDGE_MM_HEAPCFGHEAPCONFIGNAME PVRSRV_BRIDGE_MM_CMD_FIRST+31
#define PVRSRV_BRIDGE_MM_HEAPCFGHEAPDETAILS PVRSRV_BRIDGE_MM_CMD_FIRST+32
#define PVRSRV_BRIDGE_MM_DEVMEMINTREGISTERPFNOTIFYKM PVRSRV_BRIDGE_MM_CMD_FIRST+33
#define PVRSRV_BRIDGE_MM_GETMAXPHYSHEAPCOUNT PVRSRV_BRIDGE_MM_CMD_FIRST+34
#define PVRSRV_BRIDGE_MM_PHYSHEAPGETMEMINFO PVRSRV_BRIDGE_MM_CMD_FIRST+35
#define PVRSRV_BRIDGE_MM_GETDEFAULTPHYSICALHEAP PVRSRV_BRIDGE_MM_CMD_FIRST+36
#define PVRSRV_BRIDGE_MM_GETHEAPPHYSMEMUSAGE PVRSRV_BRIDGE_MM_CMD_FIRST+37
#define PVRSRV_BRIDGE_MM_DEVMEMGETFAULTADDRESS PVRSRV_BRIDGE_MM_CMD_FIRST+38
#define PVRSRV_BRIDGE_MM_PVRSRVUPDATEOOMSTATS PVRSRV_BRIDGE_MM_CMD_FIRST+39
#define PVRSRV_BRIDGE_MM_PHYSHEAPGETMEMINFOPKD PVRSRV_BRIDGE_MM_CMD_FIRST+40
#define PVRSRV_BRIDGE_MM_GETHEAPPHYSMEMUSAGEPKD PVRSRV_BRIDGE_MM_CMD_FIRST+41
#define PVRSRV_BRIDGE_MM_CMD_LAST (PVRSRV_BRIDGE_MM_CMD_FIRST+41)
/*******************************************
PMRExportPMR
*******************************************/
/* Bridge in structure for PMRExportPMR */
typedef struct PVRSRV_BRIDGE_IN_PMREXPORTPMR_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_PMREXPORTPMR;
/* Bridge out structure for PMRExportPMR */
typedef struct PVRSRV_BRIDGE_OUT_PMREXPORTPMR_TAG
{
IMG_UINT64 ui64Password;
IMG_UINT64 ui64Size;
IMG_HANDLE hPMRExport;
PVRSRV_ERROR eError;
IMG_UINT32 ui32Log2Contig;
} __packed PVRSRV_BRIDGE_OUT_PMREXPORTPMR;
/*******************************************
PMRUnexportPMR
*******************************************/
/* Bridge in structure for PMRUnexportPMR */
typedef struct PVRSRV_BRIDGE_IN_PMRUNEXPORTPMR_TAG
{
IMG_HANDLE hPMRExport;
} __packed PVRSRV_BRIDGE_IN_PMRUNEXPORTPMR;
/* Bridge out structure for PMRUnexportPMR */
typedef struct PVRSRV_BRIDGE_OUT_PMRUNEXPORTPMR_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRUNEXPORTPMR;
/*******************************************
PMRGetUID
*******************************************/
/* Bridge in structure for PMRGetUID */
typedef struct PVRSRV_BRIDGE_IN_PMRGETUID_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_PMRGETUID;
/* Bridge out structure for PMRGetUID */
typedef struct PVRSRV_BRIDGE_OUT_PMRGETUID_TAG
{
IMG_UINT64 ui64UID;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRGETUID;
/*******************************************
PMRMakeLocalImportHandle
*******************************************/
/* Bridge in structure for PMRMakeLocalImportHandle */
typedef struct PVRSRV_BRIDGE_IN_PMRMAKELOCALIMPORTHANDLE_TAG
{
IMG_HANDLE hBuffer;
} __packed PVRSRV_BRIDGE_IN_PMRMAKELOCALIMPORTHANDLE;
/* Bridge out structure for PMRMakeLocalImportHandle */
typedef struct PVRSRV_BRIDGE_OUT_PMRMAKELOCALIMPORTHANDLE_TAG
{
IMG_HANDLE hExtMem;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRMAKELOCALIMPORTHANDLE;
/*******************************************
PMRUnmakeLocalImportHandle
*******************************************/
/* Bridge in structure for PMRUnmakeLocalImportHandle */
typedef struct PVRSRV_BRIDGE_IN_PMRUNMAKELOCALIMPORTHANDLE_TAG
{
IMG_HANDLE hExtMem;
} __packed PVRSRV_BRIDGE_IN_PMRUNMAKELOCALIMPORTHANDLE;
/* Bridge out structure for PMRUnmakeLocalImportHandle */
typedef struct PVRSRV_BRIDGE_OUT_PMRUNMAKELOCALIMPORTHANDLE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRUNMAKELOCALIMPORTHANDLE;
/*******************************************
PMRImportPMR
*******************************************/
/* Bridge in structure for PMRImportPMR */
typedef struct PVRSRV_BRIDGE_IN_PMRIMPORTPMR_TAG
{
IMG_UINT64 ui64uiPassword;
IMG_UINT64 ui64uiSize;
IMG_HANDLE hPMRExport;
IMG_UINT32 ui32uiLog2Contig;
} __packed PVRSRV_BRIDGE_IN_PMRIMPORTPMR;
/* Bridge out structure for PMRImportPMR */
typedef struct PVRSRV_BRIDGE_OUT_PMRIMPORTPMR_TAG
{
IMG_HANDLE hPMR;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRIMPORTPMR;
/*******************************************
PMRLocalImportPMR
*******************************************/
/* Bridge in structure for PMRLocalImportPMR */
typedef struct PVRSRV_BRIDGE_IN_PMRLOCALIMPORTPMR_TAG
{
IMG_HANDLE hExtHandle;
} __packed PVRSRV_BRIDGE_IN_PMRLOCALIMPORTPMR;
/* Bridge out structure for PMRLocalImportPMR */
typedef struct PVRSRV_BRIDGE_OUT_PMRLOCALIMPORTPMR_TAG
{
IMG_DEVMEM_ALIGN_T uiAlign;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hPMR;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRLOCALIMPORTPMR;
/*******************************************
PMRUnrefPMR
*******************************************/
/* Bridge in structure for PMRUnrefPMR */
typedef struct PVRSRV_BRIDGE_IN_PMRUNREFPMR_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_PMRUNREFPMR;
/* Bridge out structure for PMRUnrefPMR */
typedef struct PVRSRV_BRIDGE_OUT_PMRUNREFPMR_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRUNREFPMR;
/*******************************************
PMRUnrefUnlockPMR
*******************************************/
/* Bridge in structure for PMRUnrefUnlockPMR */
typedef struct PVRSRV_BRIDGE_IN_PMRUNREFUNLOCKPMR_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_PMRUNREFUNLOCKPMR;
/* Bridge out structure for PMRUnrefUnlockPMR */
typedef struct PVRSRV_BRIDGE_OUT_PMRUNREFUNLOCKPMR_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PMRUNREFUNLOCKPMR;
/*******************************************
PhysmemNewRamBackedPMR
*******************************************/
/* Bridge in structure for PhysmemNewRamBackedPMR */
typedef struct PVRSRV_BRIDGE_IN_PHYSMEMNEWRAMBACKEDPMR_TAG
{
IMG_DEVMEM_SIZE_T uiChunkSize;
IMG_DEVMEM_SIZE_T uiSize;
IMG_UINT32 *pui32MappingTable;
const IMG_CHAR *puiAnnotation;
IMG_UINT32 ui32AnnotationLength;
IMG_UINT32 ui32Log2PageSize;
IMG_UINT32 ui32NumPhysChunks;
IMG_UINT32 ui32NumVirtChunks;
IMG_UINT32 ui32PDumpFlags;
IMG_PID ui32PID;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_PHYSMEMNEWRAMBACKEDPMR;
/* Bridge out structure for PhysmemNewRamBackedPMR */
typedef struct PVRSRV_BRIDGE_OUT_PHYSMEMNEWRAMBACKEDPMR_TAG
{
IMG_HANDLE hPMRPtr;
PVRSRV_ERROR eError;
PVRSRV_MEMALLOCFLAGS_T uiOutFlags;
} __packed PVRSRV_BRIDGE_OUT_PHYSMEMNEWRAMBACKEDPMR;
/*******************************************
PhysmemNewRamBackedLockedPMR
*******************************************/
/* Bridge in structure for PhysmemNewRamBackedLockedPMR */
typedef struct PVRSRV_BRIDGE_IN_PHYSMEMNEWRAMBACKEDLOCKEDPMR_TAG
{
IMG_DEVMEM_SIZE_T uiChunkSize;
IMG_DEVMEM_SIZE_T uiSize;
IMG_UINT32 *pui32MappingTable;
const IMG_CHAR *puiAnnotation;
IMG_UINT32 ui32AnnotationLength;
IMG_UINT32 ui32Log2PageSize;
IMG_UINT32 ui32NumPhysChunks;
IMG_UINT32 ui32NumVirtChunks;
IMG_UINT32 ui32PDumpFlags;
IMG_PID ui32PID;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_PHYSMEMNEWRAMBACKEDLOCKEDPMR;
/* Bridge out structure for PhysmemNewRamBackedLockedPMR */
typedef struct PVRSRV_BRIDGE_OUT_PHYSMEMNEWRAMBACKEDLOCKEDPMR_TAG
{
IMG_HANDLE hPMRPtr;
PVRSRV_ERROR eError;
PVRSRV_MEMALLOCFLAGS_T uiOutFlags;
} __packed PVRSRV_BRIDGE_OUT_PHYSMEMNEWRAMBACKEDLOCKEDPMR;
/*******************************************
DevmemIntPin
*******************************************/
/* Bridge in structure for DevmemIntPin */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTPIN_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTPIN;
/* Bridge out structure for DevmemIntPin */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTPIN_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTPIN;
/*******************************************
DevmemIntUnpin
*******************************************/
/* Bridge in structure for DevmemIntUnpin */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTUNPIN_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTUNPIN;
/* Bridge out structure for DevmemIntUnpin */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTUNPIN_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTUNPIN;
/*******************************************
DevmemIntPinValidate
*******************************************/
/* Bridge in structure for DevmemIntPinValidate */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTPINVALIDATE_TAG
{
IMG_HANDLE hMapping;
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTPINVALIDATE;
/* Bridge out structure for DevmemIntPinValidate */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTPINVALIDATE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTPINVALIDATE;
/*******************************************
DevmemIntUnpinInvalidate
*******************************************/
/* Bridge in structure for DevmemIntUnpinInvalidate */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTUNPININVALIDATE_TAG
{
IMG_HANDLE hMapping;
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTUNPININVALIDATE;
/* Bridge out structure for DevmemIntUnpinInvalidate */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTUNPININVALIDATE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTUNPININVALIDATE;
/*******************************************
DevmemIntCtxCreate
*******************************************/
/* Bridge in structure for DevmemIntCtxCreate */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTCTXCREATE_TAG
{
IMG_BOOL bbKernelMemoryCtx;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTCTXCREATE;
/* Bridge out structure for DevmemIntCtxCreate */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTCTXCREATE_TAG
{
IMG_HANDLE hDevMemServerContext;
IMG_HANDLE hPrivData;
PVRSRV_ERROR eError;
IMG_UINT32 ui32CPUCacheLineSize;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTCTXCREATE;
/*******************************************
DevmemIntCtxDestroy
*******************************************/
/* Bridge in structure for DevmemIntCtxDestroy */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTCTXDESTROY_TAG
{
IMG_HANDLE hDevmemServerContext;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTCTXDESTROY;
/* Bridge out structure for DevmemIntCtxDestroy */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTCTXDESTROY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTCTXDESTROY;
/*******************************************
DevmemIntHeapCreate
*******************************************/
/* Bridge in structure for DevmemIntHeapCreate */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTHEAPCREATE_TAG
{
IMG_DEV_VIRTADDR sHeapBaseAddr;
IMG_DEVMEM_SIZE_T uiHeapLength;
IMG_HANDLE hDevmemCtx;
IMG_UINT32 ui32Log2DataPageSize;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTHEAPCREATE;
/* Bridge out structure for DevmemIntHeapCreate */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTHEAPCREATE_TAG
{
IMG_HANDLE hDevmemHeapPtr;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTHEAPCREATE;
/*******************************************
DevmemIntHeapDestroy
*******************************************/
/* Bridge in structure for DevmemIntHeapDestroy */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTHEAPDESTROY_TAG
{
IMG_HANDLE hDevmemHeap;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTHEAPDESTROY;
/* Bridge out structure for DevmemIntHeapDestroy */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTHEAPDESTROY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTHEAPDESTROY;
/*******************************************
DevmemIntMapPMR
*******************************************/
/* Bridge in structure for DevmemIntMapPMR */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTMAPPMR_TAG
{
IMG_HANDLE hDevmemServerHeap;
IMG_HANDLE hPMR;
IMG_HANDLE hReservation;
PVRSRV_MEMALLOCFLAGS_T uiMapFlags;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTMAPPMR;
/* Bridge out structure for DevmemIntMapPMR */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTMAPPMR_TAG
{
IMG_HANDLE hMapping;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTMAPPMR;
/*******************************************
DevmemIntUnmapPMR
*******************************************/
/* Bridge in structure for DevmemIntUnmapPMR */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTUNMAPPMR_TAG
{
IMG_HANDLE hMapping;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTUNMAPPMR;
/* Bridge out structure for DevmemIntUnmapPMR */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTUNMAPPMR_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTUNMAPPMR;
/*******************************************
DevmemIntReserveRange
*******************************************/
/* Bridge in structure for DevmemIntReserveRange */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTRESERVERANGE_TAG
{
IMG_DEV_VIRTADDR sAddress;
IMG_DEVMEM_SIZE_T uiLength;
IMG_HANDLE hDevmemServerHeap;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTRESERVERANGE;
/* Bridge out structure for DevmemIntReserveRange */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTRESERVERANGE_TAG
{
IMG_HANDLE hReservation;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTRESERVERANGE;
/*******************************************
DevmemIntUnreserveRange
*******************************************/
/* Bridge in structure for DevmemIntUnreserveRange */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTUNRESERVERANGE_TAG
{
IMG_HANDLE hReservation;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTUNRESERVERANGE;
/* Bridge out structure for DevmemIntUnreserveRange */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTUNRESERVERANGE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTUNRESERVERANGE;
/*******************************************
ChangeSparseMem
*******************************************/
/* Bridge in structure for ChangeSparseMem */
typedef struct PVRSRV_BRIDGE_IN_CHANGESPARSEMEM_TAG
{
IMG_DEV_VIRTADDR sDevVAddr;
IMG_UINT64 ui64CPUVAddr;
IMG_HANDLE hPMR;
IMG_HANDLE hSrvDevMemHeap;
IMG_UINT32 *pui32AllocPageIndices;
IMG_UINT32 *pui32FreePageIndices;
IMG_UINT32 ui32AllocPageCount;
IMG_UINT32 ui32FreePageCount;
IMG_UINT32 ui32SparseFlags;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_CHANGESPARSEMEM;
/* Bridge out structure for ChangeSparseMem */
typedef struct PVRSRV_BRIDGE_OUT_CHANGESPARSEMEM_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_CHANGESPARSEMEM;
/*******************************************
DevmemIntMapPages
*******************************************/
/* Bridge in structure for DevmemIntMapPages */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTMAPPAGES_TAG
{
IMG_DEV_VIRTADDR sDevVAddr;
IMG_HANDLE hPMR;
IMG_HANDLE hReservation;
IMG_UINT32 ui32PageCount;
IMG_UINT32 ui32PhysicalPgOffset;
PVRSRV_MEMALLOCFLAGS_T uiFlags;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTMAPPAGES;
/* Bridge out structure for DevmemIntMapPages */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTMAPPAGES_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTMAPPAGES;
/*******************************************
DevmemIntUnmapPages
*******************************************/
/* Bridge in structure for DevmemIntUnmapPages */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTUNMAPPAGES_TAG
{
IMG_DEV_VIRTADDR sDevVAddr;
IMG_HANDLE hReservation;
IMG_UINT32 ui32PageCount;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTUNMAPPAGES;
/* Bridge out structure for DevmemIntUnmapPages */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTUNMAPPAGES_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTUNMAPPAGES;
/*******************************************
DevmemIsVDevAddrValid
*******************************************/
/* Bridge in structure for DevmemIsVDevAddrValid */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMISVDEVADDRVALID_TAG
{
IMG_DEV_VIRTADDR sAddress;
IMG_HANDLE hDevmemCtx;
} __packed PVRSRV_BRIDGE_IN_DEVMEMISVDEVADDRVALID;
/* Bridge out structure for DevmemIsVDevAddrValid */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMISVDEVADDRVALID_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMISVDEVADDRVALID;
/*******************************************
DevmemFlushDevSLCRange
*******************************************/
/* Bridge in structure for DevmemFlushDevSLCRange */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMFLUSHDEVSLCRANGE_TAG
{
IMG_DEV_VIRTADDR sAddress;
IMG_DEVMEM_SIZE_T uiSize;
IMG_HANDLE hDevmemCtx;
IMG_BOOL bInvalidate;
} __packed PVRSRV_BRIDGE_IN_DEVMEMFLUSHDEVSLCRANGE;
/* Bridge out structure for DevmemFlushDevSLCRange */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMFLUSHDEVSLCRANGE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMFLUSHDEVSLCRANGE;
/*******************************************
DevmemInvalidateFBSCTable
*******************************************/
/* Bridge in structure for DevmemInvalidateFBSCTable */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINVALIDATEFBSCTABLE_TAG
{
IMG_UINT64 ui64FBSCEntries;
IMG_HANDLE hDevmemCtx;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINVALIDATEFBSCTABLE;
/* Bridge out structure for DevmemInvalidateFBSCTable */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINVALIDATEFBSCTABLE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINVALIDATEFBSCTABLE;
/*******************************************
HeapCfgHeapConfigCount
*******************************************/
/* Bridge in structure for HeapCfgHeapConfigCount */
typedef struct PVRSRV_BRIDGE_IN_HEAPCFGHEAPCONFIGCOUNT_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_HEAPCFGHEAPCONFIGCOUNT;
/* Bridge out structure for HeapCfgHeapConfigCount */
typedef struct PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCONFIGCOUNT_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32NumHeapConfigs;
} __packed PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCONFIGCOUNT;
/*******************************************
HeapCfgHeapCount
*******************************************/
/* Bridge in structure for HeapCfgHeapCount */
typedef struct PVRSRV_BRIDGE_IN_HEAPCFGHEAPCOUNT_TAG
{
IMG_UINT32 ui32HeapConfigIndex;
} __packed PVRSRV_BRIDGE_IN_HEAPCFGHEAPCOUNT;
/* Bridge out structure for HeapCfgHeapCount */
typedef struct PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCOUNT_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32NumHeaps;
} __packed PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCOUNT;
/*******************************************
HeapCfgHeapConfigName
*******************************************/
/* Bridge in structure for HeapCfgHeapConfigName */
typedef struct PVRSRV_BRIDGE_IN_HEAPCFGHEAPCONFIGNAME_TAG
{
IMG_CHAR *puiHeapConfigName;
IMG_UINT32 ui32HeapConfigIndex;
IMG_UINT32 ui32HeapConfigNameBufSz;
} __packed PVRSRV_BRIDGE_IN_HEAPCFGHEAPCONFIGNAME;
/* Bridge out structure for HeapCfgHeapConfigName */
typedef struct PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCONFIGNAME_TAG
{
IMG_CHAR *puiHeapConfigName;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_HEAPCFGHEAPCONFIGNAME;
/*******************************************
HeapCfgHeapDetails
*******************************************/
/* Bridge in structure for HeapCfgHeapDetails */
typedef struct PVRSRV_BRIDGE_IN_HEAPCFGHEAPDETAILS_TAG
{
IMG_CHAR *puiHeapNameOut;
IMG_UINT32 ui32HeapConfigIndex;
IMG_UINT32 ui32HeapIndex;
IMG_UINT32 ui32HeapNameBufSz;
} __packed PVRSRV_BRIDGE_IN_HEAPCFGHEAPDETAILS;
/* Bridge out structure for HeapCfgHeapDetails */
typedef struct PVRSRV_BRIDGE_OUT_HEAPCFGHEAPDETAILS_TAG
{
IMG_DEV_VIRTADDR sDevVAddrBase;
IMG_DEVMEM_SIZE_T uiHeapLength;
IMG_DEVMEM_SIZE_T uiReservedRegionLength;
IMG_CHAR *puiHeapNameOut;
PVRSRV_ERROR eError;
IMG_UINT32 ui32Log2DataPageSizeOut;
IMG_UINT32 ui32Log2ImportAlignmentOut;
} __packed PVRSRV_BRIDGE_OUT_HEAPCFGHEAPDETAILS;
/*******************************************
DevmemIntRegisterPFNotifyKM
*******************************************/
/* Bridge in structure for DevmemIntRegisterPFNotifyKM */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMINTREGISTERPFNOTIFYKM_TAG
{
IMG_HANDLE hDevm;
IMG_BOOL bRegister;
IMG_UINT32 ui32PID;
} __packed PVRSRV_BRIDGE_IN_DEVMEMINTREGISTERPFNOTIFYKM;
/* Bridge out structure for DevmemIntRegisterPFNotifyKM */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMINTREGISTERPFNOTIFYKM_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMINTREGISTERPFNOTIFYKM;
/*******************************************
GetMaxPhysHeapCount
*******************************************/
/* Bridge in structure for GetMaxPhysHeapCount */
typedef struct PVRSRV_BRIDGE_IN_GETMAXPHYSHEAPCOUNT_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_GETMAXPHYSHEAPCOUNT;
/* Bridge out structure for GetMaxPhysHeapCount */
typedef struct PVRSRV_BRIDGE_OUT_GETMAXPHYSHEAPCOUNT_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32PhysHeapCount;
} __packed PVRSRV_BRIDGE_OUT_GETMAXPHYSHEAPCOUNT;
/*******************************************
PhysHeapGetMemInfo
*******************************************/
/* Bridge in structure for PhysHeapGetMemInfo */
typedef struct PVRSRV_BRIDGE_IN_PHYSHEAPGETMEMINFO_TAG
{
PHYS_HEAP_MEM_STATS *pasapPhysHeapMemStats;
PVRSRV_PHYS_HEAP *peaPhysHeapID;
IMG_UINT32 ui32PhysHeapCount;
} __packed PVRSRV_BRIDGE_IN_PHYSHEAPGETMEMINFO;
/* Bridge out structure for PhysHeapGetMemInfo */
typedef struct PVRSRV_BRIDGE_OUT_PHYSHEAPGETMEMINFO_TAG
{
PHYS_HEAP_MEM_STATS *pasapPhysHeapMemStats;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PHYSHEAPGETMEMINFO;
/*******************************************
GetDefaultPhysicalHeap
*******************************************/
/* Bridge in structure for GetDefaultPhysicalHeap */
typedef struct PVRSRV_BRIDGE_IN_GETDEFAULTPHYSICALHEAP_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_GETDEFAULTPHYSICALHEAP;
/* Bridge out structure for GetDefaultPhysicalHeap */
typedef struct PVRSRV_BRIDGE_OUT_GETDEFAULTPHYSICALHEAP_TAG
{
PVRSRV_ERROR eError;
PVRSRV_PHYS_HEAP eHeap;
} __packed PVRSRV_BRIDGE_OUT_GETDEFAULTPHYSICALHEAP;
/*******************************************
GetHeapPhysMemUsage
*******************************************/
/* Bridge in structure for GetHeapPhysMemUsage */
typedef struct PVRSRV_BRIDGE_IN_GETHEAPPHYSMEMUSAGE_TAG
{
PHYS_HEAP_MEM_STATS *pasapPhysHeapMemStats;
IMG_UINT32 ui32PhysHeapCount;
} __packed PVRSRV_BRIDGE_IN_GETHEAPPHYSMEMUSAGE;
/* Bridge out structure for GetHeapPhysMemUsage */
typedef struct PVRSRV_BRIDGE_OUT_GETHEAPPHYSMEMUSAGE_TAG
{
PHYS_HEAP_MEM_STATS *pasapPhysHeapMemStats;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_GETHEAPPHYSMEMUSAGE;
/*******************************************
DevmemGetFaultAddress
*******************************************/
/* Bridge in structure for DevmemGetFaultAddress */
typedef struct PVRSRV_BRIDGE_IN_DEVMEMGETFAULTADDRESS_TAG
{
IMG_HANDLE hDevmemCtx;
} __packed PVRSRV_BRIDGE_IN_DEVMEMGETFAULTADDRESS;
/* Bridge out structure for DevmemGetFaultAddress */
typedef struct PVRSRV_BRIDGE_OUT_DEVMEMGETFAULTADDRESS_TAG
{
IMG_DEV_VIRTADDR sFaultAddress;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DEVMEMGETFAULTADDRESS;
/*******************************************
PVRSRVUpdateOOMStats
*******************************************/
/* Bridge in structure for PVRSRVUpdateOOMStats */
typedef struct PVRSRV_BRIDGE_IN_PVRSRVUPDATEOOMSTATS_TAG
{
IMG_PID ui32pid;
IMG_UINT32 ui32ui32StatType;
} __packed PVRSRV_BRIDGE_IN_PVRSRVUPDATEOOMSTATS;
/* Bridge out structure for PVRSRVUpdateOOMStats */
typedef struct PVRSRV_BRIDGE_OUT_PVRSRVUPDATEOOMSTATS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PVRSRVUPDATEOOMSTATS;
/*******************************************
PhysHeapGetMemInfoPkd
*******************************************/
/* Bridge in structure for PhysHeapGetMemInfoPkd */
typedef struct PVRSRV_BRIDGE_IN_PHYSHEAPGETMEMINFOPKD_TAG
{
PHYS_HEAP_MEM_STATS_PKD *psapPhysHeapMemStats;
PVRSRV_PHYS_HEAP *peaPhysHeapID;
IMG_UINT32 ui32PhysHeapCount;
} __packed PVRSRV_BRIDGE_IN_PHYSHEAPGETMEMINFOPKD;
/* Bridge out structure for PhysHeapGetMemInfoPkd */
typedef struct PVRSRV_BRIDGE_OUT_PHYSHEAPGETMEMINFOPKD_TAG
{
PHYS_HEAP_MEM_STATS_PKD *psapPhysHeapMemStats;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_PHYSHEAPGETMEMINFOPKD;
/*******************************************
GetHeapPhysMemUsagePkd
*******************************************/
/* Bridge in structure for GetHeapPhysMemUsagePkd */
typedef struct PVRSRV_BRIDGE_IN_GETHEAPPHYSMEMUSAGEPKD_TAG
{
PHYS_HEAP_MEM_STATS_PKD *psapPhysHeapMemStats;
IMG_UINT32 ui32PhysHeapCount;
} __packed PVRSRV_BRIDGE_IN_GETHEAPPHYSMEMUSAGEPKD;
/* Bridge out structure for GetHeapPhysMemUsagePkd */
typedef struct PVRSRV_BRIDGE_OUT_GETHEAPPHYSMEMUSAGEPKD_TAG
{
PHYS_HEAP_MEM_STATS_PKD *psapPhysHeapMemStats;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_GETHEAPPHYSMEMUSAGEPKD;
#endif /* COMMON_MM_BRIDGE_H */

View File

@@ -0,0 +1,214 @@
/*******************************************************************************
@File
@Title Common bridge header for pvrtl
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for pvrtl
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_PVRTL_BRIDGE_H
#define COMMON_PVRTL_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "devicemem_typedefs.h"
#include "pvrsrv_tlcommon.h"
#define PVRSRV_BRIDGE_PVRTL_CMD_FIRST 0
#define PVRSRV_BRIDGE_PVRTL_TLOPENSTREAM PVRSRV_BRIDGE_PVRTL_CMD_FIRST+0
#define PVRSRV_BRIDGE_PVRTL_TLCLOSESTREAM PVRSRV_BRIDGE_PVRTL_CMD_FIRST+1
#define PVRSRV_BRIDGE_PVRTL_TLACQUIREDATA PVRSRV_BRIDGE_PVRTL_CMD_FIRST+2
#define PVRSRV_BRIDGE_PVRTL_TLRELEASEDATA PVRSRV_BRIDGE_PVRTL_CMD_FIRST+3
#define PVRSRV_BRIDGE_PVRTL_TLDISCOVERSTREAMS PVRSRV_BRIDGE_PVRTL_CMD_FIRST+4
#define PVRSRV_BRIDGE_PVRTL_TLRESERVESTREAM PVRSRV_BRIDGE_PVRTL_CMD_FIRST+5
#define PVRSRV_BRIDGE_PVRTL_TLCOMMITSTREAM PVRSRV_BRIDGE_PVRTL_CMD_FIRST+6
#define PVRSRV_BRIDGE_PVRTL_TLWRITEDATA PVRSRV_BRIDGE_PVRTL_CMD_FIRST+7
#define PVRSRV_BRIDGE_PVRTL_CMD_LAST (PVRSRV_BRIDGE_PVRTL_CMD_FIRST+7)
/*******************************************
TLOpenStream
*******************************************/
/* Bridge in structure for TLOpenStream */
typedef struct PVRSRV_BRIDGE_IN_TLOPENSTREAM_TAG
{
const IMG_CHAR *puiName;
IMG_UINT32 ui32Mode;
} __packed PVRSRV_BRIDGE_IN_TLOPENSTREAM;
/* Bridge out structure for TLOpenStream */
typedef struct PVRSRV_BRIDGE_OUT_TLOPENSTREAM_TAG
{
IMG_HANDLE hSD;
IMG_HANDLE hTLPMR;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_TLOPENSTREAM;
/*******************************************
TLCloseStream
*******************************************/
/* Bridge in structure for TLCloseStream */
typedef struct PVRSRV_BRIDGE_IN_TLCLOSESTREAM_TAG
{
IMG_HANDLE hSD;
} __packed PVRSRV_BRIDGE_IN_TLCLOSESTREAM;
/* Bridge out structure for TLCloseStream */
typedef struct PVRSRV_BRIDGE_OUT_TLCLOSESTREAM_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_TLCLOSESTREAM;
/*******************************************
TLAcquireData
*******************************************/
/* Bridge in structure for TLAcquireData */
typedef struct PVRSRV_BRIDGE_IN_TLACQUIREDATA_TAG
{
IMG_HANDLE hSD;
} __packed PVRSRV_BRIDGE_IN_TLACQUIREDATA;
/* Bridge out structure for TLAcquireData */
typedef struct PVRSRV_BRIDGE_OUT_TLACQUIREDATA_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32ReadLen;
IMG_UINT32 ui32ReadOffset;
} __packed PVRSRV_BRIDGE_OUT_TLACQUIREDATA;
/*******************************************
TLReleaseData
*******************************************/
/* Bridge in structure for TLReleaseData */
typedef struct PVRSRV_BRIDGE_IN_TLRELEASEDATA_TAG
{
IMG_HANDLE hSD;
IMG_UINT32 ui32ReadLen;
IMG_UINT32 ui32ReadOffset;
} __packed PVRSRV_BRIDGE_IN_TLRELEASEDATA;
/* Bridge out structure for TLReleaseData */
typedef struct PVRSRV_BRIDGE_OUT_TLRELEASEDATA_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_TLRELEASEDATA;
/*******************************************
TLDiscoverStreams
*******************************************/
/* Bridge in structure for TLDiscoverStreams */
typedef struct PVRSRV_BRIDGE_IN_TLDISCOVERSTREAMS_TAG
{
const IMG_CHAR *puiNamePattern;
IMG_CHAR *puiStreams;
IMG_UINT32 ui32Size;
} __packed PVRSRV_BRIDGE_IN_TLDISCOVERSTREAMS;
/* Bridge out structure for TLDiscoverStreams */
typedef struct PVRSRV_BRIDGE_OUT_TLDISCOVERSTREAMS_TAG
{
IMG_CHAR *puiStreams;
PVRSRV_ERROR eError;
IMG_UINT32 ui32NumFound;
} __packed PVRSRV_BRIDGE_OUT_TLDISCOVERSTREAMS;
/*******************************************
TLReserveStream
*******************************************/
/* Bridge in structure for TLReserveStream */
typedef struct PVRSRV_BRIDGE_IN_TLRESERVESTREAM_TAG
{
IMG_HANDLE hSD;
IMG_UINT32 ui32Size;
IMG_UINT32 ui32SizeMin;
} __packed PVRSRV_BRIDGE_IN_TLRESERVESTREAM;
/* Bridge out structure for TLReserveStream */
typedef struct PVRSRV_BRIDGE_OUT_TLRESERVESTREAM_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32Available;
IMG_UINT32 ui32BufferOffset;
} __packed PVRSRV_BRIDGE_OUT_TLRESERVESTREAM;
/*******************************************
TLCommitStream
*******************************************/
/* Bridge in structure for TLCommitStream */
typedef struct PVRSRV_BRIDGE_IN_TLCOMMITSTREAM_TAG
{
IMG_HANDLE hSD;
IMG_UINT32 ui32ReqSize;
} __packed PVRSRV_BRIDGE_IN_TLCOMMITSTREAM;
/* Bridge out structure for TLCommitStream */
typedef struct PVRSRV_BRIDGE_OUT_TLCOMMITSTREAM_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_TLCOMMITSTREAM;
/*******************************************
TLWriteData
*******************************************/
/* Bridge in structure for TLWriteData */
typedef struct PVRSRV_BRIDGE_IN_TLWRITEDATA_TAG
{
IMG_HANDLE hSD;
IMG_BYTE *pui8Data;
IMG_UINT32 ui32Size;
} __packed PVRSRV_BRIDGE_IN_TLWRITEDATA;
/* Bridge out structure for TLWriteData */
typedef struct PVRSRV_BRIDGE_OUT_TLWRITEDATA_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_TLWRITEDATA;
#endif /* COMMON_PVRTL_BRIDGE_H */

View File

@@ -0,0 +1,149 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxbreakpoint
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxbreakpoint
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXBREAKPOINT_BRIDGE_H
#define COMMON_RGXBREAKPOINT_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#define PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXBREAKPOINT_RGXSETBREAKPOINT PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXBREAKPOINT_RGXCLEARBREAKPOINT PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXBREAKPOINT_RGXENABLEBREAKPOINT PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXBREAKPOINT_RGXDISABLEBREAKPOINT PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXBREAKPOINT_RGXOVERALLOCATEBPREGISTERS PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_LAST (PVRSRV_BRIDGE_RGXBREAKPOINT_CMD_FIRST+4)
/*******************************************
RGXSetBreakpoint
*******************************************/
/* Bridge in structure for RGXSetBreakpoint */
typedef struct PVRSRV_BRIDGE_IN_RGXSETBREAKPOINT_TAG
{
IMG_HANDLE hPrivData;
IMG_UINT32 eFWDataMaster;
IMG_UINT32 ui32BreakpointAddr;
IMG_UINT32 ui32DM;
IMG_UINT32 ui32HandlerAddr;
} __packed PVRSRV_BRIDGE_IN_RGXSETBREAKPOINT;
/* Bridge out structure for RGXSetBreakpoint */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETBREAKPOINT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETBREAKPOINT;
/*******************************************
RGXClearBreakpoint
*******************************************/
/* Bridge in structure for RGXClearBreakpoint */
typedef struct PVRSRV_BRIDGE_IN_RGXCLEARBREAKPOINT_TAG
{
IMG_HANDLE hPrivData;
} __packed PVRSRV_BRIDGE_IN_RGXCLEARBREAKPOINT;
/* Bridge out structure for RGXClearBreakpoint */
typedef struct PVRSRV_BRIDGE_OUT_RGXCLEARBREAKPOINT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCLEARBREAKPOINT;
/*******************************************
RGXEnableBreakpoint
*******************************************/
/* Bridge in structure for RGXEnableBreakpoint */
typedef struct PVRSRV_BRIDGE_IN_RGXENABLEBREAKPOINT_TAG
{
IMG_HANDLE hPrivData;
} __packed PVRSRV_BRIDGE_IN_RGXENABLEBREAKPOINT;
/* Bridge out structure for RGXEnableBreakpoint */
typedef struct PVRSRV_BRIDGE_OUT_RGXENABLEBREAKPOINT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXENABLEBREAKPOINT;
/*******************************************
RGXDisableBreakpoint
*******************************************/
/* Bridge in structure for RGXDisableBreakpoint */
typedef struct PVRSRV_BRIDGE_IN_RGXDISABLEBREAKPOINT_TAG
{
IMG_HANDLE hPrivData;
} __packed PVRSRV_BRIDGE_IN_RGXDISABLEBREAKPOINT;
/* Bridge out structure for RGXDisableBreakpoint */
typedef struct PVRSRV_BRIDGE_OUT_RGXDISABLEBREAKPOINT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDISABLEBREAKPOINT;
/*******************************************
RGXOverallocateBPRegisters
*******************************************/
/* Bridge in structure for RGXOverallocateBPRegisters */
typedef struct PVRSRV_BRIDGE_IN_RGXOVERALLOCATEBPREGISTERS_TAG
{
IMG_UINT32 ui32SharedRegs;
IMG_UINT32 ui32TempRegs;
} __packed PVRSRV_BRIDGE_IN_RGXOVERALLOCATEBPREGISTERS;
/* Bridge out structure for RGXOverallocateBPRegisters */
typedef struct PVRSRV_BRIDGE_OUT_RGXOVERALLOCATEBPREGISTERS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXOVERALLOCATEBPREGISTERS;
#endif /* COMMON_RGXBREAKPOINT_BRIDGE_H */

View File

@@ -0,0 +1,229 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxcmp
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxcmp
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXCMP_BRIDGE_H
#define COMMON_RGXCMP_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#include "pvrsrv_sync_km.h"
#define PVRSRV_BRIDGE_RGXCMP_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXCMP_RGXCREATECOMPUTECONTEXT PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXCMP_RGXDESTROYCOMPUTECONTEXT PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXCMP_RGXFLUSHCOMPUTEDATA PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXCMP_RGXSETCOMPUTECONTEXTPRIORITY PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXCMP_RGXNOTIFYCOMPUTEWRITEOFFSETUPDATE PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXCMP_RGXKICKCDM2 PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+5
#define PVRSRV_BRIDGE_RGXCMP_RGXSETCOMPUTECONTEXTPROPERTY PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+6
#define PVRSRV_BRIDGE_RGXCMP_RGXGETLASTDEVICEERROR PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+7
#define PVRSRV_BRIDGE_RGXCMP_CMD_LAST (PVRSRV_BRIDGE_RGXCMP_CMD_FIRST+7)
/*******************************************
RGXCreateComputeContext
*******************************************/
/* Bridge in structure for RGXCreateComputeContext */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATECOMPUTECONTEXT_TAG
{
IMG_UINT64 ui64RobustnessAddress;
IMG_HANDLE hPrivData;
IMG_BYTE *pui8FrameworkCmd;
IMG_BYTE *pui8StaticComputeContextState;
IMG_UINT32 ui32ContextFlags;
IMG_UINT32 ui32FrameworkCmdize;
IMG_UINT32 ui32MaxDeadlineMS;
IMG_UINT32 ui32PackedCCBSizeU88;
IMG_UINT32 ui32Priority;
IMG_UINT32 ui32StaticComputeContextStateSize;
} __packed PVRSRV_BRIDGE_IN_RGXCREATECOMPUTECONTEXT;
/* Bridge out structure for RGXCreateComputeContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATECOMPUTECONTEXT_TAG
{
IMG_HANDLE hComputeContext;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATECOMPUTECONTEXT;
/*******************************************
RGXDestroyComputeContext
*******************************************/
/* Bridge in structure for RGXDestroyComputeContext */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYCOMPUTECONTEXT_TAG
{
IMG_HANDLE hComputeContext;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYCOMPUTECONTEXT;
/* Bridge out structure for RGXDestroyComputeContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYCOMPUTECONTEXT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYCOMPUTECONTEXT;
/*******************************************
RGXFlushComputeData
*******************************************/
/* Bridge in structure for RGXFlushComputeData */
typedef struct PVRSRV_BRIDGE_IN_RGXFLUSHCOMPUTEDATA_TAG
{
IMG_HANDLE hComputeContext;
} __packed PVRSRV_BRIDGE_IN_RGXFLUSHCOMPUTEDATA;
/* Bridge out structure for RGXFlushComputeData */
typedef struct PVRSRV_BRIDGE_OUT_RGXFLUSHCOMPUTEDATA_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFLUSHCOMPUTEDATA;
/*******************************************
RGXSetComputeContextPriority
*******************************************/
/* Bridge in structure for RGXSetComputeContextPriority */
typedef struct PVRSRV_BRIDGE_IN_RGXSETCOMPUTECONTEXTPRIORITY_TAG
{
IMG_HANDLE hComputeContext;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXSETCOMPUTECONTEXTPRIORITY;
/* Bridge out structure for RGXSetComputeContextPriority */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETCOMPUTECONTEXTPRIORITY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETCOMPUTECONTEXTPRIORITY;
/*******************************************
RGXNotifyComputeWriteOffsetUpdate
*******************************************/
/* Bridge in structure for RGXNotifyComputeWriteOffsetUpdate */
typedef struct PVRSRV_BRIDGE_IN_RGXNOTIFYCOMPUTEWRITEOFFSETUPDATE_TAG
{
IMG_HANDLE hComputeContext;
} __packed PVRSRV_BRIDGE_IN_RGXNOTIFYCOMPUTEWRITEOFFSETUPDATE;
/* Bridge out structure for RGXNotifyComputeWriteOffsetUpdate */
typedef struct PVRSRV_BRIDGE_OUT_RGXNOTIFYCOMPUTEWRITEOFFSETUPDATE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXNOTIFYCOMPUTEWRITEOFFSETUPDATE;
/*******************************************
RGXKickCDM2
*******************************************/
/* Bridge in structure for RGXKickCDM2 */
typedef struct PVRSRV_BRIDGE_IN_RGXKICKCDM2_TAG
{
IMG_UINT64 ui64DeadlineInus;
IMG_HANDLE hComputeContext;
IMG_UINT32 *pui32ClientUpdateOffset;
IMG_UINT32 *pui32ClientUpdateValue;
IMG_UINT32 *pui32SyncPMRFlags;
IMG_BYTE *pui8DMCmd;
IMG_CHAR *puiUpdateFenceName;
IMG_HANDLE *phClientUpdateUFOSyncPrimBlock;
IMG_HANDLE *phSyncPMRs;
PVRSRV_FENCE hCheckFenceFd;
PVRSRV_TIMELINE hUpdateTimeline;
IMG_UINT32 ui32ClientUpdateCount;
IMG_UINT32 ui32CmdSize;
IMG_UINT32 ui32ExtJobRef;
IMG_UINT32 ui32NumOfWorkgroups;
IMG_UINT32 ui32NumOfWorkitems;
IMG_UINT32 ui32PDumpFlags;
IMG_UINT32 ui32SyncPMRCount;
} __packed PVRSRV_BRIDGE_IN_RGXKICKCDM2;
/* Bridge out structure for RGXKickCDM2 */
typedef struct PVRSRV_BRIDGE_OUT_RGXKICKCDM2_TAG
{
PVRSRV_ERROR eError;
PVRSRV_FENCE hUpdateFence;
} __packed PVRSRV_BRIDGE_OUT_RGXKICKCDM2;
/*******************************************
RGXSetComputeContextProperty
*******************************************/
/* Bridge in structure for RGXSetComputeContextProperty */
typedef struct PVRSRV_BRIDGE_IN_RGXSETCOMPUTECONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Input;
IMG_HANDLE hComputeContext;
IMG_UINT32 ui32Property;
} __packed PVRSRV_BRIDGE_IN_RGXSETCOMPUTECONTEXTPROPERTY;
/* Bridge out structure for RGXSetComputeContextProperty */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETCOMPUTECONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Output;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETCOMPUTECONTEXTPROPERTY;
/*******************************************
RGXGetLastDeviceError
*******************************************/
/* Bridge in structure for RGXGetLastDeviceError */
typedef struct PVRSRV_BRIDGE_IN_RGXGETLASTDEVICEERROR_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXGETLASTDEVICEERROR;
/* Bridge out structure for RGXGetLastDeviceError */
typedef struct PVRSRV_BRIDGE_OUT_RGXGETLASTDEVICEERROR_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32Error;
} __packed PVRSRV_BRIDGE_OUT_RGXGETLASTDEVICEERROR;
#endif /* COMMON_RGXCMP_BRIDGE_H */

View File

@@ -0,0 +1,200 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxfwdbg
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxfwdbg
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXFWDBG_BRIDGE_H
#define COMMON_RGXFWDBG_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "devicemem_typedefs.h"
#include "rgx_bridge.h"
#include "pvrsrv_memallocflags.h"
#define PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGSETFWLOG PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGDUMPFREELISTPAGELIST PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGSETHCSDEADLINE PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGSETOSIDPRIORITY PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGSETOSNEWONLINESTATE PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGPHRCONFIGURE PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+5
#define PVRSRV_BRIDGE_RGXFWDBG_RGXFWDEBUGWDGCONFIGURE PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+6
#define PVRSRV_BRIDGE_RGXFWDBG_RGXCURRENTTIME PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+7
#define PVRSRV_BRIDGE_RGXFWDBG_CMD_LAST (PVRSRV_BRIDGE_RGXFWDBG_CMD_FIRST+7)
/*******************************************
RGXFWDebugSetFWLog
*******************************************/
/* Bridge in structure for RGXFWDebugSetFWLog */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGSETFWLOG_TAG
{
IMG_UINT32 ui32RGXFWLogType;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGSETFWLOG;
/* Bridge out structure for RGXFWDebugSetFWLog */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETFWLOG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETFWLOG;
/*******************************************
RGXFWDebugDumpFreelistPageList
*******************************************/
/* Bridge in structure for RGXFWDebugDumpFreelistPageList */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGDUMPFREELISTPAGELIST_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGDUMPFREELISTPAGELIST;
/* Bridge out structure for RGXFWDebugDumpFreelistPageList */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGDUMPFREELISTPAGELIST_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGDUMPFREELISTPAGELIST;
/*******************************************
RGXFWDebugSetHCSDeadline
*******************************************/
/* Bridge in structure for RGXFWDebugSetHCSDeadline */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGSETHCSDEADLINE_TAG
{
IMG_UINT32 ui32RGXHCSDeadline;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGSETHCSDEADLINE;
/* Bridge out structure for RGXFWDebugSetHCSDeadline */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETHCSDEADLINE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETHCSDEADLINE;
/*******************************************
RGXFWDebugSetOSidPriority
*******************************************/
/* Bridge in structure for RGXFWDebugSetOSidPriority */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGSETOSIDPRIORITY_TAG
{
IMG_UINT32 ui32OSid;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGSETOSIDPRIORITY;
/* Bridge out structure for RGXFWDebugSetOSidPriority */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETOSIDPRIORITY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETOSIDPRIORITY;
/*******************************************
RGXFWDebugSetOSNewOnlineState
*******************************************/
/* Bridge in structure for RGXFWDebugSetOSNewOnlineState */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGSETOSNEWONLINESTATE_TAG
{
IMG_UINT32 ui32OSNewState;
IMG_UINT32 ui32OSid;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGSETOSNEWONLINESTATE;
/* Bridge out structure for RGXFWDebugSetOSNewOnlineState */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETOSNEWONLINESTATE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGSETOSNEWONLINESTATE;
/*******************************************
RGXFWDebugPHRConfigure
*******************************************/
/* Bridge in structure for RGXFWDebugPHRConfigure */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGPHRCONFIGURE_TAG
{
IMG_UINT32 ui32ui32PHRMode;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGPHRCONFIGURE;
/* Bridge out structure for RGXFWDebugPHRConfigure */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGPHRCONFIGURE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGPHRCONFIGURE;
/*******************************************
RGXFWDebugWdgConfigure
*******************************************/
/* Bridge in structure for RGXFWDebugWdgConfigure */
typedef struct PVRSRV_BRIDGE_IN_RGXFWDEBUGWDGCONFIGURE_TAG
{
IMG_UINT32 ui32ui32WdgPeriodUs;
} __packed PVRSRV_BRIDGE_IN_RGXFWDEBUGWDGCONFIGURE;
/* Bridge out structure for RGXFWDebugWdgConfigure */
typedef struct PVRSRV_BRIDGE_OUT_RGXFWDEBUGWDGCONFIGURE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXFWDEBUGWDGCONFIGURE;
/*******************************************
RGXCurrentTime
*******************************************/
/* Bridge in structure for RGXCurrentTime */
typedef struct PVRSRV_BRIDGE_IN_RGXCURRENTTIME_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXCURRENTTIME;
/* Bridge out structure for RGXCurrentTime */
typedef struct PVRSRV_BRIDGE_OUT_RGXCURRENTTIME_TAG
{
IMG_UINT64 ui64Time;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCURRENTTIME;
#endif /* COMMON_RGXFWDBG_BRIDGE_H */

View File

@@ -0,0 +1,172 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxhwperf
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxhwperf
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXHWPERF_BRIDGE_H
#define COMMON_RGXHWPERF_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#include "rgx_hwperf.h"
#define PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXHWPERF_RGXCTRLHWPERF PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXHWPERF_RGXGETHWPERFBVNCFEATUREFLAGS PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXHWPERF_RGXCONFIGMUXHWPERFCOUNTERS PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXHWPERF_RGXCONTROLHWPERFBLOCKS PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXHWPERF_RGXCONFIGCUSTOMCOUNTERS PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXHWPERF_RGXCONFIGUREHWPERFBLOCKS PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+5
#define PVRSRV_BRIDGE_RGXHWPERF_CMD_LAST (PVRSRV_BRIDGE_RGXHWPERF_CMD_FIRST+5)
/*******************************************
RGXCtrlHWPerf
*******************************************/
/* Bridge in structure for RGXCtrlHWPerf */
typedef struct PVRSRV_BRIDGE_IN_RGXCTRLHWPERF_TAG
{
IMG_UINT64 ui64Mask;
IMG_BOOL bToggle;
IMG_UINT32 ui32StreamId;
} __packed PVRSRV_BRIDGE_IN_RGXCTRLHWPERF;
/* Bridge out structure for RGXCtrlHWPerf */
typedef struct PVRSRV_BRIDGE_OUT_RGXCTRLHWPERF_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCTRLHWPERF;
/*******************************************
RGXGetHWPerfBvncFeatureFlags
*******************************************/
/* Bridge in structure for RGXGetHWPerfBvncFeatureFlags */
typedef struct PVRSRV_BRIDGE_IN_RGXGETHWPERFBVNCFEATUREFLAGS_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXGETHWPERFBVNCFEATUREFLAGS;
/* Bridge out structure for RGXGetHWPerfBvncFeatureFlags */
typedef struct PVRSRV_BRIDGE_OUT_RGXGETHWPERFBVNCFEATUREFLAGS_TAG
{
RGX_HWPERF_BVNC sBVNC;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXGETHWPERFBVNCFEATUREFLAGS;
/*******************************************
RGXConfigMuxHWPerfCounters
*******************************************/
/* Bridge in structure for RGXConfigMuxHWPerfCounters */
typedef struct PVRSRV_BRIDGE_IN_RGXCONFIGMUXHWPERFCOUNTERS_TAG
{
RGX_HWPERF_CONFIG_MUX_CNTBLK *psBlockConfigs;
IMG_UINT32 ui32ArrayLen;
} __packed PVRSRV_BRIDGE_IN_RGXCONFIGMUXHWPERFCOUNTERS;
/* Bridge out structure for RGXConfigMuxHWPerfCounters */
typedef struct PVRSRV_BRIDGE_OUT_RGXCONFIGMUXHWPERFCOUNTERS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCONFIGMUXHWPERFCOUNTERS;
/*******************************************
RGXControlHWPerfBlocks
*******************************************/
/* Bridge in structure for RGXControlHWPerfBlocks */
typedef struct PVRSRV_BRIDGE_IN_RGXCONTROLHWPERFBLOCKS_TAG
{
IMG_UINT16 *pui16BlockIDs;
IMG_BOOL bEnable;
IMG_UINT32 ui32ArrayLen;
} __packed PVRSRV_BRIDGE_IN_RGXCONTROLHWPERFBLOCKS;
/* Bridge out structure for RGXControlHWPerfBlocks */
typedef struct PVRSRV_BRIDGE_OUT_RGXCONTROLHWPERFBLOCKS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCONTROLHWPERFBLOCKS;
/*******************************************
RGXConfigCustomCounters
*******************************************/
/* Bridge in structure for RGXConfigCustomCounters */
typedef struct PVRSRV_BRIDGE_IN_RGXCONFIGCUSTOMCOUNTERS_TAG
{
IMG_UINT32 *pui32CustomCounterIDs;
IMG_UINT16 ui16CustomBlockID;
IMG_UINT16 ui16NumCustomCounters;
} __packed PVRSRV_BRIDGE_IN_RGXCONFIGCUSTOMCOUNTERS;
/* Bridge out structure for RGXConfigCustomCounters */
typedef struct PVRSRV_BRIDGE_OUT_RGXCONFIGCUSTOMCOUNTERS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCONFIGCUSTOMCOUNTERS;
/*******************************************
RGXConfigureHWPerfBlocks
*******************************************/
/* Bridge in structure for RGXConfigureHWPerfBlocks */
typedef struct PVRSRV_BRIDGE_IN_RGXCONFIGUREHWPERFBLOCKS_TAG
{
RGX_HWPERF_CONFIG_CNTBLK *psBlockConfigs;
IMG_UINT32 ui32ArrayLen;
IMG_UINT32 ui32CtrlWord;
} __packed PVRSRV_BRIDGE_IN_RGXCONFIGUREHWPERFBLOCKS;
/* Bridge out structure for RGXConfigureHWPerfBlocks */
typedef struct PVRSRV_BRIDGE_OUT_RGXCONFIGUREHWPERFBLOCKS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCONFIGUREHWPERFBLOCKS;
#endif /* COMMON_RGXHWPERF_BRIDGE_H */

View File

@@ -0,0 +1,143 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxkicksync
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxkicksync
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXKICKSYNC_BRIDGE_H
#define COMMON_RGXKICKSYNC_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#include "pvrsrv_sync_km.h"
#define PVRSRV_BRIDGE_RGXKICKSYNC_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXKICKSYNC_RGXCREATEKICKSYNCCONTEXT PVRSRV_BRIDGE_RGXKICKSYNC_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXKICKSYNC_RGXDESTROYKICKSYNCCONTEXT PVRSRV_BRIDGE_RGXKICKSYNC_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXKICKSYNC_RGXKICKSYNC2 PVRSRV_BRIDGE_RGXKICKSYNC_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXKICKSYNC_RGXSETKICKSYNCCONTEXTPROPERTY PVRSRV_BRIDGE_RGXKICKSYNC_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXKICKSYNC_CMD_LAST (PVRSRV_BRIDGE_RGXKICKSYNC_CMD_FIRST+3)
/*******************************************
RGXCreateKickSyncContext
*******************************************/
/* Bridge in structure for RGXCreateKickSyncContext */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATEKICKSYNCCONTEXT_TAG
{
IMG_HANDLE hPrivData;
IMG_UINT32 ui32ContextFlags;
IMG_UINT32 ui32PackedCCBSizeU88;
} __packed PVRSRV_BRIDGE_IN_RGXCREATEKICKSYNCCONTEXT;
/* Bridge out structure for RGXCreateKickSyncContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATEKICKSYNCCONTEXT_TAG
{
IMG_HANDLE hKickSyncContext;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATEKICKSYNCCONTEXT;
/*******************************************
RGXDestroyKickSyncContext
*******************************************/
/* Bridge in structure for RGXDestroyKickSyncContext */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYKICKSYNCCONTEXT_TAG
{
IMG_HANDLE hKickSyncContext;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYKICKSYNCCONTEXT;
/* Bridge out structure for RGXDestroyKickSyncContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYKICKSYNCCONTEXT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYKICKSYNCCONTEXT;
/*******************************************
RGXKickSync2
*******************************************/
/* Bridge in structure for RGXKickSync2 */
typedef struct PVRSRV_BRIDGE_IN_RGXKICKSYNC2_TAG
{
IMG_HANDLE hKickSyncContext;
IMG_UINT32 *pui32UpdateDevVarOffset;
IMG_UINT32 *pui32UpdateValue;
IMG_CHAR *puiUpdateFenceName;
IMG_HANDLE *phUpdateUFODevVarBlock;
PVRSRV_FENCE hCheckFenceFD;
PVRSRV_TIMELINE hTimelineFenceFD;
IMG_UINT32 ui32ClientUpdateCount;
IMG_UINT32 ui32ExtJobRef;
} __packed PVRSRV_BRIDGE_IN_RGXKICKSYNC2;
/* Bridge out structure for RGXKickSync2 */
typedef struct PVRSRV_BRIDGE_OUT_RGXKICKSYNC2_TAG
{
PVRSRV_ERROR eError;
PVRSRV_FENCE hUpdateFenceFD;
} __packed PVRSRV_BRIDGE_OUT_RGXKICKSYNC2;
/*******************************************
RGXSetKickSyncContextProperty
*******************************************/
/* Bridge in structure for RGXSetKickSyncContextProperty */
typedef struct PVRSRV_BRIDGE_IN_RGXSETKICKSYNCCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Input;
IMG_HANDLE hKickSyncContext;
IMG_UINT32 ui32Property;
} __packed PVRSRV_BRIDGE_IN_RGXSETKICKSYNCCONTEXTPROPERTY;
/* Bridge out structure for RGXSetKickSyncContextProperty */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETKICKSYNCCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Output;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETKICKSYNCCONTEXTPROPERTY;
#endif /* COMMON_RGXKICKSYNC_BRIDGE_H */

View File

@@ -0,0 +1,146 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxregconfig
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxregconfig
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXREGCONFIG_BRIDGE_H
#define COMMON_RGXREGCONFIG_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#define PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXREGCONFIG_RGXSETREGCONFIGTYPE PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXREGCONFIG_RGXADDREGCONFIG PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXREGCONFIG_RGXCLEARREGCONFIG PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXREGCONFIG_RGXENABLEREGCONFIG PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXREGCONFIG_RGXDISABLEREGCONFIG PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXREGCONFIG_CMD_LAST (PVRSRV_BRIDGE_RGXREGCONFIG_CMD_FIRST+4)
/*******************************************
RGXSetRegConfigType
*******************************************/
/* Bridge in structure for RGXSetRegConfigType */
typedef struct PVRSRV_BRIDGE_IN_RGXSETREGCONFIGTYPE_TAG
{
IMG_UINT8 ui8RegPowerIsland;
} __packed PVRSRV_BRIDGE_IN_RGXSETREGCONFIGTYPE;
/* Bridge out structure for RGXSetRegConfigType */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETREGCONFIGTYPE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETREGCONFIGTYPE;
/*******************************************
RGXAddRegconfig
*******************************************/
/* Bridge in structure for RGXAddRegconfig */
typedef struct PVRSRV_BRIDGE_IN_RGXADDREGCONFIG_TAG
{
IMG_UINT64 ui64RegMask;
IMG_UINT64 ui64RegValue;
IMG_UINT32 ui32RegAddr;
} __packed PVRSRV_BRIDGE_IN_RGXADDREGCONFIG;
/* Bridge out structure for RGXAddRegconfig */
typedef struct PVRSRV_BRIDGE_OUT_RGXADDREGCONFIG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXADDREGCONFIG;
/*******************************************
RGXClearRegConfig
*******************************************/
/* Bridge in structure for RGXClearRegConfig */
typedef struct PVRSRV_BRIDGE_IN_RGXCLEARREGCONFIG_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXCLEARREGCONFIG;
/* Bridge out structure for RGXClearRegConfig */
typedef struct PVRSRV_BRIDGE_OUT_RGXCLEARREGCONFIG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCLEARREGCONFIG;
/*******************************************
RGXEnableRegConfig
*******************************************/
/* Bridge in structure for RGXEnableRegConfig */
typedef struct PVRSRV_BRIDGE_IN_RGXENABLEREGCONFIG_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXENABLEREGCONFIG;
/* Bridge out structure for RGXEnableRegConfig */
typedef struct PVRSRV_BRIDGE_OUT_RGXENABLEREGCONFIG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXENABLEREGCONFIG;
/*******************************************
RGXDisableRegConfig
*******************************************/
/* Bridge in structure for RGXDisableRegConfig */
typedef struct PVRSRV_BRIDGE_IN_RGXDISABLEREGCONFIG_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXDISABLEREGCONFIG;
/* Bridge out structure for RGXDisableRegConfig */
typedef struct PVRSRV_BRIDGE_OUT_RGXDISABLEREGCONFIG_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDISABLEREGCONFIG;
#endif /* COMMON_RGXREGCONFIG_BRIDGE_H */

View File

@@ -0,0 +1,404 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxta3d
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxta3d
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXTA3D_BRIDGE_H
#define COMMON_RGXTA3D_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#include "rgx_fwif_shared.h"
#include "devicemem_typedefs.h"
#include "pvrsrv_sync_km.h"
#define PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXTA3D_RGXCREATEHWRTDATASET PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXTA3D_RGXDESTROYHWRTDATASET PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXTA3D_RGXCREATEZSBUFFER PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXTA3D_RGXDESTROYZSBUFFER PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXTA3D_RGXPOPULATEZSBUFFER PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXTA3D_RGXUNPOPULATEZSBUFFER PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+5
#define PVRSRV_BRIDGE_RGXTA3D_RGXCREATEFREELIST PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+6
#define PVRSRV_BRIDGE_RGXTA3D_RGXDESTROYFREELIST PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+7
#define PVRSRV_BRIDGE_RGXTA3D_RGXCREATERENDERCONTEXT PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+8
#define PVRSRV_BRIDGE_RGXTA3D_RGXDESTROYRENDERCONTEXT PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+9
#define PVRSRV_BRIDGE_RGXTA3D_RGXSETRENDERCONTEXTPRIORITY PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+10
#define PVRSRV_BRIDGE_RGXTA3D_RGXRENDERCONTEXTSTALLED PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+11
#define PVRSRV_BRIDGE_RGXTA3D_RGXKICKTA3D2 PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+12
#define PVRSRV_BRIDGE_RGXTA3D_RGXSETRENDERCONTEXTPROPERTY PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+13
#define PVRSRV_BRIDGE_RGXTA3D_CMD_LAST (PVRSRV_BRIDGE_RGXTA3D_CMD_FIRST+13)
/*******************************************
RGXCreateHWRTDataSet
*******************************************/
/* Bridge in structure for RGXCreateHWRTDataSet */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATEHWRTDATASET_TAG
{
IMG_UINT64 ui64FlippedMultiSampleCtl;
IMG_UINT64 ui64MultiSampleCtl;
IMG_DEV_VIRTADDR *psMacrotileArrayDevVAddr;
IMG_DEV_VIRTADDR *psPMMlistDevVAddr;
IMG_DEV_VIRTADDR *psRTCDevVAddr;
IMG_DEV_VIRTADDR *psRgnHeaderDevVAddr;
IMG_DEV_VIRTADDR *psTailPtrsDevVAddr;
IMG_DEV_VIRTADDR *psVHeapTableDevVAddr;
IMG_HANDLE *phKmHwRTDataSet;
IMG_HANDLE *phapsFreeLists;
IMG_UINT32 ui32ISPMergeLowerX;
IMG_UINT32 ui32ISPMergeLowerY;
IMG_UINT32 ui32ISPMergeScaleX;
IMG_UINT32 ui32ISPMergeScaleY;
IMG_UINT32 ui32ISPMergeUpperX;
IMG_UINT32 ui32ISPMergeUpperY;
IMG_UINT32 ui32ISPMtileSize;
IMG_UINT32 ui32MTileStride;
IMG_UINT32 ui32PPPScreen;
IMG_UINT32 ui32RgnHeaderSize;
IMG_UINT32 ui32TEAA;
IMG_UINT32 ui32TEMTILE1;
IMG_UINT32 ui32TEMTILE2;
IMG_UINT32 ui32TEScreen;
IMG_UINT32 ui32TPCSize;
IMG_UINT32 ui32TPCStride;
IMG_UINT16 ui16MaxRTs;
} __packed PVRSRV_BRIDGE_IN_RGXCREATEHWRTDATASET;
/* Bridge out structure for RGXCreateHWRTDataSet */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATEHWRTDATASET_TAG
{
IMG_HANDLE *phKmHwRTDataSet;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATEHWRTDATASET;
/*******************************************
RGXDestroyHWRTDataSet
*******************************************/
/* Bridge in structure for RGXDestroyHWRTDataSet */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYHWRTDATASET_TAG
{
IMG_HANDLE hKmHwRTDataSet;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYHWRTDATASET;
/* Bridge out structure for RGXDestroyHWRTDataSet */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYHWRTDATASET_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYHWRTDATASET;
/*******************************************
RGXCreateZSBuffer
*******************************************/
/* Bridge in structure for RGXCreateZSBuffer */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATEZSBUFFER_TAG
{
IMG_HANDLE hPMR;
IMG_HANDLE hReservation;
PVRSRV_MEMALLOCFLAGS_T uiMapFlags;
} __packed PVRSRV_BRIDGE_IN_RGXCREATEZSBUFFER;
/* Bridge out structure for RGXCreateZSBuffer */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATEZSBUFFER_TAG
{
IMG_HANDLE hsZSBufferKM;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATEZSBUFFER;
/*******************************************
RGXDestroyZSBuffer
*******************************************/
/* Bridge in structure for RGXDestroyZSBuffer */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYZSBUFFER_TAG
{
IMG_HANDLE hsZSBufferMemDesc;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYZSBUFFER;
/* Bridge out structure for RGXDestroyZSBuffer */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYZSBUFFER_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYZSBUFFER;
/*******************************************
RGXPopulateZSBuffer
*******************************************/
/* Bridge in structure for RGXPopulateZSBuffer */
typedef struct PVRSRV_BRIDGE_IN_RGXPOPULATEZSBUFFER_TAG
{
IMG_HANDLE hsZSBufferKM;
} __packed PVRSRV_BRIDGE_IN_RGXPOPULATEZSBUFFER;
/* Bridge out structure for RGXPopulateZSBuffer */
typedef struct PVRSRV_BRIDGE_OUT_RGXPOPULATEZSBUFFER_TAG
{
IMG_HANDLE hsPopulation;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXPOPULATEZSBUFFER;
/*******************************************
RGXUnpopulateZSBuffer
*******************************************/
/* Bridge in structure for RGXUnpopulateZSBuffer */
typedef struct PVRSRV_BRIDGE_IN_RGXUNPOPULATEZSBUFFER_TAG
{
IMG_HANDLE hsPopulation;
} __packed PVRSRV_BRIDGE_IN_RGXUNPOPULATEZSBUFFER;
/* Bridge out structure for RGXUnpopulateZSBuffer */
typedef struct PVRSRV_BRIDGE_OUT_RGXUNPOPULATEZSBUFFER_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXUNPOPULATEZSBUFFER;
/*******************************************
RGXCreateFreeList
*******************************************/
/* Bridge in structure for RGXCreateFreeList */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATEFREELIST_TAG
{
IMG_DEV_VIRTADDR spsFreeListDevVAddr;
IMG_DEVMEM_OFFSET_T uiPMROffset;
IMG_HANDLE hMemCtxPrivData;
IMG_HANDLE hsFreeListPMR;
IMG_HANDLE hsGlobalFreeList;
IMG_BOOL bbFreeListCheck;
IMG_UINT32 ui32GrowFLPages;
IMG_UINT32 ui32GrowParamThreshold;
IMG_UINT32 ui32InitFLPages;
IMG_UINT32 ui32MaxFLPages;
} __packed PVRSRV_BRIDGE_IN_RGXCREATEFREELIST;
/* Bridge out structure for RGXCreateFreeList */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATEFREELIST_TAG
{
IMG_HANDLE hCleanupCookie;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATEFREELIST;
/*******************************************
RGXDestroyFreeList
*******************************************/
/* Bridge in structure for RGXDestroyFreeList */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYFREELIST_TAG
{
IMG_HANDLE hCleanupCookie;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYFREELIST;
/* Bridge out structure for RGXDestroyFreeList */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYFREELIST_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYFREELIST;
/*******************************************
RGXCreateRenderContext
*******************************************/
/* Bridge in structure for RGXCreateRenderContext */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATERENDERCONTEXT_TAG
{
IMG_DEV_VIRTADDR sVDMCallStackAddr;
IMG_UINT64 ui64RobustnessAddress;
IMG_HANDLE hPrivData;
IMG_BYTE *pui8FrameworkCmd;
IMG_BYTE *pui8StaticRenderContextState;
IMG_UINT32 ui32ContextFlags;
IMG_UINT32 ui32FrameworkCmdSize;
IMG_UINT32 ui32Max3DDeadlineMS;
IMG_UINT32 ui32MaxTADeadlineMS;
IMG_UINT32 ui32PackedCCBSizeU8888;
IMG_UINT32 ui32Priority;
IMG_UINT32 ui32StaticRenderContextStateSize;
IMG_UINT32 ui32ui32CallStackDepth;
} __packed PVRSRV_BRIDGE_IN_RGXCREATERENDERCONTEXT;
/* Bridge out structure for RGXCreateRenderContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATERENDERCONTEXT_TAG
{
IMG_HANDLE hRenderContext;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATERENDERCONTEXT;
/*******************************************
RGXDestroyRenderContext
*******************************************/
/* Bridge in structure for RGXDestroyRenderContext */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYRENDERCONTEXT_TAG
{
IMG_HANDLE hCleanupCookie;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYRENDERCONTEXT;
/* Bridge out structure for RGXDestroyRenderContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYRENDERCONTEXT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYRENDERCONTEXT;
/*******************************************
RGXSetRenderContextPriority
*******************************************/
/* Bridge in structure for RGXSetRenderContextPriority */
typedef struct PVRSRV_BRIDGE_IN_RGXSETRENDERCONTEXTPRIORITY_TAG
{
IMG_HANDLE hRenderContext;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXSETRENDERCONTEXTPRIORITY;
/* Bridge out structure for RGXSetRenderContextPriority */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETRENDERCONTEXTPRIORITY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETRENDERCONTEXTPRIORITY;
/*******************************************
RGXRenderContextStalled
*******************************************/
/* Bridge in structure for RGXRenderContextStalled */
typedef struct PVRSRV_BRIDGE_IN_RGXRENDERCONTEXTSTALLED_TAG
{
IMG_HANDLE hRenderContext;
} __packed PVRSRV_BRIDGE_IN_RGXRENDERCONTEXTSTALLED;
/* Bridge out structure for RGXRenderContextStalled */
typedef struct PVRSRV_BRIDGE_OUT_RGXRENDERCONTEXTSTALLED_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXRENDERCONTEXTSTALLED;
/*******************************************
RGXKickTA3D2
*******************************************/
/* Bridge in structure for RGXKickTA3D2 */
typedef struct PVRSRV_BRIDGE_IN_RGXKICKTA3D2_TAG
{
IMG_UINT64 ui64Deadline;
IMG_HANDLE hKMHWRTDataSet;
IMG_HANDLE hMSAAScratchBuffer;
IMG_HANDLE hPRFenceUFOSyncPrimBlock;
IMG_HANDLE hRenderContext;
IMG_HANDLE hZSBuffer;
IMG_UINT32 *pui32Client3DUpdateSyncOffset;
IMG_UINT32 *pui32Client3DUpdateValue;
IMG_UINT32 *pui32ClientTAFenceSyncOffset;
IMG_UINT32 *pui32ClientTAFenceValue;
IMG_UINT32 *pui32ClientTAUpdateSyncOffset;
IMG_UINT32 *pui32ClientTAUpdateValue;
IMG_UINT32 *pui32SyncPMRFlags;
IMG_BYTE *pui83DCmd;
IMG_BYTE *pui83DPRCmd;
IMG_BYTE *pui8TACmd;
IMG_CHAR *puiUpdateFenceName;
IMG_CHAR *puiUpdateFenceName3D;
IMG_HANDLE *phClient3DUpdateSyncPrimBlock;
IMG_HANDLE *phClientTAFenceSyncPrimBlock;
IMG_HANDLE *phClientTAUpdateSyncPrimBlock;
IMG_HANDLE *phSyncPMRs;
IMG_BOOL bbAbort;
IMG_BOOL bbKick3D;
IMG_BOOL bbKickPR;
IMG_BOOL bbKickTA;
PVRSRV_FENCE hCheckFence;
PVRSRV_FENCE hCheckFence3D;
PVRSRV_TIMELINE hUpdateTimeline;
PVRSRV_TIMELINE hUpdateTimeline3D;
IMG_UINT32 ui323DCmdSize;
IMG_UINT32 ui323DPRCmdSize;
IMG_UINT32 ui32Client3DUpdateCount;
IMG_UINT32 ui32ClientTAFenceCount;
IMG_UINT32 ui32ClientTAUpdateCount;
IMG_UINT32 ui32ExtJobRef;
IMG_UINT32 ui32NumberOfDrawCalls;
IMG_UINT32 ui32NumberOfIndices;
IMG_UINT32 ui32NumberOfMRTs;
IMG_UINT32 ui32PDumpFlags;
IMG_UINT32 ui32PRFenceUFOSyncOffset;
IMG_UINT32 ui32PRFenceValue;
IMG_UINT32 ui32RenderTargetSize;
IMG_UINT32 ui32SyncPMRCount;
IMG_UINT32 ui32TACmdSize;
} __packed PVRSRV_BRIDGE_IN_RGXKICKTA3D2;
/* Bridge out structure for RGXKickTA3D2 */
typedef struct PVRSRV_BRIDGE_OUT_RGXKICKTA3D2_TAG
{
PVRSRV_ERROR eError;
PVRSRV_FENCE hUpdateFence;
PVRSRV_FENCE hUpdateFence3D;
} __packed PVRSRV_BRIDGE_OUT_RGXKICKTA3D2;
/*******************************************
RGXSetRenderContextProperty
*******************************************/
/* Bridge in structure for RGXSetRenderContextProperty */
typedef struct PVRSRV_BRIDGE_IN_RGXSETRENDERCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Input;
IMG_HANDLE hRenderContext;
IMG_UINT32 ui32Property;
} __packed PVRSRV_BRIDGE_IN_RGXSETRENDERCONTEXTPROPERTY;
/* Bridge out structure for RGXSetRenderContextProperty */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETRENDERCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Output;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETRENDERCONTEXTPROPERTY;
#endif /* COMMON_RGXTA3D_BRIDGE_H */

View File

@@ -0,0 +1,112 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxtimerquery
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxtimerquery
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXTIMERQUERY_BRIDGE_H
#define COMMON_RGXTIMERQUERY_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#define PVRSRV_BRIDGE_RGXTIMERQUERY_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXTIMERQUERY_RGXBEGINTIMERQUERY PVRSRV_BRIDGE_RGXTIMERQUERY_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXTIMERQUERY_RGXENDTIMERQUERY PVRSRV_BRIDGE_RGXTIMERQUERY_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXTIMERQUERY_RGXQUERYTIMER PVRSRV_BRIDGE_RGXTIMERQUERY_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXTIMERQUERY_CMD_LAST (PVRSRV_BRIDGE_RGXTIMERQUERY_CMD_FIRST+2)
/*******************************************
RGXBeginTimerQuery
*******************************************/
/* Bridge in structure for RGXBeginTimerQuery */
typedef struct PVRSRV_BRIDGE_IN_RGXBEGINTIMERQUERY_TAG
{
IMG_UINT32 ui32QueryId;
} __packed PVRSRV_BRIDGE_IN_RGXBEGINTIMERQUERY;
/* Bridge out structure for RGXBeginTimerQuery */
typedef struct PVRSRV_BRIDGE_OUT_RGXBEGINTIMERQUERY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXBEGINTIMERQUERY;
/*******************************************
RGXEndTimerQuery
*******************************************/
/* Bridge in structure for RGXEndTimerQuery */
typedef struct PVRSRV_BRIDGE_IN_RGXENDTIMERQUERY_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXENDTIMERQUERY;
/* Bridge out structure for RGXEndTimerQuery */
typedef struct PVRSRV_BRIDGE_OUT_RGXENDTIMERQUERY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXENDTIMERQUERY;
/*******************************************
RGXQueryTimer
*******************************************/
/* Bridge in structure for RGXQueryTimer */
typedef struct PVRSRV_BRIDGE_IN_RGXQUERYTIMER_TAG
{
IMG_UINT32 ui32QueryId;
} __packed PVRSRV_BRIDGE_IN_RGXQUERYTIMER;
/* Bridge out structure for RGXQueryTimer */
typedef struct PVRSRV_BRIDGE_OUT_RGXQUERYTIMER_TAG
{
IMG_UINT64 ui64EndTime;
IMG_UINT64 ui64StartTime;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXQUERYTIMER;
#endif /* COMMON_RGXTIMERQUERY_BRIDGE_H */

View File

@@ -0,0 +1,228 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxtq2
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxtq2
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXTQ2_BRIDGE_H
#define COMMON_RGXTQ2_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#include "pvrsrv_sync_km.h"
#define PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMCREATETRANSFERCONTEXT PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMDESTROYTRANSFERCONTEXT PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMSETTRANSFERCONTEXTPRIORITY PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMNOTIFYWRITEOFFSETUPDATE PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMSUBMITTRANSFER2 PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMGETSHAREDMEMORY PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+5
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMRELEASESHAREDMEMORY PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+6
#define PVRSRV_BRIDGE_RGXTQ2_RGXTDMSETTRANSFERCONTEXTPROPERTY PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+7
#define PVRSRV_BRIDGE_RGXTQ2_CMD_LAST (PVRSRV_BRIDGE_RGXTQ2_CMD_FIRST+7)
/*******************************************
RGXTDMCreateTransferContext
*******************************************/
/* Bridge in structure for RGXTDMCreateTransferContext */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMCREATETRANSFERCONTEXT_TAG
{
IMG_UINT64 ui64RobustnessAddress;
IMG_HANDLE hPrivData;
IMG_BYTE *pui8FrameworkCmd;
IMG_UINT32 ui32ContextFlags;
IMG_UINT32 ui32FrameworkCmdSize;
IMG_UINT32 ui32PackedCCBSizeU88;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXTDMCREATETRANSFERCONTEXT;
/* Bridge out structure for RGXTDMCreateTransferContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMCREATETRANSFERCONTEXT_TAG
{
IMG_HANDLE hTransferContext;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMCREATETRANSFERCONTEXT;
/*******************************************
RGXTDMDestroyTransferContext
*******************************************/
/* Bridge in structure for RGXTDMDestroyTransferContext */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMDESTROYTRANSFERCONTEXT_TAG
{
IMG_HANDLE hTransferContext;
} __packed PVRSRV_BRIDGE_IN_RGXTDMDESTROYTRANSFERCONTEXT;
/* Bridge out structure for RGXTDMDestroyTransferContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMDESTROYTRANSFERCONTEXT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMDESTROYTRANSFERCONTEXT;
/*******************************************
RGXTDMSetTransferContextPriority
*******************************************/
/* Bridge in structure for RGXTDMSetTransferContextPriority */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMSETTRANSFERCONTEXTPRIORITY_TAG
{
IMG_HANDLE hTransferContext;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXTDMSETTRANSFERCONTEXTPRIORITY;
/* Bridge out structure for RGXTDMSetTransferContextPriority */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMSETTRANSFERCONTEXTPRIORITY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMSETTRANSFERCONTEXTPRIORITY;
/*******************************************
RGXTDMNotifyWriteOffsetUpdate
*******************************************/
/* Bridge in structure for RGXTDMNotifyWriteOffsetUpdate */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMNOTIFYWRITEOFFSETUPDATE_TAG
{
IMG_HANDLE hTransferContext;
IMG_UINT32 ui32PDumpFlags;
} __packed PVRSRV_BRIDGE_IN_RGXTDMNOTIFYWRITEOFFSETUPDATE;
/* Bridge out structure for RGXTDMNotifyWriteOffsetUpdate */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMNOTIFYWRITEOFFSETUPDATE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMNOTIFYWRITEOFFSETUPDATE;
/*******************************************
RGXTDMSubmitTransfer2
*******************************************/
/* Bridge in structure for RGXTDMSubmitTransfer2 */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMSUBMITTRANSFER2_TAG
{
IMG_UINT64 ui64DeadlineInus;
IMG_HANDLE hTransferContext;
IMG_UINT32 *pui32SyncPMRFlags;
IMG_UINT32 *pui32UpdateSyncOffset;
IMG_UINT32 *pui32UpdateValue;
IMG_UINT8 *pui8FWCommand;
IMG_CHAR *puiUpdateFenceName;
IMG_HANDLE *phSyncPMRs;
IMG_HANDLE *phUpdateUFOSyncPrimBlock;
PVRSRV_FENCE hCheckFenceFD;
PVRSRV_TIMELINE hUpdateTimeline;
IMG_UINT32 ui32Characteristic1;
IMG_UINT32 ui32Characteristic2;
IMG_UINT32 ui32ClientUpdateCount;
IMG_UINT32 ui32CommandSize;
IMG_UINT32 ui32ExternalJobReference;
IMG_UINT32 ui32PDumpFlags;
IMG_UINT32 ui32SyncPMRCount;
} __packed PVRSRV_BRIDGE_IN_RGXTDMSUBMITTRANSFER2;
/* Bridge out structure for RGXTDMSubmitTransfer2 */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMSUBMITTRANSFER2_TAG
{
PVRSRV_ERROR eError;
PVRSRV_FENCE hUpdateFence;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMSUBMITTRANSFER2;
/*******************************************
RGXTDMGetSharedMemory
*******************************************/
/* Bridge in structure for RGXTDMGetSharedMemory */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMGETSHAREDMEMORY_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RGXTDMGETSHAREDMEMORY;
/* Bridge out structure for RGXTDMGetSharedMemory */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMGETSHAREDMEMORY_TAG
{
IMG_HANDLE hCLIPMRMem;
IMG_HANDLE hUSCPMRMem;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMGETSHAREDMEMORY;
/*******************************************
RGXTDMReleaseSharedMemory
*******************************************/
/* Bridge in structure for RGXTDMReleaseSharedMemory */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMRELEASESHAREDMEMORY_TAG
{
IMG_HANDLE hPMRMem;
} __packed PVRSRV_BRIDGE_IN_RGXTDMRELEASESHAREDMEMORY;
/* Bridge out structure for RGXTDMReleaseSharedMemory */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMRELEASESHAREDMEMORY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMRELEASESHAREDMEMORY;
/*******************************************
RGXTDMSetTransferContextProperty
*******************************************/
/* Bridge in structure for RGXTDMSetTransferContextProperty */
typedef struct PVRSRV_BRIDGE_IN_RGXTDMSETTRANSFERCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Input;
IMG_HANDLE hTransferContext;
IMG_UINT32 ui32Property;
} __packed PVRSRV_BRIDGE_IN_RGXTDMSETTRANSFERCONTEXTPROPERTY;
/* Bridge out structure for RGXTDMSetTransferContextProperty */
typedef struct PVRSRV_BRIDGE_OUT_RGXTDMSETTRANSFERCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Output;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXTDMSETTRANSFERCONTEXTPROPERTY;
#endif /* COMMON_RGXTQ2_BRIDGE_H */

View File

@@ -0,0 +1,176 @@
/*******************************************************************************
@File
@Title Common bridge header for rgxtq
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for rgxtq
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RGXTQ_BRIDGE_H
#define COMMON_RGXTQ_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "rgx_bridge.h"
#include "pvrsrv_sync_km.h"
#define PVRSRV_BRIDGE_RGXTQ_CMD_FIRST 0
#define PVRSRV_BRIDGE_RGXTQ_RGXCREATETRANSFERCONTEXT PVRSRV_BRIDGE_RGXTQ_CMD_FIRST+0
#define PVRSRV_BRIDGE_RGXTQ_RGXDESTROYTRANSFERCONTEXT PVRSRV_BRIDGE_RGXTQ_CMD_FIRST+1
#define PVRSRV_BRIDGE_RGXTQ_RGXSETTRANSFERCONTEXTPRIORITY PVRSRV_BRIDGE_RGXTQ_CMD_FIRST+2
#define PVRSRV_BRIDGE_RGXTQ_RGXSUBMITTRANSFER2 PVRSRV_BRIDGE_RGXTQ_CMD_FIRST+3
#define PVRSRV_BRIDGE_RGXTQ_RGXSETTRANSFERCONTEXTPROPERTY PVRSRV_BRIDGE_RGXTQ_CMD_FIRST+4
#define PVRSRV_BRIDGE_RGXTQ_CMD_LAST (PVRSRV_BRIDGE_RGXTQ_CMD_FIRST+4)
/*******************************************
RGXCreateTransferContext
*******************************************/
/* Bridge in structure for RGXCreateTransferContext */
typedef struct PVRSRV_BRIDGE_IN_RGXCREATETRANSFERCONTEXT_TAG
{
IMG_UINT64 ui64RobustnessAddress;
IMG_HANDLE hPrivData;
IMG_BYTE *pui8FrameworkCmd;
IMG_UINT32 ui32ContextFlags;
IMG_UINT32 ui32FrameworkCmdize;
IMG_UINT32 ui32PackedCCBSizeU8888;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXCREATETRANSFERCONTEXT;
/* Bridge out structure for RGXCreateTransferContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXCREATETRANSFERCONTEXT_TAG
{
IMG_HANDLE hCLIPMRMem;
IMG_HANDLE hTransferContext;
IMG_HANDLE hUSCPMRMem;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXCREATETRANSFERCONTEXT;
/*******************************************
RGXDestroyTransferContext
*******************************************/
/* Bridge in structure for RGXDestroyTransferContext */
typedef struct PVRSRV_BRIDGE_IN_RGXDESTROYTRANSFERCONTEXT_TAG
{
IMG_HANDLE hTransferContext;
} __packed PVRSRV_BRIDGE_IN_RGXDESTROYTRANSFERCONTEXT;
/* Bridge out structure for RGXDestroyTransferContext */
typedef struct PVRSRV_BRIDGE_OUT_RGXDESTROYTRANSFERCONTEXT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXDESTROYTRANSFERCONTEXT;
/*******************************************
RGXSetTransferContextPriority
*******************************************/
/* Bridge in structure for RGXSetTransferContextPriority */
typedef struct PVRSRV_BRIDGE_IN_RGXSETTRANSFERCONTEXTPRIORITY_TAG
{
IMG_HANDLE hTransferContext;
IMG_UINT32 ui32Priority;
} __packed PVRSRV_BRIDGE_IN_RGXSETTRANSFERCONTEXTPRIORITY;
/* Bridge out structure for RGXSetTransferContextPriority */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETTRANSFERCONTEXTPRIORITY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETTRANSFERCONTEXTPRIORITY;
/*******************************************
RGXSubmitTransfer2
*******************************************/
/* Bridge in structure for RGXSubmitTransfer2 */
typedef struct PVRSRV_BRIDGE_IN_RGXSUBMITTRANSFER2_TAG
{
IMG_HANDLE hTransferContext;
IMG_UINT32 *pui32ClientUpdateCount;
IMG_UINT32 *pui32CommandSize;
IMG_UINT32 *pui32SyncPMRFlags;
IMG_UINT32 *pui32TQPrepareFlags;
IMG_UINT32 **pui32UpdateSyncOffset;
IMG_UINT32 **pui32UpdateValue;
IMG_UINT8 **pui8FWCommand;
IMG_CHAR *puiUpdateFenceName;
IMG_HANDLE *phSyncPMRs;
IMG_HANDLE **phUpdateUFOSyncPrimBlock;
PVRSRV_TIMELINE h2DUpdateTimeline;
PVRSRV_TIMELINE h3DUpdateTimeline;
PVRSRV_FENCE hCheckFenceFD;
IMG_UINT32 ui32ExtJobRef;
IMG_UINT32 ui32PrepareCount;
IMG_UINT32 ui32SyncPMRCount;
} __packed PVRSRV_BRIDGE_IN_RGXSUBMITTRANSFER2;
/* Bridge out structure for RGXSubmitTransfer2 */
typedef struct PVRSRV_BRIDGE_OUT_RGXSUBMITTRANSFER2_TAG
{
PVRSRV_ERROR eError;
PVRSRV_FENCE h2DUpdateFence;
PVRSRV_FENCE h3DUpdateFence;
} __packed PVRSRV_BRIDGE_OUT_RGXSUBMITTRANSFER2;
/*******************************************
RGXSetTransferContextProperty
*******************************************/
/* Bridge in structure for RGXSetTransferContextProperty */
typedef struct PVRSRV_BRIDGE_IN_RGXSETTRANSFERCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Input;
IMG_HANDLE hTransferContext;
IMG_UINT32 ui32Property;
} __packed PVRSRV_BRIDGE_IN_RGXSETTRANSFERCONTEXTPROPERTY;
/* Bridge out structure for RGXSetTransferContextProperty */
typedef struct PVRSRV_BRIDGE_OUT_RGXSETTRANSFERCONTEXTPROPERTY_TAG
{
IMG_UINT64 ui64Output;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RGXSETTRANSFERCONTEXTPROPERTY;
#endif /* COMMON_RGXTQ_BRIDGE_H */

View File

@@ -0,0 +1,225 @@
/*******************************************************************************
@File
@Title Common bridge header for ri
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for ri
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_RI_BRIDGE_H
#define COMMON_RI_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "ri_typedefs.h"
#define PVRSRV_BRIDGE_RI_CMD_FIRST 0
#define PVRSRV_BRIDGE_RI_RIWRITEPMRENTRY PVRSRV_BRIDGE_RI_CMD_FIRST+0
#define PVRSRV_BRIDGE_RI_RIWRITEMEMDESCENTRY PVRSRV_BRIDGE_RI_CMD_FIRST+1
#define PVRSRV_BRIDGE_RI_RIWRITEPROCLISTENTRY PVRSRV_BRIDGE_RI_CMD_FIRST+2
#define PVRSRV_BRIDGE_RI_RIUPDATEMEMDESCADDR PVRSRV_BRIDGE_RI_CMD_FIRST+3
#define PVRSRV_BRIDGE_RI_RIDELETEMEMDESCENTRY PVRSRV_BRIDGE_RI_CMD_FIRST+4
#define PVRSRV_BRIDGE_RI_RIDUMPLIST PVRSRV_BRIDGE_RI_CMD_FIRST+5
#define PVRSRV_BRIDGE_RI_RIDUMPALL PVRSRV_BRIDGE_RI_CMD_FIRST+6
#define PVRSRV_BRIDGE_RI_RIDUMPPROCESS PVRSRV_BRIDGE_RI_CMD_FIRST+7
#define PVRSRV_BRIDGE_RI_RIWRITEPMRENTRYWITHOWNER PVRSRV_BRIDGE_RI_CMD_FIRST+8
#define PVRSRV_BRIDGE_RI_CMD_LAST (PVRSRV_BRIDGE_RI_CMD_FIRST+8)
/*******************************************
RIWritePMREntry
*******************************************/
/* Bridge in structure for RIWritePMREntry */
typedef struct PVRSRV_BRIDGE_IN_RIWRITEPMRENTRY_TAG
{
IMG_HANDLE hPMRHandle;
} __packed PVRSRV_BRIDGE_IN_RIWRITEPMRENTRY;
/* Bridge out structure for RIWritePMREntry */
typedef struct PVRSRV_BRIDGE_OUT_RIWRITEPMRENTRY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIWRITEPMRENTRY;
/*******************************************
RIWriteMEMDESCEntry
*******************************************/
/* Bridge in structure for RIWriteMEMDESCEntry */
typedef struct PVRSRV_BRIDGE_IN_RIWRITEMEMDESCENTRY_TAG
{
IMG_UINT64 ui64Offset;
IMG_UINT64 ui64Size;
IMG_HANDLE hPMRHandle;
const IMG_CHAR *puiTextB;
IMG_BOOL bIsImport;
IMG_BOOL bIsSuballoc;
IMG_UINT32 ui32TextBSize;
} __packed PVRSRV_BRIDGE_IN_RIWRITEMEMDESCENTRY;
/* Bridge out structure for RIWriteMEMDESCEntry */
typedef struct PVRSRV_BRIDGE_OUT_RIWRITEMEMDESCENTRY_TAG
{
IMG_HANDLE hRIHandle;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIWRITEMEMDESCENTRY;
/*******************************************
RIWriteProcListEntry
*******************************************/
/* Bridge in structure for RIWriteProcListEntry */
typedef struct PVRSRV_BRIDGE_IN_RIWRITEPROCLISTENTRY_TAG
{
IMG_UINT64 ui64DevVAddr;
IMG_UINT64 ui64Size;
const IMG_CHAR *puiTextB;
IMG_UINT32 ui32TextBSize;
} __packed PVRSRV_BRIDGE_IN_RIWRITEPROCLISTENTRY;
/* Bridge out structure for RIWriteProcListEntry */
typedef struct PVRSRV_BRIDGE_OUT_RIWRITEPROCLISTENTRY_TAG
{
IMG_HANDLE hRIHandle;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIWRITEPROCLISTENTRY;
/*******************************************
RIUpdateMEMDESCAddr
*******************************************/
/* Bridge in structure for RIUpdateMEMDESCAddr */
typedef struct PVRSRV_BRIDGE_IN_RIUPDATEMEMDESCADDR_TAG
{
IMG_DEV_VIRTADDR sAddr;
IMG_HANDLE hRIHandle;
} __packed PVRSRV_BRIDGE_IN_RIUPDATEMEMDESCADDR;
/* Bridge out structure for RIUpdateMEMDESCAddr */
typedef struct PVRSRV_BRIDGE_OUT_RIUPDATEMEMDESCADDR_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIUPDATEMEMDESCADDR;
/*******************************************
RIDeleteMEMDESCEntry
*******************************************/
/* Bridge in structure for RIDeleteMEMDESCEntry */
typedef struct PVRSRV_BRIDGE_IN_RIDELETEMEMDESCENTRY_TAG
{
IMG_HANDLE hRIHandle;
} __packed PVRSRV_BRIDGE_IN_RIDELETEMEMDESCENTRY;
/* Bridge out structure for RIDeleteMEMDESCEntry */
typedef struct PVRSRV_BRIDGE_OUT_RIDELETEMEMDESCENTRY_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIDELETEMEMDESCENTRY;
/*******************************************
RIDumpList
*******************************************/
/* Bridge in structure for RIDumpList */
typedef struct PVRSRV_BRIDGE_IN_RIDUMPLIST_TAG
{
IMG_HANDLE hPMRHandle;
} __packed PVRSRV_BRIDGE_IN_RIDUMPLIST;
/* Bridge out structure for RIDumpList */
typedef struct PVRSRV_BRIDGE_OUT_RIDUMPLIST_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIDUMPLIST;
/*******************************************
RIDumpAll
*******************************************/
/* Bridge in structure for RIDumpAll */
typedef struct PVRSRV_BRIDGE_IN_RIDUMPALL_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_RIDUMPALL;
/* Bridge out structure for RIDumpAll */
typedef struct PVRSRV_BRIDGE_OUT_RIDUMPALL_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIDUMPALL;
/*******************************************
RIDumpProcess
*******************************************/
/* Bridge in structure for RIDumpProcess */
typedef struct PVRSRV_BRIDGE_IN_RIDUMPPROCESS_TAG
{
IMG_PID ui32Pid;
} __packed PVRSRV_BRIDGE_IN_RIDUMPPROCESS;
/* Bridge out structure for RIDumpProcess */
typedef struct PVRSRV_BRIDGE_OUT_RIDUMPPROCESS_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIDUMPPROCESS;
/*******************************************
RIWritePMREntryWithOwner
*******************************************/
/* Bridge in structure for RIWritePMREntryWithOwner */
typedef struct PVRSRV_BRIDGE_IN_RIWRITEPMRENTRYWITHOWNER_TAG
{
IMG_HANDLE hPMRHandle;
IMG_PID ui32Owner;
} __packed PVRSRV_BRIDGE_IN_RIWRITEPMRENTRYWITHOWNER;
/* Bridge out structure for RIWritePMREntryWithOwner */
typedef struct PVRSRV_BRIDGE_OUT_RIWRITEPMRENTRYWITHOWNER_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RIWRITEPMRENTRYWITHOWNER;
#endif /* COMMON_RI_BRIDGE_H */

View File

@@ -0,0 +1,369 @@
/*******************************************************************************
@File
@Title Common bridge header for srvcore
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for srvcore
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_SRVCORE_BRIDGE_H
#define COMMON_SRVCORE_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "pvrsrv_device_types.h"
#include "cache_ops.h"
#define PVRSRV_BRIDGE_SRVCORE_CMD_FIRST 0
#define PVRSRV_BRIDGE_SRVCORE_CONNECT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+0
#define PVRSRV_BRIDGE_SRVCORE_DISCONNECT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+1
#define PVRSRV_BRIDGE_SRVCORE_ACQUIREGLOBALEVENTOBJECT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+2
#define PVRSRV_BRIDGE_SRVCORE_RELEASEGLOBALEVENTOBJECT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+3
#define PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTOPEN PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+4
#define PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTWAIT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+5
#define PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTCLOSE PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+6
#define PVRSRV_BRIDGE_SRVCORE_DUMPDEBUGINFO PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+7
#define PVRSRV_BRIDGE_SRVCORE_GETDEVCLOCKSPEED PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+8
#define PVRSRV_BRIDGE_SRVCORE_HWOPTIMEOUT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+9
#define PVRSRV_BRIDGE_SRVCORE_ALIGNMENTCHECK PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+10
#define PVRSRV_BRIDGE_SRVCORE_GETDEVICESTATUS PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+11
#define PVRSRV_BRIDGE_SRVCORE_GETMULTICOREINFO PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+12
#define PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTWAITTIMEOUT PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+13
#define PVRSRV_BRIDGE_SRVCORE_FINDPROCESSMEMSTATS PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+14
#define PVRSRV_BRIDGE_SRVCORE_ACQUIREINFOPAGE PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+15
#define PVRSRV_BRIDGE_SRVCORE_RELEASEINFOPAGE PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+16
#define PVRSRV_BRIDGE_SRVCORE_CMD_LAST (PVRSRV_BRIDGE_SRVCORE_CMD_FIRST+16)
/*******************************************
Connect
*******************************************/
/* Bridge in structure for Connect */
typedef struct PVRSRV_BRIDGE_IN_CONNECT_TAG
{
IMG_UINT32 ui32ClientBuildOptions;
IMG_UINT32 ui32ClientDDKBuild;
IMG_UINT32 ui32ClientDDKVersion;
IMG_UINT32 ui32Flags;
} __packed PVRSRV_BRIDGE_IN_CONNECT;
/* Bridge out structure for Connect */
typedef struct PVRSRV_BRIDGE_OUT_CONNECT_TAG
{
IMG_UINT64 ui64PackedBvnc;
PVRSRV_ERROR eError;
IMG_UINT32 ui32CapabilityFlags;
IMG_UINT8 ui8KernelArch;
} __packed PVRSRV_BRIDGE_OUT_CONNECT;
/*******************************************
Disconnect
*******************************************/
/* Bridge in structure for Disconnect */
typedef struct PVRSRV_BRIDGE_IN_DISCONNECT_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_DISCONNECT;
/* Bridge out structure for Disconnect */
typedef struct PVRSRV_BRIDGE_OUT_DISCONNECT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DISCONNECT;
/*******************************************
AcquireGlobalEventObject
*******************************************/
/* Bridge in structure for AcquireGlobalEventObject */
typedef struct PVRSRV_BRIDGE_IN_ACQUIREGLOBALEVENTOBJECT_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_ACQUIREGLOBALEVENTOBJECT;
/* Bridge out structure for AcquireGlobalEventObject */
typedef struct PVRSRV_BRIDGE_OUT_ACQUIREGLOBALEVENTOBJECT_TAG
{
IMG_HANDLE hGlobalEventObject;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_ACQUIREGLOBALEVENTOBJECT;
/*******************************************
ReleaseGlobalEventObject
*******************************************/
/* Bridge in structure for ReleaseGlobalEventObject */
typedef struct PVRSRV_BRIDGE_IN_RELEASEGLOBALEVENTOBJECT_TAG
{
IMG_HANDLE hGlobalEventObject;
} __packed PVRSRV_BRIDGE_IN_RELEASEGLOBALEVENTOBJECT;
/* Bridge out structure for ReleaseGlobalEventObject */
typedef struct PVRSRV_BRIDGE_OUT_RELEASEGLOBALEVENTOBJECT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RELEASEGLOBALEVENTOBJECT;
/*******************************************
EventObjectOpen
*******************************************/
/* Bridge in structure for EventObjectOpen */
typedef struct PVRSRV_BRIDGE_IN_EVENTOBJECTOPEN_TAG
{
IMG_HANDLE hEventObject;
} __packed PVRSRV_BRIDGE_IN_EVENTOBJECTOPEN;
/* Bridge out structure for EventObjectOpen */
typedef struct PVRSRV_BRIDGE_OUT_EVENTOBJECTOPEN_TAG
{
IMG_HANDLE hOSEvent;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_EVENTOBJECTOPEN;
/*******************************************
EventObjectWait
*******************************************/
/* Bridge in structure for EventObjectWait */
typedef struct PVRSRV_BRIDGE_IN_EVENTOBJECTWAIT_TAG
{
IMG_HANDLE hOSEventKM;
} __packed PVRSRV_BRIDGE_IN_EVENTOBJECTWAIT;
/* Bridge out structure for EventObjectWait */
typedef struct PVRSRV_BRIDGE_OUT_EVENTOBJECTWAIT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_EVENTOBJECTWAIT;
/*******************************************
EventObjectClose
*******************************************/
/* Bridge in structure for EventObjectClose */
typedef struct PVRSRV_BRIDGE_IN_EVENTOBJECTCLOSE_TAG
{
IMG_HANDLE hOSEventKM;
} __packed PVRSRV_BRIDGE_IN_EVENTOBJECTCLOSE;
/* Bridge out structure for EventObjectClose */
typedef struct PVRSRV_BRIDGE_OUT_EVENTOBJECTCLOSE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_EVENTOBJECTCLOSE;
/*******************************************
DumpDebugInfo
*******************************************/
/* Bridge in structure for DumpDebugInfo */
typedef struct PVRSRV_BRIDGE_IN_DUMPDEBUGINFO_TAG
{
IMG_UINT32 ui32VerbLevel;
} __packed PVRSRV_BRIDGE_IN_DUMPDEBUGINFO;
/* Bridge out structure for DumpDebugInfo */
typedef struct PVRSRV_BRIDGE_OUT_DUMPDEBUGINFO_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_DUMPDEBUGINFO;
/*******************************************
GetDevClockSpeed
*******************************************/
/* Bridge in structure for GetDevClockSpeed */
typedef struct PVRSRV_BRIDGE_IN_GETDEVCLOCKSPEED_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_GETDEVCLOCKSPEED;
/* Bridge out structure for GetDevClockSpeed */
typedef struct PVRSRV_BRIDGE_OUT_GETDEVCLOCKSPEED_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32ClockSpeed;
} __packed PVRSRV_BRIDGE_OUT_GETDEVCLOCKSPEED;
/*******************************************
HWOpTimeout
*******************************************/
/* Bridge in structure for HWOpTimeout */
typedef struct PVRSRV_BRIDGE_IN_HWOPTIMEOUT_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_HWOPTIMEOUT;
/* Bridge out structure for HWOpTimeout */
typedef struct PVRSRV_BRIDGE_OUT_HWOPTIMEOUT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_HWOPTIMEOUT;
/*******************************************
AlignmentCheck
*******************************************/
/* Bridge in structure for AlignmentCheck */
typedef struct PVRSRV_BRIDGE_IN_ALIGNMENTCHECK_TAG
{
IMG_UINT32 *pui32AlignChecks;
IMG_UINT32 ui32AlignChecksSize;
} __packed PVRSRV_BRIDGE_IN_ALIGNMENTCHECK;
/* Bridge out structure for AlignmentCheck */
typedef struct PVRSRV_BRIDGE_OUT_ALIGNMENTCHECK_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_ALIGNMENTCHECK;
/*******************************************
GetDeviceStatus
*******************************************/
/* Bridge in structure for GetDeviceStatus */
typedef struct PVRSRV_BRIDGE_IN_GETDEVICESTATUS_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_GETDEVICESTATUS;
/* Bridge out structure for GetDeviceStatus */
typedef struct PVRSRV_BRIDGE_OUT_GETDEVICESTATUS_TAG
{
PVRSRV_ERROR eError;
IMG_UINT32 ui32DeviceSatus;
} __packed PVRSRV_BRIDGE_OUT_GETDEVICESTATUS;
/*******************************************
GetMultiCoreInfo
*******************************************/
/* Bridge in structure for GetMultiCoreInfo */
typedef struct PVRSRV_BRIDGE_IN_GETMULTICOREINFO_TAG
{
IMG_UINT64 *pui64Caps;
IMG_UINT32 ui32CapsSize;
} __packed PVRSRV_BRIDGE_IN_GETMULTICOREINFO;
/* Bridge out structure for GetMultiCoreInfo */
typedef struct PVRSRV_BRIDGE_OUT_GETMULTICOREINFO_TAG
{
IMG_UINT64 *pui64Caps;
PVRSRV_ERROR eError;
IMG_UINT32 ui32NumCores;
} __packed PVRSRV_BRIDGE_OUT_GETMULTICOREINFO;
/*******************************************
EventObjectWaitTimeout
*******************************************/
/* Bridge in structure for EventObjectWaitTimeout */
typedef struct PVRSRV_BRIDGE_IN_EVENTOBJECTWAITTIMEOUT_TAG
{
IMG_UINT64 ui64uiTimeoutus;
IMG_HANDLE hOSEventKM;
} __packed PVRSRV_BRIDGE_IN_EVENTOBJECTWAITTIMEOUT;
/* Bridge out structure for EventObjectWaitTimeout */
typedef struct PVRSRV_BRIDGE_OUT_EVENTOBJECTWAITTIMEOUT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_EVENTOBJECTWAITTIMEOUT;
/*******************************************
FindProcessMemStats
*******************************************/
/* Bridge in structure for FindProcessMemStats */
typedef struct PVRSRV_BRIDGE_IN_FINDPROCESSMEMSTATS_TAG
{
IMG_UINT32 *pui32MemStatsArray;
IMG_BOOL bbAllProcessStats;
IMG_UINT32 ui32ArrSize;
IMG_UINT32 ui32PID;
} __packed PVRSRV_BRIDGE_IN_FINDPROCESSMEMSTATS;
/* Bridge out structure for FindProcessMemStats */
typedef struct PVRSRV_BRIDGE_OUT_FINDPROCESSMEMSTATS_TAG
{
IMG_UINT32 *pui32MemStatsArray;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_FINDPROCESSMEMSTATS;
/*******************************************
AcquireInfoPage
*******************************************/
/* Bridge in structure for AcquireInfoPage */
typedef struct PVRSRV_BRIDGE_IN_ACQUIREINFOPAGE_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_ACQUIREINFOPAGE;
/* Bridge out structure for AcquireInfoPage */
typedef struct PVRSRV_BRIDGE_OUT_ACQUIREINFOPAGE_TAG
{
IMG_HANDLE hPMR;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_ACQUIREINFOPAGE;
/*******************************************
ReleaseInfoPage
*******************************************/
/* Bridge in structure for ReleaseInfoPage */
typedef struct PVRSRV_BRIDGE_IN_RELEASEINFOPAGE_TAG
{
IMG_HANDLE hPMR;
} __packed PVRSRV_BRIDGE_IN_RELEASEINFOPAGE;
/* Bridge out structure for ReleaseInfoPage */
typedef struct PVRSRV_BRIDGE_OUT_RELEASEINFOPAGE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_RELEASEINFOPAGE;
#endif /* COMMON_SRVCORE_BRIDGE_H */

View File

@@ -0,0 +1,254 @@
/*******************************************************************************
@File
@Title Common bridge header for sync
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for sync
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_SYNC_BRIDGE_H
#define COMMON_SYNC_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "pdump.h"
#include "pdumpdefs.h"
#include "devicemem_typedefs.h"
#include "pvrsrv_sync_km.h"
#include <powervr/pvrsrv_sync_ext.h>
#define PVRSRV_BRIDGE_SYNC_CMD_FIRST 0
#define PVRSRV_BRIDGE_SYNC_ALLOCSYNCPRIMITIVEBLOCK PVRSRV_BRIDGE_SYNC_CMD_FIRST+0
#define PVRSRV_BRIDGE_SYNC_FREESYNCPRIMITIVEBLOCK PVRSRV_BRIDGE_SYNC_CMD_FIRST+1
#define PVRSRV_BRIDGE_SYNC_SYNCPRIMSET PVRSRV_BRIDGE_SYNC_CMD_FIRST+2
#define PVRSRV_BRIDGE_SYNC_SYNCPRIMPDUMP PVRSRV_BRIDGE_SYNC_CMD_FIRST+3
#define PVRSRV_BRIDGE_SYNC_SYNCPRIMPDUMPVALUE PVRSRV_BRIDGE_SYNC_CMD_FIRST+4
#define PVRSRV_BRIDGE_SYNC_SYNCPRIMPDUMPPOL PVRSRV_BRIDGE_SYNC_CMD_FIRST+5
#define PVRSRV_BRIDGE_SYNC_SYNCPRIMPDUMPCBP PVRSRV_BRIDGE_SYNC_CMD_FIRST+6
#define PVRSRV_BRIDGE_SYNC_SYNCALLOCEVENT PVRSRV_BRIDGE_SYNC_CMD_FIRST+7
#define PVRSRV_BRIDGE_SYNC_SYNCFREEEVENT PVRSRV_BRIDGE_SYNC_CMD_FIRST+8
#define PVRSRV_BRIDGE_SYNC_SYNCCHECKPOINTSIGNALLEDPDUMPPOL PVRSRV_BRIDGE_SYNC_CMD_FIRST+9
#define PVRSRV_BRIDGE_SYNC_CMD_LAST (PVRSRV_BRIDGE_SYNC_CMD_FIRST+9)
/*******************************************
AllocSyncPrimitiveBlock
*******************************************/
/* Bridge in structure for AllocSyncPrimitiveBlock */
typedef struct PVRSRV_BRIDGE_IN_ALLOCSYNCPRIMITIVEBLOCK_TAG
{
IMG_UINT32 ui32EmptyStructPlaceholder;
} __packed PVRSRV_BRIDGE_IN_ALLOCSYNCPRIMITIVEBLOCK;
/* Bridge out structure for AllocSyncPrimitiveBlock */
typedef struct PVRSRV_BRIDGE_OUT_ALLOCSYNCPRIMITIVEBLOCK_TAG
{
IMG_HANDLE hSyncHandle;
IMG_HANDLE hhSyncPMR;
PVRSRV_ERROR eError;
IMG_UINT32 ui32SyncPrimBlockSize;
IMG_UINT32 ui32SyncPrimVAddr;
} __packed PVRSRV_BRIDGE_OUT_ALLOCSYNCPRIMITIVEBLOCK;
/*******************************************
FreeSyncPrimitiveBlock
*******************************************/
/* Bridge in structure for FreeSyncPrimitiveBlock */
typedef struct PVRSRV_BRIDGE_IN_FREESYNCPRIMITIVEBLOCK_TAG
{
IMG_HANDLE hSyncHandle;
} __packed PVRSRV_BRIDGE_IN_FREESYNCPRIMITIVEBLOCK;
/* Bridge out structure for FreeSyncPrimitiveBlock */
typedef struct PVRSRV_BRIDGE_OUT_FREESYNCPRIMITIVEBLOCK_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_FREESYNCPRIMITIVEBLOCK;
/*******************************************
SyncPrimSet
*******************************************/
/* Bridge in structure for SyncPrimSet */
typedef struct PVRSRV_BRIDGE_IN_SYNCPRIMSET_TAG
{
IMG_HANDLE hSyncHandle;
IMG_UINT32 ui32Index;
IMG_UINT32 ui32Value;
} __packed PVRSRV_BRIDGE_IN_SYNCPRIMSET;
/* Bridge out structure for SyncPrimSet */
typedef struct PVRSRV_BRIDGE_OUT_SYNCPRIMSET_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCPRIMSET;
/*******************************************
SyncPrimPDump
*******************************************/
/* Bridge in structure for SyncPrimPDump */
typedef struct PVRSRV_BRIDGE_IN_SYNCPRIMPDUMP_TAG
{
IMG_HANDLE hSyncHandle;
IMG_UINT32 ui32Offset;
} __packed PVRSRV_BRIDGE_IN_SYNCPRIMPDUMP;
/* Bridge out structure for SyncPrimPDump */
typedef struct PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMP_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMP;
/*******************************************
SyncPrimPDumpValue
*******************************************/
/* Bridge in structure for SyncPrimPDumpValue */
typedef struct PVRSRV_BRIDGE_IN_SYNCPRIMPDUMPVALUE_TAG
{
IMG_HANDLE hSyncHandle;
IMG_UINT32 ui32Offset;
IMG_UINT32 ui32Value;
} __packed PVRSRV_BRIDGE_IN_SYNCPRIMPDUMPVALUE;
/* Bridge out structure for SyncPrimPDumpValue */
typedef struct PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMPVALUE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMPVALUE;
/*******************************************
SyncPrimPDumpPol
*******************************************/
/* Bridge in structure for SyncPrimPDumpPol */
typedef struct PVRSRV_BRIDGE_IN_SYNCPRIMPDUMPPOL_TAG
{
IMG_HANDLE hSyncHandle;
PDUMP_POLL_OPERATOR eOperator;
IMG_UINT32 ui32Mask;
IMG_UINT32 ui32Offset;
IMG_UINT32 ui32Value;
PDUMP_FLAGS_T uiPDumpFlags;
} __packed PVRSRV_BRIDGE_IN_SYNCPRIMPDUMPPOL;
/* Bridge out structure for SyncPrimPDumpPol */
typedef struct PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMPPOL_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMPPOL;
/*******************************************
SyncPrimPDumpCBP
*******************************************/
/* Bridge in structure for SyncPrimPDumpCBP */
typedef struct PVRSRV_BRIDGE_IN_SYNCPRIMPDUMPCBP_TAG
{
IMG_DEVMEM_SIZE_T uiBufferSize;
IMG_DEVMEM_SIZE_T uiPacketSize;
IMG_DEVMEM_OFFSET_T uiWriteOffset;
IMG_HANDLE hSyncHandle;
IMG_UINT32 ui32Offset;
} __packed PVRSRV_BRIDGE_IN_SYNCPRIMPDUMPCBP;
/* Bridge out structure for SyncPrimPDumpCBP */
typedef struct PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMPCBP_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCPRIMPDUMPCBP;
/*******************************************
SyncAllocEvent
*******************************************/
/* Bridge in structure for SyncAllocEvent */
typedef struct PVRSRV_BRIDGE_IN_SYNCALLOCEVENT_TAG
{
const IMG_CHAR *puiClassName;
IMG_BOOL bServerSync;
IMG_UINT32 ui32ClassNameSize;
IMG_UINT32 ui32FWAddr;
} __packed PVRSRV_BRIDGE_IN_SYNCALLOCEVENT;
/* Bridge out structure for SyncAllocEvent */
typedef struct PVRSRV_BRIDGE_OUT_SYNCALLOCEVENT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCALLOCEVENT;
/*******************************************
SyncFreeEvent
*******************************************/
/* Bridge in structure for SyncFreeEvent */
typedef struct PVRSRV_BRIDGE_IN_SYNCFREEEVENT_TAG
{
IMG_UINT32 ui32FWAddr;
} __packed PVRSRV_BRIDGE_IN_SYNCFREEEVENT;
/* Bridge out structure for SyncFreeEvent */
typedef struct PVRSRV_BRIDGE_OUT_SYNCFREEEVENT_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCFREEEVENT;
/*******************************************
SyncCheckpointSignalledPDumpPol
*******************************************/
/* Bridge in structure for SyncCheckpointSignalledPDumpPol */
typedef struct PVRSRV_BRIDGE_IN_SYNCCHECKPOINTSIGNALLEDPDUMPPOL_TAG
{
PVRSRV_FENCE hFence;
} __packed PVRSRV_BRIDGE_IN_SYNCCHECKPOINTSIGNALLEDPDUMPPOL;
/* Bridge out structure for SyncCheckpointSignalledPDumpPol */
typedef struct PVRSRV_BRIDGE_OUT_SYNCCHECKPOINTSIGNALLEDPDUMPPOL_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCCHECKPOINTSIGNALLEDPDUMPPOL;
#endif /* COMMON_SYNC_BRIDGE_H */

View File

@@ -0,0 +1,97 @@
/*******************************************************************************
@File
@Title Common bridge header for synctracking
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Declares common defines and structures used by both the client
and server side of the bridge for synctracking
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
#ifndef COMMON_SYNCTRACKING_BRIDGE_H
#define COMMON_SYNCTRACKING_BRIDGE_H
#include <powervr/mem_types.h>
#include "img_defs.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#define PVRSRV_BRIDGE_SYNCTRACKING_CMD_FIRST 0
#define PVRSRV_BRIDGE_SYNCTRACKING_SYNCRECORDREMOVEBYHANDLE PVRSRV_BRIDGE_SYNCTRACKING_CMD_FIRST+0
#define PVRSRV_BRIDGE_SYNCTRACKING_SYNCRECORDADD PVRSRV_BRIDGE_SYNCTRACKING_CMD_FIRST+1
#define PVRSRV_BRIDGE_SYNCTRACKING_CMD_LAST (PVRSRV_BRIDGE_SYNCTRACKING_CMD_FIRST+1)
/*******************************************
SyncRecordRemoveByHandle
*******************************************/
/* Bridge in structure for SyncRecordRemoveByHandle */
typedef struct PVRSRV_BRIDGE_IN_SYNCRECORDREMOVEBYHANDLE_TAG
{
IMG_HANDLE hhRecord;
} __packed PVRSRV_BRIDGE_IN_SYNCRECORDREMOVEBYHANDLE;
/* Bridge out structure for SyncRecordRemoveByHandle */
typedef struct PVRSRV_BRIDGE_OUT_SYNCRECORDREMOVEBYHANDLE_TAG
{
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCRECORDREMOVEBYHANDLE;
/*******************************************
SyncRecordAdd
*******************************************/
/* Bridge in structure for SyncRecordAdd */
typedef struct PVRSRV_BRIDGE_IN_SYNCRECORDADD_TAG
{
IMG_HANDLE hhServerSyncPrimBlock;
const IMG_CHAR *puiClassName;
IMG_BOOL bbServerSync;
IMG_UINT32 ui32ClassNameSize;
IMG_UINT32 ui32ui32FwBlockAddr;
IMG_UINT32 ui32ui32SyncOffset;
} __packed PVRSRV_BRIDGE_IN_SYNCRECORDADD;
/* Bridge out structure for SyncRecordAdd */
typedef struct PVRSRV_BRIDGE_OUT_SYNCRECORDADD_TAG
{
IMG_HANDLE hhRecord;
PVRSRV_ERROR eError;
} __packed PVRSRV_BRIDGE_OUT_SYNCRECORDADD;
#endif /* COMMON_SYNCTRACKING_BRIDGE_H */

View File

@@ -0,0 +1,163 @@
#define PVRSRV_APPHINT_FIRMWARE_HEAP_POLICY 5
#define PVRSRV_ENABLE_CCCB_GROW
#define RGX_FW_FILENAME "rgx.fw"
#define RGX_SH_FILENAME "rgx.sh"
#define PVR_BUILD_DIR "thead_linux"
#define PVRSRV_MODNAME "pvrsrvkm"
#define PVRSYNC_MODNAME "pvr_sync"
#define SUPPORT_RGX 1
#define DISPLAY_CONTROLLER drm_nulldisp
#define PVRSRV_HWPERF_COUNTERS_PERBLK 12
#define RGX_BVNC_CORE_KM_HEADER "cores/rgxcore_km_36.52.104.182.h"
#define RGX_BNC_CONFIG_KM_HEADER "configs/rgxconfig_km_36.V.104.182.h"
#define PVRSRV_NEED_PVR_DPF
#define SUPPORT_PHYSMEM_TEST
#define SUPPORT_RGXTQ_BRIDGE
#define PVRSRV_POISON_ON_ALLOC_VALUE 0xd9
#define PVRSRV_POISON_ON_FREE_VALUE 0x63
#define RGX_NUM_OS_SUPPORTED 1
#define RGX_OSID_0_DEFAULT_PRIORITY (1 - 0)
#define RGX_OSID_1_DEFAULT_PRIORITY (1 - 1)
#define RGX_OSID_2_DEFAULT_PRIORITY (1 - 2)
#define RGX_OSID_3_DEFAULT_PRIORITY (1 - 3)
#define RGX_OSID_4_DEFAULT_PRIORITY (1 - 4)
#define RGX_OSID_5_DEFAULT_PRIORITY (1 - 5)
#define RGX_OSID_6_DEFAULT_PRIORITY (1 - 6)
#define RGX_OSID_7_DEFAULT_PRIORITY (1 - 7)
#define RGX_HCS_DEFAULT_DEADLINE_MS 0xFFFFFFFFU
#define PVRSRV_APPHINT_DRIVERMODE 0x7FFFFFFF
#define RGX_FW_HEAP_SHIFT 25
#define SUPPORT_POWMON_COMPONENT
#define PVR_POWER_ACTOR_MEASUREMENT_PERIOD_MS 10U
#define PVR_POWER_MONITOR_HWPERF
#define PVR_LDM_PLATFORM_PRE_REGISTERED
#define PVR_LDM_DRIVER_REGISTRATION_NAME "pvrsrvkm"
#define PVRSRV_FULL_SYNC_TRACKING_HISTORY_LEN 256
#define ION_DEFAULT_HEAP_NAME "ion_system_heap"
#define ION_DEFAULT_HEAP_ID_MASK (1 << ION_HEAP_TYPE_SYSTEM)
#define PVRSRV_APPHINT_HWRDEBUGDUMPLIMIT APPHNT_BLDVAR_DBGDUMPLIMIT
#define PVRSRV_APPHINT_ENABLETRUSTEDDEVICEACECONFIG IMG_FALSE
#define PVRSRV_APPHINT_GENERALNON4KHEAPPAGESIZE 0x4000
#define PVRSRV_APPHINT_HWPERFCLIENTBUFFERSIZE 786432
#define PVRSRV_APPHINT_ENABLESIGNATURECHECKS APPHNT_BLDVAR_ENABLESIGNATURECHECKS
#define PVRSRV_APPHINT_SIGNATURECHECKSBUFSIZE RGXFW_SIG_BUFFER_SIZE_MIN
#define PVRSRV_APPHINT_ENABLEFULLSYNCTRACKING IMG_FALSE
#define PVRSRV_APPHINT_ENABLEPAGEFAULTDEBUG APPHNT_BLDVAR_ENABLEPAGEFAULTDEBUG
#define PVRSRV_APPHINT_VALIDATEIRQ 0
#define PVRSRV_APPHINT_DISABLECLOCKGATING 0
#define PVRSRV_APPHINT_DISABLEDMOVERLAP 0
#define PVRSRV_APPHINT_ENABLECDMKILLINGRANDMODE 0
#define PVRSRV_APPHINT_ENABLERANDOMCONTEXTSWITCH 0
#define PVRSRV_APPHINT_ENABLESOFTRESETCNTEXTSWITCH 0
#define PVRSRV_APPHINT_ENABLEFWCONTEXTSWITCH RGXFWIF_INICFG_OS_CTXSWITCH_DM_ALL
#define PVRSRV_APPHINT_ENABLERDPOWERISLAND RGX_RD_POWER_ISLAND_DEFAULT
#define PVRSRV_APPHINT_FIRMWAREPERF FW_PERF_CONF_NONE
#define PVRSRV_APPHINT_FWCONTEXTSWITCHPROFILE RGXFWIF_CTXSWITCH_PROFILE_MEDIUM_EN
#define PVRSRV_APPHINT_HWPERFDISABLECUSTOMCOUNTERFILTER 0
#define PVRSRV_APPHINT_HWPERFFWBUFSIZEINKB 2048
#define PVRSRV_APPHINT_HWPERFHOSTBUFSIZEINKB 2048
#define PVRSRV_APPHINT_HWPERFHOSTTHREADTIMEOUTINMS 50
#define PVRSRV_APPHINT_TFBCCOMPRESSIONCONTROLGROUP 0
#define PVRSRV_APPHINT_TFBCCOMPRESSIONCONTROLSCHEME 0
#define PVRSRV_APPHINT_JONESDISABLEMASK 0
#define PVRSRV_APPHINT_NEWFILTERINGMODE 1
#define PVRSRV_APPHINT_TRUNCATEMODE 0
#define PVRSRV_APPHINT_EMUMAXFREQ 0
#define PVRSRV_APPHINT_GPIOVALIDATIONMODE 0
#define PVRSRV_APPHINT_RGXBVNC ""
#define PVRSRV_APPHINT_CLEANUPTHREADPRIORITY 5
#define PVRSRV_APPHINT_WATCHDOGTHREADPRIORITY 0
#define PVRSRV_APPHINT_CACHEOPTHREADPRIORITY 1
#define PVRSRV_APPHINT_ASSERTONHWRTRIGGER IMG_FALSE
#define PVRSRV_APPHINT_ASSERTOUTOFMEMORY IMG_FALSE
#define PVRSRV_APPHINT_CHECKMLIST APPHNT_BLDVAR_DEBUG
#define PVRSRV_APPHINT_DISABLEFEDLOGGING IMG_FALSE
#define PVRSRV_APPHINT_KCCB_SIZE_LOG2 7
#define PVRSRV_APPHINT_ENABLEAPM RGX_ACTIVEPM_DEFAULT
#define PVRSRV_APPHINT_ENABLEHTBLOGGROUP 0
#define PVRSRV_APPHINT_ENABLELOGGROUP RGXFWIF_LOG_TYPE_NONE
#define PVRSRV_APPHINT_FIRMWARELOGTYPE 0
#define PVRSRV_APPHINT_FWTRACEBUFSIZEINDWORDS RGXFW_TRACE_BUF_DEFAULT_SIZE_IN_DWORDS
#define PVRSRV_APPHINT_FBCDCVERSIONOVERRIDE 0
#define PVRSRV_APPHINT_HTBOPERATIONMODE HTB_OPMODE_DROPOLDEST
#define PVRSRV_APPHINT_HTBUFFERSIZE 64
#define PVRSRV_APPHINT_ENABLEFTRACEGPU IMG_FALSE
#define PVRSRV_APPHINT_HWPERFFWFILTER 0
#define PVRSRV_APPHINT_HWPERFHOSTFILTER 0
#define PVRSRV_APPHINT_HWPERFCLIENTFILTER_SERVICES 0
#define PVRSRV_APPHINT_HWPERFCLIENTFILTER_EGL 0
#define PVRSRV_APPHINT_HWPERFCLIENTFILTER_OPENGLES 0
#define PVRSRV_APPHINT_HWPERFCLIENTFILTER_OPENCL 0
#define PVRSRV_APPHINT_HWPERFCLIENTFILTER_VULKAN 0
#define PVRSRV_APPHINT_HWPERFCLIENTFILTER_OPENGL 0
#define PVRSRV_APPHINT_TIMECORRCLOCK 0
#define PVRSRV_APPHINT_ENABLEFWPOISONONFREE IMG_FALSE
#define PVRSRV_APPHINT_FWPOISONONFREEVALUE 0xBD
#define PVRSRV_APPHINT_ZEROFREELIST IMG_FALSE
#define PVRSRV_APPHINT_GPUUNITSPOWERCHANGE IMG_FALSE
#define PVRSRV_APPHINT_DISABLEPDUMPPANIC IMG_FALSE
#define PVRSRV_APPHINT_CACHEOPCONFIG 0
#define PVRSRV_APPHINT_CACHEOPUMKMHRESHOLDSIZE 0
#define PVRSRV_APPHINT_IGNOREHWREPORTEDBVNC IMG_FALSE
#define PVRSRV_APPHINT_PHYSMEMTESTPASSES APPHNT_PHYSMEMTEST_ENABLE
#define PVRSRV_APPHINT_TESTSLRINTERVAL 0
#define PVRSRV_APPHINT_RISCVDMITEST 0
#define PVRSRV_APPHINT_VALIDATESOCUSCTIMERS 0
#define SOC_TIMER_FREQ 20
#define PDVFS_COM_HOST 1
#define PDVFS_COM_AP 2
#define PDVFS_COM_PMC 3
#define PDVFS_COM_IMG_CLKDIV 4
#define PDVFS_COM PDVFS_COM_HOST
#define PVR_GPIO_MODE_GENERAL 1
#define PVR_GPIO_MODE_POWMON_PIN 2
#define PVR_GPIO_MODE PVR_GPIO_MODE_GENERAL
#define PVRSRV_ENABLE_PROCESS_STATS
#define SUPPORT_USC_BREAKPOINT
#define SUPPORT_AGP
#define RGXFW_SAFETY_WATCHDOG_PERIOD_IN_US 1000000
#define PVRSRV_DEVICE_INIT_MODE PVRSRV_LINUX_DEV_INIT_ON_CONNECT
#define SUPPORT_DI_BRG_IMPL
#define PVR_LINUX_PHYSMEM_MAX_POOL_PAGES 10240
#define PVR_LINUX_PHYSMEM_MAX_EXCESS_POOL_PAGES 20480
#define PVR_DIRTY_BYTES_FLUSH_THRESHOLD 524288
#define PVR_LINUX_HIGHORDER_ALLOCATION_THRESHOLD 256
#define PVR_LINUX_PHYSMEM_MAX_ALLOC_ORDER_NUM 2
#define PVR_LINUX_KMALLOC_ALLOCATION_THRESHOLD 16384
#define SUPPORT_NATIVE_FENCE_SYNC
#define PVRSRV_STALLED_CCB_ACTION
#define UPDATE_FENCE_CHECKPOINT_COUNT 1
#define PVR_DRM_NAME "pvr"
#define DEVICE_MEMSETCPY_ALIGN_IN_BYTES 16
#define DISABLE_GPU_FREQUENCY_CALIBRATION
#define RGX_INITIAL_SLR_HOLDOFF_PERIOD_MS 0
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_TQ3D 14
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_TQ2D 14
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_CDM 13
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_TA 15
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_3D 16
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_KICKSYNC 13
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_TDM 14
#define PVRSRV_RGX_LOG2_CLIENT_CCB_SIZE_RDM 13
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_TQ3D 17
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_TQ2D 17
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_CDM 15
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_TA 16
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_3D 17
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_KICKSYNC 13
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_TDM 17
#define PVRSRV_RGX_LOG2_CLIENT_CCB_MAX_SIZE_RDM 15
#define SUPPORT_BUFFER_SYNC 1
#ifdef CONFIG_DRM_POWERVR_ROGUE_DEBUG
#define DEBUG
#define DEBUG_BRIDGE_KM
#define PVRSRV_ENABLE_GPU_MEMORY_INFO
#define PVRSRV_ENABLE_SYNC_POISONING
#define PVR_ANNOTATION_MAX_LEN 96
#define PVR_BUILD_TYPE "debug"
#define TRACK_FW_BOOT
#else
#define PVR_ANNOTATION_MAX_LEN 63
#define PVR_BUILD_TYPE "release"
#define RELEASE
#endif

View File

@@ -0,0 +1,53 @@
override PVRSRV_DIR := services
override HOST_PRIMARY_ARCH := host_x86_64
override HOST_32BIT_ARCH := host_i386
override HOST_FORCE_32BIT := -m32
override HOST_ALL_ARCH := host_x86_64 host_i386
override TARGET_PRIMARY_ARCH := target_riscv64
override TARGET_SECONDARY_ARCH :=
override TARGET_ALL_ARCH := target_riscv64
override TARGET_FORCE_32BIT :=
override PVR_ARCH := rogue
override METAG_VERSION_NEEDED := 2.8.1.0.3
override MIPS_VERSION_NEEDED := 2014.07-1
override RISCV_VERSION_NEEDED := 1.0.1
override KERNEL_COMPONENTS := srvkm drm_nulldisp
override WINDOW_SYSTEM := wayland
override PVRSRV_MODNAME := pvrsrvkm
override PVR_BUILD_DIR := thead_linux
override SUPPORT_RGX := 1
override DISPLAY_CONTROLLER := drm_nulldisp
override PVR_SYSTEM := rgx_thead
override PVR_LOADER :=
override SORT_BRIDGE_STRUCTS := 1
override DEBUGLINK := 1
override RGX_BNC := 36.V.104.182
override SUPPORT_PHYSMEM_TEST := 1
override SUPPORT_MIPS_64K_PAGE_SIZE :=
override RGX_NUM_OS_SUPPORTED := 1
override VMM_TYPE := stub
override SUPPORT_POWMON_COMPONENT := 1
override RGX_TIMECORR_CLOCK := mono
override PDVFS_COM_HOST := 1
override PDVFS_COM_AP := 2
override PDVFS_COM_PMC := 3
override PDVFS_COM_IMG_CLKDIV := 4
override PDVFS_COM := PDVFS_COM_HOST
override PVR_GPIO_MODE_GENERAL := 1
override PVR_GPIO_MODE_POWMON_PIN := 2
override PVR_GPIO_MODE := PVR_GPIO_MODE_GENERAL
override PVR_HANDLE_BACKEND := idr
override SUPPORT_DMABUF_BRIDGE := 1
override SUPPORT_USC_BREAKPOINT := 1
override SUPPORT_DI_BRG_IMPL := 1
override SUPPORT_NATIVE_FENCE_SYNC := 1
override SUPPORT_DMA_FENCE := 1
override SUPPORT_BUFFER_SYNC := 1
ifeq ($(CONFIG_DRM_POWERVR_ROGUE_DEBUG),y)
override BUILD := debug
override PVRSRV_ENABLE_GPU_MEMORY_INFO := 1
override PVR_BUILD_TYPE := debug
else
override BUILD := release
override PVR_BUILD_TYPE := release
endif

View File

@@ -0,0 +1,80 @@
/*************************************************************************/ /*!
@Title RGX Configuration for BVNC 1.V.4.5 (kernel defines)
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef RGXCONFIG_KM_1_V_4_5_H
#define RGXCONFIG_KM_1_V_4_5_H
/***** Automatically generated file. Do not edit manually ********************/
/******************************************************************************
* B.V.N.C Validation defines
*****************************************************************************/
#define RGX_BNC_KM_B 1
#define RGX_BNC_KM_N 4
#define RGX_BNC_KM_C 5
/******************************************************************************
* DDK Defines
*****************************************************************************/
#define RGX_FEATURE_CDM_CONTROL_STREAM_FORMAT (1U)
#define RGX_FEATURE_COMPUTE
#define RGX_FEATURE_COMPUTE_OVERLAP
#define RGX_FEATURE_FBCDC_ALGORITHM (1U)
#define RGX_FEATURE_FBCDC_ARCHITECTURE (1U)
#define RGX_FEATURE_FBC_MAX_DEFAULT_DESCRIPTORS (0U)
#define RGX_FEATURE_FBC_MAX_LARGE_DESCRIPTORS (0U)
#define RGX_FEATURE_GS_RTA_SUPPORT
#define RGX_FEATURE_LAYOUT_MARS (0U)
#define RGX_FEATURE_META (MTP218)
#define RGX_FEATURE_META_COREMEM_SIZE (0U)
#define RGX_FEATURE_NUM_CLUSTERS (4U)
#define RGX_FEATURE_NUM_ISP_IPP_PIPES (3U)
#define RGX_FEATURE_NUM_RASTER_PIPES (1U)
#define RGX_FEATURE_PERFBUS
#define RGX_FEATURE_PHYS_BUS_WIDTH (40U)
#define RGX_FEATURE_SLC_CACHE_LINE_SIZE_BITS (512U)
#define RGX_FEATURE_SLC_SIZE_IN_KILOBYTES (128U)
#define RGX_FEATURE_TILE_SIZE_X (32U)
#define RGX_FEATURE_TILE_SIZE_Y (32U)
#define RGX_FEATURE_TLA
#define RGX_FEATURE_VIRTUAL_ADDRESS_SPACE_BITS (40U)
#endif /* RGXCONFIG_KM_1_V_4_5_H */

View File

@@ -0,0 +1,105 @@
/*************************************************************************/ /*!
@Title RGX Configuration for BVNC 36.V.104.182 (kernel defines)
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef RGXCONFIG_KM_36_V_104_182_H
#define RGXCONFIG_KM_36_V_104_182_H
/***** Automatically generated file. Do not edit manually ********************/
/******************************************************************************
* B.V.N.C Validation defines
*****************************************************************************/
#define RGX_BNC_KM_B 36
#define RGX_BNC_KM_N 104
#define RGX_BNC_KM_C 182
/******************************************************************************
* DDK Defines
*****************************************************************************/
#define RGX_FEATURE_AXI_ACELITE
#define RGX_FEATURE_CDM_CONTROL_STREAM_FORMAT (1U)
#define RGX_FEATURE_COMPUTE
#define RGX_FEATURE_COMPUTE_OVERLAP
#define RGX_FEATURE_COREID_PER_OS
#define RGX_FEATURE_FBCDC (50U)
#define RGX_FEATURE_FBCDC_ALGORITHM (50U)
#define RGX_FEATURE_FBCDC_ARCHITECTURE (7U)
#define RGX_FEATURE_FBC_MAX_DEFAULT_DESCRIPTORS (0U)
#define RGX_FEATURE_FBC_MAX_LARGE_DESCRIPTORS (0U)
#define RGX_FEATURE_GPU_MULTICORE_SUPPORT
#define RGX_FEATURE_GPU_VIRTUALISATION
#define RGX_FEATURE_GS_RTA_SUPPORT
#define RGX_FEATURE_IRQ_PER_OS
#define RGX_FEATURE_LAYOUT_MARS (1U)
#define RGX_FEATURE_MIPS
#define RGX_FEATURE_NUM_CLUSTERS (1U)
#define RGX_FEATURE_NUM_ISP_IPP_PIPES (6U)
#define RGX_FEATURE_NUM_OSIDS (8U)
#define RGX_FEATURE_NUM_RASTER_PIPES (1U)
#define RGX_FEATURE_PBE2_IN_XE
#define RGX_FEATURE_PBVNC_COREID_REG
#define RGX_FEATURE_PERFBUS
#define RGX_FEATURE_PHYS_BUS_WIDTH (36U)
#define RGX_FEATURE_ROGUEXE
#define RGX_FEATURE_SIMPLE_INTERNAL_PARAMETER_FORMAT
#define RGX_FEATURE_SIMPLE_INTERNAL_PARAMETER_FORMAT_V2
#define RGX_FEATURE_SIMPLE_PARAMETER_FORMAT_VERSION (2U)
#define RGX_FEATURE_SLC_BANKS (1U)
#define RGX_FEATURE_SLC_CACHE_LINE_SIZE_BITS (512U)
#define RGX_FEATURE_SLC_SIZE_CONFIGURABLE /* Specifies the SLC is */
/* customer-configurable. True SLC */
/* size must be sourced from */
/* register. */
#define RGX_FEATURE_SLC_SIZE_IN_KILOBYTES (16U)
#define RGX_FEATURE_SOC_TIMER
#define RGX_FEATURE_SYS_BUS_SECURE_RESET
#define RGX_FEATURE_TILE_SIZE_X (16U)
#define RGX_FEATURE_TILE_SIZE_Y (16U)
#define RGX_FEATURE_TPU_CEM_DATAMASTER_GLOBAL_REGISTERS
#define RGX_FEATURE_TPU_DM_GLOBAL_REGISTERS
#define RGX_FEATURE_VIRTUAL_ADDRESS_SPACE_BITS (40U)
#define RGX_FEATURE_XE_ARCHITECTURE (1U)
#define RGX_FEATURE_XE_MEMORY_HIERARCHY
#define RGX_FEATURE_XPU_MAX_REGBANKS_ADDR_WIDTH (19U)
#define RGX_FEATURE_XPU_MAX_SLAVES (3U)
#define RGX_FEATURE_XPU_REGISTER_BROADCAST (1U)
#endif /* RGXCONFIG_KM_36_V_104_182_H */

View File

@@ -0,0 +1,491 @@
/*************************************************************************/ /*!
@File
@Title Server side connection management
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Handles connections coming from the client and the management
connection based information
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include "handle.h"
#include "pvrsrv.h"
#include "connection_server.h"
#include "osconnection_server.h"
#include "allocmem.h"
#include "pvr_debug.h"
#include "sync_server.h"
#include "process_stats.h"
#include "pdump_km.h"
#include "osfunc.h"
#include "tlstream.h"
#include "rgxhwperf_common.h"
/* PID associated with Connection currently being purged by Cleanup thread */
static IMG_PID gCurrentPurgeConnectionPid;
static PVRSRV_ERROR ConnectionDataDestroy(CONNECTION_DATA *psConnection)
{
PVRSRV_ERROR eError;
PROCESS_HANDLE_BASE *psProcessHandleBase;
IMG_UINT64 ui64MaxBridgeTime;
PVRSRV_DATA *psPVRSRVData = PVRSRVGetPVRSRVData();
if (psPVRSRVData->bUnload)
{
/* driver is unloading so do not allow the bridge lock to be released */
ui64MaxBridgeTime = 0;
}
else
{
ui64MaxBridgeTime = CONNECTION_DEFERRED_CLEANUP_TIMESLICE_NS;
}
PVR_ASSERT(psConnection != NULL);
PVR_LOG_RETURN_IF_INVALID_PARAM(psConnection, "psConnection");
/* Close HWPerfClient stream here even though we created it in
* PVRSRVConnectKM(). */
if (psConnection->hClientTLStream)
{
TLStreamClose(psConnection->hClientTLStream);
psConnection->hClientTLStream = NULL;
PVR_DPF((PVR_DBG_MESSAGE, "Destroyed private stream."));
}
/* Get process handle base to decrement the refcount */
psProcessHandleBase = psConnection->psProcessHandleBase;
if (psProcessHandleBase != NULL)
{
eError = PVRSRVReleaseProcessHandleBase(psProcessHandleBase, psConnection->pid,
ui64MaxBridgeTime);
PVR_LOG_RETURN_IF_ERROR(eError, "PVRSRVReleaseProcessHandleBase");
psConnection->psProcessHandleBase = NULL;
}
/* Free handle base for this connection */
if (psConnection->psHandleBase != NULL)
{
eError = PVRSRVFreeHandleBase(psConnection->psHandleBase, ui64MaxBridgeTime);
/*
* If we get PVRSRV_ERROR_RETRY we need to pass this back to the caller
* who will schedule a retry.
* Do not log this as it is an expected exception.
* This can occur if the Firmware is still processing a workload from
* the client when a tear-down request is received.
* Retrying will allow the in-flight work to be completed and the
* tear-down request can be completed when the FW is no longer busy.
*/
if (PVRSRV_ERROR_RETRY == eError)
{
return eError;
}
else
{
PVR_LOG_RETURN_IF_ERROR(eError, "PVRSRVFreeHandleBase:2");
}
psConnection->psHandleBase = NULL;
}
if (psConnection->psSyncConnectionData != NULL)
{
SyncUnregisterConnection(psConnection->psSyncConnectionData);
psConnection->psSyncConnectionData = NULL;
}
if (psConnection->psPDumpConnectionData != NULL)
{
PDumpUnregisterConnection(psConnection->psPDumpConnectionData);
psConnection->psPDumpConnectionData = NULL;
}
/* Call environment specific connection data deinit function */
if (psConnection->hOsPrivateData != NULL)
{
eError = OSConnectionPrivateDataDeInit(psConnection->hOsPrivateData);
PVR_LOG_RETURN_IF_ERROR(eError, "OSConnectionPrivateDataDeInit");
psConnection->hOsPrivateData = NULL;
}
/* Close the PID stats entry as late as possible to catch all frees */
#if defined(PVRSRV_ENABLE_PROCESS_STATS) && !defined(PVRSRV_DEBUG_LINUX_MEMORY_STATS)
if (psConnection->hProcessStats != NULL)
{
PVRSRVStatsDeregisterProcess(psConnection->hProcessStats);
psConnection->hProcessStats = NULL;
}
#endif
OSFreeMemNoStats(psConnection);
return PVRSRV_OK;
}
PVRSRV_ERROR PVRSRVCommonConnectionConnect(void **ppvPrivData, void *pvOSData)
{
CONNECTION_DATA *psConnection;
PVRSRV_ERROR eError;
PROCESS_HANDLE_BASE *psProcessHandleBase;
/* Allocate connection data area, no stats since process not registered yet */
psConnection = OSAllocZMemNoStats(sizeof(*psConnection));
PVR_LOG_RETURN_IF_NOMEM(psConnection, "psConnection");
/* Allocate process statistics as early as possible to catch all allocs */
#if defined(PVRSRV_ENABLE_PROCESS_STATS) && !defined(PVRSRV_DEBUG_LINUX_MEMORY_STATS)
eError = PVRSRVStatsRegisterProcess(&psConnection->hProcessStats);
PVR_LOG_GOTO_IF_ERROR(eError, "PVRSRVStatsRegisterProcess", failure);
#endif
/* Call environment specific connection data init function */
eError = OSConnectionPrivateDataInit(&psConnection->hOsPrivateData, pvOSData);
PVR_LOG_GOTO_IF_ERROR(eError, "OSConnectionPrivateDataInit", failure);
psConnection->pid = OSGetCurrentClientProcessIDKM();
psConnection->vpid = OSGetCurrentVirtualProcessID();
psConnection->tid = (IMG_UINT32)OSGetCurrentClientThreadIDKM();
OSStringLCopy(psConnection->pszProcName, OSGetCurrentClientProcessNameKM(), PVRSRV_CONNECTION_PROCESS_NAME_LEN);
#if defined(SUPPORT_DMA_TRANSFER)
OSLockCreate(&psConnection->hDmaReqLock);
eError = OSEventObjectCreate("Dma transfer cleanup event object",
&psConnection->hDmaEventObject);
PVR_LOG_GOTO_IF_ERROR(eError, "OSEventObjectCreate", failure);
OSAtomicWrite(&psConnection->ui32NumDmaTransfersInFlight, 0);
psConnection->bAcceptDmaRequests = IMG_TRUE;
#endif
/* Register this connection with the sync core */
eError = SyncRegisterConnection(&psConnection->psSyncConnectionData);
PVR_LOG_GOTO_IF_ERROR(eError, "SyncRegisterConnection", failure);
/*
* Register this connection and Sync PDump callback with
* the pdump core. Pass in the Sync connection data.
*/
eError = PDumpRegisterConnection(psConnection->psSyncConnectionData,
SyncConnectionPDumpSyncBlocks,
&psConnection->psPDumpConnectionData);
PVR_LOG_GOTO_IF_ERROR(eError, "PDumpRegisterConnection", failure);
/* Allocate handle base for this connection */
eError = PVRSRVAllocHandleBase(&psConnection->psHandleBase,
PVRSRV_HANDLE_BASE_TYPE_CONNECTION);
PVR_LOG_GOTO_IF_ERROR(eError, "PVRSRVAllocHandleBase", failure);
/* get process handle base (if it doesn't exist it will be allocated) */
eError = PVRSRVAcquireProcessHandleBase(psConnection->pid, &psProcessHandleBase);
PVR_LOG_GOTO_IF_ERROR(eError, "PVRSRVAcquireProcessHandleBase", failure);
/* hConnectionsLock now resides in PVRSRV_DEVICE_NODE */
{
IMG_BOOL bHostStreamIsNull;
PVRSRV_RGXDEV_INFO *psRgxDevInfo;
PVRSRV_DEVICE_NODE *psDevNode = OSGetDevNode(psConnection);
OSLockAcquire(psDevNode->hConnectionsLock);
dllist_add_to_tail(&psDevNode->sConnections, &psConnection->sConnectionListNode);
#if defined(DEBUG) || defined(PDUMP)
PVR_LOG(("%s connected - (devID = %u)", psConnection->pszProcName,
psDevNode->sDevId.ui32InternalID));
#endif
OSLockRelease(psDevNode->hConnectionsLock);
if (!PVRSRV_VZ_MODE_IS(GUEST))
{
psRgxDevInfo = _RGX_DEVICE_INFO_FROM_NODE(psDevNode);
OSLockAcquire(psRgxDevInfo->hLockHWPerfHostStream);
bHostStreamIsNull = (IMG_BOOL)(psRgxDevInfo->hHWPerfHostStream == NULL);
OSLockRelease(psRgxDevInfo->hLockHWPerfHostStream);
if (!bHostStreamIsNull)
{
if (TLStreamIsOpenForReading(psRgxDevInfo->hHWPerfHostStream))
{
/* Announce this client connection in the host stream, if event mask is set */
RGXSRV_HWPERF_HOST_CLIENT_INFO_PROCESS_NAME(psDevNode, psConnection->pid, psConnection->pszProcName);
}
}
}
}
psConnection->psProcessHandleBase = psProcessHandleBase;
*ppvPrivData = psConnection;
return PVRSRV_OK;
failure:
ConnectionDataDestroy(psConnection);
return eError;
}
static PVRSRV_ERROR _CleanupThreadPurgeConnectionData(void *pvConnectionData)
{
PVRSRV_ERROR eErrorConnection, eErrorKernel;
CONNECTION_DATA *psConnectionData = pvConnectionData;
gCurrentPurgeConnectionPid = psConnectionData->pid;
eErrorConnection = ConnectionDataDestroy(psConnectionData);
if (eErrorConnection != PVRSRV_OK)
{
if (eErrorConnection == PVRSRV_ERROR_RETRY)
{
PVR_DPF((PVR_DBG_MESSAGE,
"%s: Failed to purge connection data %p "
"(deferring destruction)",
__func__,
psConnectionData));
}
}
else
{
PVR_DPF((PVR_DBG_MESSAGE,
"%s: Connection data %p deferred destruction finished",
__func__,
psConnectionData));
}
/* Check if possible resize the global handle base */
eErrorKernel = PVRSRVPurgeHandles(KERNEL_HANDLE_BASE);
PVR_LOG_IF_ERROR(eErrorKernel, "PVRSRVPurgeHandles");
gCurrentPurgeConnectionPid = 0;
return eErrorConnection;
}
#if defined(SUPPORT_DMA_TRANSFER)
static void WaitForOutstandingDma(CONNECTION_DATA *psConnectionData)
{
PVRSRV_ERROR eError;
IMG_HANDLE hEvent;
IMG_UINT32 ui32Tries = 100;
#if defined(DMA_VERBOSE)
PVR_DPF((PVR_DBG_ERROR,
"Waiting on %d DMA transfers in flight...", OSAtomicRead(&psConnectionData->ui32NumDmaTransfersInFlight)));
#endif
eError = OSEventObjectOpen(psConnectionData->hDmaEventObject, &hEvent);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "%s: Failed to open event object", __func__));
return;
}
while (OSAtomicRead(&psConnectionData->ui32NumDmaTransfersInFlight) != 0)
{
/*
#define DMA_TRANSFER_TIMEOUT_US (5000000ULL)
This currently doesn't work properly. Wait time is not as requested.
Using OSSleepms instead
OSEventObjectWaitKernel(hEvent, DMA_TRANSFER_TIMEOUT_US);
*/
OSSleepms(50);
if (!ui32Tries)
{
PVR_DPF((PVR_DBG_ERROR, "%s: Timeout while waiting on outstanding DMA transfers!", __func__));
break;
}
ui32Tries--;
}
OSEventObjectClose(hEvent);
}
#endif
void PVRSRVCommonConnectionDisconnect(void *pvDataPtr)
{
CONNECTION_DATA *psConnectionData = pvDataPtr;
PVRSRV_DEVICE_NODE *psDevNode = OSGetDevNode(psConnectionData);
OSLockAcquire(psDevNode->hConnectionsLock);
dllist_remove_node(&psConnectionData->sConnectionListNode);
OSLockRelease(psDevNode->hConnectionsLock);
/* Notify the PDump core if the pdump control client is disconnecting */
if (psConnectionData->ui32ClientFlags & SRV_FLAGS_PDUMPCTRL)
{
PDumpDisconnectionNotify(psDevNode);
}
#if defined(SUPPORT_DMA_TRANSFER)
OSLockAcquire(psConnectionData->hDmaReqLock);
psConnectionData->bAcceptDmaRequests = IMG_FALSE;
OSLockRelease(psConnectionData->hDmaReqLock);
WaitForOutstandingDma(psConnectionData);
OSEventObjectDestroy(psConnectionData->hDmaEventObject);
OSLockDestroy(psConnectionData->hDmaReqLock);
#endif
#if defined(DEBUG) || defined(PDUMP)
PVR_LOG(("%s disconnected - (devID = %u)", psConnectionData->pszProcName,
psDevNode->sDevId.ui32InternalID));
#endif
#if defined(PVRSRV_FORCE_UNLOAD_IF_BAD_STATE)
if (PVRSRVGetPVRSRVData()->eServicesState == PVRSRV_SERVICES_STATE_OK)
#endif
{
/* Defer the release of the connection data */
psConnectionData->sCleanupThreadFn.pfnFree = _CleanupThreadPurgeConnectionData;
psConnectionData->sCleanupThreadFn.pvData = psConnectionData;
psConnectionData->sCleanupThreadFn.bDependsOnHW = IMG_FALSE;
CLEANUP_THREAD_SET_RETRY_COUNT(&psConnectionData->sCleanupThreadFn,
CLEANUP_THREAD_RETRY_COUNT_DEFAULT);
PVRSRVCleanupThreadAddWork(&psConnectionData->sCleanupThreadFn);
}
}
IMG_PID PVRSRVGetPurgeConnectionPid(void)
{
return gCurrentPurgeConnectionPid;
}
/* Prefix for debug messages about Active Connections */
#define DEBUG_DUMP_CONNECTION_FORMAT_STR " P%d-V%d-T%d-%s,"
#define CONNECTIONS_PREFIX "Connections Device ID:%u(%d)"
#define MAX_CONNECTIONS_PREFIX (29)
#define MAX_DEBUG_DUMP_CONNECTION_STR_LEN (1+10+10+10+7+PVRSRV_CONNECTION_PROCESS_NAME_LEN)
#define MAX_DEBUG_DUMP_STRING_LEN (1+MAX_CONNECTIONS_PREFIX+(3*MAX_DEBUG_DUMP_CONNECTION_STR_LEN))
void PVRSRVConnectionDebugNotify(PVRSRV_DEVICE_NODE *psDevNode,
DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf,
void *pvDumpDebugFile)
{
PDLLIST_NODE pNext, pNode;
/* We must check for an initialised device before accessing its mutex.
* The mutex is initialised as part of DeviceInitialize() which occurs
* on first access to the device node.
*/
if (psDevNode->eDevState != PVRSRV_DEVICE_STATE_ACTIVE)
{
PVR_DUMPDEBUG_LOG("Connections: No Devices: No active connections");
return;
}
OSLockAcquire(psDevNode->hConnectionsLock);
if (dllist_is_empty(&psDevNode->sConnections))
{
PVR_DUMPDEBUG_LOG(CONNECTIONS_PREFIX " No active connections",
(unsigned char)psDevNode->sDevId.ui32InternalID,
(unsigned char)psDevNode->sDevId.i32OsDeviceID);
}
else
{
IMG_CHAR sActiveConnections[MAX_DEBUG_DUMP_STRING_LEN];
IMG_UINT16 i, uiPos = 0;
IMG_BOOL bPrinted = IMG_FALSE;
size_t uiSize = sizeof(sActiveConnections);
IMG_CHAR szTmpConBuff[MAX_CONNECTIONS_PREFIX + 1];
i = OSSNPrintf(szTmpConBuff,
MAX_CONNECTIONS_PREFIX,
CONNECTIONS_PREFIX,
(unsigned char)psDevNode->sDevId.ui32InternalID,
(unsigned char)psDevNode->sDevId.i32OsDeviceID);
OSStringLCopy(sActiveConnections+uiPos, szTmpConBuff, uiSize);
/* Move the write offset to the end of the current string */
uiPos += i;
/* Update the amount of remaining space available to copy into */
uiSize -= i;
dllist_foreach_node(&psDevNode->sConnections, pNode, pNext)
{
CONNECTION_DATA *sData = IMG_CONTAINER_OF(pNode, CONNECTION_DATA, sConnectionListNode);
IMG_CHAR sTmpBuff[MAX_DEBUG_DUMP_CONNECTION_STR_LEN];
i = OSSNPrintf(sTmpBuff, MAX_DEBUG_DUMP_CONNECTION_STR_LEN,
DEBUG_DUMP_CONNECTION_FORMAT_STR, sData->pid, sData->vpid, sData->tid, sData->pszProcName);
i = MIN(MAX_DEBUG_DUMP_CONNECTION_STR_LEN, i);
bPrinted = IMG_FALSE;
OSStringLCopy(sActiveConnections+uiPos, sTmpBuff, uiSize);
/* Move the write offset to the end of the current string */
uiPos += i;
/* Update the amount of remaining space available to copy into */
uiSize -= i;
/* If there is not enough space to add another connection to this line, output the line */
if (uiSize <= MAX_DEBUG_DUMP_CONNECTION_STR_LEN)
{
PVR_DUMPDEBUG_LOG("%s", sActiveConnections);
/*
* Remove the "Connections:" prefix from the buffer.
* Leave the subsequent buffer contents indented by the same
* amount to aid in interpreting the debug output.
*/
uiPos = sizeof(CONNECTIONS_PREFIX) - 1;
/* Reset the amount of space available to copy into */
uiSize = MAX_DEBUG_DUMP_STRING_LEN - uiPos;
bPrinted = IMG_TRUE;
}
}
/* Only print the current line if it hasn't already been printed */
if (!bPrinted)
{
/* Strip off the final comma */
sActiveConnections[OSStringNLength(sActiveConnections, MAX_DEBUG_DUMP_STRING_LEN) - 1] = '\0';
PVR_DUMPDEBUG_LOG("%s", sActiveConnections);
}
#undef MAX_DEBUG_DUMP_STRING_LEN
#undef MAX_DEBUG_DUMP_CONNECTIONS_PER_LINE
}
OSLockRelease(psDevNode->hConnectionsLock);
}

View File

@@ -0,0 +1,144 @@
/*************************************************************************/ /*!
@File
@Title Server side connection management
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description API for server side connection management
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#if !defined(CONNECTION_SERVER_H)
#define CONNECTION_SERVER_H
#include "img_types.h"
#include "img_defs.h"
#include "handle.h"
#include "pvrsrv_cleanup.h"
/* Variable used to hold in memory the timeout for the current time slice*/
extern IMG_UINT64 gui64TimesliceLimit;
/* Counter number of handle data freed during the current time slice */
extern IMG_UINT32 gui32HandleDataFreeCounter;
/* Set the maximum time the freeing of the resources can keep the lock */
#define CONNECTION_DEFERRED_CLEANUP_TIMESLICE_NS (3000 * 1000) /* 3ms */
typedef struct _CONNECTION_DATA_
{
PVRSRV_HANDLE_BASE *psHandleBase;
PROCESS_HANDLE_BASE *psProcessHandleBase;
struct _SYNC_CONNECTION_DATA_ *psSyncConnectionData;
struct _PDUMP_CONNECTION_DATA_ *psPDumpConnectionData;
/* Holds the client flags supplied at connection time */
IMG_UINT32 ui32ClientFlags;
/*
* OS specific data can be stored via this handle.
* See osconnection_server.h for a generic mechanism
* for initialising this field.
*/
IMG_HANDLE hOsPrivateData;
#define PVRSRV_CONNECTION_PROCESS_NAME_LEN (16)
IMG_PID pid;
IMG_PID vpid;
IMG_UINT32 tid;
IMG_CHAR pszProcName[PVRSRV_CONNECTION_PROCESS_NAME_LEN];
IMG_HANDLE hProcessStats;
IMG_HANDLE hClientTLStream;
#if defined(SUPPORT_GPUVIRT_VALIDATION)
/*
* Connection-based values per application which can be modified by the
* AppHint settings 'OSid, OSidReg, bOSidAxiProtReg' for each application.
* These control where the connection's memory allocation is sourced from.
* ui32OSid, ui32OSidReg range from 0..(GPUVIRT_VALIDATION_NUM_OS - 1).
*/
IMG_UINT32 ui32OSid;
IMG_UINT32 ui32OSidReg;
IMG_BOOL bOSidAxiProtReg;
#endif /* defined(SUPPORT_GPUVIRT_VALIDATION) */
#if defined(SUPPORT_DMA_TRANSFER)
IMG_BOOL bAcceptDmaRequests;
ATOMIC_T ui32NumDmaTransfersInFlight;
POS_LOCK hDmaReqLock;
IMG_HANDLE hDmaEventObject;
#endif
/* Structure which is hooked into the cleanup thread work list */
PVRSRV_CLEANUP_THREAD_WORK sCleanupThreadFn;
DLLIST_NODE sConnectionListNode;
/* List navigation for deferred freeing of connection data */
struct _CONNECTION_DATA_ **ppsThis;
struct _CONNECTION_DATA_ *psNext;
} CONNECTION_DATA;
#include "osconnection_server.h"
PVRSRV_ERROR PVRSRVCommonConnectionConnect(void **ppvPrivData, void *pvOSData);
void PVRSRVCommonConnectionDisconnect(void *pvPrivData);
/**************************************************************************/ /*!
@Function PVRSRVGetPurgeConnectionPid
@Description Returns PID associated with Connection currently being purged by
Cleanup Thread. If no Connection is purged 0 is returned.
@Return PID associated with currently purged connection or 0 if no
connection is being purged
*/ /***************************************************************************/
IMG_PID PVRSRVGetPurgeConnectionPid(void);
void PVRSRVConnectionDebugNotify(PVRSRV_DEVICE_NODE *psDevNode,
DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf,
void *pvDumpDebugFile);
#ifdef INLINE_IS_PRAGMA
#pragma inline(PVRSRVConnectionPrivateData)
#endif
static INLINE
IMG_HANDLE PVRSRVConnectionPrivateData(CONNECTION_DATA *psConnection)
{
return (psConnection != NULL) ? psConnection->hOsPrivateData : NULL;
}
#endif /* !defined(CONNECTION_SERVER_H) */

View File

@@ -0,0 +1,69 @@
/*************************************************************************/ /*!
@Title RGX Core BVNC 1.82.4.5
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef RGXCORE_KM_1_82_4_5_H
#define RGXCORE_KM_1_82_4_5_H
/* Automatically generated file (04/10/2021 09:01:50): Do not edit manually */
/* CS: @2503111 */
/******************************************************************************
* BVNC = 1.82.4.5
*****************************************************************************/
#define RGX_BVNC_KM_B 1
#define RGX_BVNC_KM_V 82
#define RGX_BVNC_KM_N 4
#define RGX_BVNC_KM_C 5
/******************************************************************************
* Errata
*****************************************************************************/
/******************************************************************************
* Enhancements
*****************************************************************************/
#endif /* RGXCORE_KM_1_82_4_5_H */

View File

@@ -0,0 +1,74 @@
/*************************************************************************/ /*!
@Title RGX Core BVNC 36.52.104.182
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef RGXCORE_KM_36_52_104_182_H
#define RGXCORE_KM_36_52_104_182_H
/* Automatically generated file (04/10/2021 09:01:50): Do not edit manually */
/* CS: @5849605 */
/******************************************************************************
* BVNC = 36.52.104.182
*****************************************************************************/
#define RGX_BVNC_KM_B 36
#define RGX_BVNC_KM_V 52
#define RGX_BVNC_KM_N 104
#define RGX_BVNC_KM_C 182
/******************************************************************************
* Errata
*****************************************************************************/
#define FIX_HW_BRN_63553
/******************************************************************************
* Enhancements
*****************************************************************************/
#define HW_ERN_42290
#define HW_ERN_42606
#define HW_ERN_47025
#define HW_ERN_57596
#endif /* RGXCORE_KM_36_52_104_182_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
/*************************************************************************/ /*!
@File
@Title Common debug definitions and functions.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DEBUG_COMMON_H
#define DEBUG_COMMON_H
#include "pvrsrv_error.h"
#include "device.h"
PVRSRV_ERROR DebugCommonInitDriver(void);
void DebugCommonDeInitDriver(void);
PVRSRV_ERROR DebugCommonInitDevice(PVRSRV_DEVICE_NODE *psDeviceNode);
void DebugCommonDeInitDevice(PVRSRV_DEVICE_NODE *psDeviceNode);
#endif /* DEBUG_COMMON_H */

View File

@@ -0,0 +1,540 @@
/**************************************************************************/ /*!
@File
@Title Common Device header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Device related function templates and defines
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /***************************************************************************/
#ifndef DEVICE_H
#define DEVICE_H
#include "devicemem_heapcfg.h"
#include "mmu_common.h"
#include "ra.h" /* RA_ARENA */
#include "pvrsrv_device.h"
#include "sync_checkpoint.h"
#include "srvkm.h"
#include "physheap.h"
#include "sync_internal.h"
#include "sysinfo.h"
#include "dllist.h"
#include "rgx_bvnc_defs_km.h"
#include "lock.h"
#include "power.h"
#if defined(SUPPORT_GPUVIRT_VALIDATION)
#include "virt_validation_defs.h"
#endif
typedef struct _PVRSRV_POWER_DEV_TAG_ *PPVRSRV_POWER_DEV;
struct SYNC_RECORD;
struct _CONNECTION_DATA_;
/*************************************************************************/ /*!
@Function AllocUFOBlockCallback
@Description Device specific callback for allocation of a UFO block
@Input psDeviceNode Pointer to device node to allocate
the UFO for.
@Output ppsMemDesc Pointer to pointer for the memdesc of
the allocation
@Output pui32SyncAddr FW Base address of the UFO block
@Output puiSyncPrimBlockSize Size of the UFO block
@Return PVRSRV_OK if allocation was successful
*/ /**************************************************************************/
typedef PVRSRV_ERROR (*AllocUFOBlockCallback)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
DEVMEM_MEMDESC **ppsMemDesc,
IMG_UINT32 *pui32SyncAddr,
IMG_UINT32 *puiSyncPrimBlockSize);
/*************************************************************************/ /*!
@Function FreeUFOBlockCallback
@Description Device specific callback for freeing of a UFO
@Input psDeviceNode Pointer to device node that the UFO block was
allocated from.
@Input psMemDesc Pointer to pointer for the memdesc of the UFO
block to free.
*/ /**************************************************************************/
typedef void (*FreeUFOBlockCallback)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
DEVMEM_MEMDESC *psMemDesc);
typedef struct _PVRSRV_DEVICE_IDENTIFIER_
{
/* Pdump memory and register bank names */
IMG_CHAR *pszPDumpDevName;
IMG_CHAR *pszPDumpRegName;
/* Under Linux, this is the minor number of RenderNode corresponding to this Device */
IMG_INT32 i32OsDeviceID;
/* Services layer enumeration of the device used in pvrdebug */
IMG_UINT32 ui32InternalID;
} PVRSRV_DEVICE_IDENTIFIER;
typedef struct _DEVICE_MEMORY_INFO_
{
/* Heap count. Doesn't include additional heaps from PVRSRVCreateDeviceMemHeap */
IMG_UINT32 ui32HeapCount;
/* Blueprints for creating new device memory contexts */
IMG_UINT32 uiNumHeapConfigs;
DEVMEM_HEAP_CONFIG *psDeviceMemoryHeapConfigArray;
DEVMEM_HEAP_BLUEPRINT *psDeviceMemoryHeap;
} DEVICE_MEMORY_INFO;
#define MMU_BAD_PHYS_ADDR (0xbadbad00badULL)
#define DUMMY_PAGE ("DUMMY_PAGE")
#define DEV_ZERO_PAGE ("DEV_ZERO_PAGE")
#define PVR_DUMMY_PAGE_INIT_VALUE (0x0)
#define PVR_ZERO_PAGE_INIT_VALUE (0x0)
typedef struct __DEFAULT_PAGE__
{
/*Page handle for the page allocated (UMA/LMA)*/
PG_HANDLE sPageHandle;
POS_LOCK psPgLock;
ATOMIC_T atRefCounter;
/*Default page size in terms of log2 */
IMG_UINT32 ui32Log2PgSize;
IMG_UINT64 ui64PgPhysAddr;
#if defined(PDUMP)
IMG_HANDLE hPdumpPg;
#endif
} PVRSRV_DEF_PAGE;
typedef enum _PVRSRV_DEVICE_STATE_
{
PVRSRV_DEVICE_STATE_UNDEFINED = 0,
PVRSRV_DEVICE_STATE_INIT,
PVRSRV_DEVICE_STATE_ACTIVE,
PVRSRV_DEVICE_STATE_DEINIT,
PVRSRV_DEVICE_STATE_BAD,
} PVRSRV_DEVICE_STATE;
typedef enum _PVRSRV_DEVICE_HEALTH_STATUS_
{
PVRSRV_DEVICE_HEALTH_STATUS_UNDEFINED = 0,
PVRSRV_DEVICE_HEALTH_STATUS_OK,
PVRSRV_DEVICE_HEALTH_STATUS_NOT_RESPONDING,
PVRSRV_DEVICE_HEALTH_STATUS_DEAD,
PVRSRV_DEVICE_HEALTH_STATUS_FAULT
} PVRSRV_DEVICE_HEALTH_STATUS;
typedef enum _PVRSRV_DEVICE_HEALTH_REASON_
{
PVRSRV_DEVICE_HEALTH_REASON_NONE = 0,
PVRSRV_DEVICE_HEALTH_REASON_ASSERTED,
PVRSRV_DEVICE_HEALTH_REASON_POLL_FAILING,
PVRSRV_DEVICE_HEALTH_REASON_TIMEOUTS,
PVRSRV_DEVICE_HEALTH_REASON_QUEUE_CORRUPT,
PVRSRV_DEVICE_HEALTH_REASON_QUEUE_STALLED,
PVRSRV_DEVICE_HEALTH_REASON_IDLING,
PVRSRV_DEVICE_HEALTH_REASON_RESTARTING,
PVRSRV_DEVICE_HEALTH_REASON_MISSING_INTERRUPTS
} PVRSRV_DEVICE_HEALTH_REASON;
typedef enum _PVRSRV_DEVICE_DEBUG_DUMP_STATUS_
{
PVRSRV_DEVICE_DEBUG_DUMP_NONE = 0,
PVRSRV_DEVICE_DEBUG_DUMP_CAPTURE
} PVRSRV_DEVICE_DEBUG_DUMP_STATUS;
#ifndef DI_GROUP_DEFINED
#define DI_GROUP_DEFINED
typedef struct DI_GROUP DI_GROUP;
#endif
#ifndef DI_ENTRY_DEFINED
#define DI_ENTRY_DEFINED
typedef struct DI_ENTRY DI_ENTRY;
#endif
typedef struct _PVRSRV_DEVICE_DEBUG_INFO_
{
DI_GROUP *psGroup;
DI_ENTRY *psDumpDebugEntry;
#ifdef SUPPORT_RGX
DI_ENTRY *psFWTraceEntry;
#ifdef SUPPORT_FIRMWARE_GCOV
DI_ENTRY *psFWGCOVEntry;
#endif
DI_ENTRY *psFWMappingsEntry;
#if defined(SUPPORT_VALIDATION) || defined(SUPPORT_RISCV_GDB)
DI_ENTRY *psRiscvDmiDIEntry;
IMG_UINT64 ui64RiscvDmi;
#endif
#endif /* SUPPORT_RGX */
#ifdef SUPPORT_VALIDATION
DI_ENTRY *psRGXRegsEntry;
#endif /* SUPPORT_VALIDATION */
#ifdef SUPPORT_POWER_VALIDATION_VIA_DEBUGFS
DI_ENTRY *psPowMonEntry;
#endif
#ifdef SUPPORT_POWER_SAMPLING_VIA_DEBUGFS
DI_ENTRY *psPowerDataEntry;
#endif
} PVRSRV_DEVICE_DEBUG_INFO;
#if defined(PVRSRV_DEBUG_LISR_EXECUTION)
#define RGX_LISR_INIT (0U)
#define RGX_LISR_DEVICE_NOT_POWERED (1U)
#define RGX_LISR_NOT_TRIGGERED_BY_HW (2U)
#define RGX_LISR_FW_IRQ_COUNTER_NOT_UPDATED (3U)
#define RGX_LISR_PROCESSED (4U)
typedef IMG_UINT32 LISR_STATUS;
typedef struct _LISR_EXECUTION_INFO_
{
/* status of last LISR invocation */
LISR_STATUS ui32Status;
/* snapshot from the last LISR invocation */
#if defined(RGX_FW_IRQ_OS_COUNTERS)
IMG_UINT32 aui32InterruptCountSnapshot[RGX_NUM_OS_SUPPORTED];
#else
IMG_UINT32 aui32InterruptCountSnapshot[RGXFW_THREAD_NUM];
#endif
/* time of the last LISR invocation */
IMG_UINT64 ui64Clockns;
} LISR_EXECUTION_INFO;
#define UPDATE_LISR_DBG_STATUS(status) psDeviceNode->sLISRExecutionInfo.ui32Status = (status)
#define UPDATE_LISR_DBG_SNAPSHOT(idx, val) psDeviceNode->sLISRExecutionInfo.aui32InterruptCountSnapshot[idx] = (val)
#define UPDATE_LISR_DBG_TIMESTAMP() psDeviceNode->sLISRExecutionInfo.ui64Clockns = OSClockns64()
#define UPDATE_LISR_DBG_COUNTER() psDeviceNode->ui64nLISR++
#define UPDATE_MISR_DBG_COUNTER() psDeviceNode->ui64nMISR++
#else
#define UPDATE_LISR_DBG_STATUS(status)
#define UPDATE_LISR_DBG_SNAPSHOT(idx, val)
#define UPDATE_LISR_DBG_TIMESTAMP()
#define UPDATE_LISR_DBG_COUNTER()
#define UPDATE_MISR_DBG_COUNTER()
#endif /* defined(PVRSRV_DEBUG_LISR_EXECUTION) */
typedef struct _PVRSRV_DEVICE_NODE_
{
PVRSRV_DEVICE_IDENTIFIER sDevId;
PVRSRV_DEVICE_STATE eDevState;
PVRSRV_DEVICE_FABRIC_TYPE eDevFabricType;
ATOMIC_T eHealthStatus; /* Holds values from PVRSRV_DEVICE_HEALTH_STATUS */
ATOMIC_T eHealthReason; /* Holds values from PVRSRV_DEVICE_HEALTH_REASON */
ATOMIC_T eDebugDumpRequested; /* Holds values from PVRSRV_DEVICE_DEBUG_DUMP_STATUS */
IMG_HANDLE *hDebugTable;
/* device specific MMU attributes */
MMU_DEVICEATTRIBS *psMMUDevAttrs;
/* Device specific MMU firmware attributes, used only in some devices */
MMU_DEVICEATTRIBS *psFirmwareMMUDevAttrs;
PHYS_HEAP *psMMUPhysHeap;
/* lock for power state transitions */
POS_LOCK hPowerLock;
IMG_PID uiPwrLockOwnerPID; /* Only valid between lock and corresponding unlock
operations of hPowerLock */
/* current system device power state */
PVRSRV_SYS_POWER_STATE eCurrentSysPowerState;
PPVRSRV_POWER_DEV psPowerDev;
/* multicore configuration information */
IMG_UINT32 ui32MultiCoreNumCores; /* total cores primary + secondaries. 0 for non-multi core */
IMG_UINT32 ui32MultiCorePrimaryId; /* primary core id for this device */
IMG_UINT64 *pui64MultiCoreCapabilities; /* capabilities for each core */
/*
callbacks the device must support:
*/
PVRSRV_ERROR (*pfnDevSLCFlushRange)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
MMU_CONTEXT *psMMUContext,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
IMG_BOOL bInvalidate);
PVRSRV_ERROR (*pfnInvalFBSCTable)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
MMU_CONTEXT *psMMUContext,
IMG_UINT64 ui64FBSCEntries);
PVRSRV_ERROR (*pfnValidateOrTweakPhysAddrs)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
MMU_DEVICEATTRIBS *psDevAttrs,
IMG_UINT64 *pui64Addr);
void (*pfnMMUCacheInvalidate)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
MMU_CONTEXT *psMMUContext,
MMU_LEVEL eLevel,
IMG_BOOL bUnmap);
PVRSRV_ERROR (*pfnMMUCacheInvalidateKick)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
IMG_UINT32 *pui32NextMMUInvalidateUpdate);
IMG_UINT32 (*pfnMMUCacheGetInvalidateCounter)(struct _PVRSRV_DEVICE_NODE_ *psDevNode);
void (*pfnDumpDebugInfo)(struct _PVRSRV_DEVICE_NODE_ *psDevNode);
PVRSRV_ERROR (*pfnUpdateHealthStatus)(struct _PVRSRV_DEVICE_NODE_ *psDevNode,
IMG_BOOL bIsTimerPoll);
#if defined(SUPPORT_AUTOVZ)
void (*pfnUpdateAutoVzWatchdog)(struct _PVRSRV_DEVICE_NODE_ *psDevNode);
#endif
PVRSRV_ERROR (*pfnValidationGPUUnitsPowerChange)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_UINT32 ui32NewState);
PVRSRV_ERROR (*pfnResetHWRLogs)(struct _PVRSRV_DEVICE_NODE_ *psDevNode);
PVRSRV_ERROR (*pfnVerifyBVNC)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_UINT64 ui64GivenBVNC, IMG_UINT64 ui64CoreIdMask);
/* Method to drain device HWPerf packets from firmware buffer to host buffer */
PVRSRV_ERROR (*pfnServiceHWPerf)(struct _PVRSRV_DEVICE_NODE_ *psDevNode);
PVRSRV_ERROR (*pfnDeviceVersionString)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_CHAR **ppszVersionString);
PVRSRV_ERROR (*pfnDeviceClockSpeed)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_PUINT32 pui32RGXClockSpeed);
PVRSRV_ERROR (*pfnSoftReset)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_UINT64 ui64ResetValue1, IMG_UINT64 ui64ResetValue2);
PVRSRV_ERROR (*pfnAlignmentCheck)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_UINT32 ui32FWAlignChecksSize, IMG_UINT32 aui32FWAlignChecks[]);
IMG_BOOL (*pfnCheckDeviceFeature)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_UINT64 ui64FeatureMask);
IMG_INT32 (*pfnGetDeviceFeatureValue)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, enum _RGX_FEATURE_WITH_VALUE_INDEX_ eFeatureIndex);
PVRSRV_ERROR (*pfnGetMultiCoreInfo)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_UINT32 ui32CapsSize,
IMG_UINT32 *pui32NumCores, IMG_UINT64 *pui64Caps);
IMG_BOOL (*pfnHasFBCDCVersion31)(struct _PVRSRV_DEVICE_NODE_ *psDevNode);
MMU_DEVICEATTRIBS* (*pfnGetMMUDeviceAttributes)(struct _PVRSRV_DEVICE_NODE_ *psDevNode, IMG_BOOL bKernelMemoryCtx);
PVRSRV_DEVICE_CONFIG *psDevConfig;
/* device post-finalise compatibility check */
PVRSRV_ERROR (*pfnInitDeviceCompatCheck) (struct _PVRSRV_DEVICE_NODE_*);
/* initialise device-specific physheaps */
PVRSRV_ERROR (*pfnPhysMemDeviceHeapsInit) (struct _PVRSRV_DEVICE_NODE_ *);
/* initialise fw mmu, if FW not using GPU mmu, NULL otherwise. */
PVRSRV_ERROR (*pfnFwMMUInit) (struct _PVRSRV_DEVICE_NODE_ *);
/* information about the device's address space and heaps */
DEVICE_MEMORY_INFO sDevMemoryInfo;
/* device's shared-virtual-memory heap max virtual address */
IMG_UINT64 ui64GeneralSVMHeapTopVA;
ATOMIC_T iNumClockSpeedChanges;
/* private device information */
void *pvDevice;
#if defined(SUPPORT_GPUVIRT_VALIDATION)
RA_ARENA *psOSSharedArena;
RA_ARENA *psOSidSubArena[GPUVIRT_VALIDATION_NUM_OS];
#endif
/* FW_MAIN, FW_CONFIG and FW_GUEST heaps. Should be part of registered heaps? */
PHYS_HEAP *psFWMainPhysHeap;
PHYS_HEAP *psFWCfgPhysHeap;
PHYS_HEAP *apsFWPremapPhysHeap[RGX_NUM_OS_SUPPORTED];
IMG_UINT32 ui32RegisteredPhysHeaps;
PHYS_HEAP **papsRegisteredPhysHeaps;
/* PHYS_HEAP Mapping table to the platform's physical memory heap(s)
* used by this device. The physical heaps are created based on
* the PHYS_HEAP_CONFIG data from the platform's system layer at device
* creation time.
*
* Contains PVRSRV_PHYS_HEAP_LAST entries for all the possible physical heaps allowed in the design.
* It allows the system layer PhysHeaps for the device to be identified for use in creating new PMRs.
* See PhysHeapCreatePMR()
*/
PHYS_HEAP *apsPhysHeap[PVRSRV_PHYS_HEAP_LAST];
IMG_UINT32 ui32UserAllocHeapCount;
#if defined(SUPPORT_AUTOVZ)
/* Phys Heap reserved for storing the MMU mappings of firmware.
* The memory backing up this Phys Heap must persist between driver or OS reboots */
PHYS_HEAP *psFwMMUReservedPhysHeap;
#endif
/* Flag indicating if the firmware has been initialised during the
* 1st boot of the Host driver according to the AutoVz life-cycle. */
IMG_BOOL bAutoVzFwIsUp;
struct _PVRSRV_DEVICE_NODE_ *psNext;
struct _PVRSRV_DEVICE_NODE_ **ppsThis;
/* Functions for notification about memory contexts */
PVRSRV_ERROR (*pfnRegisterMemoryContext)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
MMU_CONTEXT *psMMUContext,
IMG_HANDLE *hPrivData);
void (*pfnUnregisterMemoryContext)(IMG_HANDLE hPrivData);
/* Functions for allocation/freeing of UFOs */
AllocUFOBlockCallback pfnAllocUFOBlock; /*!< Callback for allocation of a block of UFO memory */
FreeUFOBlockCallback pfnFreeUFOBlock; /*!< Callback for freeing of a block of UFO memory */
IMG_HANDLE hSyncServerRecordNotify;
POS_LOCK hSyncServerRecordLock;
IMG_UINT32 ui32SyncServerRecordCount;
IMG_UINT32 ui32SyncServerRecordCountHighWatermark;
DLLIST_NODE sSyncServerRecordList;
struct SYNC_RECORD *apsSyncServerRecordsFreed[PVRSRV_FULL_SYNC_TRACKING_HISTORY_LEN];
IMG_UINT32 uiSyncServerRecordFreeIdx;
IMG_HANDLE hSyncCheckpointRecordNotify;
POS_LOCK hSyncCheckpointRecordLock;
IMG_UINT32 ui32SyncCheckpointRecordCount;
IMG_UINT32 ui32SyncCheckpointRecordCountHighWatermark;
DLLIST_NODE sSyncCheckpointRecordList;
struct SYNC_CHECKPOINT_RECORD *apsSyncCheckpointRecordsFreed[PVRSRV_FULL_SYNC_TRACKING_HISTORY_LEN];
IMG_UINT32 uiSyncCheckpointRecordFreeIdx;
IMG_HANDLE hSyncCheckpointNotify;
POS_SPINLOCK hSyncCheckpointListLock; /*!< Protects sSyncCheckpointSyncsList */
DLLIST_NODE sSyncCheckpointSyncsList;
PSYNC_CHECKPOINT_CONTEXT hSyncCheckpointContext;
PSYNC_PRIM_CONTEXT hSyncPrimContext;
/* With this sync-prim we make sure the MMU cache is flushed
* before we free the page table memory */
PVRSRV_CLIENT_SYNC_PRIM *psMMUCacheSyncPrim;
IMG_UINT32 ui32NextMMUInvalidateUpdate;
IMG_HANDLE hCmdCompNotify;
IMG_HANDLE hDbgReqNotify;
IMG_HANDLE hAppHintDbgReqNotify;
IMG_HANDLE hPhysHeapDbgReqNotify;
PVRSRV_DEF_PAGE sDummyPage;
PVRSRV_DEF_PAGE sDevZeroPage;
POSWR_LOCK hMemoryContextPageFaultNotifyListLock;
DLLIST_NODE sMemoryContextPageFaultNotifyListHead;
/* System DMA capability */
IMG_BOOL bHasSystemDMA;
IMG_HANDLE hDmaTxChan;
IMG_HANDLE hDmaRxChan;
#if defined(PDUMP)
/*
* FBC clear color register default value to use.
*/
IMG_UINT64 ui64FBCClearColour;
/* Device-level callback which is called when pdump.exe starts.
* Should be implemented in device-specific init code, e.g. rgxinit.c
*/
PVRSRV_ERROR (*pfnPDumpInitDevice)(struct _PVRSRV_DEVICE_NODE_ *psDeviceNode);
/* device-level callback to return pdump ID associated to a memory context */
IMG_UINT32 (*pfnMMUGetContextID)(IMG_HANDLE hDevMemContext);
IMG_UINT8 *pui8DeferredSyncCPSignal; /*! Deferred fence events buffer */
IMG_UINT16 ui16SyncCPReadIdx; /*! Read index in the above deferred fence events buffer */
IMG_UINT16 ui16SyncCPWriteIdx; /*! Write index in the above deferred fence events buffer */
POS_LOCK hSyncCheckpointSignalLock; /*! Guards data shared between an sleepable-contexts */
void *pvSyncCPMISR; /*! MISR to emit pending/deferred fence signals */
void *hTransition; /*!< SyncCheckpoint PdumpTransition Cookie */
DLLIST_NODE sSyncCheckpointContextListHead; /*!< List head for the sync chkpt contexts */
POS_LOCK hSyncCheckpointContextListLock; /*! lock for accessing sync chkpt contexts list */
#endif
#if defined(SUPPORT_VALIDATION)
POS_LOCK hValidationLock;
#endif
/* Members for linking which connections are open on this device */
POS_LOCK hConnectionsLock; /*!< Lock protecting sConnections */
DLLIST_NODE sConnections; /*!< The list of currently active connection objects for this device node */
#if defined(PVRSRV_DEBUG_LISR_EXECUTION)
LISR_EXECUTION_INFO sLISRExecutionInfo; /*!< Information about the last execution of the LISR */
IMG_UINT64 ui64nLISR; /*!< Number of LISR calls seen */
IMG_UINT64 ui64nMISR; /*!< Number of MISR calls made */
#endif
PVRSRV_DEVICE_DEBUG_INFO sDebugInfo;
} PVRSRV_DEVICE_NODE;
/*
* Macros to be used instead of calling directly the pfns since these macros
* will expand the feature passed as argument into the bitmask/index to work
* with the macros defined in rgx_bvnc_defs_km.h
*/
#define PVRSRV_IS_FEATURE_SUPPORTED(psDevNode, Feature) \
psDevNode->pfnCheckDeviceFeature(psDevNode, RGX_FEATURE_##Feature##_BIT_MASK)
#define PVRSRV_GET_DEVICE_FEATURE_VALUE(psDevNode, Feature) \
psDevNode->pfnGetDeviceFeatureValue(psDevNode, RGX_FEATURE_##Feature##_IDX)
PVRSRV_ERROR PVRSRVDeviceFinalise(PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_BOOL bInitSuccessful);
PVRSRV_ERROR PVRSRVDevInitCompatCheck(PVRSRV_DEVICE_NODE *psDeviceNode);
PVRSRV_ERROR RGXClientConnectCompatCheck_ClientAgainstFW(PVRSRV_DEVICE_NODE * psDeviceNode, IMG_UINT32 ui32ClientBuildOptions);
#endif /* DEVICE_H */
/******************************************************************************
End of file (device.h)
******************************************************************************/

View File

@@ -0,0 +1,123 @@
/*************************************************************************/ /*!
@File device_connection.h
@Title
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#if !defined(DEVICE_CONNECTION_H)
#define DEVICE_CONNECTION_H
#include "img_types.h"
#include "img_defs.h"
#if defined(__KERNEL__)
typedef struct _PVRSRV_DEVICE_NODE_ *SHARED_DEV_CONNECTION;
#else
#include "connection.h"
typedef const struct PVRSRV_DEV_CONNECTION_TAG *SHARED_DEV_CONNECTION;
#endif
/******************************************************************************
* Device capability flags and masks
*
* Following bitmask shows allocated ranges and values for our device
* capability settings:
*
* 31 27 23 19 15 11 7 3 0
* |...|...|...|...|...|...|...|...
* ** CACHE_COHERENT [0x1..0x2]
* x PVRSRV_CACHE_COHERENT_DEVICE_FLAG
* x. PVRSRV_CACHE_COHERENT_CPU_FLAG
* *... NONMAPPABLE_MEMORY [0x8]
* x... PVRSRV_NONMAPPABLE_MEMORY_PRESENT_FLAG
* *.... PDUMP_IS_RECORDING [0x10]
* x.... PVRSRV_PDUMP_IS_RECORDING
* ***........ DEVMEM_SVM_ALLOC [0x100..0x400]
* x........ PVRSRV_DEVMEM_SVM_ALLOC_UNSUPPORTED
* x......... PVRSRV_DEVMEM_SVM_ALLOC_SUPPORTED
* x.......... PVRSRV_DEVMEM_SVM_ALLOC_CANFAIL
* *........... FBCDC_V3_1 [0x800]
* x........... FBCDC_V3_1_USED
* *............ PVRSRV_SYSTEM_DMA
* x............ PVRSRV_SYSTEM_DMA_USED
* |...|...|...|...|...|...|...|...
*****************************************************************************/
/* Flag to be passed over the bridge during connection stating whether CPU cache coherent is available*/
#define PVRSRV_CACHE_COHERENT_SHIFT (0)
#define PVRSRV_CACHE_COHERENT_DEVICE_FLAG (1U << PVRSRV_CACHE_COHERENT_SHIFT)
#define PVRSRV_CACHE_COHERENT_CPU_FLAG (2U << PVRSRV_CACHE_COHERENT_SHIFT)
#define PVRSRV_CACHE_COHERENT_EMULATE_FLAG (4U << PVRSRV_CACHE_COHERENT_SHIFT)
#define PVRSRV_CACHE_COHERENT_MASK (7U << PVRSRV_CACHE_COHERENT_SHIFT)
/* Flag to be passed over the bridge during connection stating whether CPU non-mappable memory is present */
#define PVRSRV_NONMAPPABLE_MEMORY_PRESENT_SHIFT (7)
#define PVRSRV_NONMAPPABLE_MEMORY_PRESENT_FLAG (1U << PVRSRV_NONMAPPABLE_MEMORY_PRESENT_SHIFT)
/* Flag to be passed over the bridge to indicate PDump activity */
#define PVRSRV_PDUMP_IS_RECORDING_SHIFT (4)
#define PVRSRV_PDUMP_IS_RECORDING (1U << PVRSRV_PDUMP_IS_RECORDING_SHIFT)
/* Flag to be passed over the bridge during connection stating SVM allocation availability */
#define PVRSRV_DEVMEM_SVM_ALLOC_SHIFT (8)
#define PVRSRV_DEVMEM_SVM_ALLOC_UNSUPPORTED (1U << PVRSRV_DEVMEM_SVM_ALLOC_SHIFT)
#define PVRSRV_DEVMEM_SVM_ALLOC_SUPPORTED (2U << PVRSRV_DEVMEM_SVM_ALLOC_SHIFT)
#define PVRSRV_DEVMEM_SVM_ALLOC_CANFAIL (4U << PVRSRV_DEVMEM_SVM_ALLOC_SHIFT)
/* Flag to be passed over the bridge during connection stating whether GPU uses FBCDC v3.1 */
#define PVRSRV_FBCDC_V3_1_USED_SHIFT (11)
#define PVRSRV_FBCDC_V3_1_USED (1U << PVRSRV_FBCDC_V3_1_USED_SHIFT)
/* Flag to be passed over the bridge during connection stating whether System has
DMA transfer capability to and from device memory */
#define PVRSRV_SYSTEM_DMA_SHIFT (12)
#define PVRSRV_SYSTEM_DMA_USED (1U << PVRSRV_SYSTEM_DMA_SHIFT)
static INLINE IMG_HANDLE GetBridgeHandle(SHARED_DEV_CONNECTION hDevConnection)
{
#if defined(__KERNEL__)
return hDevConnection;
#else
return hDevConnection->hServices;
#endif
}
#endif /* !defined(DEVICE_CONNECTION_H) */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,730 @@
/*************************************************************************/ /*!
@File
@Title Device Memory Management core internal
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Services internal interface to core device memory management
functions that are shared between client and server code.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef SRVCLIENT_DEVICEMEM_H
#define SRVCLIENT_DEVICEMEM_H
/******************************************************************************
* *
* +------------+ +------------+ +--------------+ +--------------+ *
* | a sub- | | a sub- | | an | | allocation | *
* | allocation | | allocation | | allocation | | also mapped | *
* | | | | | in proc 1 | | into proc 2 | *
* +------------+ +------------+ +--------------+ +--------------+ *
* | | | | *
* +--------------+ +--------------+ +--------------+ *
* | page gran- | | page gran- | | page gran- | *
* | ular mapping | | ular mapping | | ular mapping | *
* +--------------+ +--------------+ +--------------+ *
* | | | *
* | | | *
* | | | *
* +--------------+ +--------------+ *
* | | | | *
* | A "P.M.R." | | A "P.M.R." | *
* | | | | *
* +--------------+ +--------------+ *
* *
******************************************************************************/
/*
All device memory allocations are ultimately a view upon (not
necessarily the whole of) a "PMR".
A PMR is a "Physical Memory Resource", which may be a
"pre-faulted" lump of physical memory, or it may be a
representation of some physical memory that will be instantiated
at some future time.
PMRs always represent multiple of some power-of-2 "contiguity"
promised by the PMR, which will allow them to be mapped in whole
pages into the device MMU. As memory allocations may be smaller
than a page, these mappings may be suballocated and thus shared
between multiple allocations in one process. A PMR may also be
mapped simultaneously into multiple device memory contexts
(cross-process scenario), however, for security reasons, it is not
legal to share a PMR "both ways" at once, that is, mapped into
multiple processes and divided up amongst several suballocations.
This PMR terminology is introduced here for background
information, but is generally of little concern to the caller of
this API. This API handles suballocations and mappings, and the
caller thus deals primarily with MEMORY DESCRIPTORS representing
an allocation or suballocation, HEAPS representing ranges of
virtual addresses in a CONTEXT.
*/
/*
|<---------------------------context------------------------------>|
|<-------heap------->| |<-------heap------->|<-------heap------->|
|<-alloc->| | |<-alloc->|<-alloc->|| |<-alloc->| |
*/
#include "img_types.h"
#include "img_defs.h"
#include "devicemem_typedefs.h"
#include "pdumpdefs.h"
#include "pvrsrv_error.h"
#include "pvrsrv_memallocflags.h"
#include "pdump.h"
#include "device_connection.h"
typedef IMG_UINT32 DEVMEM_HEAPCFGID;
#define DEVMEM_HEAPCFG_FORCLIENTS 0
#define DEVMEM_HEAPCFG_META 1
/*
In order to call the server side functions, we need a bridge handle.
We abstract that here, as we may wish to change its form.
*/
typedef IMG_HANDLE DEVMEM_BRIDGE_HANDLE;
/*************************************************************************/ /*!
@Function DevmemUnpin
@Description This is the counterpart to DevmemPin(). It is meant to be
called before repinning an allocation.
For a detailed description see client API documentation.
@Input phMemDesc The MemDesc that is going to be unpinned.
@Return PVRSRV_ERROR: PVRSRV_OK on success and the memory is
registered to be reclaimed. Error otherwise.
*/ /**************************************************************************/
IMG_INTERNAL PVRSRV_ERROR
DevmemUnpin(DEVMEM_MEMDESC *psMemDesc);
/*************************************************************************/ /*!
@Function DevmemPin
@Description This is the counterpart to DevmemUnpin(). It is meant to be
called after unpinning an allocation.
For a detailed description see client API documentation.
@Input phMemDesc The MemDesc that is going to be pinned.
@Return PVRSRV_ERROR: PVRSRV_OK on success and the allocation content
was successfully restored.
PVRSRV_ERROR_PMR_NEW_MEMORY when the content
could not be restored and new physical memory
was allocated.
A different error otherwise.
*/ /**************************************************************************/
IMG_INTERNAL PVRSRV_ERROR
DevmemPin(DEVMEM_MEMDESC *psMemDesc);
IMG_INTERNAL PVRSRV_ERROR
DevmemGetHeapInt(DEVMEM_HEAP *psHeap,
IMG_HANDLE *phDevmemHeap);
IMG_INTERNAL PVRSRV_ERROR
DevmemGetSize(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_SIZE_T* puiSize);
IMG_INTERNAL void
DevmemGetAnnotation(DEVMEM_MEMDESC *psMemDesc,
IMG_CHAR **pszAnnotation);
/*
* DevmemCreateContext()
*
* Create a device memory context
*
* This must be called before any heap is created in this context
*
* Caller to provide bridge handle which will be recorded internally and used
* for all future operations on items from this memory context. Caller also
* to provide devicenode handle, as this is used for MMU configuration and
* also to determine the heap configuration for the auto-instantiated heaps.
*
* Note that when compiled in services/server, the hBridge is not used and
* is thrown away by the "fake" direct bridge. (This may change. It is
* recommended that NULL be passed for the handle for now.)
*
* hDeviceNode and uiHeapBlueprintID shall together dictate which heap-config
* to use.
*
* This will cause the server side counterpart to be created also.
*
* If you call DevmemCreateContext() (and the call succeeds) you are promising
* that you will later call Devmem_ContextDestroy(), except for abnormal
* process termination in which case it is expected it will be destroyed as
* part of handle clean up.
*
* Caller to provide storage for the pointer to the newly created
* NEWDEVMEM_CONTEXT object.
*/
PVRSRV_ERROR
DevmemCreateContext(SHARED_DEV_CONNECTION hDevConnection,
DEVMEM_HEAPCFGID uiHeapBlueprintID,
DEVMEM_CONTEXT **ppsCtxPtr);
/*
* DevmemAcquireDevPrivData()
*
* Acquire the device private data for this memory context
*/
PVRSRV_ERROR
DevmemAcquireDevPrivData(DEVMEM_CONTEXT *psCtx,
IMG_HANDLE *hPrivData);
/*
* DevmemReleaseDevPrivData()
*
* Release the device private data for this memory context
*/
PVRSRV_ERROR
DevmemReleaseDevPrivData(DEVMEM_CONTEXT *psCtx);
/*
* DevmemDestroyContext()
*
* Undoes that done by DevmemCreateContext()
*/
PVRSRV_ERROR
DevmemDestroyContext(DEVMEM_CONTEXT *psCtx);
/*
* DevmemCreateHeap()
*
* Create a heap in the given context.
*
* N.B. Not intended to be called directly, though it can be.
* Normally, heaps are instantiated at context creation time according
* to the specified blueprint. See DevmemCreateContext() for details.
*
* This will cause MMU code to set up data structures for the heap,
* but may not cause page tables to be modified until allocations are
* made from the heap.
*
* uiReservedRegionLength Reserved address space for static VAs shared
* between clients and firmware
*
* The "Quantum" is both the device MMU page size to be configured for
* this heap, and the unit multiples of which "quantized" allocations
* are made (allocations smaller than this, known as "suballocations"
* will be made from a "sub alloc RA" and will "import" chunks
* according to this quantum)
*
* Where imported PMRs (or, for example, PMRs created by device class
* buffers) are mapped into this heap, it is important that the
* physical contiguity guarantee offered by the PMR is greater than or
* equal to the quantum size specified here, otherwise the attempt to
* map it will fail. "Normal" allocations via Devmem_Allocate
* shall automatically meet this requirement, as each "import" will
* trigger the creation of a PMR with the desired contiguity. The
* supported quantum sizes in that case shall be dictated by the OS
* specific implementation of PhysmemNewOSRamBackedPMR() (see)
*/
PVRSRV_ERROR
DevmemCreateHeap(DEVMEM_CONTEXT *psCtxPtr,
/* base and length of heap */
IMG_DEV_VIRTADDR sBaseAddress,
IMG_DEVMEM_SIZE_T uiLength,
IMG_DEVMEM_SIZE_T uiReservedRegionLength,
/* log2 of allocation quantum, i.e. "page" size.
All allocations (that go to server side) are
multiples of this. We use a client-side RA to
make sub-allocations from this */
IMG_UINT32 ui32Log2Quantum,
/* The minimum import alignment for this heap */
IMG_UINT32 ui32Log2ImportAlignment,
/* Name of heap for debug */
/* N.B. Okay to exist on caller's stack - this
func takes a copy if it needs it. */
const IMG_CHAR *pszName,
DEVMEM_HEAPCFGID uiHeapBlueprintID,
DEVMEM_HEAP **ppsHeapPtr);
/*
* DevmemDestroyHeap()
*
* Reverses DevmemCreateHeap()
*
* N.B. All allocations must have been freed and all mappings must
* have been unmapped before invoking this call
*/
PVRSRV_ERROR
DevmemDestroyHeap(DEVMEM_HEAP *psHeap);
/*
* DevmemExportalignAdjustSizeAndAlign()
* Compute the Size and Align passed to avoid suballocations
* (used when allocation with PVRSRV_MEMALLOCFLAG_EXPORTALIGN).
*
* Returns PVRSRV_ERROR_INVALID_PARAMS if uiLog2Quantum has invalid value.
*/
IMG_INTERNAL PVRSRV_ERROR
DevmemExportalignAdjustSizeAndAlign(IMG_UINT32 uiLog2Quantum,
IMG_DEVMEM_SIZE_T *puiSize,
IMG_DEVMEM_ALIGN_T *puiAlign);
/*
* DevmemSubAllocate()
*
* Makes an allocation (possibly a "suballocation", as described
* below) of device virtual memory from this heap.
*
* The size and alignment of the allocation will be honoured by the RA
* that allocates the "suballocation". The resulting allocation will
* be mapped into GPU virtual memory and the physical memory to back
* it will exist, by the time this call successfully completes.
*
* The size must be a positive integer multiple of the alignment.
* (i.e. the alignment specifies the alignment of both the start and
* the end of the resulting allocation.)
*
* Allocations made via this API are routed through a "suballocation
* RA" which is responsible for ensuring that small allocations can be
* made without wasting physical memory in the server. Furthermore,
* such suballocations can be made entirely client side without
* needing to go to the server unless the allocation spills into a new
* page.
*
* Such suballocations cause many allocations to share the same "PMR".
* This happens only when the flags match exactly.
*
*/
PVRSRV_ERROR
DevmemSubAllocate(IMG_UINT8 uiPreAllocMultiplier,
DEVMEM_HEAP *psHeap,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_ALIGN_T uiAlign,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
const IMG_CHAR *pszText,
DEVMEM_MEMDESC **ppsMemDescPtr);
#define DevmemAllocate(...) \
DevmemSubAllocate(DEVMEM_NO_PRE_ALLOCATE_MULTIPLIER, __VA_ARGS__)
PVRSRV_ERROR
DevmemAllocateExportable(SHARED_DEV_CONNECTION hDevConnection,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_ALIGN_T uiAlign,
IMG_UINT32 uiLog2HeapPageSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
const IMG_CHAR *pszText,
DEVMEM_MEMDESC **ppsMemDescPtr);
PVRSRV_ERROR
DeviceMemChangeSparse(DEVMEM_MEMDESC *psMemDesc,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 *paui32AllocPageIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 *pauiFreePageIndices,
SPARSE_MEM_RESIZE_FLAGS uiFlags);
PVRSRV_ERROR
DevmemAllocateSparse(SHARED_DEV_CONNECTION hDevConnection,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_SIZE_T uiChunkSize,
IMG_UINT32 ui32NumPhysChunks,
IMG_UINT32 ui32NumVirtChunks,
IMG_UINT32 *pui32MappingTable,
IMG_DEVMEM_ALIGN_T uiAlign,
IMG_UINT32 uiLog2HeapPageSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
const IMG_CHAR *pszText,
DEVMEM_MEMDESC **ppsMemDescPtr);
PVRSRV_ERROR
DevmemSubAllocateAndMap(IMG_UINT8 uiPreAllocMultiplier,
DEVMEM_HEAP *psHeap,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_ALIGN_T uiAlign,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
const IMG_CHAR *pszText,
DEVMEM_MEMDESC **ppsMemDescPtr,
IMG_DEV_VIRTADDR *psDevVirtAddr);
#define DevmemAllocateAndMap(...) \
DevmemSubAllocateAndMap(DEVMEM_NO_PRE_ALLOCATE_MULTIPLIER, __VA_ARGS__)
/*
* DevmemFree()
*
* Reverses that done by DevmemSubAllocate() N.B. The underlying
* mapping and server side allocation _may_ not be torn down, for
* example, if the allocation has been exported, or if multiple
* allocations were suballocated from the same mapping, but this is
* properly refcounted, so the caller does not have to care.
*/
IMG_BOOL
DevmemFree(DEVMEM_MEMDESC *psMemDesc);
IMG_BOOL
DevmemReleaseDevAddrAndFree(DEVMEM_MEMDESC *psMemDesc);
/*
DevmemMapToDevice:
Map an allocation to the device it was allocated from.
This function _must_ be called before any call to
DevmemAcquireDevVirtAddr is made as it binds the allocation
to the heap.
DevmemReleaseDevVirtAddr is used to release the reference
to the device mapping this function created, but it doesn't
mean that the memory will actually be unmapped from the
device as other references to the mapping obtained via
DevmemAcquireDevVirtAddr could still be active.
*/
PVRSRV_ERROR DevmemMapToDevice(DEVMEM_MEMDESC *psMemDesc,
DEVMEM_HEAP *psHeap,
IMG_DEV_VIRTADDR *psDevVirtAddr);
/*
DevmemMapToDeviceAddress:
Same as DevmemMapToDevice but the caller chooses the address
to map to.
*/
IMG_INTERNAL PVRSRV_ERROR
DevmemMapToDeviceAddress(DEVMEM_MEMDESC *psMemDesc,
DEVMEM_HEAP *psHeap,
IMG_DEV_VIRTADDR sDevVirtAddr);
/*
DevmemGetDevVirtAddr
Obtain the MemDesc's device virtual address.
This function _must_ be called after DevmemMapToDevice(Address)
and is expected to be used be functions which didn't allocate
the MemDesc but need to know it's address.
It will PVR_ASSERT if no device mapping exists and 0 is returned.
*/
IMG_DEV_VIRTADDR
DevmemGetDevVirtAddr(DEVMEM_MEMDESC *psMemDesc);
/*
DevmemAcquireDevVirtAddr
Acquire the MemDesc's device virtual address.
This function _must_ be called after DevmemMapToDevice
and is expected to be used be functions which didn't allocate
the MemDesc but need to know it's address
*/
PVRSRV_ERROR DevmemAcquireDevVirtAddr(DEVMEM_MEMDESC *psMemDesc,
IMG_DEV_VIRTADDR *psDevVirtAddrRet);
/*
* DevmemReleaseDevVirtAddr()
*
* give up the licence to use the device virtual address that was
* acquired by "Acquire" or "MapToDevice"
*/
void
DevmemReleaseDevVirtAddr(DEVMEM_MEMDESC *psMemDesc);
/*
* DevmemAcquireCpuVirtAddr()
*
* Acquires a license to use the cpu virtual address of this mapping.
* Note that the memory may not have been mapped into cpu virtual
* memory prior to this call. On first "acquire" the memory will be
* mapped in (if it wasn't statically mapped in) and on last put it
* _may_ become unmapped. Later calling "Acquire" again, _may_ cause
* the memory to be mapped at a different address.
*/
PVRSRV_ERROR DevmemAcquireCpuVirtAddr(DEVMEM_MEMDESC *psMemDesc,
void **ppvCpuVirtAddr);
/*
* DevmemReacquireCpuVirtAddr()
*
* (Re)acquires license to use the cpu virtual address of this mapping
* if (and only if) there is already a pre-existing license to use the
* cpu virtual address for the mapping, returns NULL otherwise.
*/
void DevmemReacquireCpuVirtAddr(DEVMEM_MEMDESC *psMemDesc,
void **ppvCpuVirtAddr);
/*
* DevmemReleaseDevVirtAddr()
*
* give up the licence to use the cpu virtual address that was granted
* with the "Get" call.
*/
void
DevmemReleaseCpuVirtAddr(DEVMEM_MEMDESC *psMemDesc);
#if defined(SUPPORT_INSECURE_EXPORT)
/*
* DevmemExport()
*
* Given a memory allocation allocated with DevmemAllocateExportable()
* create a "cookie" that can be passed intact by the caller's own choice
* of secure IPC to another process and used as the argument to "map"
* to map this memory into a heap in the target processes. N.B. This can
* also be used to map into multiple heaps in one process, though that's not
* the intention.
*
* Note, the caller must later call Unexport before freeing the
* memory.
*/
PVRSRV_ERROR DevmemExport(DEVMEM_MEMDESC *psMemDesc,
DEVMEM_EXPORTCOOKIE *psExportCookie);
void DevmemUnexport(DEVMEM_MEMDESC *psMemDesc,
DEVMEM_EXPORTCOOKIE *psExportCookie);
PVRSRV_ERROR
DevmemImport(SHARED_DEV_CONNECTION hDevConnection,
DEVMEM_EXPORTCOOKIE *psCookie,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
DEVMEM_MEMDESC **ppsMemDescPtr);
#endif /* SUPPORT_INSECURE_EXPORT */
/*
* DevmemMakeLocalImportHandle()
*
* This is a "special case" function for making a server export cookie
* which went through the direct bridge into an export cookie that can
* be passed through the client bridge.
*/
PVRSRV_ERROR
DevmemMakeLocalImportHandle(SHARED_DEV_CONNECTION hDevConnection,
IMG_HANDLE hServerExport,
IMG_HANDLE *hClientExport);
/*
* DevmemUnmakeLocalImportHandle()
*
* Free any resource associated with the Make operation
*/
PVRSRV_ERROR
DevmemUnmakeLocalImportHandle(SHARED_DEV_CONNECTION hDevConnection,
IMG_HANDLE hClientExport);
/*
*
* The following set of functions is specific to the heap "blueprint"
* stuff, for automatic creation of heaps when a context is created
*
*/
/* Devmem_HeapConfigCount: returns the number of heap configs that
this device has. Note that there is no acquire/release semantics
required, as this data is guaranteed to be constant for the
lifetime of the device node */
PVRSRV_ERROR
DevmemHeapConfigCount(SHARED_DEV_CONNECTION hDevConnection,
IMG_UINT32 *puiNumHeapConfigsOut);
/* Devmem_HeapCount: returns the number of heaps that a given heap
config on this device has. Note that there is no acquire/release
semantics required, as this data is guaranteed to be constant for
the lifetime of the device node */
PVRSRV_ERROR
DevmemHeapCount(SHARED_DEV_CONNECTION hDevConnection,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 *puiNumHeapsOut);
/* Devmem_HeapConfigName: return the name of the given heap config.
The caller is to provide the storage for the returned string and
indicate the number of bytes (including null terminator) for such
string in the BufSz arg. Note that there is no acquire/release
semantics required, as this data is guaranteed to be constant for
the lifetime of the device node.
*/
PVRSRV_ERROR
DevmemHeapConfigName(SHARED_DEV_CONNECTION hsDevConnection,
IMG_UINT32 uiHeapConfigIndex,
IMG_CHAR *pszConfigNameOut,
IMG_UINT32 uiConfigNameBufSz);
/* Devmem_HeapDetails: fetches all the metadata that is recorded in
this heap "blueprint". Namely: heap name (caller to provide
storage, and indicate buffer size (including null terminator) in
BufSz arg), device virtual address and length, log2 of data page
size (will be one of 12, 14, 16, 18, 20, 21, at time of writing).
Note that there is no acquire/release semantics required, as this
data is guaranteed to be constant for the lifetime of the device
node. */
PVRSRV_ERROR
DevmemHeapDetails(SHARED_DEV_CONNECTION hDevConnection,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 uiHeapIndex,
IMG_CHAR *pszHeapNameOut,
IMG_UINT32 uiHeapNameBufSz,
IMG_DEV_VIRTADDR *psDevVAddrBaseOut,
IMG_DEVMEM_SIZE_T *puiHeapLengthOut,
IMG_DEVMEM_SIZE_T *puiReservedRegionLengthOut,
IMG_UINT32 *puiLog2DataPageSize,
IMG_UINT32 *puiLog2ImportAlignmentOut);
/*
* Devmem_FindHeapByName()
*
* returns the heap handle for the named _automagic_ heap in this
* context. "automagic" heaps are those that are born with the
* context from a blueprint
*/
PVRSRV_ERROR
DevmemFindHeapByName(const DEVMEM_CONTEXT *psCtx,
const IMG_CHAR *pszHeapName,
DEVMEM_HEAP **ppsHeapRet);
/*
* DevmemGetHeapBaseDevVAddr()
*
* returns the device virtual address of the base of the heap.
*/
PVRSRV_ERROR
DevmemGetHeapBaseDevVAddr(DEVMEM_HEAP *psHeap,
IMG_DEV_VIRTADDR *pDevVAddr);
PVRSRV_ERROR
DevmemLocalGetImportHandle(DEVMEM_MEMDESC *psMemDesc,
IMG_HANDLE *phImport);
PVRSRV_ERROR
DevmemGetImportUID(DEVMEM_MEMDESC *psMemDesc,
IMG_UINT64 *pui64UID);
PVRSRV_ERROR
DevmemGetReservation(DEVMEM_MEMDESC *psMemDesc,
IMG_HANDLE *hReservation);
IMG_INTERNAL void
DevmemGetPMRData(DEVMEM_MEMDESC *psMemDesc,
IMG_HANDLE *hPMR,
IMG_DEVMEM_OFFSET_T *puiPMROffset);
IMG_INTERNAL void
DevmemGetFlags(DEVMEM_MEMDESC *psMemDesc,
PVRSRV_MEMALLOCFLAGS_T *puiFlags);
IMG_INTERNAL SHARED_DEV_CONNECTION
DevmemGetConnection(DEVMEM_MEMDESC *psMemDesc);
PVRSRV_ERROR
DevmemLocalImport(SHARED_DEV_CONNECTION hDevConnection,
IMG_HANDLE hExtHandle,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
DEVMEM_MEMDESC **ppsMemDescPtr,
IMG_DEVMEM_SIZE_T *puiSizePtr,
const IMG_CHAR *pszAnnotation);
IMG_INTERNAL PVRSRV_ERROR
DevmemIsDevVirtAddrValid(DEVMEM_CONTEXT *psContext,
IMG_DEV_VIRTADDR sDevVAddr);
IMG_INTERNAL PVRSRV_ERROR
DevmemGetFaultAddress(DEVMEM_CONTEXT *psContext,
IMG_DEV_VIRTADDR *psFaultAddress);
IMG_INTERNAL PVRSRV_ERROR
DevmemFlushDeviceSLCRange(DEVMEM_MEMDESC *psMemDesc,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
IMG_BOOL bInvalidate);
IMG_INTERNAL PVRSRV_ERROR
DevmemInvalidateFBSCTable(DEVMEM_CONTEXT *psContext,
IMG_UINT64 ui64FBSCEntries);
/* DevmemGetHeapLog2PageSize()
*
* Get the page size used for a certain heap.
*/
IMG_UINT32
DevmemGetHeapLog2PageSize(DEVMEM_HEAP *psHeap);
/* DevmemGetMemFlags()
*
* Get the memalloc flags for a certain memdesc.
*/
PVRSRV_MEMALLOCFLAGS_T
DevmemGetMemAllocFlags(DEVMEM_MEMDESC *psMemDesc);
/* DevmemGetHeapReservedSize()
*
* Get the reserved size used for a certain heap.
*/
IMG_DEVMEM_SIZE_T
DevmemGetHeapReservedSize(DEVMEM_HEAP *psHeap);
/*************************************************************************/ /*!
@Function RegisterDevMemPFNotify
@Description Registers that the application wants to be signaled when a page
fault occurs.
@Input psContext Memory context the process that would like to
be notified about.
@Input ui32PID The PID of the calling process.
@Input bRegister If true, register. If false, de-register.
@Return PVRSRV_ERROR: PVRSRV_OK on success. Otherwise, a PVRSRV_
error code
*/ /**************************************************************************/
IMG_INTERNAL PVRSRV_ERROR
RegisterDevmemPFNotify(DEVMEM_CONTEXT *psContext,
IMG_UINT32 ui32PID,
IMG_BOOL bRegister);
/*************************************************************************/ /*!
@Function DevmemHeapSetPremapStatus
@Description In some special cases like virtualisation, a device memory heap
must be entirely backed by physical memory and mapped into the
device's virtual address space. This is done at context creation.
When objects are allocated from such a heap, the mapping part
must be skipped. The 'bPremapped' flag dictates if allocations
are to be mapped or not.
@Input psHeap Device memory heap to be updated
@Input IsPremapped The premapping status to be set
*/ /**************************************************************************/
IMG_INTERNAL void
DevmemHeapSetPremapStatus(DEVMEM_HEAP *psHeap, IMG_BOOL IsPremapped);
#endif /* #ifndef SRVCLIENT_DEVICEMEM_H */

View File

@@ -0,0 +1,184 @@
/*************************************************************************/ /*!
@File devicemem_heapcfg.c
@Title Device Heap Configuration Helper Functions
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Device memory management
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /***************************************************************************/
/* our exported API */
#include "devicemem_heapcfg.h"
#include "devicemem_utils.h"
#include "device.h"
#include "img_types.h"
#include "img_defs.h"
#include "pvr_debug.h"
#include "pvrsrv_error.h"
#include "osfunc.h"
#include "connection_server.h"
static INLINE void _CheckBlueprintHeapAlignment(DEVMEM_HEAP_BLUEPRINT *psHeapBlueprint)
{
IMG_UINT32 ui32OSPageSize = OSGetPageShift();
/* Any heap length should at least match OS page size at the minimum or
* a multiple of OS page size */
if ((psHeapBlueprint->uiHeapLength < DEVMEM_HEAP_MINIMUM_SIZE) ||
(psHeapBlueprint->uiHeapLength & (ui32OSPageSize - 1)))
{
PVR_DPF((PVR_DBG_ERROR,
"%s: Invalid Heap \"%s\" Size: "
"%"IMG_UINT64_FMTSPEC
"("IMG_DEVMEM_SIZE_FMTSPEC")",
__func__,
psHeapBlueprint->pszName,
psHeapBlueprint->uiHeapLength,
psHeapBlueprint->uiHeapLength));
PVR_DPF((PVR_DBG_ERROR,
"Heap Size should always be a non-zero value and a "
"multiple of OS Page Size:%u(0x%x)",
ui32OSPageSize, ui32OSPageSize));
PVR_ASSERT(psHeapBlueprint->uiHeapLength >= ui32OSPageSize);
}
PVR_ASSERT(psHeapBlueprint->uiReservedRegionLength % DEVMEM_HEAP_RESERVED_SIZE_GRANULARITY == 0);
}
void HeapCfgBlueprintInit(const IMG_CHAR *pszName,
IMG_UINT64 ui64HeapBaseAddr,
IMG_DEVMEM_SIZE_T uiHeapLength,
IMG_DEVMEM_SIZE_T uiReservedRegionLength,
IMG_UINT32 ui32Log2DataPageSize,
IMG_UINT32 uiLog2ImportAlignment,
DEVMEM_HEAP_BLUEPRINT *psHeapBlueprint)
{
psHeapBlueprint->pszName = pszName;
psHeapBlueprint->sHeapBaseAddr.uiAddr = ui64HeapBaseAddr;
psHeapBlueprint->uiHeapLength = uiHeapLength;
psHeapBlueprint->uiReservedRegionLength = uiReservedRegionLength;
psHeapBlueprint->uiLog2DataPageSize = ui32Log2DataPageSize;
psHeapBlueprint->uiLog2ImportAlignment = uiLog2ImportAlignment;
_CheckBlueprintHeapAlignment(psHeapBlueprint);
}
PVRSRV_ERROR
HeapCfgHeapConfigCount(CONNECTION_DATA * psConnection,
const PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_UINT32 *puiNumHeapConfigsOut)
{
PVR_UNREFERENCED_PARAMETER(psConnection);
*puiNumHeapConfigsOut = psDeviceNode->sDevMemoryInfo.uiNumHeapConfigs;
return PVRSRV_OK;
}
PVRSRV_ERROR
HeapCfgHeapCount(CONNECTION_DATA * psConnection,
const PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 *puiNumHeapsOut)
{
if (uiHeapConfigIndex >= psDeviceNode->sDevMemoryInfo.uiNumHeapConfigs)
{
return PVRSRV_ERROR_DEVICEMEM_INVALID_HEAP_CONFIG_INDEX;
}
*puiNumHeapsOut = psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeapConfigArray[uiHeapConfigIndex].uiNumHeaps;
return PVRSRV_OK;
}
PVRSRV_ERROR
HeapCfgHeapConfigName(CONNECTION_DATA * psConnection,
const PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 uiHeapConfigNameBufSz,
IMG_CHAR *pszHeapConfigNameOut)
{
if (uiHeapConfigIndex >= psDeviceNode->sDevMemoryInfo.uiNumHeapConfigs)
{
return PVRSRV_ERROR_DEVICEMEM_INVALID_HEAP_CONFIG_INDEX;
}
OSSNPrintf(pszHeapConfigNameOut, uiHeapConfigNameBufSz, "%s", psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeapConfigArray[uiHeapConfigIndex].pszName);
return PVRSRV_OK;
}
PVRSRV_ERROR
HeapCfgHeapDetails(CONNECTION_DATA * psConnection,
const PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 uiHeapIndex,
IMG_UINT32 uiHeapNameBufSz,
IMG_CHAR *pszHeapNameOut,
IMG_DEV_VIRTADDR *psDevVAddrBaseOut,
IMG_DEVMEM_SIZE_T *puiHeapLengthOut,
IMG_DEVMEM_SIZE_T *puiReservedRegionLengthOut,
IMG_UINT32 *puiLog2DataPageSizeOut,
IMG_UINT32 *puiLog2ImportAlignmentOut)
{
DEVMEM_HEAP_BLUEPRINT *psHeapBlueprint;
if (uiHeapConfigIndex >= psDeviceNode->sDevMemoryInfo.uiNumHeapConfigs)
{
return PVRSRV_ERROR_DEVICEMEM_INVALID_HEAP_CONFIG_INDEX;
}
if (uiHeapIndex >= psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeapConfigArray[uiHeapConfigIndex].uiNumHeaps)
{
return PVRSRV_ERROR_DEVICEMEM_INVALID_HEAP_INDEX;
}
psHeapBlueprint = &psDeviceNode->sDevMemoryInfo.psDeviceMemoryHeapConfigArray[uiHeapConfigIndex].psHeapBlueprintArray[uiHeapIndex];
OSSNPrintf(pszHeapNameOut, uiHeapNameBufSz, "%s", psHeapBlueprint->pszName);
*psDevVAddrBaseOut = psHeapBlueprint->sHeapBaseAddr;
*puiHeapLengthOut = psHeapBlueprint->uiHeapLength;
*puiReservedRegionLengthOut = psHeapBlueprint->uiReservedRegionLength;
*puiLog2DataPageSizeOut = psHeapBlueprint->uiLog2DataPageSize;
*puiLog2ImportAlignmentOut = psHeapBlueprint->uiLog2ImportAlignment;
return PVRSRV_OK;
}

View File

@@ -0,0 +1,184 @@
/**************************************************************************/ /*!
@File
@Title Device Heap Configuration Helper Functions
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Device memory management
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /***************************************************************************/
#ifndef DEVICEMEMHEAPCFG_H
#define DEVICEMEMHEAPCFG_H
#include <powervr/mem_types.h>
#include "img_types.h"
#include "pvrsrv_error.h"
/*
* Supported log2 page size values for RGX_GENERAL_NON_4K_HEAP_ID
*/
#define RGX_HEAP_4KB_PAGE_SHIFT (12U)
#define RGX_HEAP_16KB_PAGE_SHIFT (14U)
#define RGX_HEAP_64KB_PAGE_SHIFT (16U)
#define RGX_HEAP_256KB_PAGE_SHIFT (18U)
#define RGX_HEAP_1MB_PAGE_SHIFT (20U)
#define RGX_HEAP_2MB_PAGE_SHIFT (21U)
struct _PVRSRV_DEVICE_NODE_;
struct _CONNECTION_DATA_;
/*
A "heap config" is a blueprint to be used for initial setting up of heaps
when a device memory context is created.
We define a data structure to define this, but it's really down to the
caller to populate it. This is all expected to be in-kernel. We provide an
API that client code can use to enquire about the blueprint, such that it may
do the heap set-up during the context creation call on behalf of the user.
*/
/* Blueprint for a single heap */
typedef struct _DEVMEM_HEAP_BLUEPRINT_
{
/* Name of this heap - for debug purposes, and perhaps for lookup
by name */
const IMG_CHAR *pszName;
/* Virtual address of the beginning of the heap. This _must_ be a
multiple of the data page size for the heap. It is
_recommended_ that it be coarser than that - especially, it
should begin on a boundary appropriate to the MMU for the
device. For Rogue, this is a Page Directory boundary, or 1GB
(virtual address a multiple of 0x0040000000). */
IMG_DEV_VIRTADDR sHeapBaseAddr;
/* Length of the heap. Given that the END address of the heap has
a similar restriction to that of the _beginning_ of the heap.
That is the heap length _must_ be a whole number of data pages.
Again, the recommendation is that it ends on a 1GB boundary.
Again, this is not essential, but we do know that (at the time
of writing) the current implementation of mmu_common.c is such
that no two heaps may share a page directory, thus the
remaining virtual space would be wasted if the length were not
a multiple of 1GB */
IMG_DEVMEM_SIZE_T uiHeapLength;
/* VA space starting sHeapBaseAddr to uiReservedRegionLength-1 are reserved
for statically defined addresses (shared/known between clients and FW).
Services never maps allocations into this reserved address space _unless_
explicitly requested via PVRSRVMapToDeviceAddress by passing sDevVirtAddr
which falls within this reserved range. Since this range is completely for
clients to manage (where allocations are page granular), it _must_ again be
a whole number of data pages. Additionally, another constraint enforces this
to be a multiple of DEVMEM_HEAP_RESERVED_SIZE_GRANULARITY (which evaluates to
max page size supported) to support varied pages sizes */
IMG_DEVMEM_SIZE_T uiReservedRegionLength;
/* Data page size. This is the page size that is going to get
programmed into the MMU, so it needs to be a valid one for the
device. Importantly, the start address and length _must_ be
multiples of this page size. Note that the page size is
specified as the log 2 relative to 1 byte (e.g. 12 indicates
4kB) */
IMG_UINT32 uiLog2DataPageSize;
/* Import alignment. Force imports to this heap to be
aligned to at least this value */
IMG_UINT32 uiLog2ImportAlignment;
} DEVMEM_HEAP_BLUEPRINT;
void HeapCfgBlueprintInit(const IMG_CHAR *pszName,
IMG_UINT64 ui64HeapBaseAddr,
IMG_DEVMEM_SIZE_T uiHeapLength,
IMG_DEVMEM_SIZE_T uiReservedRegionLength,
IMG_UINT32 ui32Log2DataPageSize,
IMG_UINT32 uiLog2ImportAlignment,
DEVMEM_HEAP_BLUEPRINT *psHeapBlueprint);
/* Entire named heap config */
typedef struct _DEVMEM_HEAP_CONFIG_
{
/* Name of this heap config - for debug and maybe lookup */
const IMG_CHAR *pszName;
/* Number of heaps in this config */
IMG_UINT32 uiNumHeaps;
/* Array of individual heap blueprints as defined above */
DEVMEM_HEAP_BLUEPRINT *psHeapBlueprintArray;
} DEVMEM_HEAP_CONFIG;
PVRSRV_ERROR
HeapCfgHeapConfigCount(struct _CONNECTION_DATA_ *psConnection,
const struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
IMG_UINT32 *puiNumHeapConfigsOut
);
PVRSRV_ERROR
HeapCfgHeapCount(struct _CONNECTION_DATA_ *psConnection,
const struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 *puiNumHeapsOut
);
PVRSRV_ERROR
HeapCfgHeapConfigName(struct _CONNECTION_DATA_ *psConnection,
const struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 uiHeapConfigNameBufSz,
IMG_CHAR *pszHeapConfigNameOut
);
PVRSRV_ERROR
HeapCfgHeapDetails(struct _CONNECTION_DATA_ *psConnection,
const struct _PVRSRV_DEVICE_NODE_ *psDeviceNode,
IMG_UINT32 uiHeapConfigIndex,
IMG_UINT32 uiHeapIndex,
IMG_UINT32 uiHeapNameBufSz,
IMG_CHAR *pszHeapNameOut,
IMG_DEV_VIRTADDR *psDevVAddrBaseOut,
IMG_DEVMEM_SIZE_T *puiHeapLengthOut,
IMG_DEVMEM_SIZE_T *puiReservedRegionLengthOut,
IMG_UINT32 *puiLog2DataPageSizeOut,
IMG_UINT32 *puiLog2ImportAlignmentOut
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,157 @@
/*************************************************************************/ /*!
@File devicemem_history_server.h
@Title Resource Information abstraction
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Devicemem History functions
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DEVICEMEM_HISTORY_SERVER_H
#define DEVICEMEM_HISTORY_SERVER_H
#include "img_defs.h"
#include "pvrsrv_error.h"
#include "rgxmem.h"
#include "devicemem_utils.h"
#include "connection_server.h"
PVRSRV_ERROR DevicememHistoryInitKM(void);
void DevicememHistoryDeInitKM(void);
PVRSRV_ERROR DevicememHistoryMapKM(PMR *psPMR,
IMG_UINT32 ui32Offset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const char szName[DEVMEM_ANNOTATION_MAX_LEN],
IMG_UINT32 ui32PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 *pui32AllocationIndexOut);
PVRSRV_ERROR DevicememHistoryUnmapKM(PMR *psPMR,
IMG_UINT32 ui32Offset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const char szName[DEVMEM_ANNOTATION_MAX_LEN],
IMG_UINT32 ui32PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 *pui32AllocationIndexOut);
PVRSRV_ERROR DevicememHistoryMapVRangeKM(CONNECTION_DATA *psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_DEV_VIRTADDR sBaseDevVAddr,
IMG_UINT32 ui32StartPage,
IMG_UINT32 ui32NumPages,
IMG_DEVMEM_SIZE_T uiAllocSize,
const IMG_CHAR szName[DEVMEM_ANNOTATION_MAX_LEN],
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 *ui32AllocationIndexOut);
PVRSRV_ERROR DevicememHistoryUnmapVRangeKM(CONNECTION_DATA *psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_DEV_VIRTADDR sBaseDevVAddr,
IMG_UINT32 ui32StartPage,
IMG_UINT32 ui32NumPages,
IMG_DEVMEM_SIZE_T uiAllocSize,
const IMG_CHAR szName[DEVMEM_ANNOTATION_MAX_LEN],
IMG_UINT32 ui32Log2PageSize,
IMG_UINT32 ui32AllocationIndex,
IMG_UINT32 *ui32AllocationIndexOut);
PVRSRV_ERROR DevicememHistorySparseChangeKM(PMR *psPMR,
IMG_UINT32 ui32Offset,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
const char szName[DEVMEM_ANNOTATION_MAX_LEN],
IMG_UINT32 ui32PageSize,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 *paui32AllocPageIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 *pauiFreePageIndices,
IMG_UINT32 AllocationIndex,
IMG_UINT32 *pui32AllocationIndexOut);
/* used when the PID does not matter */
#define DEVICEMEM_HISTORY_PID_ANY 0xFFFFFFFE
typedef struct _DEVICEMEM_HISTORY_QUERY_IN_
{
IMG_PID uiPID;
IMG_DEV_VIRTADDR sDevVAddr;
} DEVICEMEM_HISTORY_QUERY_IN;
/* Store up to 4 results for a lookup. In the case of the faulting page being
* re-mapped between the page fault occurring on HW and the page fault analysis
* being done, the second result entry will show the allocation being unmapped.
* A further 2 entries are added to cater for multiple buffers in the same page.
*/
#define DEVICEMEM_HISTORY_QUERY_OUT_MAX_RESULTS 4
typedef struct _DEVICEMEM_HISTORY_QUERY_OUT_RESULT_
{
IMG_CHAR szString[DEVMEM_ANNOTATION_MAX_LEN];
IMG_DEV_VIRTADDR sBaseDevVAddr;
IMG_DEVMEM_SIZE_T uiSize;
IMG_BOOL bMap;
IMG_BOOL bRange;
IMG_BOOL bAll;
IMG_UINT64 ui64When;
IMG_UINT64 ui64Age;
/* info for sparse map/unmap operations (i.e. bRange=IMG_TRUE) */
IMG_UINT32 ui32StartPage;
IMG_UINT32 ui32PageCount;
IMG_DEV_VIRTADDR sMapStartAddr;
IMG_DEV_VIRTADDR sMapEndAddr;
RGXMEM_PROCESS_INFO sProcessInfo;
} DEVICEMEM_HISTORY_QUERY_OUT_RESULT;
typedef struct _DEVICEMEM_HISTORY_QUERY_OUT_
{
IMG_UINT32 ui32NumResults;
/* result 0 is the newest */
DEVICEMEM_HISTORY_QUERY_OUT_RESULT sResults[DEVICEMEM_HISTORY_QUERY_OUT_MAX_RESULTS];
} DEVICEMEM_HISTORY_QUERY_OUT;
IMG_BOOL
DevicememHistoryQuery(DEVICEMEM_HISTORY_QUERY_IN *psQueryIn,
DEVICEMEM_HISTORY_QUERY_OUT *psQueryOut,
IMG_UINT32 ui32PageSizeBytes,
IMG_BOOL bMatchAnyAllocInPage);
#endif

View File

@@ -0,0 +1,363 @@
/*************************************************************************/ /*!
@File
@Title Device Memory Management PDump internal
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Services internal interface to PDump device memory management
functions that are shared between client and server code.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DEVICEMEM_PDUMP_H
#define DEVICEMEM_PDUMP_H
#include "devicemem.h"
#include "pdumpdefs.h"
#include "pdump.h"
#if defined(PDUMP)
/*
* DevmemPDumpLoadMem()
*
* takes a memory descriptor, offset, and size, and takes the current contents
* of the memory at that location and writes it to the prm pdump file, and
* emits a pdump LDB to load the data from that file. The intention here is
* that the contents of the simulated buffer upon pdump playback will be made
* to be the same as they are when this command is run, enabling pdump of
* cases where the memory has been modified externally, i.e. by the host cpu
* or by a third party.
*/
void
DevmemPDumpLoadMem(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
PDUMP_FLAGS_T uiPDumpFlags);
/*
* DevmemPDumpLoadZeroMem()
*
* As DevmemPDumpLoadMem() but the PDump allocation will be populated with
* zeros from the zero page in the parameter stream
*/
void
DevmemPDumpLoadZeroMem(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
PDUMP_FLAGS_T uiPDumpFlags);
/*
* DevmemPDumpLoadMemValue32()
*
* As above but dumps the value at a dword-aligned address in plain text to
* the pdump script2 file. Useful for patching a buffer at pdump playback by
* simply editing the script output file.
*
* (The same functionality can be achieved by the above function but the
* binary PARAM file must be patched in that case.)
*/
IMG_INTERNAL void
DevmemPDumpLoadMemValue32(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT32 ui32Value,
PDUMP_FLAGS_T uiPDumpFlags);
/*
* DevmemPDumpMemValue64()
*
* As above but dumps the 64bit-value at a dword-aligned address in plain text
* to the pdump script2 file. Useful for patching a buffer at pdump playback by
* simply editing the script output file.
*
* (The same functionality can be achieved by the above function but the
* binary PARAM file must be patched in that case.)
*/
IMG_INTERNAL void
DevmemPDumpLoadMemValue64(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT64 ui64Value,
PDUMP_FLAGS_T uiPDumpFlags);
/*
* DevmemPDumpPageCatBaseToSAddr()
*
* Returns the symbolic address of a piece of memory represented by an offset
* into the mem descriptor.
*/
PVRSRV_ERROR
DevmemPDumpPageCatBaseToSAddr(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T *puiMemOffset,
IMG_CHAR *pszName,
IMG_UINT32 ui32Size);
/*
* DevmemPDumpSaveToFile()
*
* Emits a pdump SAB to cause the current contents of the memory to be written
* to the given file during playback
*/
void
DevmemPDumpSaveToFile(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR *pszFilename,
IMG_UINT32 uiFileOffset);
/*
* DevmemPDumpSaveToFileVirtual()
*
* Emits a pdump SAB, just like DevmemPDumpSaveToFile(), but uses the virtual
* address and device MMU context to cause the pdump player to traverse the
* MMU page tables itself.
*/
void
DevmemPDumpSaveToFileVirtual(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR *pszFilename,
IMG_UINT32 ui32FileOffset,
IMG_UINT32 ui32PdumpFlags);
/*
* DevmemPDumpDataDescriptor()
*
* Emits a pdump CMD:OutputData, using the virtual address and device MMU
* context. Provides more flexibility than a pdump SAB because metadata can
* be passed to an external pdump player library via the command header.
*/
void
DevmemPDumpDataDescriptor(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR *pszFilename,
IMG_UINT32 ui32HeaderType,
IMG_UINT32 ui32ElementType,
IMG_UINT32 ui32ElementCount,
IMG_UINT32 ui32PdumpFlags);
/*
*
* DevmemPDumpDevmemPol32()
*
* Writes a PDump 'POL' command to wait for a masked 32-bit memory location to
* become the specified value.
*/
PVRSRV_ERROR
DevmemPDumpDevmemPol32(const DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT32 ui32Value,
IMG_UINT32 ui32Mask,
PDUMP_POLL_OPERATOR eOperator,
PDUMP_FLAGS_T ui32PDumpFlags);
#if defined(__KERNEL__)
/*
*
* DevmemPDumpDevmemCheck32()
*
* Writes a PDump 'POL' command to run a single-shot check for a masked
* 32-bit memory location to match the specified value.
*/
PVRSRV_ERROR
DevmemPDumpDevmemCheck32(const DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT32 ui32Value,
IMG_UINT32 ui32Mask,
PDUMP_POLL_OPERATOR eOperator,
PDUMP_FLAGS_T ui32PDumpFlags);
#endif
/*
* DevmemPDumpCBP()
*
* Polls for space in circular buffer. Reads the read offset from memory and
* waits until there is enough space to write the packet.
*
* psMemDesc - MemDesc which contains the read offset
* uiReadOffset - Offset into MemDesc to the read offset
* uiWriteOffset - Current write offset
* uiPacketSize - Size of packet to write
* uiBufferSize - Size of circular buffer
*/
PVRSRV_ERROR
DevmemPDumpCBP(const DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiReadOffset,
IMG_DEVMEM_OFFSET_T uiWriteOffset,
IMG_DEVMEM_SIZE_T uiPacketSize,
IMG_DEVMEM_SIZE_T uiBufferSize);
#else /* PDUMP */
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpLoadMem)
#endif
static INLINE void
DevmemPDumpLoadMem(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
PDUMP_FLAGS_T uiPDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiOffset);
PVR_UNREFERENCED_PARAMETER(uiSize);
PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpLoadMemValue32)
#endif
static INLINE void
DevmemPDumpLoadMemValue32(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT32 ui32Value,
PDUMP_FLAGS_T uiPDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiOffset);
PVR_UNREFERENCED_PARAMETER(ui32Value);
PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpLoadMemValue64)
#endif
static INLINE void
DevmemPDumpLoadMemValue64(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT64 ui64Value,
PDUMP_FLAGS_T uiPDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiOffset);
PVR_UNREFERENCED_PARAMETER(ui64Value);
PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpPageCatBaseToSAddr)
#endif
static INLINE PVRSRV_ERROR
DevmemPDumpPageCatBaseToSAddr(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T *puiMemOffset,
IMG_CHAR *pszName,
IMG_UINT32 ui32Size)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(puiMemOffset);
PVR_UNREFERENCED_PARAMETER(pszName);
PVR_UNREFERENCED_PARAMETER(ui32Size);
return PVRSRV_OK;
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpSaveToFile)
#endif
static INLINE void
DevmemPDumpSaveToFile(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR *pszFilename,
IMG_UINT32 uiFileOffset)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiOffset);
PVR_UNREFERENCED_PARAMETER(uiSize);
PVR_UNREFERENCED_PARAMETER(pszFilename);
PVR_UNREFERENCED_PARAMETER(uiFileOffset);
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpSaveToFileVirtual)
#endif
static INLINE void
DevmemPDumpSaveToFileVirtual(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_DEVMEM_SIZE_T uiSize,
const IMG_CHAR *pszFilename,
IMG_UINT32 ui32FileOffset,
IMG_UINT32 ui32PdumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiOffset);
PVR_UNREFERENCED_PARAMETER(uiSize);
PVR_UNREFERENCED_PARAMETER(pszFilename);
PVR_UNREFERENCED_PARAMETER(ui32FileOffset);
PVR_UNREFERENCED_PARAMETER(ui32PdumpFlags);
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpDevmemPol32)
#endif
static INLINE PVRSRV_ERROR
DevmemPDumpDevmemPol32(const DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT32 ui32Value,
IMG_UINT32 ui32Mask,
PDUMP_POLL_OPERATOR eOperator,
PDUMP_FLAGS_T ui32PDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiOffset);
PVR_UNREFERENCED_PARAMETER(ui32Value);
PVR_UNREFERENCED_PARAMETER(ui32Mask);
PVR_UNREFERENCED_PARAMETER(eOperator);
PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
return PVRSRV_OK;
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemPDumpCBP)
#endif
static INLINE PVRSRV_ERROR
DevmemPDumpCBP(const DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiReadOffset,
IMG_DEVMEM_OFFSET_T uiWriteOffset,
IMG_DEVMEM_SIZE_T uiPacketSize,
IMG_DEVMEM_SIZE_T uiBufferSize)
{
PVR_UNREFERENCED_PARAMETER(psMemDesc);
PVR_UNREFERENCED_PARAMETER(uiReadOffset);
PVR_UNREFERENCED_PARAMETER(uiWriteOffset);
PVR_UNREFERENCED_PARAMETER(uiPacketSize);
PVR_UNREFERENCED_PARAMETER(uiBufferSize);
return PVRSRV_OK;
}
#endif /* PDUMP */
#endif /* DEVICEMEM_PDUMP_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,633 @@
/*************************************************************************/ /*!
@File
@Title Device Memory Management
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Server side component for device memory management
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DEVICEMEM_SERVER_H
#define DEVICEMEM_SERVER_H
#include "device.h" /* For device node */
#include "img_types.h"
#include "img_defs.h"
#include "pvr_debug.h"
#include "pvrsrv_error.h"
#include "connection_server.h"
#include "pmr.h"
typedef struct _DEVMEMINT_CTX_ DEVMEMINT_CTX;
typedef struct _DEVMEMINT_CTX_EXPORT_ DEVMEMINT_CTX_EXPORT;
typedef struct _DEVMEMINT_HEAP_ DEVMEMINT_HEAP;
typedef struct _DEVMEMINT_RESERVATION_ DEVMEMINT_RESERVATION;
typedef struct _DEVMEMINT_MAPPING_ DEVMEMINT_MAPPING;
typedef struct _DEVMEMINT_PF_NOTIFY_ DEVMEMINT_PF_NOTIFY;
/*************************************************************************/ /*!
@Function DevmemIntUnpin
@Description This is the counterpart to DevmemPin(). It is meant to be
called when the allocation is NOT mapped in the device virtual
space.
@Input psPMR The physical memory to unpin.
@Return PVRSRV_ERROR: PVRSRV_OK on success and the memory is
registered to be reclaimed. Error otherwise.
*/ /**************************************************************************/
PVRSRV_ERROR DevmemIntUnpin(PMR *psPMR);
/*************************************************************************/ /*!
@Function DevmemIntUnpinInvalidate
@Description This is the counterpart to DevmemIntPinValidate(). It is meant
to be called for allocations that ARE mapped in the device
virtual space and we have to invalidate the mapping.
@Input psPMR The physical memory to unpin.
@Return PVRSRV_ERROR: PVRSRV_OK on success and the memory is
registered to be reclaimed. Error otherwise.
*/ /**************************************************************************/
PVRSRV_ERROR
DevmemIntUnpinInvalidate(DEVMEMINT_MAPPING *psDevmemMapping, PMR *psPMR);
/*************************************************************************/ /*!
@Function DevmemIntPin
@Description This is the counterpart to DevmemIntUnpin().
Is meant to be called if there is NO device mapping present.
@Input psPMR The physical memory to pin.
@Return PVRSRV_ERROR: PVRSRV_OK on success and the allocation content
was successfully restored.
PVRSRV_ERROR_PMR_NEW_MEMORY when the content
could not be restored and new physical memory
was allocated.
A different error otherwise.
*/ /**************************************************************************/
PVRSRV_ERROR DevmemIntPin(PMR *psPMR);
/*************************************************************************/ /*!
@Function DevmemIntPinValidate
@Description This is the counterpart to DevmemIntUnpinInvalidate().
Is meant to be called if there is IS a device mapping present
that needs to be taken care of.
@Input psDevmemMapping The mapping structure used for the passed PMR.
@Input psPMR The physical memory to pin.
@Return PVRSRV_ERROR: PVRSRV_OK on success and the allocation content
was successfully restored.
PVRSRV_ERROR_PMR_NEW_MEMORY when the content
could not be restored and new physical memory
was allocated.
A different error otherwise.
*/ /**************************************************************************/
PVRSRV_ERROR
DevmemIntPinValidate(DEVMEMINT_MAPPING *psDevmemMapping, PMR *psPMR);
/*
* DevmemServerGetImportHandle()
*
* For given exportable memory descriptor returns PMR handle
*
*/
PVRSRV_ERROR
DevmemServerGetImportHandle(DEVMEM_MEMDESC *psMemDesc,
IMG_HANDLE *phImport);
/*
* DevmemServerGetHeapHandle()
*
* For given reservation returns the Heap handle
*
*/
PVRSRV_ERROR
DevmemServerGetHeapHandle(DEVMEMINT_RESERVATION *psReservation,
IMG_HANDLE *phHeap);
/*
* DevmemServerGetContext()
*
* For given heap returns the context.
*
*/
PVRSRV_ERROR
DevmemServerGetContext(DEVMEMINT_HEAP *psDevmemHeap,
DEVMEMINT_CTX **ppsDevmemCtxPtr);
/*
* DevmemServerGetPrivData()
*
* For given context returns the private data handle.
*
*/
PVRSRV_ERROR
DevmemServerGetPrivData(DEVMEMINT_CTX *psDevmemCtx,
IMG_HANDLE *phPrivData);
/*
* DevmemIntAllocDefBackingPage
*
* This function allocates default backing page and initializes it
* with a given default value
*
*/
PVRSRV_ERROR DevmemIntAllocDefBackingPage(PVRSRV_DEVICE_NODE *psDevNode,
PVRSRV_DEF_PAGE *psDefPage,
IMG_INT uiInitValue,
IMG_CHAR *pcDefPageName,
IMG_BOOL bInitPage);
/*
* DevmemIntFreeDefBackingPage
*
* Frees a given page
*/
void DevmemIntFreeDefBackingPage(PVRSRV_DEVICE_NODE *psDevNode,
PVRSRV_DEF_PAGE *psDefPage,
IMG_CHAR *pcDefPageName);
/*
* DevmemIntCtxCreate()
*
* Create a Server-side Device Memory Context. This is usually the counterpart
* of the client side memory context, and indeed is usually created at the
* same time.
*
* You must have one of these before creating any heaps.
*
* All heaps must have been destroyed before calling
* DevmemIntCtxDestroy()
*
* If you call DevmemIntCtxCreate() (and it succeeds) you are promising to
* later call DevmemIntCtxDestroy()
*
* Note that this call will cause the device MMU code to do some work for
* creating the device memory context, but it does not guarantee that a page
* catalogue will have been created, as this may be deferred until the first
* allocation.
*
* Caller to provide storage for a pointer to the DEVMEM_CTX object that will
* be created by this call.
*/
PVRSRV_ERROR
DevmemIntCtxCreate(CONNECTION_DATA *psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
/* devnode / perproc etc */
IMG_BOOL bKernelMemoryCtx,
DEVMEMINT_CTX **ppsDevmemCtxPtr,
IMG_HANDLE *hPrivData,
IMG_UINT32 *pui32CPUCacheLineSize);
/*
* DevmemIntCtxDestroy()
*
* Undoes a prior DevmemIntCtxCreate or DevmemIntCtxImport.
*/
PVRSRV_ERROR
DevmemIntCtxDestroy(DEVMEMINT_CTX *psDevmemCtx);
/*
* DevmemIntHeapCreate()
*
* Creates a new heap in this device memory context. This will cause a call
* into the MMU code to allocate various data structures for managing this
* heap. It will not necessarily cause any page tables to be set up, as this
* can be deferred until first allocation. (i.e. we shouldn't care - it's up
* to the MMU code)
*
* Note that the data page size must be specified (as log 2). The data page
* size as specified here will be communicated to the mmu module, and thus may
* determine the page size configured in page directory entries for subsequent
* allocations from this heap. It is essential that the page size here is less
* than or equal to the "minimum contiguity guarantee" of any PMR that you
* subsequently attempt to map to this heap.
*
* If you call DevmemIntHeapCreate() (and the call succeeds) you are promising
* that you shall subsequently call DevmemIntHeapDestroy()
*
* Caller to provide storage for a pointer to the DEVMEM_HEAP object that will
* be created by this call.
*/
PVRSRV_ERROR
DevmemIntHeapCreate(DEVMEMINT_CTX *psDevmemCtx,
IMG_DEV_VIRTADDR sHeapBaseAddr,
IMG_DEVMEM_SIZE_T uiHeapLength,
IMG_UINT32 uiLog2DataPageSize,
DEVMEMINT_HEAP **ppsDevmemHeapPtr);
/*
* DevmemIntHeapDestroy()
*
* Destroys a heap previously created with DevmemIntHeapCreate()
*
* All allocations from his heap must have been freed before this
* call.
*/
PVRSRV_ERROR
DevmemIntHeapDestroy(DEVMEMINT_HEAP *psDevmemHeap);
/*
* DevmemIntMapPMR()
*
* Maps the given PMR to the virtual range previously allocated with
* DevmemIntReserveRange()
*
* If appropriate, the PMR must have had its physical backing committed, as
* this call will call into the MMU code to set up the page tables for this
* allocation, which shall in turn request the physical addresses from the
* PMR. Alternatively, the PMR implementation can choose to do so off the
* the back of the "lock" callback, which it will receive as a result
* (indirectly) of this call.
*
* This function makes no promise w.r.t. the circumstances that it can be
* called, and these would be "inherited" from the implementation of the PMR.
* For example if the PMR "lock" callback causes pages to be pinned at that
* time (which may cause scheduling or disk I/O etc.) then it would not be
* legal to "Map" the PMR in a context where scheduling events are disallowed.
*
* If you call DevmemIntMapPMR() (and the call succeeds) then you are promising
* that you shall later call DevmemIntUnmapPMR()
*/
PVRSRV_ERROR
DevmemIntMapPMR(DEVMEMINT_HEAP *psDevmemHeap,
DEVMEMINT_RESERVATION *psReservation,
PMR *psPMR,
PVRSRV_MEMALLOCFLAGS_T uiMapFlags,
DEVMEMINT_MAPPING **ppsMappingPtr);
/*
* DevmemIntUnmapPMR()
*
* Reverses the mapping caused by DevmemIntMapPMR()
*/
PVRSRV_ERROR
DevmemIntUnmapPMR(DEVMEMINT_MAPPING *psMapping);
/* DevmemIntMapPages()
*
* Maps an arbitrary amount of pages from a PMR to a reserved range
*
* @input psReservation Reservation handle for the range
* @input psPMR PMR that is mapped
* @input ui32PageCount Number of consecutive pages that are
* mapped
* @input ui32PhysicalPgOffset Logical offset in the PMR
* @input uiFlags Mapping flags
* @input sDevVAddrBase Virtual address base to start the
* mapping from
*/
PVRSRV_ERROR
DevmemIntMapPages(DEVMEMINT_RESERVATION *psReservation,
PMR *psPMR,
IMG_UINT32 ui32PageCount,
IMG_UINT32 ui32PhysicalPgOffset,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_DEV_VIRTADDR sDevVAddrBase);
/* DevmemIntUnmapPages()
*
* Unmaps an arbitrary amount of pages from a reserved range
*
* @input psReservation Reservation handle for the range
* @input sDevVAddrBase Virtual address base to start from
* @input ui32PageCount Number of consecutive pages that are
* unmapped
*/
PVRSRV_ERROR
DevmemIntUnmapPages(DEVMEMINT_RESERVATION *psReservation,
IMG_DEV_VIRTADDR sDevVAddrBase,
IMG_UINT32 ui32PageCount);
/*
* DevmemIntReserveRange()
*
* Indicates that the specified range should be reserved from the given heap.
*
* In turn causes the page tables to be allocated to cover the specified range.
*
* If you call DevmemIntReserveRange() (and the call succeeds) then you are
* promising that you shall later call DevmemIntUnreserveRange()
*/
PVRSRV_ERROR
DevmemIntReserveRange(DEVMEMINT_HEAP *psDevmemHeap,
IMG_DEV_VIRTADDR sAllocationDevVAddr,
IMG_DEVMEM_SIZE_T uiAllocationSize,
DEVMEMINT_RESERVATION **ppsReservationPtr);
/*
* DevmemIntUnreserveRange()
*
* Undoes the state change caused by DevmemIntReserveRage()
*/
PVRSRV_ERROR
DevmemIntUnreserveRange(DEVMEMINT_RESERVATION *psDevmemReservation);
/*************************************************************************/ /*!
@Function DevmemIntChangeSparse
@Description Changes the sparse allocations of a PMR by allocating and freeing
pages and changing their corresponding CPU and GPU mappings.
@input psDevmemHeap Pointer to the heap we map on
@input psPMR The PMR we want to map
@input ui32AllocPageCount Number of pages to allocate
@input pai32AllocIndices The logical PMR indices where pages will
be allocated. May be NULL.
@input ui32FreePageCount Number of pages to free
@input pai32FreeIndices The logical PMR indices where pages will
be freed. May be NULL.
@input uiSparseFlags Flags passed in to determine which kind
of sparse change the user wanted.
See devicemem_typedefs.h for details.
@input uiFlags Memalloc flags for this virtual range.
@input sDevVAddrBase The base address of the virtual range of
this sparse allocation.
@input sCpuVAddrBase The CPU base address of this allocation.
May be 0 if not existing.
@Return PVRSRV_ERROR failure code
*/ /**************************************************************************/
PVRSRV_ERROR
DevmemIntChangeSparse(DEVMEMINT_HEAP *psDevmemHeap,
PMR *psPMR,
IMG_UINT32 ui32AllocPageCount,
IMG_UINT32 *pai32AllocIndices,
IMG_UINT32 ui32FreePageCount,
IMG_UINT32 *pai32FreeIndices,
SPARSE_MEM_RESIZE_FLAGS uiSparseFlags,
PVRSRV_MEMALLOCFLAGS_T uiFlags,
IMG_DEV_VIRTADDR sDevVAddrBase,
IMG_UINT64 sCpuVAddrBase);
/*
* DevmemIntFlushDevSLCRange()
*
* Flush specified device context's virtual address range from SLC.
*/
PVRSRV_ERROR
DevmemIntFlushDevSLCRange(DEVMEMINT_CTX *psDevmemCtx,
IMG_DEV_VIRTADDR sDevVAddr,
IMG_DEVMEM_SIZE_T uiSize,
IMG_BOOL bInvalidate);
/*
* DevmemIntRGXInvalidateFBSCTable()
*
* Invalidate selected FBSC table indices.
*
*/
PVRSRV_ERROR
DevmemIntInvalidateFBSCTable(DEVMEMINT_CTX *psDevmemCtx,
IMG_UINT64 ui64FBSCEntryMask);
PVRSRV_ERROR
DevmemIntIsVDevAddrValid(CONNECTION_DATA * psConnection,
PVRSRV_DEVICE_NODE *psDevNode,
DEVMEMINT_CTX *psDevMemContext,
IMG_DEV_VIRTADDR sDevAddr);
PVRSRV_ERROR
DevmemIntGetFaultAddress(CONNECTION_DATA * psConnection,
PVRSRV_DEVICE_NODE *psDevNode,
DEVMEMINT_CTX *psDevMemContext,
IMG_DEV_VIRTADDR *psFaultAddress);
/*************************************************************************/ /*!
@Function DevmemIntRegisterPFNotifyKM
@Description Registers a PID to be notified when a page fault occurs on a
specific device memory context.
@Input psDevmemCtx The context to be notified about.
@Input ui32PID The PID of the process that would like to be
notified.
@Input bRegister If true, register. If false, de-register.
@Return PVRSRV_ERROR
*/ /**************************************************************************/
PVRSRV_ERROR
DevmemIntRegisterPFNotifyKM(DEVMEMINT_CTX *psDevmemCtx,
IMG_INT32 ui32PID,
IMG_BOOL bRegister);
/*************************************************************************/ /*!
@Function DevmemIntPFNotify
@Description Notifies any processes that have registered themselves to be
notified when a page fault happens on a specific device memory
context.
@Input *psDevNode The device node.
@Input ui64FaultedPCAddress The page catalogue address that faulted.
@Input sFaultAddress The address that triggered the fault.
@Return PVRSRV_ERROR
*/ /**************************************************************************/
PVRSRV_ERROR DevmemIntPFNotify(PVRSRV_DEVICE_NODE *psDevNode,
IMG_UINT64 ui64FaultedPCAddress,
IMG_DEV_VIRTADDR sFaultAddress);
#if defined(PDUMP)
/*
* DevmemIntPDumpSaveToFileVirtual()
*
* Writes out PDump "SAB" commands with the data found in memory at
* the given virtual address.
*/
PVRSRV_ERROR
DevmemIntPDumpSaveToFileVirtual(DEVMEMINT_CTX *psDevmemCtx,
IMG_DEV_VIRTADDR sDevAddrStart,
IMG_DEVMEM_SIZE_T uiSize,
IMG_UINT32 uiArraySize,
const IMG_CHAR *pszFilename,
IMG_UINT32 ui32FileOffset,
IMG_UINT32 ui32PDumpFlags);
IMG_UINT32
DevmemIntMMUContextID(DEVMEMINT_CTX *psDevMemContext);
PVRSRV_ERROR
DevmemIntPDumpImageDescriptor(CONNECTION_DATA * psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
DEVMEMINT_CTX *psDevMemContext,
IMG_UINT32 ui32Size,
const IMG_CHAR *pszFileName,
IMG_DEV_VIRTADDR sData,
IMG_UINT32 ui32DataSize,
IMG_UINT32 ui32LogicalWidth,
IMG_UINT32 ui32LogicalHeight,
IMG_UINT32 ui32PhysicalWidth,
IMG_UINT32 ui32PhysicalHeight,
PDUMP_PIXEL_FORMAT ePixFmt,
IMG_MEMLAYOUT eMemLayout,
IMG_FB_COMPRESSION eFBCompression,
const IMG_UINT32 *paui32FBCClearColour,
PDUMP_FBC_SWIZZLE eFBCSwizzle,
IMG_DEV_VIRTADDR sHeader,
IMG_UINT32 ui32HeaderSize,
IMG_UINT32 ui32PDumpFlags);
PVRSRV_ERROR
DevmemIntPDumpDataDescriptor(CONNECTION_DATA * psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
DEVMEMINT_CTX *psDevMemContext,
IMG_UINT32 ui32Size,
const IMG_CHAR *pszFileName,
IMG_DEV_VIRTADDR sData,
IMG_UINT32 ui32DataSize,
IMG_UINT32 ui32HeaderType,
IMG_UINT32 ui32ElementType,
IMG_UINT32 ui32ElementCount,
IMG_UINT32 ui32PDumpFlags);
#else /* PDUMP */
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemIntPDumpSaveToFileVirtual)
#endif
static INLINE PVRSRV_ERROR
DevmemIntPDumpSaveToFileVirtual(DEVMEMINT_CTX *psDevmemCtx,
IMG_DEV_VIRTADDR sDevAddrStart,
IMG_DEVMEM_SIZE_T uiSize,
IMG_UINT32 uiArraySize,
const IMG_CHAR *pszFilename,
IMG_UINT32 ui32FileOffset,
IMG_UINT32 ui32PDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psDevmemCtx);
PVR_UNREFERENCED_PARAMETER(sDevAddrStart);
PVR_UNREFERENCED_PARAMETER(uiSize);
PVR_UNREFERENCED_PARAMETER(uiArraySize);
PVR_UNREFERENCED_PARAMETER(pszFilename);
PVR_UNREFERENCED_PARAMETER(ui32FileOffset);
PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
return PVRSRV_OK;
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemIntPDumpImageDescriptor)
#endif
static INLINE PVRSRV_ERROR
DevmemIntPDumpImageDescriptor(CONNECTION_DATA * psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
DEVMEMINT_CTX *psDevMemContext,
IMG_UINT32 ui32Size,
const IMG_CHAR *pszFileName,
IMG_DEV_VIRTADDR sData,
IMG_UINT32 ui32DataSize,
IMG_UINT32 ui32LogicalWidth,
IMG_UINT32 ui32LogicalHeight,
IMG_UINT32 ui32PhysicalWidth,
IMG_UINT32 ui32PhysicalHeight,
PDUMP_PIXEL_FORMAT ePixFmt,
IMG_MEMLAYOUT eMemLayout,
IMG_FB_COMPRESSION eFBCompression,
const IMG_UINT32 *paui32FBCClearColour,
PDUMP_FBC_SWIZZLE eFBCSwizzle,
IMG_DEV_VIRTADDR sHeader,
IMG_UINT32 ui32HeaderSize,
IMG_UINT32 ui32PDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psConnection);
PVR_UNREFERENCED_PARAMETER(psDeviceNode);
PVR_UNREFERENCED_PARAMETER(psDevMemContext);
PVR_UNREFERENCED_PARAMETER(ui32Size);
PVR_UNREFERENCED_PARAMETER(pszFileName);
PVR_UNREFERENCED_PARAMETER(sData);
PVR_UNREFERENCED_PARAMETER(ui32DataSize);
PVR_UNREFERENCED_PARAMETER(ui32LogicalWidth);
PVR_UNREFERENCED_PARAMETER(ui32LogicalHeight);
PVR_UNREFERENCED_PARAMETER(ui32PhysicalWidth);
PVR_UNREFERENCED_PARAMETER(ui32PhysicalHeight);
PVR_UNREFERENCED_PARAMETER(ePixFmt);
PVR_UNREFERENCED_PARAMETER(eMemLayout);
PVR_UNREFERENCED_PARAMETER(eFBCompression);
PVR_UNREFERENCED_PARAMETER(paui32FBCClearColour);
PVR_UNREFERENCED_PARAMETER(eFBCSwizzle);
PVR_UNREFERENCED_PARAMETER(sHeader);
PVR_UNREFERENCED_PARAMETER(ui32HeaderSize);
PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
return PVRSRV_OK;
}
#ifdef INLINE_IS_PRAGMA
#pragma inline(DevmemIntPDumpDataDescriptor)
#endif
static INLINE PVRSRV_ERROR
DevmemIntPDumpDataDescriptor(CONNECTION_DATA * psConnection,
PVRSRV_DEVICE_NODE *psDeviceNode,
DEVMEMINT_CTX *psDevMemContext,
IMG_UINT32 ui32Size,
const IMG_CHAR *pszFileName,
IMG_DEV_VIRTADDR sData,
IMG_UINT32 ui32DataSize,
IMG_UINT32 ui32ElementType,
IMG_UINT32 ui32ElementCount,
IMG_UINT32 ui32PDumpFlags)
{
PVR_UNREFERENCED_PARAMETER(psConnection);
PVR_UNREFERENCED_PARAMETER(psDeviceNode);
PVR_UNREFERENCED_PARAMETER(psDevMemContext);
PVR_UNREFERENCED_PARAMETER(ui32Size);
PVR_UNREFERENCED_PARAMETER(pszFileName);
PVR_UNREFERENCED_PARAMETER(sData);
PVR_UNREFERENCED_PARAMETER(ui32DataSize);
PVR_UNREFERENCED_PARAMETER(ui32ElementType);
PVR_UNREFERENCED_PARAMETER(ui32ElementCount);
PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
return PVRSRV_OK;
}
#endif /* PDUMP */
PVRSRV_ERROR
DevmemIntInit(void);
PVRSRV_ERROR
DevmemIntDeInit(void);
PVRSRV_ERROR
DevmemIntExportCtx(DEVMEMINT_CTX *psContext,
PMR *psPMR,
DEVMEMINT_CTX_EXPORT **ppsContextExport);
PVRSRV_ERROR
DevmemIntUnexportCtx(DEVMEMINT_CTX_EXPORT *psContextExport);
PVRSRV_ERROR
DevmemIntAcquireRemoteCtx(PMR *psPMR,
DEVMEMINT_CTX **ppsContext,
IMG_HANDLE *phPrivData);
#endif /* DEVICEMEM_SERVER_H */

View File

@@ -0,0 +1,198 @@
/**************************************************************************/ /*!
@File
@Title Device Memory Management
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Header file utilities that are specific to device memory functions
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /***************************************************************************/
#include "img_defs.h"
#include "img_types.h"
#include "device.h"
#include "pvrsrv_memallocflags.h"
#include "pvrsrv.h"
static INLINE PVRSRV_ERROR DevmemCPUCacheMode(PVRSRV_DEVICE_NODE *psDeviceNode,
PVRSRV_MEMALLOCFLAGS_T ulFlags,
IMG_UINT32 *pui32Ret)
{
IMG_UINT32 ui32CPUCacheMode = PVRSRV_CPU_CACHE_MODE(ulFlags);
IMG_UINT32 ui32Ret;
PVRSRV_ERROR eError = PVRSRV_OK;
PVR_ASSERT(ui32CPUCacheMode == PVRSRV_CPU_CACHE_MODE(ulFlags));
switch (ui32CPUCacheMode)
{
case PVRSRV_MEMALLOCFLAG_CPU_UNCACHED:
ui32Ret = PVRSRV_MEMALLOCFLAG_CPU_UNCACHED;
break;
case PVRSRV_MEMALLOCFLAG_CPU_UNCACHED_WC:
ui32Ret = PVRSRV_MEMALLOCFLAG_CPU_UNCACHED_WC;
break;
case PVRSRV_MEMALLOCFLAG_CPU_CACHE_INCOHERENT:
ui32Ret = PVRSRV_MEMALLOCFLAG_CPU_CACHED;
break;
case PVRSRV_MEMALLOCFLAG_CPU_CACHE_COHERENT:
/*
* If system has no coherency but coherency has been requested for CPU
* and GPU we currently fall back to write-combine.
* This avoids errors on arm64 when uncached is turned into ordered device memory
* and suffers from problems with unaligned access.
*/
if ( (PVRSRV_GPU_CACHE_MODE(ulFlags) == PVRSRV_MEMALLOCFLAG_GPU_CACHE_COHERENT) &&
!(PVRSRVSystemSnoopingOfCPUCache(psDeviceNode->psDevConfig) && PVRSRVSystemSnoopingOfDeviceCache(psDeviceNode->psDevConfig)) )
{
ui32Ret = PVRSRV_MEMALLOCFLAG_CPU_UNCACHED_WC;
}
else
{
ui32Ret = PVRSRV_MEMALLOCFLAG_CPU_CACHED;
}
break;
default:
PVR_LOG(("DevmemCPUCacheMode: Unknown CPU cache mode 0x%08x", ui32CPUCacheMode));
PVR_ASSERT(0);
/*
We should never get here, but if we do then setting the mode
to uncached is the safest thing to do.
*/
ui32Ret = PVRSRV_MEMALLOCFLAG_CPU_UNCACHED;
eError = PVRSRV_ERROR_UNSUPPORTED_CACHE_MODE;
break;
}
*pui32Ret = ui32Ret;
return eError;
}
static INLINE PVRSRV_ERROR DevmemDeviceCacheMode(PVRSRV_DEVICE_NODE *psDeviceNode,
PVRSRV_MEMALLOCFLAGS_T ulFlags,
IMG_UINT32 *pui32Ret)
{
IMG_UINT32 ui32DeviceCacheMode = PVRSRV_GPU_CACHE_MODE(ulFlags);
IMG_UINT32 ui32Ret;
PVRSRV_ERROR eError = PVRSRV_OK;
PVR_ASSERT(ui32DeviceCacheMode == PVRSRV_GPU_CACHE_MODE(ulFlags));
switch (ui32DeviceCacheMode)
{
case PVRSRV_MEMALLOCFLAG_GPU_UNCACHED:
ui32Ret = PVRSRV_MEMALLOCFLAG_GPU_UNCACHED;
break;
case PVRSRV_MEMALLOCFLAG_GPU_UNCACHED_WC:
ui32Ret = PVRSRV_MEMALLOCFLAG_GPU_UNCACHED_WC;
break;
case PVRSRV_MEMALLOCFLAG_GPU_CACHE_INCOHERENT:
ui32Ret = PVRSRV_MEMALLOCFLAG_GPU_CACHED;
break;
case PVRSRV_MEMALLOCFLAG_GPU_CACHE_COHERENT:
/*
* If system has no coherency but coherency has been requested for CPU
* and GPU we currently fall back to write-combine.
* This avoids errors on arm64 when uncached is turned into ordered device memory
* and suffers from problems with unaligned access.
*/
if ( (PVRSRV_CPU_CACHE_MODE(ulFlags) == PVRSRV_MEMALLOCFLAG_CPU_CACHE_COHERENT) &&
!(PVRSRVSystemSnoopingOfCPUCache(psDeviceNode->psDevConfig) && PVRSRVSystemSnoopingOfDeviceCache(psDeviceNode->psDevConfig)) )
{
ui32Ret = PVRSRV_MEMALLOCFLAG_GPU_UNCACHED_WC;
}
else
{
ui32Ret = PVRSRV_MEMALLOCFLAG_GPU_CACHED;
}
break;
default:
PVR_LOG(("DevmemDeviceCacheMode: Unknown device cache mode 0x%08x", ui32DeviceCacheMode));
PVR_ASSERT(0);
/*
We should never get here, but if we do then setting the mode
to uncached is the safest thing to do.
*/
ui32Ret = PVRSRV_MEMALLOCFLAG_GPU_UNCACHED;
eError = PVRSRV_ERROR_UNSUPPORTED_CACHE_MODE;
break;
}
*pui32Ret = ui32Ret;
return eError;
}
static INLINE IMG_BOOL DevmemCPUCacheCoherency(PVRSRV_DEVICE_NODE *psDeviceNode,
PVRSRV_MEMALLOCFLAGS_T ulFlags)
{
IMG_UINT32 ui32CPUCacheMode = PVRSRV_CPU_CACHE_MODE(ulFlags);
IMG_BOOL bRet = IMG_FALSE;
PVR_ASSERT(ui32CPUCacheMode == PVRSRV_CPU_CACHE_MODE(ulFlags));
if (ui32CPUCacheMode == PVRSRV_MEMALLOCFLAG_CPU_CACHE_COHERENT)
{
bRet = PVRSRVSystemSnoopingOfDeviceCache(psDeviceNode->psDevConfig);
}
return bRet;
}
static INLINE IMG_BOOL DevmemDeviceCacheCoherency(PVRSRV_DEVICE_NODE *psDeviceNode,
PVRSRV_MEMALLOCFLAGS_T ulFlags)
{
IMG_UINT32 ui32DeviceCacheMode = PVRSRV_GPU_CACHE_MODE(ulFlags);
IMG_BOOL bRet = IMG_FALSE;
PVR_ASSERT(ui32DeviceCacheMode == PVRSRV_GPU_CACHE_MODE(ulFlags));
if (ui32DeviceCacheMode == PVRSRV_MEMALLOCFLAG_GPU_CACHE_COHERENT)
{
bRet = PVRSRVSystemSnoopingOfCPUCache(psDeviceNode->psDevConfig);
}
return bRet;
}

View File

@@ -0,0 +1,142 @@
/*************************************************************************/ /*!
@File
@Title Device Memory Management
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Client side part of device memory management -- this file
is forked from new_devmem_allocation.h as this one has to
reside in the top level include so that client code is able
to make use of the typedefs.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DEVICEMEM_TYPEDEFS_H
#define DEVICEMEM_TYPEDEFS_H
#include <powervr/mem_types.h>
#include "img_types.h"
#include "pvrsrv_memallocflags.h"
typedef struct DEVMEM_CONTEXT_TAG DEVMEM_CONTEXT; /*!< Convenience typedef for struct DEVMEM_CONTEXT_TAG */
typedef struct DEVMEM_HEAP_TAG DEVMEM_HEAP; /*!< Convenience typedef for struct DEVMEM_HEAP_TAG */
typedef struct DEVMEM_MEMDESC_TAG DEVMEM_MEMDESC; /*!< Convenience typedef for struct DEVMEM_MEMDESC_TAG */
typedef struct DEVMEM_PAGELIST_TAG DEVMEM_PAGELIST; /*!< Convenience typedef for struct DEVMEM_PAGELIST_TAG */
typedef IMG_HANDLE DEVMEM_EXPORTHANDLE; /*!< Typedef for DeviceMem Export Handle */
typedef IMG_UINT64 DEVMEM_EXPORTKEY; /*!< Typedef for DeviceMem Export Key */
typedef IMG_DEVMEM_SIZE_T DEVMEM_SIZE_T; /*!< Typedef for DeviceMem SIZE_T */
typedef IMG_DEVMEM_LOG2ALIGN_T DEVMEM_LOG2ALIGN_T; /*!< Typedef for DeviceMem LOG2 Alignment */
typedef struct DEVMEMX_PHYS_MEMDESC_TAG DEVMEMX_PHYSDESC; /*!< Convenience typedef for DevmemX physical */
typedef struct DEVMEMX_VIRT_MEMDESC_TAG DEVMEMX_VIRTDESC; /*!< Convenience typedef for DevmemX virtual */
/*! calling code needs all the info in this struct, to be able to pass it around */
typedef struct
{
/*! A handle to the PMR. */
IMG_HANDLE hPMRExportHandle;
/*! The "key" to prove we have authorisation to use this PMR */
IMG_UINT64 uiPMRExportPassword;
/*! Size and alignment properties for this PMR. Note, these
numbers are not trusted in kernel, but we need to cache them
client-side in order to allocate from the VM arena. The kernel
will know the actual alignment and size of the PMR and thus
would prevent client code from breaching security here. Ditto
for physmem granularity (aka page size) if this is different
from alignment */
IMG_DEVMEM_SIZE_T uiSize;
/*! We call this "contiguity guarantee" to be more precise than
calling it "alignment" or "page size", terms which may seem
similar but have different emphasis. The number reported here
is the minimum contiguity guarantee from the creator of the
PMR. Now, there is no requirement to allocate that coarsely
from the RA. The alignment given to the RA simply needs to be
at least as coarse as the device page size for the heap we
ultimately intend to map into. What is important is that the
device MMU data page size is not greater than the minimum
contiguity guarantee from the PMR. This value is reported to
the client in order that it can choose to make early checks and
perhaps decide which heap (in a variable page size scenario) it
would be safe to map this PMR into. For convenience, the
client may choose to use this argument as the alignment of the
virtual range he chooses to allocate, but this is _not_
necessary and in many cases would be able to get away with a
finer alignment, should the heap into which this PMR will be
mapped support it. */
IMG_DEVMEM_LOG2ALIGN_T uiLog2ContiguityGuarantee;
} DEVMEM_EXPORTCOOKIE;
/* Enum that describes the operation associated with changing sparse memory */
typedef IMG_UINT32 SPARSE_MEM_RESIZE_FLAGS;
#define SPARSE_RESIZE_NONE 0U
/* This should be set to indicate the change needs allocation */
#define SPARSE_RESIZE_ALLOC 1U
/* This should be set to indicate the change needs free */
#define SPARSE_RESIZE_FREE 2U
#define SPARSE_RESIZE_BOTH (SPARSE_RESIZE_ALLOC | SPARSE_RESIZE_FREE)
/* This should be set to silently swap underlying physical memory
* without disturbing its device or cpu virtual maps.
* This flag is not supported in the case of PDUMP and could lead to
* PDUMP panic when used.
*/
#define SPARSE_REMAP_MEM 4U
/* Should be set to get the sparse changes appear in cpu virtual map */
#define SPARSE_MAP_CPU_ADDR 8U
/* To be used with all the sparse allocations that gets mapped to CPU Virtual
* space. The sparse allocation CPU mapping is torn down and re-mapped every
* time the sparse allocation layout changes.
*/
#define PVRSRV_UNMAP_ON_SPARSE_CHANGE 1
/* To use with DevmemSubAllocate() as the default factor if no over-allocation
* is desired.
*/
#define DEVMEM_NO_PRE_ALLOCATE_MULTIPLIER (1U)
/* Defines the max length for PMR, MemDesc, Device memory History and RI debug
* annotations stored in memory, including the null terminator.
*/
#define DEVMEM_ANNOTATION_MAX_LEN ((IMG_UINT32)PVR_ANNOTATION_MAX_LEN + 1U)
#endif /* #ifndef DEVICEMEM_TYPEDEFS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,605 @@
/*************************************************************************/ /*!
@File
@Title Device Memory Management internal utility functions
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Utility functions used internally by device memory management
code.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DEVICEMEM_UTILS_H
#define DEVICEMEM_UTILS_H
#include "devicemem.h"
#include "img_types.h"
#include "pvrsrv_error.h"
#include "pvr_debug.h"
#include "allocmem.h"
#include "ra.h"
#include "osfunc.h"
#include "lock.h"
#include "osmmap.h"
#include "pvrsrv_memallocflags_internal.h"
#define DEVMEM_HEAPNAME_MAXLENGTH 160
/*
* Reserved VA space of a heap must always be multiple of DEVMEM_HEAP_RESERVED_SIZE_GRANULARITY,
* this check is validated in the DDK. Note this is only reserving "Virtual Address" space and
* physical allocations (and mappings thereon) should only be done as much as required (to avoid
* wastage).
* Granularity has been chosen to support the max possible practically used OS page size.
*/
#define DEVMEM_HEAP_RESERVED_SIZE_GRANULARITY 0x10000 /* 64KB is MAX anticipated OS page size */
/*
* VA heap size should be at least OS page size. This check is validated in the DDK.
*/
#define DEVMEM_HEAP_MINIMUM_SIZE 0x10000 /* 64KB is MAX anticipated OS page size */
#if defined(DEVMEM_DEBUG) && defined(REFCOUNT_DEBUG)
#define DEVMEM_REFCOUNT_PRINT(fmt, ...) PVRSRVDebugPrintf(PVR_DBG_ERROR, __FILE__, __LINE__, fmt, __VA_ARGS__)
#else
#define DEVMEM_REFCOUNT_PRINT(fmt, ...)
#endif
/* If we need a "hMapping" but we don't have a server-side mapping, we poison
* the entry with this value so that it's easily recognised in the debugger.
* Note that this is potentially a valid handle, but then so is NULL, which is
* no better, indeed worse, as it's not obvious in the debugger. The value
* doesn't matter. We _never_ use it (and because it's valid, we never assert
* it isn't this) but it's nice to have a value in the source code that we can
* grep for if things go wrong.
*/
#define LACK_OF_MAPPING_POISON ((IMG_HANDLE)0x6116dead)
#define LACK_OF_RESERVATION_POISON ((IMG_HANDLE)0x7117dead)
#define DEVICEMEM_HISTORY_ALLOC_INDEX_NONE 0xFFFFFFFF
struct DEVMEM_CONTEXT_TAG
{
SHARED_DEV_CONNECTION hDevConnection;
/* Number of heaps that have been created in this context
* (regardless of whether they have allocations)
*/
IMG_UINT32 uiNumHeaps;
/* Each "DEVMEM_CONTEXT" has a counterpart in the server, which
* is responsible for handling the mapping into device MMU.
* We have a handle to that here.
*/
IMG_HANDLE hDevMemServerContext;
/* Number of automagically created heaps in this context,
* i.e. those that are born at context creation time from the
* chosen "heap config" or "blueprint"
*/
IMG_UINT32 uiAutoHeapCount;
/* Pointer to array of such heaps */
struct DEVMEM_HEAP_TAG **ppsAutoHeapArray;
/* The cache line size for use when allocating memory,
* as it is not queryable on the client side
*/
IMG_UINT32 ui32CPUCacheLineSize;
/* Private data handle for device specific data */
IMG_HANDLE hPrivData;
};
/* Flags that record how a heaps virtual address space is managed. */
#define DEVMEM_HEAP_MANAGER_UNKNOWN 0
/* Heap VAs assigned by the client of Services APIs, heap's RA not used at all. */
#define DEVMEM_HEAP_MANAGER_USER (1U << 0)
/* Heap VAs managed by the OSs kernel, VA from CPU mapping call used */
#define DEVMEM_HEAP_MANAGER_KERNEL (1U << 1)
/* Heap VAs managed by the heap's own RA */
#define DEVMEM_HEAP_MANAGER_RA (1U << 2)
/* Heap VAs managed jointly by Services and the client of Services.
* The reserved region of the heap is managed explicitly by the client of Services
* The non-reserved region of the heap is managed by the heap's own RA */
#define DEVMEM_HEAP_MANAGER_DUAL_USER_RA (DEVMEM_HEAP_MANAGER_USER | DEVMEM_HEAP_MANAGER_RA)
struct DEVMEM_HEAP_TAG
{
/* Name of heap - for debug and lookup purposes. */
IMG_CHAR *pszName;
/* Number of live imports in the heap */
ATOMIC_T hImportCount;
/* Base address and size of heap, required by clients due to some
* requesters not being full range
*/
IMG_DEV_VIRTADDR sBaseAddress;
DEVMEM_SIZE_T uiSize;
DEVMEM_SIZE_T uiReservedRegionSize; /* uiReservedRegionLength in DEVMEM_HEAP_BLUEPRINT */
/* The heap manager, describing if the space is managed by the user, an RA,
* kernel or combination */
IMG_UINT32 ui32HeapManagerFlags;
/* This RA is for managing sub-allocations within the imports (PMRs)
* within the heap's virtual space. RA only used in DevmemSubAllocate()
* to track sub-allocated buffers.
*
* Resource Span - a PMR import added when the RA calls the
* imp_alloc CB (SubAllocImportAlloc) which returns the
* PMR import and size (span length).
* Resource - an allocation/buffer i.e. a MemDesc. Resource size represents
* the size of the sub-allocation.
*/
RA_ARENA *psSubAllocRA;
IMG_CHAR *pszSubAllocRAName;
/* The psQuantizedVMRA is for the coarse allocation (PMRs) of virtual
* space from the heap.
*
* Resource Span - the heap's VM space from base to base+length,
* only one is added at heap creation.
* Resource - a PMR import associated with the heap. Dynamic number
* as memory is allocated/freed from or mapped/unmapped to
* the heap. Resource size follows PMR logical size.
*/
RA_ARENA *psQuantizedVMRA;
IMG_CHAR *pszQuantizedVMRAName;
/* We also need to store a copy of the quantum size in order to feed
* this down to the server.
*/
IMG_UINT32 uiLog2Quantum;
/* Store a copy of the minimum import alignment */
IMG_UINT32 uiLog2ImportAlignment;
/* The parent memory context for this heap */
struct DEVMEM_CONTEXT_TAG *psCtx;
/* Lock to protect this structure */
POS_LOCK hLock;
/* Each "DEVMEM_HEAP" has a counterpart in the server, which is
* responsible for handling the mapping into device MMU.
* We have a handle to that here.
*/
IMG_HANDLE hDevMemServerHeap;
/* This heap is fully allocated and premapped into the device address space.
* Used in virtualisation for firmware heaps of Guest and optionally Host drivers. */
IMG_BOOL bPremapped;
};
typedef IMG_UINT32 DEVMEM_PROPERTIES_T; /*!< Typedef for Devicemem properties */
#define DEVMEM_PROPERTIES_EXPORTABLE (1UL<<0) /*!< Is it exportable? */
#define DEVMEM_PROPERTIES_IMPORTED (1UL<<1) /*!< Is it imported from another process? */
#define DEVMEM_PROPERTIES_SUBALLOCATABLE (1UL<<2) /*!< Is it suballocatable? */
#define DEVMEM_PROPERTIES_UNPINNED (1UL<<3) /*!< Is it currently pinned? */
#define DEVMEM_PROPERTIES_IMPORT_IS_ZEROED (1UL<<4) /*!< Is the memory fully zeroed? */
#define DEVMEM_PROPERTIES_IMPORT_IS_CLEAN (1UL<<5) /*!< Is the memory clean, i.e. not been used before? */
#define DEVMEM_PROPERTIES_SECURE (1UL<<6) /*!< Is it a special secure buffer? No CPU maps allowed! */
#define DEVMEM_PROPERTIES_IMPORT_IS_POISONED (1UL<<7) /*!< Is the memory fully poisoned? */
#define DEVMEM_PROPERTIES_NO_CPU_MAPPING (1UL<<8) /* No CPU Mapping is allowed, RW attributes
are further derived from allocation memory flags */
#define DEVMEM_PROPERTIES_NO_LAYOUT_CHANGE (1UL<<9) /* No sparse resizing allowed, once a memory
layout is chosen, no change allowed later,
This includes pinning and unpinning */
typedef struct DEVMEM_DEVICE_IMPORT_TAG
{
DEVMEM_HEAP *psHeap; /*!< Heap this import is bound to */
IMG_DEV_VIRTADDR sDevVAddr; /*!< Device virtual address of the import */
IMG_UINT32 ui32RefCount; /*!< Refcount of the device virtual address */
IMG_HANDLE hReservation; /*!< Device memory reservation handle */
IMG_HANDLE hMapping; /*!< Device mapping handle */
IMG_BOOL bMapped; /*!< This is import mapped? */
POS_LOCK hLock; /*!< Lock to protect the device import */
} DEVMEM_DEVICE_IMPORT;
typedef struct DEVMEM_CPU_IMPORT_TAG
{
void *pvCPUVAddr; /*!< CPU virtual address of the import */
IMG_UINT32 ui32RefCount; /*!< Refcount of the CPU virtual address */
IMG_HANDLE hOSMMapData; /*!< CPU mapping handle */
POS_LOCK hLock; /*!< Lock to protect the CPU import */
} DEVMEM_CPU_IMPORT;
typedef struct DEVMEM_IMPORT_TAG
{
SHARED_DEV_CONNECTION hDevConnection;
IMG_DEVMEM_ALIGN_T uiAlign; /*!< Alignment of the PMR */
DEVMEM_SIZE_T uiSize; /*!< Size of import */
ATOMIC_T hRefCount; /*!< Refcount for this import */
DEVMEM_PROPERTIES_T uiProperties; /*!< Stores properties of an import like if
it is exportable, pinned or suballocatable */
IMG_HANDLE hPMR; /*!< Handle to the PMR */
PVRSRV_MEMALLOCFLAGS_T uiFlags; /*!< Flags for this import */
POS_LOCK hLock; /*!< Lock to protect the import */
DEVMEM_DEVICE_IMPORT sDeviceImport; /*!< Device specifics of the import */
DEVMEM_CPU_IMPORT sCPUImport; /*!< CPU specifics of the import */
} DEVMEM_IMPORT;
typedef struct DEVMEM_DEVICE_MEMDESC_TAG
{
IMG_DEV_VIRTADDR sDevVAddr; /*!< Device virtual address of the allocation */
IMG_UINT32 ui32RefCount; /*!< Refcount of the device virtual address */
POS_LOCK hLock; /*!< Lock to protect device memdesc */
} DEVMEM_DEVICE_MEMDESC;
typedef struct DEVMEM_CPU_MEMDESC_TAG
{
void *pvCPUVAddr; /*!< CPU virtual address of the import */
IMG_UINT32 ui32RefCount; /*!< Refcount of the device CPU address */
POS_LOCK hLock; /*!< Lock to protect CPU memdesc */
} DEVMEM_CPU_MEMDESC;
struct DEVMEM_MEMDESC_TAG
{
DEVMEM_IMPORT *psImport; /*!< Import this memdesc is on */
IMG_DEVMEM_OFFSET_T uiOffset; /*!< Offset into import where our allocation starts */
IMG_DEVMEM_SIZE_T uiAllocSize; /*!< Size of the allocation */
ATOMIC_T hRefCount; /*!< Refcount of the memdesc */
POS_LOCK hLock; /*!< Lock to protect memdesc */
IMG_HANDLE hPrivData;
DEVMEM_DEVICE_MEMDESC sDeviceMemDesc; /*!< Device specifics of the memdesc */
DEVMEM_CPU_MEMDESC sCPUMemDesc; /*!< CPU specifics of the memdesc */
IMG_CHAR szText[DEVMEM_ANNOTATION_MAX_LEN]; /*!< Annotation for this memdesc */
IMG_UINT32 ui32AllocationIndex;
#if defined(DEBUG)
IMG_BOOL bPoisonOnFree;
#endif
#if defined(PVRSRV_ENABLE_GPU_MEMORY_INFO)
IMG_HANDLE hRIHandle; /*!< Handle to RI information */
#endif
};
/* The physical descriptor used to store handles and information of device
* physical allocations.
*/
struct DEVMEMX_PHYS_MEMDESC_TAG
{
IMG_UINT32 uiNumPages; /*!< Number of pages that the import has*/
IMG_UINT32 uiLog2PageSize; /*!< Page size */
ATOMIC_T hRefCount; /*!< Refcount of the memdesc */
PVRSRV_MEMALLOCFLAGS_T uiFlags; /*!< Flags for this import */
IMG_HANDLE hPMR; /*!< Handle to the PMR */
DEVMEM_CPU_IMPORT sCPUImport; /*!< CPU specifics of the memdesc */
DEVMEM_BRIDGE_HANDLE hBridge; /*!< Bridge connection for the server */
void *pvUserData; /*!< User data */
};
/* The virtual descriptor used to store handles and information of a device
* virtual range and the mappings to it.
*/
struct DEVMEMX_VIRT_MEMDESC_TAG
{
IMG_UINT32 uiNumPages; /*!< Number of pages that the import has*/
PVRSRV_MEMALLOCFLAGS_T uiFlags; /*!< Flags for this import */
DEVMEMX_PHYSDESC **apsPhysDescTable; /*!< Table to store links to physical descs */
DEVMEM_DEVICE_IMPORT sDeviceImport; /*!< Device specifics of the memdesc */
IMG_CHAR szText[DEVMEM_ANNOTATION_MAX_LEN]; /*!< Annotation for this virt memdesc */
IMG_UINT32 ui32AllocationIndex; /*!< To track mappings in this range */
#if defined(PVRSRV_ENABLE_GPU_MEMORY_INFO)
IMG_HANDLE hRIHandle; /*!< Handle to RI information */
#endif
};
#define DEVICEMEM_UTILS_NO_ADDRESS 0
/******************************************************************************
@Function DevmemValidateParams
@Description Check if flags are conflicting and if align is a size multiple.
@Input uiSize Size of the import.
@Input uiAlign Alignment of the import.
@Input puiFlags Pointer to the flags for the import.
@return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR DevmemValidateParams(IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_ALIGN_T uiAlign,
PVRSRV_MEMALLOCFLAGS_T *puiFlags);
/******************************************************************************
@Function DevmemImportStructAlloc
@Description Allocates memory for an import struct. Does not allocate a PMR!
Create locks for CPU and Devmem mappings.
@Input hDevConnection Connection to use for calls from the import.
@Input ppsImport The import to allocate.
@return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR DevmemImportStructAlloc(SHARED_DEV_CONNECTION hDevConnection,
DEVMEM_IMPORT **ppsImport);
/******************************************************************************
@Function DevmemImportStructInit
@Description Initialises the import struct with the given parameters.
Set it's refcount to 1!
@Input psImport The import to initialise.
@Input uiSize Size of the import.
@Input uiAlign Alignment of allocations in the import.
@Input uiMapFlags
@Input hPMR Reference to the PMR of this import struct.
@Input uiProperties Properties of the import. Is it exportable,
imported, suballocatable, unpinned?
******************************************************************************/
void DevmemImportStructInit(DEVMEM_IMPORT *psImport,
IMG_DEVMEM_SIZE_T uiSize,
IMG_DEVMEM_ALIGN_T uiAlign,
PVRSRV_MEMALLOCFLAGS_T uiMapFlags,
IMG_HANDLE hPMR,
DEVMEM_PROPERTIES_T uiProperties);
/******************************************************************************
@Function DevmemImportStructDevMap
@Description NEVER call after the last DevmemMemDescRelease()
Maps the PMR referenced by the import struct to the device's
virtual address space.
Does nothing but increase the cpu mapping refcount if the
import struct was already mapped.
@Input psHeap The heap to map to.
@Input bMap Caller can choose if the import should be really
mapped in the page tables or if just a virtual range
should be reserved and the refcounts increased.
@Input psImport The import we want to map.
@Input uiOptionalMapAddress An optional address to map to.
Pass DEVICEMEM_UTILS_NOADDRESS if not used.
@return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR DevmemImportStructDevMap(DEVMEM_HEAP *psHeap,
IMG_BOOL bMap,
DEVMEM_IMPORT *psImport,
IMG_UINT64 uiOptionalMapAddress);
/******************************************************************************
@Function DevmemImportStructDevUnmap
@Description Unmaps the PMR referenced by the import struct from the
device's virtual address space.
If this was not the last remaining CPU mapping on the import
struct only the cpu mapping refcount is decreased.
@return A boolean to signify if the import was unmapped.
******************************************************************************/
IMG_BOOL DevmemImportStructDevUnmap(DEVMEM_IMPORT *psImport);
/******************************************************************************
@Function DevmemImportStructCPUMap
@Description NEVER call after the last DevmemMemDescRelease()
Maps the PMR referenced by the import struct to the CPU's
virtual address space.
Does nothing but increase the cpu mapping refcount if the
import struct was already mapped.
@return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR DevmemImportStructCPUMap(DEVMEM_IMPORT *psImport);
/******************************************************************************
@Function DevmemImportStructCPUUnmap
@Description Unmaps the PMR referenced by the import struct from the CPU's
virtual address space.
If this was not the last remaining CPU mapping on the import
struct only the cpu mapping refcount is decreased.
******************************************************************************/
void DevmemImportStructCPUUnmap(DEVMEM_IMPORT *psImport);
/******************************************************************************
@Function DevmemImportStructAcquire
@Description Acquire an import struct by increasing it's refcount.
******************************************************************************/
void DevmemImportStructAcquire(DEVMEM_IMPORT *psImport);
/******************************************************************************
@Function DevmemImportStructRelease
@Description Reduces the refcount of the import struct.
Destroys the import in the case it was the last reference.
Destroys underlying PMR if this import was the last reference
to it.
@return A boolean to signal if the import was destroyed. True = yes.
******************************************************************************/
IMG_BOOL DevmemImportStructRelease(DEVMEM_IMPORT *psImport);
/******************************************************************************
@Function DevmemImportDiscard
@Description Discard a created, but uninitialised import structure.
This must only be called before DevmemImportStructInit
after which DevmemImportStructRelease must be used to
"free" the import structure.
******************************************************************************/
void DevmemImportDiscard(DEVMEM_IMPORT *psImport);
/******************************************************************************
@Function DevmemMemDescAlloc
@Description Allocates a MemDesc and create it's various locks.
Zero the allocated memory.
@return PVRSRV_ERROR
******************************************************************************/
PVRSRV_ERROR DevmemMemDescAlloc(DEVMEM_MEMDESC **ppsMemDesc);
#if defined(DEBUG)
/******************************************************************************
@Function DevmemMemDescSetPoF
@Description Sets the Poison on Free flag to true for this MemDesc if the
given MemAllocFlags have the Poison on Free bit set.
Poison on Free is a debug only feature.
******************************************************************************/
void DevmemMemDescSetPoF(DEVMEM_MEMDESC *psMemDesc, PVRSRV_MEMALLOCFLAGS_T uiFlags);
#endif
/******************************************************************************
@Function DevmemMemDescInit
@Description Sets the given offset and import struct fields in the MemDesc.
Initialises refcount to 1 and other values to 0.
@Input psMemDesc MemDesc to initialise.
@Input uiOffset Offset in the import structure.
@Input psImport Import the MemDesc is on.
@Input uiAllocSize Size of the allocation
******************************************************************************/
void DevmemMemDescInit(DEVMEM_MEMDESC *psMemDesc,
IMG_DEVMEM_OFFSET_T uiOffset,
DEVMEM_IMPORT *psImport,
IMG_DEVMEM_SIZE_T uiAllocSize);
/******************************************************************************
@Function DevmemMemDescAcquire
@Description Acquires the MemDesc by increasing it's refcount.
******************************************************************************/
void DevmemMemDescAcquire(DEVMEM_MEMDESC *psMemDesc);
/******************************************************************************
@Function DevmemMemDescRelease
@Description Releases the MemDesc by reducing it's refcount.
Destroy the MemDesc if it's recount is 0.
Destroy the import struct the MemDesc is on if that was the
last MemDesc on the import, probably following the destruction
of the underlying PMR.
@return A boolean to signal if the MemDesc was destroyed. True = yes.
******************************************************************************/
IMG_BOOL DevmemMemDescRelease(DEVMEM_MEMDESC *psMemDesc);
/******************************************************************************
@Function DevmemMemDescDiscard
@Description Discard a created, but uninitialised MemDesc structure.
This must only be called before DevmemMemDescInit after
which DevmemMemDescRelease must be used to "free" the
MemDesc structure.
******************************************************************************/
void DevmemMemDescDiscard(DEVMEM_MEMDESC *psMemDesc);
/******************************************************************************
@Function GetImportProperties
@Description Atomically read psImport->uiProperties
It's possible that another thread modifies uiProperties
immediately after this function returns, making its result
stale. So, it's recommended to use this function only to
check if certain non-volatile flags were set.
******************************************************************************/
static INLINE DEVMEM_PROPERTIES_T GetImportProperties(DEVMEM_IMPORT *psImport)
{
DEVMEM_PROPERTIES_T uiProperties;
OSLockAcquire(psImport->hLock);
uiProperties = psImport->uiProperties;
OSLockRelease(psImport->hLock);
return uiProperties;
}
/******************************************************************************
@Function DevmemCPUMemSet
@Description Given a CPU Mapped Devmem address, set the memory at that
range (address, address + size) to the uiPattern provided.
Flags determine the OS abstracted MemSet method to use.
******************************************************************************/
static INLINE void DevmemCPUMemSet(void *pvMem,
IMG_UINT8 uiPattern,
IMG_DEVMEM_SIZE_T uiSize,
PVRSRV_MEMALLOCFLAGS_T uiFlags)
{
if (PVRSRV_CHECK_CPU_UNCACHED(uiFlags))
{
OSDeviceMemSet(pvMem, uiPattern, uiSize);
}
else
{
/* it's safe to use OSCachedMemSet() for cached and wc memory */
OSCachedMemSet(pvMem, uiPattern, uiSize);
}
}
/******************************************************************************
@Function DevmemCPUMapCheckImportProperties
@Description Given a MemDesc check that the import properties are correct
to allow for mapping the MemDesc to the CPU.
Returns PVRSRV_OK on success.
******************************************************************************/
static INLINE PVRSRV_ERROR DevmemCPUMapCheckImportProperties(DEVMEM_MEMDESC *psMemDesc)
{
DEVMEM_PROPERTIES_T uiProperties = GetImportProperties(psMemDesc->psImport);
if (uiProperties &
(DEVMEM_PROPERTIES_UNPINNED | DEVMEM_PROPERTIES_SECURE))
{
#if defined(SUPPORT_SECURITY_VALIDATION)
if (uiProperties & DEVMEM_PROPERTIES_SECURE)
{
PVR_DPF((PVR_DBG_WARNING,
"%s: Allocation is a secure buffer. "
"It should not be possible to map to CPU, but for security "
"validation this will be allowed for testing purposes, "
"as long as the buffer is pinned.",
__func__));
}
if (uiProperties & DEVMEM_PROPERTIES_UNPINNED)
#endif
{
PVR_DPF((PVR_DBG_ERROR,
"%s: Allocation is currently unpinned or a secure buffer. "
"Not possible to map to CPU!",
__func__));
return PVRSRV_ERROR_INVALID_MAP_REQUEST;
}
}
if (uiProperties & DEVMEM_PROPERTIES_NO_CPU_MAPPING)
{
PVR_DPF((PVR_DBG_ERROR,
"%s: CPU Mapping is not possible on this allocation!",
__func__));
return PVRSRV_ERROR_INVALID_MAP_REQUEST;
}
return PVRSRV_OK;
}
#endif /* DEVICEMEM_UTILS_H */

View File

@@ -0,0 +1,236 @@
/*************************************************************************/ /*!
@File
@Title Common types for Debug Info framework.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DI_COMMON_H
#define DI_COMMON_H
#include "img_types.h"
/* Token that signals that a header should be printed. */
#define DI_START_TOKEN ((void *) 1)
/* This is a public handle to an entry. */
#ifndef DI_GROUP_DEFINED
#define DI_GROUP_DEFINED
typedef struct DI_GROUP DI_GROUP;
#endif
#ifndef DI_ENTRY_DEFINED
#define DI_ENTRY_DEFINED
typedef struct DI_ENTRY DI_ENTRY;
#endif
typedef struct OSDI_IMPL_ENTRY OSDI_IMPL_ENTRY;
/*! Debug Info entries types. */
typedef enum DI_ENTRY_TYPE
{
DI_ENTRY_TYPE_GENERIC, /*!< generic entry type, implements
start/stop/next/show iterator
interface */
DI_ENTRY_TYPE_RANDOM_ACCESS, /*!< random access entry, implements
seek/read iterator interface */
} DI_ENTRY_TYPE;
/*! @Function DI_PFN_START
*
* @Description
* Start operation returns first entry and passes it to Show operation.
*
* @Input psEntry pointer to the implementation entry
* @InOut pui64Pos current data position in the entry
*
* @Return pointer to data that will be passed to the other iterator
* functions in pvData argument
*/
typedef void *(*DI_PFN_START)(OSDI_IMPL_ENTRY *psEntry, IMG_UINT64 *pui64Pos);
/*! @Function DI_PFN_STOP
*
* @Description
* Stop operations is called after iterator reaches end of data.
*
* If pvData was allocated in pfnStart it should be freed here.
*
* @Input psEntry pointer to the implementation entry
* @Input pvData pointer to data returned from pfnStart/pfnNext
*/
typedef void (*DI_PFN_STOP)(OSDI_IMPL_ENTRY *psEntry, void *pvData);
/*! @Function DI_PFN_NEXT
*
* @Description
* Next returns next data entry and passes it to Show operation.
*
* @Input psEntry pointer to the implementation entry
* @Input pvData pointer to data returned from pfnStart/pfnNext
* @InOut pui64Pos current data position in the entry
*/
typedef void *(*DI_PFN_NEXT)(OSDI_IMPL_ENTRY *psEntry, void *pvData,
IMG_UINT64 *pui64Pos);
/*! @Function DI_PFN_SHOW
*
* @Description
* Outputs the data element.
*
* @Input psEntry pointer to the implementation entry
* @Input pvData pointer to data returned from pfnStart/pfnNext
*/
typedef int (*DI_PFN_SHOW)(OSDI_IMPL_ENTRY *psEntry, void *pvData);
/*! @Function DI_PFN_SEEK
*
* @Description
* Changes position of the entry data pointer
*
* @Input uiOffset new entry offset (absolute)
* @Input pvData private data provided during entry creation
*/
typedef IMG_INT64 (*DI_PFN_SEEK)(IMG_UINT64 ui64Offset, void *pvData);
/*! @Function DI_PFN_READ
*
* @Description
* Retrieves data from the entry from position previously set by Seek.
*
* @Input pszBuffer output buffer
* @Input ui64Count length of the output buffer
* @InOut pui64Pos pointer to the current position in the entry
* @Input pvData private data provided during entry creation
*/
typedef IMG_INT64 (*DI_PFN_READ)(IMG_CHAR *pszBuffer, IMG_UINT64 ui64Count,
IMG_UINT64 *pui64Pos, void *pvData);
/*! @Function DI_PFN_WRITE
*
* @Description
* Handle writes operation to the entry.
*
* @Input pszBuffer NUL-terminated buffer containing written data
* @Input ui64Count length of the data in pszBuffer (length of the buffer)
* @InOut pui64Pos pointer to the current position in the entry
* @Input pvData private data provided during entry creation
*/
typedef IMG_INT64 (*DI_PFN_WRITE)(const IMG_CHAR *pszBuffer,
IMG_UINT64 ui64Count, IMG_UINT64 *pui64Pos,
void *pvData);
/*! Debug info entry iterator.
*
* This covers all entry types: GENERIC and RANDOM_ACCESS.
*
* The GENERIC entry type
*
* The GENERIC type should implement either a full set of following callbacks:
* pfnStart, pfnStop, pfnNext and pfnShow, or pfnShow only. If only pfnShow
* callback is given the framework will use default handlers in place of the
* other ones.
*
* e.g. for generic entry:
*
* struct sIter = {
* .pfnStart = StartCb, .pfnStop = StopCb, pfnNext = NextCb,
* .pfnShow = ShowCb
* };
*
* The use case for implementing pfnShow only is if the data for the given
* entry is short and can be printed in one go because the pfnShow callback
* will be called only once.
*
* e.g. for one-shot print generic entry:
*
* struct sIter = {
* .pfnShow = SingleShowCb
* };
*
* The DICreateEntry() function will return error if DI_ENTRY_TYPE_GENERIC
* type is used and invalid combination of callbacks is given.
*
* The RANDOM_ACCESS entry
*
* The RANDOM_ACCESS type should implement either both pfnSeek and pfnRead
* or pfnRead only callbacks.
*
* e.g. of seekable and readable random access entry:
*
* struct sIter = {
* .pfnSeek = SeekCb, .pfnRead = ReadCb
* };
*
* The DICreateEntry() function will return error if DI_ENTRY_TYPE_RANDOM_ACCESS
* type is used and invalid combination of callbacks is given.
*
* Writing to file (optional)
*
* The iterator allows also to pass a pfnWrite callback that allows implementing
* write operation on the entry. The write operation is entry type agnostic
* which means that it can be defined for both GENERIC and RANDOM_ACCESS
* entries.
*
* e.g. for writable one-shot print generic entry
*
* struct sIter = {
* .pfnShow = SingleShowCb, .pfnWrite = WriteCb
* };
*/
typedef struct DI_ITERATOR_CB
{
/* Generic entry interface. */
DI_PFN_START pfnStart; /*!< Starts iteration and returns first element
of entry's data. */
DI_PFN_STOP pfnStop; /*!< Stops iteration. */
DI_PFN_NEXT pfnNext; /*!< Returns next element of entry's data. */
DI_PFN_SHOW pfnShow; /*!< Shows current data element of an entry. */
/* Optional random access entry interface. */
DI_PFN_SEEK pfnSeek; /*!< Sets data pointer in an entry. */
DI_PFN_READ pfnRead; /*!< Reads data from an entry. */
/* Optional writing to entry interface. Null terminated. */
DI_PFN_WRITE pfnWrite; /*!< Performs write operation on an entry. */
IMG_UINT32 ui32WriteLenMax; /*!< Maximum char length of entry
accepted for write. Includes \0 */
} DI_ITERATOR_CB;
#endif /* DI_COMMON_H */

View File

@@ -0,0 +1,889 @@
/*************************************************************************/ /*!
@File
@Title OS agnostic implementation of Debug Info interface.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Implements osdi_impl.h API to provide access to driver's
debug data via pvrdebug.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include "allocmem.h"
#include "hash.h"
#include "img_defs.h"
#include "img_types.h"
#include "lock.h"
#include "osfunc_common.h"
#include "osfunc.h" /* for thread */
#include "tlstream.h"
#include "dllist.h"
#include "osdi_impl.h"
#include "di_impl_brg.h"
#include "di_impl_brg_intern.h"
#include "pvr_dicommon.h"
#if defined(PVRSRV_FORCE_UNLOAD_IF_BAD_STATE)
#include "pvrsrv.h"
#endif
#define ENTRIES_TABLE_INIT_SIZE 64
#define STREAM_BUFFER_SIZE 0x4000 /* 16KB */
#define STREAM_LINE_LENGTH 512
#if defined(PVRSRV_SERVER_THREADS_INDEFINITE_SLEEP)
#define WRITER_THREAD_SLEEP_TIMEOUT 0ull
#else
#define WRITER_THREAD_SLEEP_TIMEOUT 28800000000ull
#endif
#define WRITER_THREAD_DESTROY_TIMEOUT 100000ull
#define WRITER_THREAD_DESTROY_RETRIES 10u
#define WRITE_RETRY_COUNT 10 /* retry a write to a TL buffer 10 times */
#define WRITE_RETRY_WAIT_TIME 100 /* wait 10ms between write retries */
typedef enum THREAD_STATE
{
THREAD_STATE_NULL,
THREAD_STATE_ALIVE,
THREAD_STATE_TERMINATED,
} THREAD_STATE;
static struct DIIB_IMPL
{
HASH_TABLE *psEntriesTable; /*!< Table of entries. */
POS_LOCK psEntriesLock; /*!< Protects psEntriesTable. */
IMG_HANDLE hWriterThread;
IMG_HANDLE hWriterEventObject;
ATOMIC_T eThreadState;
DLLIST_NODE sWriterQueue;
POS_LOCK psWriterLock; /*!< Protects sWriterQueue. */
} *_g_psImpl;
struct DIIB_GROUP
{
const IMG_CHAR *pszName;
struct DIIB_GROUP *psParentGroup;
};
struct DIIB_ENTRY
{
struct DIIB_GROUP *psParentGroup;
OSDI_IMPL_ENTRY sImplEntry;
DI_ITERATOR_CB sIterCb;
DI_ENTRY_TYPE eType;
IMG_CHAR pszFullPath[DI_IMPL_BRG_PATH_LEN];
void *pvPrivData;
POS_LOCK hLock; /*!< Protects access to entry's iterator. */
};
struct DI_CONTEXT_TAG
{
IMG_HANDLE hStream;
ATOMIC_T iRefCnt;
IMG_BOOL bClientConnected; /*!< Indicated that the client is or is not
connected to the DI. */
};
struct DIIB_WORK_ITEM
{
DI_CONTEXT *psContext;
DIIB_ENTRY *psEntry;
IMG_UINT64 ui64Size;
IMG_UINT64 ui64Offset;
DLLIST_NODE sQueueElement;
};
/* Declaring function here to avoid dependencies that are introduced by
* including osfunc.h. */
IMG_INT32 OSStringNCompare(const IMG_CHAR *pStr1, const IMG_CHAR *pStr2,
size_t uiSize);
/* djb2 hash function is public domain */
static IMG_UINT32 _Hash(size_t uKeySize, void *pKey, IMG_UINT32 uHashTabLen)
{
IMG_CHAR *pszStr = pKey;
IMG_UINT32 ui32Hash = 5381, ui32Char;
PVR_UNREFERENCED_PARAMETER(uKeySize);
PVR_UNREFERENCED_PARAMETER(uHashTabLen);
while ((ui32Char = *pszStr++) != '\0')
{
ui32Hash = ((ui32Hash << 5) + ui32Hash) + ui32Char; /* hash * 33 + c */
}
return ui32Hash;
}
static IMG_BOOL _Compare(size_t uKeySize, void *pKey1, void *pKey2)
{
IMG_CHAR *pszKey1 = pKey1, *pszKey2 = pKey2;
return OSStringNCompare(pszKey1, pszKey2, uKeySize) == 0;
}
/* ----- native callbacks interface ----------------------------------------- */
static void _WriteWithRetires(void *pvNativeHandle, const IMG_CHAR *pszStr,
IMG_UINT uiLen)
{
PVRSRV_ERROR eError;
IMG_INT iRetry = 0;
IMG_UINT32 ui32Flags = TL_FLAG_NO_WRITE_FAILED;
do
{
/* Try to write to the buffer but don't inject MOST_RECENT_WRITE_FAILED
* packet in case of failure because we're going to retry. */
eError = TLStreamWriteRetFlags(pvNativeHandle, (IMG_UINT8 *) pszStr,
uiLen, &ui32Flags);
if (eError == PVRSRV_ERROR_STREAM_FULL)
{
// wait to give the client a change to read
OSSleepms(WRITE_RETRY_WAIT_TIME);
}
}
while (eError == PVRSRV_ERROR_STREAM_FULL && iRetry++ < WRITE_RETRY_COUNT);
/* One last try to write to the buffer. In this case upon failure
* a MOST_RECENT_WRITE_FAILED packet will be inject to the buffer to
* indicate data loss. */
if (eError == PVRSRV_ERROR_STREAM_FULL)
{
eError = TLStreamWrite(pvNativeHandle, (IMG_UINT8 *) pszStr, uiLen);
}
PVR_LOG_IF_ERROR(eError, "TLStreamWrite");
}
static void _WriteData(void *pvNativeHandle, const void *pvData,
IMG_UINT32 uiSize)
{
_WriteWithRetires(pvNativeHandle, pvData, uiSize);
}
__printf(2, 0)
static void _VPrintf(void *pvNativeHandle, const IMG_CHAR *pszFmt,
va_list pArgs)
{
IMG_CHAR pcBuffer[STREAM_LINE_LENGTH];
IMG_UINT uiLen = OSVSNPrintf(pcBuffer, sizeof(pcBuffer) - 1, pszFmt, pArgs);
pcBuffer[uiLen] = '\0';
_WriteWithRetires(pvNativeHandle, pcBuffer, uiLen + 1);
}
static void _Puts(void *pvNativeHandle, const IMG_CHAR *pszStr)
{
_WriteWithRetires(pvNativeHandle, pszStr, OSStringLength(pszStr) + 1);
}
static IMG_BOOL _HasOverflowed(void *pvNativeHandle)
{
PVR_UNREFERENCED_PARAMETER(pvNativeHandle);
return IMG_FALSE;
}
static OSDI_IMPL_ENTRY_CB _g_sEntryCallbacks = {
.pfnWrite = _WriteData,
.pfnVPrintf = _VPrintf,
.pfnPuts = _Puts,
.pfnHasOverflowed = _HasOverflowed,
};
/* ----- entry operations --------------------------------------------------- */
static PVRSRV_ERROR _ContextUnrefAndMaybeDestroy(DI_CONTEXT *psContext)
{
if (OSAtomicDecrement(&psContext->iRefCnt) == 0)
{
TLStreamClose(psContext->hStream);
OSFreeMem(psContext);
}
return PVRSRV_OK;
}
static IMG_INT64 _ReadGeneric(const DI_CONTEXT *psContext, DIIB_ENTRY *psEntry)
{
IMG_INT64 iRet = 0;
IMG_UINT64 ui64Pos = 0;
DI_ITERATOR_CB *psIter = &psEntry->sIterCb;
OSDI_IMPL_ENTRY *psImplEntry = &psEntry->sImplEntry;
PVRSRV_ERROR eError;
if (psIter->pfnStart != NULL)
{
/* this is a full sequence of the operation */
void *pvData = psIter->pfnStart(psImplEntry, &ui64Pos);
while (pvData != NULL && psContext->bClientConnected)
{
iRet = psIter->pfnShow(psImplEntry, pvData);
if (iRet < 0)
{
break;
}
pvData = psIter->pfnNext(psImplEntry, pvData, &ui64Pos);
}
psIter->pfnStop(psImplEntry, pvData);
}
else if (psIter->pfnShow != NULL)
{
/* this is a simplified sequence of the operation */
iRet = psIter->pfnShow(psImplEntry, NULL);
}
eError = TLStreamMarkEOS(psImplEntry->pvNative, IMG_FALSE);
PVR_LOG_GOTO_IF_ERROR(eError, "TLStreamMarkEOS", return_error_);
return iRet;
return_error_:
return -1;
}
static IMG_INT64 _ReadRndAccess(DIIB_ENTRY *psEntry, IMG_UINT64 ui64Count,
IMG_UINT64 *pui64Pos, void *pvData)
{
PVRSRV_ERROR eError;
IMG_UINT8 *pui8Buffer;
IMG_HANDLE hStream = psEntry->sImplEntry.pvNative;
if (psEntry->sIterCb.pfnRead == NULL)
{
return -1;
}
eError = TLStreamReserve(hStream, &pui8Buffer, ui64Count);
PVR_LOG_GOTO_IF_ERROR(eError, "TLStreamReserve", return_error_);
psEntry->sIterCb.pfnRead((IMG_CHAR *) pui8Buffer, ui64Count, pui64Pos,
pvData);
eError = TLStreamCommit(hStream, ui64Count);
PVR_LOG_GOTO_IF_ERROR(eError, "TLStreamCommit", return_error_);
eError = TLStreamMarkEOS(psEntry->sImplEntry.pvNative, IMG_FALSE);
PVR_LOG_GOTO_IF_ERROR(eError, "TLStreamMarkEOS", return_error_);
return 0;
return_error_:
return -1;
}
static void _WriterThread(void *pvArg)
{
PVRSRV_ERROR eError;
IMG_HANDLE hEvent;
DLLIST_NODE *psNode;
eError = OSEventObjectOpen(_g_psImpl->hWriterEventObject, &hEvent);
PVR_LOG_RETURN_VOID_IF_ERROR(eError, "OSEventObjectOpen");
#ifdef PVRSRV_FORCE_UNLOAD_IF_BAD_STATE
while (PVRSRVGetPVRSRVData()->eServicesState == PVRSRV_SERVICES_STATE_OK &&
OSAtomicRead(&_g_psImpl->eThreadState) == THREAD_STATE_ALIVE)
#else
while (OSAtomicRead(&_g_psImpl->eThreadState) == THREAD_STATE_ALIVE)
#endif
{
struct DIIB_WORK_ITEM *psItem = NULL;
OSLockAcquire(_g_psImpl->psWriterLock);
/* Get element from list tail so that we always get the oldest element
* (elements are added to head). */
while ((psNode = dllist_get_prev_node(&_g_psImpl->sWriterQueue)) != NULL)
{
IMG_INT64 i64Ret;
DIIB_ENTRY *psEntry;
OSDI_IMPL_ENTRY *psImplEntry;
dllist_remove_node(psNode);
OSLockRelease(_g_psImpl->psWriterLock);
psItem = IMG_CONTAINER_OF(psNode, struct DIIB_WORK_ITEM,
sQueueElement);
psEntry = psItem->psEntry;
psImplEntry = &psItem->psEntry->sImplEntry;
/* if client has already disconnected we can just drop this item */
if (psItem->psContext->bClientConnected)
{
PVR_ASSERT(psItem->psContext->hStream != NULL);
psImplEntry->pvNative = psItem->psContext->hStream;
if (psEntry->eType == DI_ENTRY_TYPE_GENERIC)
{
i64Ret = _ReadGeneric(psItem->psContext, psEntry);
PVR_LOG_IF_FALSE(i64Ret >= 0, "generic access read operation "
"failed");
}
else if (psEntry->eType == DI_ENTRY_TYPE_RANDOM_ACCESS)
{
IMG_UINT64 ui64Pos = psItem->ui64Offset;
i64Ret = _ReadRndAccess(psEntry, psItem->ui64Size, &ui64Pos,
psEntry->pvPrivData);
PVR_LOG_IF_FALSE(i64Ret >= 0, "random access read operation "
"failed");
}
else
{
PVR_ASSERT(psEntry->eType == DI_ENTRY_TYPE_GENERIC ||
psEntry->eType == DI_ENTRY_TYPE_RANDOM_ACCESS);
}
psImplEntry->pvNative = NULL;
}
else
{
PVR_DPF((PVR_DBG_MESSAGE, "client reading entry \"%s\" has "
"disconnected", psEntry->pszFullPath));
}
_ContextUnrefAndMaybeDestroy(psItem->psContext);
OSFreeMemNoStats(psItem);
OSLockAcquire(_g_psImpl->psWriterLock);
}
OSLockRelease(_g_psImpl->psWriterLock);
eError = OSEventObjectWaitKernel(hEvent, WRITER_THREAD_SLEEP_TIMEOUT);
if (eError != PVRSRV_OK && eError != PVRSRV_ERROR_TIMEOUT)
{
PVR_LOG_ERROR(eError, "OSEventObjectWaitKernel");
}
}
OSLockAcquire(_g_psImpl->psWriterLock);
/* clear the queue if there are any items pending */
while ((psNode = dllist_get_prev_node(&_g_psImpl->sWriterQueue)) != NULL)
{
struct DIIB_WORK_ITEM *psItem = IMG_CONTAINER_OF(psNode,
struct DIIB_WORK_ITEM,
sQueueElement);
dllist_remove_node(psNode);
_ContextUnrefAndMaybeDestroy(psItem->psContext);
OSFreeMem(psItem);
}
OSLockRelease(_g_psImpl->psWriterLock);
eError = OSEventObjectClose(hEvent);
PVR_LOG_IF_ERROR(eError, "OSEventObjectClose");
OSAtomicWrite(&_g_psImpl->eThreadState, THREAD_STATE_TERMINATED);
}
/* ----- DI internal API ---------------------------------------------------- */
DIIB_ENTRY *DIImplBrgFind(const IMG_CHAR *pszPath)
{
DIIB_ENTRY *psEntry;
OSLockAcquire(_g_psImpl->psEntriesLock);
psEntry = (void *) HASH_Retrieve_Extended(_g_psImpl->psEntriesTable,
(IMG_CHAR *) pszPath);
OSLockRelease(_g_psImpl->psEntriesLock);
return psEntry;
}
/* ----- DI bridge interface ------------------------------------------------ */
static PVRSRV_ERROR _CreateStream(IMG_CHAR *pszStreamName, IMG_HANDLE *phStream)
{
IMG_UINT32 iRet;
IMG_HANDLE hStream;
PVRSRV_ERROR eError;
/* for now only one stream can be created. Should we be able to create
* per context stream? */
iRet = OSSNPrintf(pszStreamName, PRVSRVTL_MAX_STREAM_NAME_SIZE,
"di_stream_%x", OSGetCurrentClientProcessIDKM());
if (iRet >= PRVSRVTL_MAX_STREAM_NAME_SIZE)
{
/* this check is superfluous because it can never happen but in case
* someone changes the definition of PRVSRVTL_MAX_STREAM_NAME_SIZE
* handle this case */
pszStreamName[0] = '\0';
return PVRSRV_ERROR_INTERNAL_ERROR;
}
eError = TLStreamCreate(&hStream, pszStreamName, STREAM_BUFFER_SIZE,
TL_OPMODE_DROP_NEWER, NULL, NULL, NULL, NULL);
PVR_RETURN_IF_ERROR(eError);
*phStream = hStream;
return PVRSRV_OK;
}
PVRSRV_ERROR DICreateContextKM(IMG_CHAR *pszStreamName, DI_CONTEXT **ppsContext)
{
PVRSRV_ERROR eError;
DI_CONTEXT *psContext;
IMG_HANDLE hStream = NULL;
THREAD_STATE eTState;
PVR_LOG_RETURN_IF_INVALID_PARAM(ppsContext != NULL, "ppsContext");
PVR_LOG_RETURN_IF_INVALID_PARAM(pszStreamName != NULL, "pszStreamName");
psContext = OSAllocMem(sizeof(*psContext));
PVR_LOG_GOTO_IF_NOMEM(psContext, eError, return_);
eError = _CreateStream(pszStreamName, &hStream);
PVR_LOG_GOTO_IF_ERROR(eError, "_CreateStream", free_desc_);
psContext->hStream = hStream;
/* indicated to the write thread if the client is still connected and
* waiting for the data */
psContext->bClientConnected = IMG_TRUE;
OSAtomicWrite(&psContext->iRefCnt, 1);
eTState = OSAtomicCompareExchange(&_g_psImpl->eThreadState,
THREAD_STATE_NULL,
THREAD_STATE_ALIVE);
/* if the thread has not been started yet do it */
if (eTState == THREAD_STATE_NULL)
{
PVR_ASSERT(_g_psImpl->hWriterThread == NULL);
eError = OSThreadCreate(&_g_psImpl->hWriterThread, "di_writer",
_WriterThread, NULL, IMG_FALSE, NULL);
PVR_LOG_GOTO_IF_ERROR(eError, "OSThreadCreate", free_close_stream_);
}
*ppsContext = psContext;
return PVRSRV_OK;
free_close_stream_:
TLStreamClose(psContext->hStream);
OSAtomicWrite(&_g_psImpl->eThreadState, THREAD_STATE_TERMINATED);
free_desc_:
OSFreeMem(psContext);
return_:
return eError;
}
PVRSRV_ERROR DIDestroyContextKM(DI_CONTEXT *psContext)
{
PVR_LOG_RETURN_IF_INVALID_PARAM(psContext != NULL, "psContext");
/* pass the information to the write thread that the client has
* disconnected */
psContext->bClientConnected = IMG_FALSE;
return _ContextUnrefAndMaybeDestroy(psContext);
}
PVRSRV_ERROR DIReadEntryKM(DI_CONTEXT *psContext, const IMG_CHAR *pszEntryPath,
IMG_UINT64 ui64Offset, IMG_UINT64 ui64Size)
{
PVRSRV_ERROR eError;
struct DIIB_WORK_ITEM *psItem;
PVR_LOG_RETURN_IF_INVALID_PARAM(psContext != NULL, "psContext");
PVR_LOG_RETURN_IF_INVALID_PARAM(pszEntryPath != NULL, "pszEntryPath");
/* 'no stats' to avoid acquiring the process stats locks */
psItem = OSAllocMemNoStats(sizeof(*psItem));
PVR_LOG_GOTO_IF_NOMEM(psItem, eError, return_);
psItem->psContext = psContext;
psItem->psEntry = DIImplBrgFind(pszEntryPath);
PVR_LOG_GOTO_IF_FALSE_VA(psItem->psEntry != NULL, free_item_,
"entry %s does not exist", pszEntryPath);
psItem->ui64Size = ui64Size;
psItem->ui64Offset = ui64Offset;
/* increment ref count on the context so that it doesn't get freed
* before it gets processed by the writer thread. */
OSAtomicIncrement(&psContext->iRefCnt);
OSLockAcquire(_g_psImpl->psWriterLock);
dllist_add_to_head(&_g_psImpl->sWriterQueue, &psItem->sQueueElement);
OSLockRelease(_g_psImpl->psWriterLock);
eError = OSEventObjectSignal(_g_psImpl->hWriterEventObject);
PVR_LOG_IF_ERROR(eError, "OSEventObjectSignal");
return PVRSRV_OK;
free_item_:
eError = PVRSRV_ERROR_NOT_FOUND;
OSFreeMemNoStats(psItem);
return_:
return eError;
}
PVRSRV_ERROR DIWriteEntryKM(DI_CONTEXT *psContext, const IMG_CHAR *pszEntryPath,
IMG_UINT32 ui32ValueSize, const IMG_CHAR *pszValue)
{
DIIB_ENTRY *psEntry;
DI_PFN_WRITE pfnEntryPuts;
IMG_INT64 i64Length = 0;
PVR_LOG_RETURN_IF_INVALID_PARAM(psContext != NULL, "psContext");
PVR_LOG_RETURN_IF_INVALID_PARAM(pszEntryPath != NULL, "pszEntryPath");
PVR_LOG_RETURN_IF_INVALID_PARAM(pszValue != NULL, "pszValue");
psEntry = DIImplBrgFind(pszEntryPath);
PVR_LOG_RETURN_IF_FALSE_VA(psEntry != NULL, PVRSRV_ERROR_NOT_FOUND,
"entry %s does not exist", pszEntryPath);
pfnEntryPuts = psEntry->sIterCb.pfnWrite;
if (pfnEntryPuts != NULL)
{
i64Length = pfnEntryPuts(pszValue, ui32ValueSize, (IMG_UINT64*)&i64Length, psEntry->pvPrivData);
/* To deal with -EINVAL being returned */
PVR_LOG_RETURN_IF_INVALID_PARAM(i64Length >= 0, pszValue);
}
else
{
PVR_LOG_MSG(PVR_DBG_WARNING, "Unable to write to Entry. Write callback not enabled");
return PVRSRV_ERROR_INVALID_REQUEST;
}
return PVRSRV_OK;
}
static PVRSRV_ERROR _listName(uintptr_t k,
uintptr_t v,
void* hStream)
{
PVRSRV_ERROR eError;
DIIB_ENTRY *psEntry;
IMG_UINT32 ui32Size;
IMG_CHAR aszName[DI_IMPL_BRG_PATH_LEN];
psEntry = (DIIB_ENTRY*) v;
PVR_ASSERT(psEntry != NULL);
PVR_UNREFERENCED_PARAMETER(k);
ui32Size = OSSNPrintf(aszName, DI_IMPL_BRG_PATH_LEN, "%s\n", psEntry->pszFullPath);
PVR_LOG_IF_FALSE(ui32Size > 5, "ui32Size too small, Error suspected!");
eError = TLStreamWrite(hStream, (IMG_UINT8 *)aszName, ui32Size+1);
return eError;
}
PVRSRV_ERROR DIListAllEntriesKM(DI_CONTEXT *psContext)
{
PVRSRV_ERROR eError;
PVR_LOG_RETURN_IF_INVALID_PARAM(psContext != NULL, "psContext");
eError = HASH_Iterate(_g_psImpl->psEntriesTable, _listName, psContext->hStream);
PVR_LOG_IF_ERROR(eError, "HASH_Iterate_Extended");
eError = TLStreamMarkEOS(psContext->hStream, IMG_FALSE);
return eError;
}
/* ----- DI implementation interface ---------------------------------------- */
static PVRSRV_ERROR _Init(void)
{
PVRSRV_ERROR eError;
_g_psImpl = OSAllocMem(sizeof(*_g_psImpl));
PVR_LOG_GOTO_IF_NOMEM(_g_psImpl, eError, return_);
_g_psImpl->psEntriesTable = HASH_Create_Extended(ENTRIES_TABLE_INIT_SIZE,
DI_IMPL_BRG_PATH_LEN,
_Hash, _Compare);
PVR_LOG_GOTO_IF_NOMEM(_g_psImpl->psEntriesTable, eError, free_impl_);
eError = OSLockCreate(&_g_psImpl->psEntriesLock);
PVR_LOG_GOTO_IF_ERROR(eError, "OSCreateLock", free_table_);
eError = OSLockCreate(&_g_psImpl->psWriterLock);
PVR_LOG_GOTO_IF_ERROR(eError, "OSCreateLock", free_entries_lock_);
eError = OSEventObjectCreate("DI_WRITER_EO",
&_g_psImpl->hWriterEventObject);
PVR_LOG_GOTO_IF_ERROR(eError, "OSEventObjectCreate", free_writer_lock_);
_g_psImpl->hWriterThread = NULL;
OSAtomicWrite(&_g_psImpl->eThreadState, THREAD_STATE_NULL);
dllist_init(&_g_psImpl->sWriterQueue);
return PVRSRV_OK;
free_writer_lock_:
OSLockDestroy(_g_psImpl->psWriterLock);
free_entries_lock_:
OSLockDestroy(_g_psImpl->psEntriesLock);
free_table_:
HASH_Delete_Extended(_g_psImpl->psEntriesTable, IMG_FALSE);
free_impl_:
OSFreeMem(_g_psImpl);
_g_psImpl = NULL;
return_:
return eError;
}
static void _DeInit(void)
{
PVRSRV_ERROR eError = PVRSRV_OK;
THREAD_STATE eTState;
eTState = OSAtomicCompareExchange(&_g_psImpl->eThreadState,
THREAD_STATE_ALIVE,
THREAD_STATE_TERMINATED);
if (eTState == THREAD_STATE_ALIVE)
{
if (_g_psImpl->hWriterEventObject != NULL)
{
eError = OSEventObjectSignal(_g_psImpl->hWriterEventObject);
PVR_LOG_IF_ERROR(eError, "OSEventObjectSignal");
}
LOOP_UNTIL_TIMEOUT(WRITER_THREAD_DESTROY_TIMEOUT)
{
eError = OSThreadDestroy(_g_psImpl->hWriterThread);
if (eError == PVRSRV_OK)
{
break;
}
OSWaitus(WRITER_THREAD_DESTROY_TIMEOUT/WRITER_THREAD_DESTROY_RETRIES);
} END_LOOP_UNTIL_TIMEOUT();
PVR_LOG_IF_ERROR(eError, "OSThreadDestroy");
}
if (_g_psImpl->hWriterEventObject != NULL)
{
eError = OSEventObjectDestroy(_g_psImpl->hWriterEventObject);
PVR_LOG_IF_ERROR(eError, "OSEventObjectDestroy");
}
HASH_Delete_Extended(_g_psImpl->psEntriesTable, IMG_FALSE);
OSLockDestroy(_g_psImpl->psWriterLock);
OSLockDestroy(_g_psImpl->psEntriesLock);
OSFreeMem(_g_psImpl);
_g_psImpl = NULL;
}
/* Recursively traverses the ancestors list up to the root group and
* appends their names preceded by "/" to the path in reverse order
* (root group's name first and psGroup group's name last).
* Returns current offset in the path (the current path length without the
* NUL character). If there is no more space in the path returns -1
* to indicate an error (the path is too long to fit into the buffer). */
static IMG_INT _BuildGroupPath(IMG_CHAR *pszPath, const DIIB_GROUP *psGroup)
{
IMG_INT iOff;
if (psGroup == NULL)
{
return 0;
}
PVR_ASSERT(pszPath != NULL);
iOff = _BuildGroupPath(pszPath, psGroup->psParentGroup);
PVR_RETURN_IF_FALSE(iOff != -1, -1);
iOff += OSStringLCopy(pszPath + iOff, "/",
DI_IMPL_BRG_PATH_LEN - iOff);
PVR_RETURN_IF_FALSE(iOff < DI_IMPL_BRG_PATH_LEN, -1);
iOff += OSStringLCopy(pszPath + iOff, psGroup->pszName,
DI_IMPL_BRG_PATH_LEN - iOff);
PVR_RETURN_IF_FALSE(iOff < DI_IMPL_BRG_PATH_LEN, -1);
return iOff;
}
static PVRSRV_ERROR _BuildEntryPath(IMG_CHAR *pszPath, const IMG_CHAR *pszName,
const DIIB_GROUP *psGroup)
{
IMG_INT iOff = _BuildGroupPath(pszPath, psGroup);
PVR_RETURN_IF_FALSE(iOff != -1, PVRSRV_ERROR_INVALID_OFFSET);
iOff += OSStringLCopy(pszPath + iOff, "/", DI_IMPL_BRG_PATH_LEN - iOff);
PVR_RETURN_IF_FALSE(iOff < DI_IMPL_BRG_PATH_LEN,
PVRSRV_ERROR_INVALID_OFFSET);
iOff += OSStringLCopy(pszPath + iOff, pszName, DI_IMPL_BRG_PATH_LEN - iOff);
PVR_RETURN_IF_FALSE(iOff < DI_IMPL_BRG_PATH_LEN,
PVRSRV_ERROR_INVALID_OFFSET);
return PVRSRV_OK;
}
static PVRSRV_ERROR _CreateEntry(const IMG_CHAR *pszName,
DI_ENTRY_TYPE eType,
const DI_ITERATOR_CB *psIterCb,
void *pvPrivData,
void *pvParentGroup,
void **pvEntry)
{
DIIB_GROUP *psParentGroup = pvParentGroup;
DIIB_ENTRY *psEntry;
PVRSRV_ERROR eError;
PVR_LOG_RETURN_IF_INVALID_PARAM(pvEntry != NULL, "pvEntry");
PVR_LOG_RETURN_IF_INVALID_PARAM(pvParentGroup != NULL, "pvParentGroup");
switch (eType)
{
case DI_ENTRY_TYPE_GENERIC:
break;
case DI_ENTRY_TYPE_RANDOM_ACCESS:
break;
default:
PVR_DPF((PVR_DBG_ERROR, "eType invalid in %s()", __func__));
PVR_GOTO_WITH_ERROR(eError, PVRSRV_ERROR_INVALID_PARAMS, return_);
}
psEntry = OSAllocMem(sizeof(*psEntry));
PVR_LOG_GOTO_IF_NOMEM(psEntry, eError, return_);
eError = OSLockCreate(&psEntry->hLock);
PVR_LOG_GOTO_IF_ERROR(eError, "OSLockCreate", free_entry_);
psEntry->eType = eType;
psEntry->sIterCb = *psIterCb;
psEntry->pvPrivData = pvPrivData;
psEntry->psParentGroup = psParentGroup;
psEntry->pszFullPath[0] = '\0';
psEntry->sImplEntry.pvPrivData = pvPrivData;
psEntry->sImplEntry.pvNative = NULL;
psEntry->sImplEntry.psCb = &_g_sEntryCallbacks;
eError = _BuildEntryPath(psEntry->pszFullPath, pszName,
psEntry->psParentGroup);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "%s() failed in _BuildEntryPath() for \"%s\" "
"entry", __func__, pszName));
goto destroy_lock_;
}
OSLockAcquire(_g_psImpl->psEntriesLock);
eError = HASH_Insert_Extended(_g_psImpl->psEntriesTable,
psEntry->pszFullPath,
(uintptr_t) psEntry) ?
PVRSRV_OK : PVRSRV_ERROR_UNABLE_TO_ADD_HANDLE;
OSLockRelease(_g_psImpl->psEntriesLock);
PVR_LOG_GOTO_IF_ERROR(eError, "HASH_Insert_Extended failed", destroy_lock_);
*pvEntry = psEntry;
return PVRSRV_OK;
destroy_lock_:
OSLockDestroy(psEntry->hLock);
free_entry_:
OSFreeMem(psEntry);
return_:
return eError;
}
static void _DestroyEntry(void *pvEntry)
{
DIIB_ENTRY *psEntry = pvEntry;
PVR_ASSERT(psEntry != NULL);
OSLockAcquire(_g_psImpl->psEntriesLock);
HASH_Remove_Extended(_g_psImpl->psEntriesTable, psEntry->pszFullPath);
OSLockRelease(_g_psImpl->psEntriesLock);
OSLockDestroy(psEntry->hLock);
OSFreeMem(psEntry);
}
static PVRSRV_ERROR _CreateGroup(const IMG_CHAR *pszName,
void *pvParentGroup,
void **ppvGroup)
{
DIIB_GROUP *psNewGroup;
PVR_LOG_RETURN_IF_INVALID_PARAM(pszName != NULL, "pszName");
PVR_LOG_RETURN_IF_INVALID_PARAM(ppvGroup != NULL, "ppvGroup");
psNewGroup = OSAllocMem(sizeof(*psNewGroup));
PVR_LOG_RETURN_IF_NOMEM(psNewGroup, "OSAllocMem");
psNewGroup->pszName = pszName;
psNewGroup->psParentGroup = pvParentGroup;
*ppvGroup = psNewGroup;
return PVRSRV_OK;
}
static void _DestroyGroup(void *pvGroup)
{
DIIB_GROUP *psGroup = pvGroup;
PVR_ASSERT(psGroup != NULL);
OSFreeMem(psGroup);
}
PVRSRV_ERROR PVRDIImplBrgRegister(void)
{
OSDI_IMPL_CB sImplCb = {
.pfnInit = _Init,
.pfnDeInit = _DeInit,
.pfnCreateEntry = _CreateEntry,
.pfnDestroyEntry = _DestroyEntry,
.pfnCreateGroup = _CreateGroup,
.pfnDestroyGroup = _DestroyGroup
};
return DIRegisterImplementation("impl_brg", &sImplCb);
}

View File

@@ -0,0 +1,92 @@
/*************************************************************************/ /*!
@File
@Title OS agnostic implementation of Debug Info interface.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef PVR_IMPL_BRG_H
#define PVR_IMPL_BRG_H
#include "pvrsrv_error.h"
typedef struct DI_CONTEXT_TAG DI_CONTEXT;
typedef struct DI_ENTRY_DESC DI_ENTRY_DESC;
PVRSRV_ERROR PVRDIImplBrgRegister(void);
/*! @Function DICreateContextKM
*
* @Description
* Creates DI context which among others also creates a TL stream for reading
* entries.
*
* @Output pszStreamName: name of the TL stream created in this context
* @Output ppsContext: pointer to the new context
*
* @Return PVRSRV_ERROR error code
* PVRSRV_OK in case of a success
* PVRSRV_ERROR_INVALID_PARAMS if any of the parameters is invalid
* PVRSRV_ERROR_OUT_OF_MEMORY if any of the memory allocations failed
* error codes returned by TLStreamCreate()
*/
PVRSRV_ERROR DICreateContextKM(IMG_CHAR *pszStreamName,
DI_CONTEXT **ppsContext);
/*! @Function DIDestroyContextKM
*
* @Description
* Destroy the DI context and all underlying dependencies.
*
* @Input psContext: pointer to the context
*
* @Return PVRSRV_ERROR error code
* PVRSRV_OK in case of a success
* PVRSRV_ERROR_INVALID_PARAMS if invalid context pointer given
*/
PVRSRV_ERROR DIDestroyContextKM(DI_CONTEXT *psContext);
PVRSRV_ERROR DIReadEntryKM(DI_CONTEXT *psContext, const IMG_CHAR *pszEntryPath,
IMG_UINT64 ui64Offset, IMG_UINT64 ui64Size);
PVRSRV_ERROR DIWriteEntryKM(DI_CONTEXT *psContext, const IMG_CHAR *pszEntryPath,
IMG_UINT32 ui32ValueSize, const IMG_CHAR *pszValue);
PVRSRV_ERROR DIListAllEntriesKM(DI_CONTEXT *psContext);
#endif /* PVR_IMPL_BRG_H */

View File

@@ -0,0 +1,61 @@
/*************************************************************************/ /*!
@File
@Title OS agnostic implementation of Debug Info internal interface.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef PVR_IMPL_BRG_INTERN_H
#define PVR_IMPL_BRG_INTERN_H
typedef struct DIIB_GROUP DIIB_GROUP;
typedef struct DIIB_ENTRY DIIB_ENTRY;
/*! @Function DIImplBrgFind
*
* @Description
* Retrieves an entry based on a given path.
*
* @Input pszPath: Full entry path in form of
* /rootGroup/.../parentGroup/entryName.
*
* @Return Returns entry object if exists or NULL otherwise.
*/
DIIB_ENTRY *DIImplBrgFind(const IMG_CHAR *pszPath);
#endif /* PVR_IMPL_BRG_INTERN_H */

View File

@@ -0,0 +1,780 @@
/*************************************************************************/ /*!
@File
@Title Debug Info framework functions and types.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include "di_server.h"
#include "osdi_impl.h"
#include "pvrsrv_error.h"
#include "dllist.h"
#include "lock.h"
#include "allocmem.h"
#include "osfunc.h"
#define ROOT_GROUP_NAME PVR_DRM_NAME
/*! Implementation object. */
typedef struct DI_IMPL
{
const IMG_CHAR *pszName; /*<! name of the implementation */
OSDI_IMPL_CB sCb; /*<! implementation callbacks */
IMG_BOOL bInitialised; /*<! set to IMG_TRUE after implementation
is initialised */
DLLIST_NODE sListNode; /*<! node element of the global list of all
implementations */
} DI_IMPL;
/*! Wrapper object for objects originating from derivative implementations.
* This wraps both entries and groups native implementation objects. */
typedef struct DI_NATIVE_HANDLE
{
void *pvHandle; /*!< opaque handle to the native object */
DI_IMPL *psDiImpl; /*!< implementation pvHandle is associated
with */
DLLIST_NODE sListNode; /*!< node element of native handles list */
} DI_NATIVE_HANDLE;
/*! Debug Info entry object.
*
* Depending on the implementation this can be represented differently. For
* example for the DebugFS this translates to a file.
*/
struct DI_ENTRY
{
const IMG_CHAR *pszName; /*!< name of the entry */
void *pvPrivData; /*! handle to entry's private data */
DI_ENTRY_TYPE eType; /*! entry type */
DI_ITERATOR_CB sIterCb; /*!< iterator interface for the entry */
DLLIST_NODE sListNode; /*!< node element of group's entry list */
DLLIST_NODE sNativeHandleList; /*!< list of native handles belonging to this
entry */
};
/*! Debug Info group object.
*
* Depending on the implementation this can be represented differently. For
* example for the DebugFS this translates to a directory.
*/
struct DI_GROUP
{
IMG_CHAR *pszName; /*!< name of the group */
const struct DI_GROUP *psParent; /*!< parent groups */
DLLIST_NODE sListNode; /*!< node element of group's group list */
DLLIST_NODE sGroupList; /*!< list of groups (children) that belong
to this group */
DLLIST_NODE sEntryList; /*!< list of entries (children) that belong
to this group */
DLLIST_NODE sNativeHandleList; /*!< list of native handles belonging to
this group */
};
/* List of all registered implementations. */
static DECLARE_DLLIST(_g_sImpls);
/* Root group for the DI entries and groups. This group is used as a root
* group for all other groups and entries if during creation a parent groups
* is not given. */
static DI_GROUP *_g_psRootGroup;
/* Protects access to _g_sImpls and _g_psRootGroup */
static POS_LOCK _g_hLock;
PVRSRV_ERROR DIInit(void)
{
PVRSRV_ERROR eError;
eError = OSLockCreate(&_g_hLock);
PVR_LOG_GOTO_IF_ERROR(eError, "OSLockCreate", return_);
_g_psRootGroup = OSAllocMem(sizeof(*_g_psRootGroup));
PVR_LOG_GOTO_IF_NOMEM(_g_psRootGroup, eError, destroy_lock_);
_g_psRootGroup->pszName = OSAllocMem(sizeof(ROOT_GROUP_NAME));
PVR_LOG_GOTO_IF_NOMEM(_g_psRootGroup->pszName, eError, cleanup_name_);
OSStringLCopy(_g_psRootGroup->pszName, ROOT_GROUP_NAME,
sizeof(ROOT_GROUP_NAME));
dllist_init(&_g_psRootGroup->sListNode);
dllist_init(&_g_psRootGroup->sGroupList);
dllist_init(&_g_psRootGroup->sEntryList);
dllist_init(&_g_psRootGroup->sNativeHandleList);
return PVRSRV_OK;
cleanup_name_:
OSFreeMem(_g_psRootGroup);
destroy_lock_:
OSLockDestroy(_g_hLock);
return_:
return eError;
}
/* Destroys the whole tree of group and entries for a given group as a root. */
static void _DeInitGroupRecursively(DI_GROUP *psGroup)
{
DLLIST_NODE *psThis, *psNext;
dllist_foreach_node(&psGroup->sEntryList, psThis, psNext)
{
DI_ENTRY *psThisEntry = IMG_CONTAINER_OF(psThis, DI_ENTRY, sListNode);
DIDestroyEntry(psThisEntry);
}
dllist_foreach_node(&psGroup->sGroupList, psThis, psNext)
{
DI_GROUP *psThisGroup = IMG_CONTAINER_OF(psThis, DI_GROUP, sListNode);
_DeInitGroupRecursively(psThisGroup);
}
DIDestroyGroup(psGroup);
}
void DIDeInit(void)
{
DLLIST_NODE *psThis, *psNext;
OSLockAcquire(_g_hLock);
if (!dllist_is_empty(&_g_psRootGroup->sGroupList) ||
!dllist_is_empty(&_g_psRootGroup->sEntryList))
{
PVR_DPF((PVR_DBG_WARNING, "%s: entries or groups still exist during "
"de-initialisation process, destroying all", __func__));
}
_DeInitGroupRecursively(_g_psRootGroup);
_g_psRootGroup = NULL;
/* Remove all of the implementations. */
dllist_foreach_node(&_g_sImpls, psThis, psNext)
{
DI_IMPL *psDiImpl = IMG_CONTAINER_OF(psThis, DI_IMPL, sListNode);
if (psDiImpl->bInitialised)
{
psDiImpl->sCb.pfnDeInit();
psDiImpl->bInitialised = IMG_FALSE;
}
dllist_remove_node(&psDiImpl->sListNode);
OSFreeMem(psDiImpl);
}
OSLockRelease(_g_hLock);
/* all resources freed so free the lock itself too */
OSLockDestroy(_g_hLock);
}
static IMG_BOOL _ValidateIteratorCb(const DI_ITERATOR_CB *psIterCb,
DI_ENTRY_TYPE eType)
{
IMG_UINT32 uiFlags = 0;
if (psIterCb == NULL)
{
return IMG_FALSE;
}
if (eType == DI_ENTRY_TYPE_GENERIC)
{
uiFlags |= psIterCb->pfnShow != NULL ? BIT(0) : 0;
uiFlags |= psIterCb->pfnStart != NULL ? BIT(1) : 0;
uiFlags |= psIterCb->pfnStop != NULL ? BIT(2) : 0;
uiFlags |= psIterCb->pfnNext != NULL ? BIT(3) : 0;
/* either only pfnShow or all callbacks need to be set */
if (uiFlags != BIT(0) && !BITMASK_HAS(uiFlags, 0x0f))
{
return IMG_FALSE;
}
}
else if (eType == DI_ENTRY_TYPE_RANDOM_ACCESS)
{
uiFlags |= psIterCb->pfnRead != NULL ? BIT(0) : 0;
uiFlags |= psIterCb->pfnSeek != NULL ? BIT(1) : 0;
/* either only pfnRead or all callbacks need to be set */
if (uiFlags != BIT(0) && !BITMASK_HAS(uiFlags, 0x03))
{
return IMG_FALSE;
}
}
else
{
return IMG_FALSE;
}
return IMG_TRUE;
}
static PVRSRV_ERROR _CreateNativeEntry(DI_ENTRY *psEntry,
const DI_NATIVE_HANDLE *psNativeParent)
{
PVRSRV_ERROR eError;
DI_IMPL *psImpl = psNativeParent->psDiImpl;
DI_NATIVE_HANDLE *psNativeEntry = OSAllocMem(sizeof(*psNativeEntry));
PVR_LOG_GOTO_IF_NOMEM(psNativeEntry, eError, return_);
eError = psImpl->sCb.pfnCreateEntry(psEntry->pszName,
psEntry->eType,
&psEntry->sIterCb,
psEntry->pvPrivData,
psNativeParent->pvHandle,
&psNativeEntry->pvHandle);
PVR_LOG_GOTO_IF_ERROR(eError, "psImpl->sCb.pfnCreateEntry", free_memory_);
psNativeEntry->psDiImpl = psImpl;
dllist_add_to_head(&psEntry->sNativeHandleList, &psNativeEntry->sListNode);
return PVRSRV_OK;
free_memory_:
OSFreeMem(psNativeEntry);
return_:
return eError;
}
static void _DestroyNativeEntry(DI_NATIVE_HANDLE *psNativeEntry)
{
dllist_remove_node(&psNativeEntry->sListNode);
OSFreeMem(psNativeEntry);
}
PVRSRV_ERROR DICreateEntry(const IMG_CHAR *pszName,
DI_GROUP *psGroup,
const DI_ITERATOR_CB *psIterCb,
void *pvPriv,
DI_ENTRY_TYPE eType,
DI_ENTRY **ppsEntry)
{
PVRSRV_ERROR eError;
DLLIST_NODE *psThis, *psNext;
DI_ENTRY *psEntry;
PVR_LOG_RETURN_IF_INVALID_PARAM(pszName != NULL, "pszName");
PVR_LOG_RETURN_IF_INVALID_PARAM(_ValidateIteratorCb(psIterCb, eType),
"psIterCb");
PVR_LOG_RETURN_IF_INVALID_PARAM(ppsEntry != NULL, "psEntry");
psEntry = OSAllocMem(sizeof(*psEntry));
PVR_LOG_RETURN_IF_NOMEM(psEntry, "OSAllocMem");
if (psGroup == NULL)
{
psGroup = _g_psRootGroup;
}
psEntry->pszName = pszName;
psEntry->pvPrivData = pvPriv;
psEntry->eType = eType;
psEntry->sIterCb = *psIterCb;
dllist_init(&psEntry->sNativeHandleList);
OSLockAcquire(_g_hLock);
dllist_add_to_tail(&psGroup->sEntryList, &psEntry->sListNode);
/* Iterate over all of the native handles of parent group to create
* the entry for every registered implementation. */
dllist_foreach_node(&psGroup->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNativeGroup =
IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE, sListNode);
eError = _CreateNativeEntry(psEntry, psNativeGroup);
PVR_GOTO_IF_ERROR(eError, cleanup_);
}
OSLockRelease(_g_hLock);
*ppsEntry = psEntry;
return PVRSRV_OK;
cleanup_:
OSLockRelease(_g_hLock);
/* Something went wrong so if there were any native entries created remove
* them from the list, free them and free the DI entry itself. */
dllist_foreach_node(&psEntry->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNativeEntry =
IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE, sListNode);
_DestroyNativeEntry(psNativeEntry);
}
OSFreeMem(psEntry);
return eError;
}
void DIDestroyEntry(DI_ENTRY *psEntry)
{
DLLIST_NODE *psThis, *psNext;
PVR_LOG_RETURN_VOID_IF_FALSE(psEntry != NULL,
"psEntry invalid in DIDestroyEntry()");
/* Iterate through all of the native entries of the DI entry, remove
* them from the list and then destroy them. After that, destroy the
* DI entry itself. */
dllist_foreach_node(&psEntry->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNative = IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE,
sListNode);
/* The implementation must ensure that entry is not removed if any
* operations are being executed on the entry. If this is the case
* the implementation should block until all of them are finished
* and prevent any further operations.
* This will guarantee proper synchronisation between the DI framework
* and underlying implementations and prevent destruction/access
* races. */
psNative->psDiImpl->sCb.pfnDestroyEntry(psNative->pvHandle);
dllist_remove_node(&psNative->sListNode);
OSFreeMem(psNative);
}
dllist_remove_node(&psEntry->sListNode);
OSFreeMem(psEntry);
}
static PVRSRV_ERROR _CreateNativeGroup(DI_GROUP *psGroup,
const DI_NATIVE_HANDLE *psNativeParent,
DI_NATIVE_HANDLE **ppsNativeGroup)
{
PVRSRV_ERROR eError;
DI_IMPL *psImpl = psNativeParent->psDiImpl;
DI_NATIVE_HANDLE *psNativeGroup = OSAllocMem(sizeof(*psNativeGroup));
PVR_LOG_GOTO_IF_NOMEM(psNativeGroup, eError, return_);
eError = psImpl->sCb.pfnCreateGroup(psGroup->pszName,
psNativeParent->pvHandle,
&psNativeGroup->pvHandle);
PVR_LOG_GOTO_IF_ERROR(eError, "psImpl->sCb.pfnCreateGroup", free_memory_);
psNativeGroup->psDiImpl = psImpl;
dllist_add_to_head(&psGroup->sNativeHandleList, &psNativeGroup->sListNode);
*ppsNativeGroup = psNativeGroup;
return PVRSRV_OK;
free_memory_:
OSFreeMem(psNativeGroup);
return_:
return eError;
}
static void _DestroyNativeGroup(DI_NATIVE_HANDLE *psNativeEntry)
{
dllist_remove_node(&psNativeEntry->sListNode);
OSFreeMem(psNativeEntry);
}
PVRSRV_ERROR DICreateGroup(const IMG_CHAR *pszName,
DI_GROUP *psParent,
DI_GROUP **ppsGroup)
{
PVRSRV_ERROR eError;
DLLIST_NODE *psThis, *psNext;
DI_GROUP *psGroup;
size_t uSize;
PVR_LOG_RETURN_IF_INVALID_PARAM(pszName != NULL, "pszName");
PVR_LOG_RETURN_IF_INVALID_PARAM(ppsGroup != NULL, "ppsDiGroup");
psGroup = OSAllocMem(sizeof(*psGroup));
PVR_LOG_RETURN_IF_NOMEM(psGroup, "OSAllocMem");
if (psParent == NULL)
{
psParent = _g_psRootGroup;
}
uSize = OSStringLength(pszName) + 1;
psGroup->pszName = OSAllocMem(uSize * sizeof(*psGroup->pszName));
PVR_LOG_GOTO_IF_NOMEM(psGroup->pszName, eError, cleanup_name_);
OSStringLCopy(psGroup->pszName, pszName, uSize);
psGroup->psParent = psParent;
dllist_init(&psGroup->sGroupList);
dllist_init(&psGroup->sEntryList);
dllist_init(&psGroup->sNativeHandleList);
OSLockAcquire(_g_hLock);
dllist_add_to_tail(&psParent->sGroupList, &psGroup->sListNode);
/* Iterate over all of the native handles of parent group to create
* the group for every registered implementation. */
dllist_foreach_node(&psParent->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNativeGroup = NULL, *psNativeParent =
IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE, sListNode);
eError = _CreateNativeGroup(psGroup, psNativeParent, &psNativeGroup);
PVR_GOTO_IF_ERROR(eError, cleanup_);
}
OSLockRelease(_g_hLock);
*ppsGroup = psGroup;
return PVRSRV_OK;
cleanup_:
OSLockRelease(_g_hLock);
/* Something went wrong so if there were any native groups created remove
* them from the list, free them and free the DI group itself. */
dllist_foreach_node(&psGroup->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNativeGroup =
IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE, sListNode);
dllist_remove_node(&psNativeGroup->sListNode);
OSFreeMem(psNativeGroup);
}
OSFreeMem(psGroup->pszName);
cleanup_name_:
OSFreeMem(psGroup);
return eError;
}
void DIDestroyGroup(DI_GROUP *psGroup)
{
DLLIST_NODE *psThis, *psNext;
PVR_LOG_RETURN_VOID_IF_FALSE(psGroup != NULL,
"psGroup invalid in DIDestroyGroup()");
/* Iterate through all of the native groups of the DI group, remove
* them from the list and then destroy them. After that destroy the
* DI group itself. */
dllist_foreach_node(&psGroup->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNative = IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE,
sListNode);
psNative->psDiImpl->sCb.pfnDestroyGroup(psNative->pvHandle);
dllist_remove_node(&psNative->sListNode);
OSFreeMem(psNative);
}
dllist_remove_node(&psGroup->sListNode);
OSFreeMem(psGroup->pszName);
OSFreeMem(psGroup);
}
void *DIGetPrivData(const OSDI_IMPL_ENTRY *psEntry)
{
PVR_ASSERT(psEntry != NULL);
return psEntry->pvPrivData;
}
void DIWrite(const OSDI_IMPL_ENTRY *psEntry, const void *pvData,
IMG_UINT32 uiSize)
{
PVR_ASSERT(psEntry != NULL);
PVR_ASSERT(psEntry->psCb != NULL);
PVR_ASSERT(psEntry->psCb->pfnWrite != NULL);
PVR_ASSERT(psEntry->pvNative != NULL);
psEntry->psCb->pfnWrite(psEntry->pvNative, pvData, uiSize);
}
void DIPrintf(const OSDI_IMPL_ENTRY *psEntry, const IMG_CHAR *pszFmt, ...)
{
va_list args;
PVR_ASSERT(psEntry != NULL);
PVR_ASSERT(psEntry->psCb != NULL);
PVR_ASSERT(psEntry->psCb->pfnVPrintf != NULL);
PVR_ASSERT(psEntry->pvNative != NULL);
va_start(args, pszFmt);
psEntry->psCb->pfnVPrintf(psEntry->pvNative, pszFmt, args);
va_end(args);
}
void DIVPrintf(const OSDI_IMPL_ENTRY *psEntry, const IMG_CHAR *pszFmt,
va_list pArgs)
{
PVR_ASSERT(psEntry != NULL);
PVR_ASSERT(psEntry->psCb != NULL);
PVR_ASSERT(psEntry->psCb->pfnVPrintf != NULL);
PVR_ASSERT(psEntry->pvNative != NULL);
psEntry->psCb->pfnVPrintf(psEntry->pvNative, pszFmt, pArgs);
}
void DIPuts(const OSDI_IMPL_ENTRY *psEntry, const IMG_CHAR *pszStr)
{
PVR_ASSERT(psEntry != NULL);
PVR_ASSERT(psEntry->psCb != NULL);
PVR_ASSERT(psEntry->psCb->pfnPuts != NULL);
PVR_ASSERT(psEntry->pvNative != NULL);
psEntry->psCb->pfnPuts(psEntry->pvNative, pszStr);
}
IMG_BOOL DIHasOverflowed(const OSDI_IMPL_ENTRY *psEntry)
{
PVR_ASSERT(psEntry != NULL);
PVR_ASSERT(psEntry->psCb != NULL);
PVR_ASSERT(psEntry->psCb->pfnHasOverflowed != NULL);
PVR_ASSERT(psEntry->pvNative != NULL);
return psEntry->psCb->pfnHasOverflowed(psEntry->pvNative);
}
/* ---- OS implementation API ---------------------------------------------- */
static IMG_BOOL _ValidateImplCb(const OSDI_IMPL_CB *psImplCb)
{
PVR_GOTO_IF_FALSE(psImplCb->pfnInit != NULL, failed_);
PVR_GOTO_IF_FALSE(psImplCb->pfnDeInit != NULL, failed_);
PVR_GOTO_IF_FALSE(psImplCb->pfnCreateGroup != NULL, failed_);
PVR_GOTO_IF_FALSE(psImplCb->pfnDestroyGroup != NULL, failed_);
PVR_GOTO_IF_FALSE(psImplCb->pfnCreateEntry != NULL, failed_);
PVR_GOTO_IF_FALSE(psImplCb->pfnDestroyEntry != NULL, failed_);
return IMG_TRUE;
failed_:
return IMG_FALSE;
}
/* Walks the tree of groups and entries and create all of the native handles
* for the given implementation for all of the already existing groups and
* entries. */
static PVRSRV_ERROR _InitNativeHandlesRecursively(DI_IMPL *psImpl,
DI_GROUP *psGroup,
DI_NATIVE_HANDLE *psNativeParent)
{
PVRSRV_ERROR eError;
DLLIST_NODE *psThis, *psNext;
DI_NATIVE_HANDLE *psNativeGroup;
psNativeGroup = OSAllocMem(sizeof(*psNativeGroup));
PVR_LOG_RETURN_IF_NOMEM(psNativeGroup, "OSAllocMem");
eError = psImpl->sCb.pfnCreateGroup(psGroup->pszName,
psNativeParent ? psNativeParent->pvHandle : NULL,
&psNativeGroup->pvHandle);
PVR_LOG_GOTO_IF_ERROR(eError, "psImpl->sCb.pfnCreateGroup", free_memory_);
psNativeGroup->psDiImpl = psImpl;
dllist_add_to_head(&psGroup->sNativeHandleList,
&psNativeGroup->sListNode);
dllist_foreach_node(&psGroup->sGroupList, psThis, psNext)
{
DI_GROUP *psThisGroup = IMG_CONTAINER_OF(psThis, DI_GROUP, sListNode);
// and then walk the new group
eError = _InitNativeHandlesRecursively(psImpl, psThisGroup,
psNativeGroup);
PVR_LOG_RETURN_IF_ERROR(eError, "_InitNativeHandlesRecursively");
}
dllist_foreach_node(&psGroup->sEntryList, psThis, psNext)
{
DI_ENTRY *psThisEntry = IMG_CONTAINER_OF(psThis, DI_ENTRY, sListNode);
eError = _CreateNativeEntry(psThisEntry, psNativeGroup);
PVR_LOG_RETURN_IF_ERROR(eError, "_CreateNativeEntry");
}
return PVRSRV_OK;
free_memory_:
OSFreeMem(psNativeGroup);
return eError;
}
/* Walks the tree of groups and entries and destroys all of the native handles
* for the given implementation. */
static void _DeInitNativeHandlesRecursively(DI_IMPL *psImpl, DI_GROUP *psGroup)
{
DLLIST_NODE *psThis, *psNext;
dllist_foreach_node(&psGroup->sEntryList, psThis, psNext)
{
DI_ENTRY *psThisEntry = IMG_CONTAINER_OF(psThis, DI_ENTRY, sListNode);
// free all of the native entries that belong to this implementation
dllist_foreach_node(&psThisEntry->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNativeEntry =
IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE, sListNode);
if (psNativeEntry->psDiImpl == psImpl)
{
_DestroyNativeEntry(psNativeEntry);
// there can be only one entry on the list for a given
// implementation
break;
}
}
}
dllist_foreach_node(&psGroup->sGroupList, psThis, psNext)
{
DI_GROUP *psThisGroup = IMG_CONTAINER_OF(psThis, DI_GROUP, sListNode);
// and then walk the new group
_DeInitNativeHandlesRecursively(psImpl, psThisGroup);
}
// free all of the native entries that belong to this implementation
dllist_foreach_node(&psGroup->sNativeHandleList, psThis, psNext)
{
DI_NATIVE_HANDLE *psNativeGroup =
IMG_CONTAINER_OF(psThis, DI_NATIVE_HANDLE, sListNode);
if (psNativeGroup->psDiImpl == psImpl)
{
_DestroyNativeGroup(psNativeGroup);
// there can be only one entry on the list for a given
// implementation
break;
}
}
}
static PVRSRV_ERROR _InitImpl(DI_IMPL *psImpl)
{
PVRSRV_ERROR eError;
// DI_NATIVE_HANDLE *psNativeGroup;
eError = psImpl->sCb.pfnInit();
PVR_LOG_GOTO_IF_ERROR(eError, "psImpl->pfnInit()", return_);
/* if the implementation is being created after any groups or entries
* have been created we need to walk the current tree and create
* native groups and entries for all of the existing ones */
eError = _InitNativeHandlesRecursively(psImpl, _g_psRootGroup, NULL);
PVR_LOG_GOTO_IF_ERROR(eError, "_InitNativeHandlesRecursively",
free_native_handles_and_deinit_);
psImpl->bInitialised = IMG_TRUE;
return PVRSRV_OK;
free_native_handles_and_deinit_:
/* something went wrong so we need to walk the tree and remove all of the
* native entries and groups that we've created before we can destroy
* the implementation */
_DeInitNativeHandlesRecursively(psImpl, _g_psRootGroup);
psImpl->sCb.pfnDeInit();
return_:
return eError;
}
PVRSRV_ERROR DIRegisterImplementation(const IMG_CHAR *pszName,
const OSDI_IMPL_CB *psImplCb)
{
DI_IMPL *psImpl;
PVRSRV_ERROR eError;
PVR_LOG_RETURN_IF_INVALID_PARAM(pszName != NULL, "pszName");
PVR_LOG_RETURN_IF_INVALID_PARAM(_ValidateImplCb(psImplCb), "psImplCb");
/* if root group does not exist it can mean 2 things:
* - DIInit() was not called so initialisation order is incorrect and needs
* to be fixed
* - DIInit() failed but if that happens we should never make it here */
PVR_ASSERT(_g_psRootGroup != NULL);
psImpl = OSAllocMem(sizeof(*psImpl));
PVR_LOG_RETURN_IF_NOMEM(psImpl, "OSAllocMem");
psImpl->pszName = pszName;
psImpl->sCb = *psImplCb;
OSLockAcquire(_g_hLock);
eError = _InitImpl(psImpl);
if (eError != PVRSRV_OK)
{
/* implementation could not be initialised so remove it from the
* list, free the memory and forget about it */
PVR_DPF((PVR_DBG_ERROR, "%s: could not initialise \"%s\" debug "
"info implementation, discarding", __func__,
psImpl->pszName));
goto free_impl_;
}
psImpl->bInitialised = IMG_TRUE;
dllist_add_to_tail(&_g_sImpls, &psImpl->sListNode);
OSLockRelease(_g_hLock);
return PVRSRV_OK;
free_impl_:
OSLockRelease(_g_hLock);
OSFreeMem(psImpl);
return eError;
}

View File

@@ -0,0 +1,219 @@
/*************************************************************************/ /*!
@File
@Title Functions for creating Debug Info groups and entries.
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DI_SERVER_H
#define DI_SERVER_H
#if defined(__linux__)
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
#include <linux/stdarg.h>
#else
#include <stdarg.h>
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) */
#else
#include <stdarg.h>
#endif /* __linux__ */
#include "di_common.h"
#include "pvrsrv_error.h"
#include "img_defs.h"
/*! @Function DIInit
*
* @Description
* Initialises Debug Info framework. This function will create common resources
* for the framework.
*
* Note: This function must be called before first call to
* DIRegisterImplementation() all of the implementations.
*/
PVRSRV_ERROR DIInit(void);
/*! @Function DIDeInit
*
* @Description
* De-initialises Debug Info framework. This function will call pfnDeInit()
* on each implementation and clean up common resources.
*
* In case some of the entries and groups have not been cleaned up this function
* will also perform recursive sweep and remove all entries and group for
* all implementations.
*/
void DIDeInit(void);
/*! @Function DICreateEntry
*
* @Description
* Creates debug info entry. Depending on different implementations the entry
* might be for example a DebugFS file or something totally different.
*
* The entry will belong to a parent group if provided or to the root group
* if not.
*
* @Input pszName: name of the new entry
* @Input psDiGroup: parent group, if NULL entry will belong to the root group
* @Input psIterCb: implementation of the iterator for the entry
* @Input psPriv: private data that will be passed to the iterator operations
* @Input eType: type of the entry
*
* @Output ppsEntry: handle to the newly created entry
*
* @Return PVRSRV_ERROR error code
*/
PVRSRV_ERROR DICreateEntry(const IMG_CHAR *pszName,
DI_GROUP *psGroup,
const DI_ITERATOR_CB *psIterCb,
void *psPriv,
DI_ENTRY_TYPE eType,
DI_ENTRY **ppsEntry);
/*! @Function DIDestroyEntry
*
* @Description
* Destroys debug info entry.
*
* @Input psEntry: handle to the entry
*/
void DIDestroyEntry(DI_ENTRY *psEntry);
/*! @Function DICreateGroup
*
* @Description
* Creates debug info group. Depending on different implementations the group
* might be for example a DebugFS directory or something totally different.
*
* The group will belong to a parent group if provided or to the root group
* if not.
*
* @Input pszName: name of the new entry
* @Input psParent: parent group, if NULL entry will belong to the root group
*
* @Output ppsGroup: handle to the newly created entry
*
* @Return PVRSRV_ERROR error code
*/
PVRSRV_ERROR DICreateGroup(const IMG_CHAR *pszName,
DI_GROUP *psParent,
DI_GROUP **ppsGroup);
/*! @Function DIDestroyGroup
*
* @Description
* Destroys debug info group.
*
* @Input psGroup: handle to the group
*/
void DIDestroyGroup(DI_GROUP *psGroup);
/*! @Function DIGetPrivData
*
* @Description
* Retrieves private data from psEntry. The data is either passed during
* entry creation via psPriv parameter of DICreateEntry() function
* or by explicitly setting it with DIGetPrivData() function.
*
* @Input psEntry pointer to OSDI_IMPL_ENTRY object
*
* @Returns pointer to the private data (can be NULL if private data
* has not been specified)
*/
void *DIGetPrivData(const OSDI_IMPL_ENTRY *psEntry);
/*! @Function DIWrite
*
* @Description
* Writes the binary data of the DI entry to the output sync, whatever that may
* be for the DI implementation.
*
* @Input psEntry pointer to OSDI_IMPL_ENTRY object
* @Input pvData data
* @Input uiSize pvData length
*/
void DIWrite(const OSDI_IMPL_ENTRY *psEntry, const void *pvData,
IMG_UINT32 uiSize);
/*! @Function DIPrintf
*
* @Description
* Prints formatted string to the DI entry.
*
* @Input psEntry pointer to OSDI_IMPL_ENTRY object
* @Input pszFmt NUL-terminated format string
*/
void DIPrintf(const OSDI_IMPL_ENTRY *psEntry, const IMG_CHAR *pszFmt, ...)
__printf(2, 3);
/*! @Function DIVPrintf
*
* @Description
* Prints formatted string to the DI entry. Equivalent to DIPrintf but takes
* va_list instead of a variable number of arguments.
*
* @Input psEntry pointer to OSDI_IMPL_ENTRY object
* @Input pszFmt NUL-terminated format string
* @Input pArgs vs_list object
*/
void DIVPrintf(const OSDI_IMPL_ENTRY *psEntry, const IMG_CHAR *pszFmt,
va_list pArgs);
/*! @Function DIPrintf
*
* @Description
* Prints a string to the DI entry.
*
* @Input psEntry pointer to OSDI_IMPL_ENTRY object
* @Input pszFmt NUL-terminated string
*/
void DIPuts(const OSDI_IMPL_ENTRY *psEntry, const IMG_CHAR *pszStr);
/*! @Function DIHasOverflowed
*
* @Description
* Checks if the DI buffer has overflowed.
*
* @Return IMG_TRUE if buffer overflowed
*/
IMG_BOOL DIHasOverflowed(const OSDI_IMPL_ENTRY *psEntry);
#endif /* DI_SERVER_H */

View File

@@ -0,0 +1,408 @@
/*************************************************************************/ /*!
@File
@Title Double linked list header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Double linked list interface
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DLLIST_H
#define DLLIST_H
#include "img_types.h"
#include "img_defs.h"
/*!
Pointer to a linked list node
*/
typedef struct DLLIST_NODE_ *PDLLIST_NODE;
/*!
Node in a linked list
*/
/*
* Note: the following structure's size is architecture-dependent and clients
* may need to create a mirror of the structure definition if it needs to be
* used in a structure shared between host and device.
* Consider such clients if any changes are made to this structure.
*/
typedef struct DLLIST_NODE_
{
struct DLLIST_NODE_ *psPrevNode;
struct DLLIST_NODE_ *psNextNode;
} DLLIST_NODE;
/*!
Static initialiser
*/
#define DECLARE_DLLIST(n) \
DLLIST_NODE (n) = {&(n), &(n)}
/*************************************************************************/ /*!
@Function dllist_foreach_node
@Description Walk through all the nodes on the list.
Safe against removal of (node).
@Input list_head List node to start the operation
@Input node Current list node
@Input next Node after the current one
*/
/*****************************************************************************/
#define dllist_foreach_node(list_head, node, next) \
for ((node) = (list_head)->psNextNode, (next) = (node)->psNextNode; \
(node) != (list_head); \
(node) = (next), (next) = (node)->psNextNode)
#define dllist_foreach_node_backwards(list_head, node, prev) \
for ((node) = (list_head)->psPrevNode, (prev) = (node)->psPrevNode; \
(node) != (list_head); \
(node) = (prev), (prev) = (node)->psPrevNode)
/*************************************************************************/ /*!
@Function dllist_foreach
@Description Simplification of dllist_foreach_node.
Walk through all the nodes on the list.
Safe against removal of currently-iterated node.
Adds utility-macro dllist_cur() to typecast the current node.
@Input list_head List node to start the operation
*/
/*****************************************************************************/
#define dllist_foreach(list_head) \
for (DLLIST_NODE *_DllNode = (list_head).psNextNode, *_DllNext = _DllNode->psNextNode; \
_DllNode != &(list_head); \
_DllNode = _DllNext, _DllNext = _DllNode->psNextNode)
#define dllist_foreach_backwards(list_head) \
for (DLLIST_NODE *_DllNode = (list_head).psPrevNode, *_DllPrev = _DllNode->psPrevNode; \
_DllNode != &(list_head); \
_DllNode = _DllPrev, _DllPrev = _DllNode->psPrevNode)
#define dllist_cur(type, member) IMG_CONTAINER_OF(_DllNode, type, member)
/*************************************************************************/ /*!
@Function dllist_init
@Description Initialize a new double linked list
@Input psListHead List head Node
*/
/*****************************************************************************/
static INLINE
void dllist_init(PDLLIST_NODE psListHead)
{
psListHead->psPrevNode = psListHead;
psListHead->psNextNode = psListHead;
}
/*************************************************************************/ /*!
@Function dllist_is_empty
@Description Returns whether the list is empty
@Input psListHead List head Node
*/
/*****************************************************************************/
static INLINE
bool dllist_is_empty(PDLLIST_NODE psListHead)
{
return ((psListHead->psPrevNode == psListHead)
&& (psListHead->psNextNode == psListHead));
}
/*************************************************************************/ /*!
@Function dllist_add_to_head
@Description Add psNewNode to head of list psListHead
@Input psListHead Head Node
@Input psNewNode New Node
*/
/*****************************************************************************/
static INLINE
void dllist_add_to_head(PDLLIST_NODE psListHead, PDLLIST_NODE psNewNode)
{
PDLLIST_NODE psTmp;
psTmp = psListHead->psNextNode;
psListHead->psNextNode = psNewNode;
psNewNode->psNextNode = psTmp;
psTmp->psPrevNode = psNewNode;
psNewNode->psPrevNode = psListHead;
}
/*************************************************************************/ /*!
@Function dllist_add_to_tail
@Description Add psNewNode to tail of list psListHead
@Input psListHead Head Node
@Input psNewNode New Node
*/
/*****************************************************************************/
static INLINE
void dllist_add_to_tail(PDLLIST_NODE psListHead, PDLLIST_NODE psNewNode)
{
PDLLIST_NODE psTmp;
psTmp = psListHead->psPrevNode;
psListHead->psPrevNode = psNewNode;
psNewNode->psPrevNode = psTmp;
psTmp->psNextNode = psNewNode;
psNewNode->psNextNode = psListHead;
}
/*************************************************************************/ /*!
@Function dllist_node_is_in_list
@Description Returns true if psNode is in a list
@Input psNode List node
*/
/*****************************************************************************/
static INLINE
bool dllist_node_is_in_list(PDLLIST_NODE psNode)
{
return (psNode->psNextNode != NULL);
}
/*************************************************************************/ /*!
@Function dllist_get_next_node
@Description Returns the list node after psListHead or NULL psListHead is
the only element in the list.
@Input psListHead List node to start the operation
*/
/*****************************************************************************/
static INLINE
PDLLIST_NODE dllist_get_next_node(PDLLIST_NODE psListHead)
{
if (psListHead->psNextNode == psListHead)
{
return NULL;
}
else
{
return psListHead->psNextNode;
}
}
/*************************************************************************/ /*!
@Function dllist_get_prev_node
@Description Returns the list node preceding psListHead or NULL if
psListHead is the only element in the list.
@Input psListHead List node to start the operation
*/
/*****************************************************************************/
static INLINE
PDLLIST_NODE dllist_get_prev_node(PDLLIST_NODE psListHead)
{
if (psListHead->psPrevNode == psListHead)
{
return NULL;
}
else
{
return psListHead->psPrevNode;
}
}
/*************************************************************************/ /*!
@Function dllist_remove_node
@Description Removes psListNode from the list where it currently belongs
@Input psListNode List node to be removed
*/
/*****************************************************************************/
static INLINE
void dllist_remove_node(PDLLIST_NODE psListNode)
{
psListNode->psNextNode->psPrevNode = psListNode->psPrevNode;
psListNode->psPrevNode->psNextNode = psListNode->psNextNode;
/* Clear the node to show it's not in a list */
psListNode->psPrevNode = NULL;
psListNode->psNextNode = NULL;
}
/*************************************************************************/ /*!
@Function dllist_replace_head
@Description Moves the list from psOldHead to psNewHead
@Input psOldHead List node to be replaced. Will become a
head node of an empty list.
@Input psNewHead List node to be inserted. Must be an
empty list head.
*/
/*****************************************************************************/
static INLINE
void dllist_replace_head(PDLLIST_NODE psOldHead, PDLLIST_NODE psNewHead)
{
if (dllist_is_empty(psOldHead))
{
psNewHead->psNextNode = psNewHead;
psNewHead->psPrevNode = psNewHead;
}
else
{
/* Change the neighbouring nodes */
psOldHead->psNextNode->psPrevNode = psNewHead;
psOldHead->psPrevNode->psNextNode = psNewHead;
/* Copy the old data to the new node */
psNewHead->psNextNode = psOldHead->psNextNode;
psNewHead->psPrevNode = psOldHead->psPrevNode;
/* Remove links to the previous list */
psOldHead->psNextNode = psOldHead;
psOldHead->psPrevNode = psOldHead;
}
}
/**************************************************************************/ /*!
@Function dllist_insert_list_at_head
@Description Inserts psInHead list into the head of the psOutHead list.
After this operation psOutHead will contain psInHead at the
head of the list and the remaining elements that were
already in psOutHead will be places after the psInList (so
at a tail of the original list).
@Input psOutHead List node psInHead will be inserted to.
@Input psInHead List node to be inserted to psOutHead.
After this operation this becomes an empty list.
*/ /***************************************************************************/
static INLINE
void dllist_insert_list_at_head(PDLLIST_NODE psOutHead, PDLLIST_NODE psInHead)
{
PDLLIST_NODE psInHeadNextNode = psInHead->psNextNode;
PDLLIST_NODE psOutHeadNextNode = psOutHead->psNextNode;
if (!dllist_is_empty(psInHead))
{
psOutHead->psNextNode = psInHeadNextNode;
psInHeadNextNode->psPrevNode = psOutHead;
psInHead->psPrevNode->psNextNode = psOutHeadNextNode;
psOutHeadNextNode->psPrevNode = psInHead->psPrevNode;
dllist_init(psInHead);
}
}
/*************************************************************************/ /*!
@Description Pointer to a dllist comparison callback function.
@Input psNode Pointer to a node in a dllist.
@Input psNext Pointer to psNode's next neighbour.
*/ /**************************************************************************/
typedef bool (*DLLIST_CMP_CB)(const DLLIST_NODE *psNode, const DLLIST_NODE *psNext);
/*************************************************************************/ /*!
@Function dllist_sort
@Description Insert-sorts the List in place
The cmpr function passes the current and next node,
From which the user writes the function responsible
for choosing to swap order or not.
The function returns true if a swap is required
@Input psListHead List Head to be sorted.
@Input cmpr Function pointer to use for sorting
*/
/*****************************************************************************/
static INLINE void dllist_sort(PDLLIST_NODE psListHead,
DLLIST_CMP_CB cmpr)
{
DLLIST_NODE *node, *next;
DLLIST_NODE sTempHead;
dllist_init(&sTempHead);
dllist_foreach_node(psListHead, node, next)
{
dllist_remove_node(node);
dllist_add_to_head(&sTempHead, node);
}
while (!dllist_is_empty(&sTempHead))
{
DLLIST_NODE *psSmallestNode = NULL;
dllist_foreach_node(&sTempHead, node, next)
{
if (!psSmallestNode || cmpr(psSmallestNode, node))
{
psSmallestNode = node;
}
}
dllist_remove_node(psSmallestNode);
dllist_add_to_tail(psListHead, psSmallestNode);
}
}
#endif /* DLLIST_H */

View File

@@ -0,0 +1,83 @@
/*************************************************************************/ /*!
@File dma_km.h
@Title DMA transfer module header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DMA_KM_H
#define DMA_KM_H
#if defined(__linux__)
#include <linux/version.h>
#else
#define KERNEL_VERSION
#endif
#include "pvrsrv_error.h"
#include "img_types.h"
#include "cache_ops.h"
#include "device.h"
#include "pmr.h"
#include "pvrsrv_sync_km.h"
#include "connection_server.h"
PVRSRV_ERROR DmaDeviceParams(CONNECTION_DATA *psConnection,
PVRSRV_DEVICE_NODE *psDevNode,
IMG_UINT32 *ui32DmaBuffAlign,
IMG_UINT32 *ui32DmaTransferMult);
PVRSRV_ERROR DmaSparseMappingTable(PMR *psPMR,
IMG_DEVMEM_OFFSET_T uiOffset,
IMG_UINT32 ui32SizeInPages,
IMG_BOOL *pbTable);
PVRSRV_ERROR DmaTransfer(CONNECTION_DATA *psConnection,
PVRSRV_DEVICE_NODE *psDevNode,
IMG_UINT32 uiNumDMAs,
PMR** ppsPMR,
IMG_UINT64 *puiAddress,
IMG_DEVMEM_OFFSET_T *puiOffset,
IMG_DEVMEM_SIZE_T *puiSize,
IMG_BOOL bMemToDev,
PVRSRV_TIMELINE iUpdateTimeline);
PVRSRV_ERROR PVRSRVInitialiseDMA(PVRSRV_DEVICE_NODE *psDeviceNode);
void PVRSRVDeInitialiseDMA(PVRSRV_DEVICE_NODE *psDeviceNode);
#endif /* DMA_KM_H */

View File

@@ -0,0 +1,523 @@
/*************************************************************************/ /*!
@File dma_support.c
@Title System DMA support
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Provides a contiguous memory allocator (i.e. DMA allocator);
APIs are used for allocation/ioremapping (DMA/PA <-> CPU/VA)
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#include <linux/mm.h>
#include <asm/page.h>
#include <linux/device.h>
#include <linux/highmem.h>
#include <linux/vmalloc.h>
#include <linux/dma-mapping.h>
#include <asm-generic/getorder.h>
#include "allocmem.h"
#include "dma_support.h"
#include "pvr_vmap.h"
#include "kernel_compatibility.h"
#define DMA_MAX_IOREMAP_ENTRIES 2
static IMG_BOOL gbEnableDmaIoRemapping = IMG_FALSE;
static DMA_ALLOC gsDmaIoRemapArray[DMA_MAX_IOREMAP_ENTRIES] = {{0}};
static void*
SysDmaAcquireKernelAddress(struct page *psPage, IMG_UINT64 ui64Size, DMA_ALLOC *psDmaAlloc)
{
IMG_BOOL bPageByPage = IMG_TRUE;
IMG_UINT32 uiIdx;
void *pvVirtAddr = NULL;
IMG_UINT32 ui32PgCount = (IMG_UINT32)(ui64Size >> OSGetPageShift());
PVRSRV_DEVICE_NODE *psDevNode = OSAllocZMemNoStats(sizeof(*psDevNode));
PVRSRV_DEVICE_CONFIG *psDevConfig = OSAllocZMemNoStats(sizeof(*psDevConfig));
struct page **pagearray = OSAllocZMemNoStats(ui32PgCount * sizeof(struct page *));
void *pvOSDevice = psDmaAlloc->pvOSDevice;
#if defined(CONFIG_ARM64)
pgprot_t prot = pgprot_writecombine(PAGE_KERNEL);
#else
pgprot_t prot = pgprot_noncached(PAGE_KERNEL);
#endif
/* Validate all required dynamic tmp buffer allocations */
if (psDevNode == NULL || psDevConfig == NULL || pagearray == NULL)
{
if (psDevNode)
{
OSFreeMem(psDevNode);
}
if (psDevConfig)
{
OSFreeMem(psDevConfig);
}
if (pagearray)
{
OSFreeMem(pagearray);
}
goto e0;
}
/* Fake psDevNode->psDevConfig->pvOSDevice */
psDevConfig->pvOSDevice = pvOSDevice;
psDevNode->psDevConfig = psDevConfig;
/* Evict any page data contents from d-cache */
for (uiIdx = 0; uiIdx < ui32PgCount; uiIdx++)
{
void *pvVirtStart, *pvVirtEnd;
IMG_CPU_PHYADDR sCPUPhysStart, sCPUPhysEnd;
/* Prepare array required for vmap */
pagearray[uiIdx] = &psPage[uiIdx];
if (bPageByPage)
{
#if defined(CONFIG_64BIT)
bPageByPage = IMG_FALSE;
pvVirtStart = kmap(&psPage[uiIdx]);
pvVirtEnd = pvVirtStart + ui64Size;
sCPUPhysStart.uiAddr = page_to_phys(&psPage[uiIdx]);
sCPUPhysEnd.uiAddr = sCPUPhysStart.uiAddr + ui64Size;
/* all pages have a kernel linear address, flush entire range */
#else
pvVirtStart = kmap(&psPage[uiIdx]);
pvVirtEnd = pvVirtStart + PAGE_SIZE;
sCPUPhysStart.uiAddr = page_to_phys(&psPage[uiIdx]);
sCPUPhysEnd.uiAddr = sCPUPhysStart.uiAddr + PAGE_SIZE;
/* pages might be from HIGHMEM, need to kmap/flush per page */
#endif
/* Fallback to range-based d-cache flush */
OSCPUCacheInvalidateRangeKM(psDevNode,
pvVirtStart, pvVirtEnd,
sCPUPhysStart, sCPUPhysEnd);
kunmap(&psPage[uiIdx]);
}
}
/* Remap pages into VMALLOC space */
pvVirtAddr = pvr_vmap(pagearray, ui32PgCount, VM_READ | VM_WRITE, prot);
psDmaAlloc->PageProps = prot;
/* Clean-up tmp buffers */
OSFreeMem(psDevConfig);
OSFreeMem(psDevNode);
OSFreeMem(pagearray);
e0:
return pvVirtAddr;
}
static void SysDmaReleaseKernelAddress(void *pvVirtAddr, IMG_UINT64 ui64Size, pgprot_t pgprot)
{
pvr_vunmap(pvVirtAddr, ui64Size >> OSGetPageShift(), pgprot);
}
/*!
******************************************************************************
@Function SysDmaAllocMem
@Description Allocates physically contiguous memory
@Return PVRSRV_ERROR PVRSRV_OK on success. Otherwise, a PVRSRV_
error code
******************************************************************************/
PVRSRV_ERROR SysDmaAllocMem(DMA_ALLOC *psDmaAlloc)
{
PVRSRV_ERROR eError = PVRSRV_OK;
struct device *psDev;
struct page *psPage;
size_t uiSize;
if (psDmaAlloc == NULL ||
psDmaAlloc->hHandle ||
psDmaAlloc->pvVirtAddr ||
psDmaAlloc->ui64Size == 0 ||
psDmaAlloc->sBusAddr.uiAddr ||
psDmaAlloc->pvOSDevice == NULL)
{
PVR_LOG_IF_FALSE((IMG_FALSE), "Invalid parameter");
return PVRSRV_ERROR_INVALID_PARAMS;
}
uiSize = PVR_ALIGN(psDmaAlloc->ui64Size, PAGE_SIZE);
psDev = (struct device *)psDmaAlloc->pvOSDevice;
psDmaAlloc->hHandle = dma_alloc_coherent(psDev, uiSize, (dma_addr_t *)&psDmaAlloc->sBusAddr.uiAddr, GFP_KERNEL);
if (psDmaAlloc->hHandle)
{
psDmaAlloc->pvVirtAddr = psDmaAlloc->hHandle;
PVR_DPF((PVR_DBG_MESSAGE,
"Allocated DMA buffer V:0x%p P:0x%llx S:0x"IMG_SIZE_FMTSPECX,
psDmaAlloc->pvVirtAddr,
psDmaAlloc->sBusAddr.uiAddr,
uiSize));
}
else if ((psPage = alloc_pages(GFP_KERNEL, get_order(uiSize))))
{
psDmaAlloc->sBusAddr.uiAddr = dma_map_page(psDev, psPage, 0, uiSize, DMA_BIDIRECTIONAL);
if (dma_mapping_error(psDev, psDmaAlloc->sBusAddr.uiAddr))
{
PVR_DPF((PVR_DBG_ERROR,
"dma_map_page() failed, page 0x%p order %d",
psPage,
get_order(uiSize)));
__free_pages(psPage, get_order(uiSize));
goto e0;
}
psDmaAlloc->psPage = psPage;
psDmaAlloc->pvVirtAddr = SysDmaAcquireKernelAddress(psPage, uiSize, psDmaAlloc);
if (! psDmaAlloc->pvVirtAddr)
{
PVR_DPF((PVR_DBG_ERROR,
"SysDmaAcquireKernelAddress() failed, page 0x%p order %d",
psPage,
get_order(uiSize)));
dma_unmap_page(psDev, psDmaAlloc->sBusAddr.uiAddr, uiSize, DMA_BIDIRECTIONAL);
__free_pages(psPage, get_order(uiSize));
goto e0;
}
PVR_DPF((PVR_DBG_MESSAGE,
"Allocated contiguous buffer V:0x%p P:0x%llx S:0x"IMG_SIZE_FMTSPECX,
psDmaAlloc->pvVirtAddr,
psDmaAlloc->sBusAddr.uiAddr,
uiSize));
}
else
{
PVR_DPF((PVR_DBG_ERROR, "Unable to allocate contiguous buffer, size: 0x"IMG_SIZE_FMTSPECX, uiSize));
eError = PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES;
}
e0:
PVR_LOG_RETURN_IF_FALSE((psDmaAlloc->pvVirtAddr), "DMA/CMA allocation failed", PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES);
return eError;
}
/*!
******************************************************************************
@Function SysDmaFreeMem
@Description Free physically contiguous memory
@Return void
******************************************************************************/
void SysDmaFreeMem(DMA_ALLOC *psDmaAlloc)
{
size_t uiSize;
struct device *psDev;
if (psDmaAlloc == NULL ||
psDmaAlloc->ui64Size == 0 ||
psDmaAlloc->pvOSDevice == NULL ||
psDmaAlloc->pvVirtAddr == NULL ||
psDmaAlloc->sBusAddr.uiAddr == 0)
{
PVR_LOG_IF_FALSE((IMG_FALSE), "Invalid parameter");
return;
}
uiSize = PVR_ALIGN(psDmaAlloc->ui64Size, PAGE_SIZE);
psDev = (struct device *)psDmaAlloc->pvOSDevice;
if (psDmaAlloc->pvVirtAddr != psDmaAlloc->hHandle)
{
SysDmaReleaseKernelAddress(psDmaAlloc->pvVirtAddr, uiSize, psDmaAlloc->PageProps);
}
if (! psDmaAlloc->hHandle)
{
struct page *psPage;
dma_unmap_page(psDev, psDmaAlloc->sBusAddr.uiAddr, uiSize, DMA_BIDIRECTIONAL);
psPage = psDmaAlloc->psPage;
__free_pages(psPage, get_order(uiSize));
return;
}
dma_free_coherent(psDev, uiSize, psDmaAlloc->hHandle, (dma_addr_t )psDmaAlloc->sBusAddr.uiAddr);
}
/*!
******************************************************************************
@Function SysDmaRegisterForIoRemapping
@Description Registers DMA_ALLOC for manual I/O remapping
@Return PVRSRV_ERROR PVRSRV_OK on success. Otherwise, a PVRSRV_
error code
******************************************************************************/
PVRSRV_ERROR SysDmaRegisterForIoRemapping(DMA_ALLOC *psDmaAlloc)
{
size_t uiSize;
IMG_UINT32 ui32Idx;
IMG_BOOL bTabEntryFound = IMG_TRUE;
PVRSRV_ERROR eError = PVRSRV_ERROR_TOO_FEW_BUFFERS;
if (psDmaAlloc == NULL ||
psDmaAlloc->ui64Size == 0 ||
psDmaAlloc->pvOSDevice == NULL ||
psDmaAlloc->pvVirtAddr == NULL ||
psDmaAlloc->sBusAddr.uiAddr == 0)
{
PVR_LOG_IF_FALSE((IMG_FALSE), "Invalid parameter");
return PVRSRV_ERROR_INVALID_PARAMS;
}
uiSize = PVR_ALIGN(psDmaAlloc->ui64Size, PAGE_SIZE);
for (ui32Idx = 0; ui32Idx < DMA_MAX_IOREMAP_ENTRIES; ++ui32Idx)
{
/* Check if an I/O remap entry exists for remapping */
if (gsDmaIoRemapArray[ui32Idx].pvVirtAddr == NULL)
{
PVR_ASSERT(gsDmaIoRemapArray[ui32Idx].sBusAddr.uiAddr == 0);
PVR_ASSERT(gsDmaIoRemapArray[ui32Idx].ui64Size == 0);
break;
}
}
if (ui32Idx >= DMA_MAX_IOREMAP_ENTRIES)
{
bTabEntryFound = IMG_FALSE;
}
if (bTabEntryFound)
{
IMG_BOOL bSameVAddr, bSamePAddr, bSameSize;
bSamePAddr = gsDmaIoRemapArray[ui32Idx].sBusAddr.uiAddr == psDmaAlloc->sBusAddr.uiAddr;
bSameVAddr = gsDmaIoRemapArray[ui32Idx].pvVirtAddr == psDmaAlloc->pvVirtAddr;
bSameSize = gsDmaIoRemapArray[ui32Idx].ui64Size == uiSize;
if (bSameVAddr)
{
if (bSamePAddr && bSameSize)
{
eError = PVRSRV_OK;
}
else
{
eError = PVRSRV_ERROR_ALREADY_EXISTS;
}
}
else
{
PVR_ASSERT(bSamePAddr == IMG_FALSE);
gsDmaIoRemapArray[ui32Idx].ui64Size = uiSize;
gsDmaIoRemapArray[ui32Idx].sBusAddr = psDmaAlloc->sBusAddr;
gsDmaIoRemapArray[ui32Idx].pvVirtAddr = psDmaAlloc->pvVirtAddr;
PVR_DPF((PVR_DBG_MESSAGE,
"DMA: register I/O remap: "
"VA: 0x%p, PA: 0x%llx, Size: 0x"IMG_SIZE_FMTSPECX,
psDmaAlloc->pvVirtAddr,
psDmaAlloc->sBusAddr.uiAddr,
uiSize));
gbEnableDmaIoRemapping = IMG_TRUE;
eError = PVRSRV_OK;
}
}
return eError;
}
/*!
******************************************************************************
@Function SysDmaDeregisterForIoRemapping
@Description Deregisters DMA_ALLOC from manual I/O remapping
@Return void
******************************************************************************/
void SysDmaDeregisterForIoRemapping(DMA_ALLOC *psDmaAlloc)
{
size_t uiSize;
IMG_UINT32 ui32Idx;
if (psDmaAlloc == NULL ||
psDmaAlloc->ui64Size == 0 ||
psDmaAlloc->pvOSDevice == NULL ||
psDmaAlloc->pvVirtAddr == NULL ||
psDmaAlloc->sBusAddr.uiAddr == 0)
{
PVR_LOG_IF_FALSE((IMG_FALSE), "Invalid parameter");
return;
}
uiSize = PVR_ALIGN(psDmaAlloc->ui64Size, PAGE_SIZE);
/* Remove specified entries from list of I/O remap entries */
for (ui32Idx = 0; ui32Idx < DMA_MAX_IOREMAP_ENTRIES; ++ui32Idx)
{
if (gsDmaIoRemapArray[ui32Idx].pvVirtAddr == psDmaAlloc->pvVirtAddr)
{
gsDmaIoRemapArray[ui32Idx].sBusAddr.uiAddr = 0;
gsDmaIoRemapArray[ui32Idx].pvVirtAddr = NULL;
gsDmaIoRemapArray[ui32Idx].ui64Size = 0;
PVR_DPF((PVR_DBG_MESSAGE,
"DMA: deregister I/O remap: "
"VA: 0x%p, PA: 0x%llx, Size: 0x"IMG_SIZE_FMTSPECX,
psDmaAlloc->pvVirtAddr,
psDmaAlloc->sBusAddr.uiAddr,
uiSize));
break;
}
}
/* Check if no other I/O remap entries exists for remapping */
for (ui32Idx = 0; ui32Idx < DMA_MAX_IOREMAP_ENTRIES; ++ui32Idx)
{
if (gsDmaIoRemapArray[ui32Idx].pvVirtAddr != NULL)
{
break;
}
}
if (ui32Idx == DMA_MAX_IOREMAP_ENTRIES)
{
/* No entries found so disable remapping */
gbEnableDmaIoRemapping = IMG_FALSE;
}
}
/*!
******************************************************************************
@Function SysDmaDevPAddrToCpuVAddr
@Description Maps a DMA_ALLOC physical address to CPU virtual address
@Return IMG_CPU_VIRTADDR on success. Otherwise, a NULL
******************************************************************************/
IMG_CPU_VIRTADDR SysDmaDevPAddrToCpuVAddr(IMG_UINT64 uiAddr, IMG_UINT64 ui64Size)
{
IMG_CPU_VIRTADDR pvDMAVirtAddr = NULL;
DMA_ALLOC *psHeapDmaAlloc;
IMG_UINT32 ui32Idx;
if (gbEnableDmaIoRemapping == IMG_FALSE)
{
return pvDMAVirtAddr;
}
for (ui32Idx = 0; ui32Idx < DMA_MAX_IOREMAP_ENTRIES; ++ui32Idx)
{
psHeapDmaAlloc = &gsDmaIoRemapArray[ui32Idx];
if (psHeapDmaAlloc->sBusAddr.uiAddr && uiAddr >= psHeapDmaAlloc->sBusAddr.uiAddr)
{
IMG_UINT64 uiSpan = psHeapDmaAlloc->ui64Size;
IMG_UINT64 uiOffset = uiAddr - psHeapDmaAlloc->sBusAddr.uiAddr;
if (uiOffset < uiSpan)
{
PVR_ASSERT((uiOffset+ui64Size-1) < uiSpan);
pvDMAVirtAddr = psHeapDmaAlloc->pvVirtAddr + uiOffset;
PVR_DPF((PVR_DBG_MESSAGE,
"DMA: remap: PA: 0x%llx => VA: 0x%p",
uiAddr, pvDMAVirtAddr));
break;
}
}
}
return pvDMAVirtAddr;
}
/*!
******************************************************************************
@Function SysDmaCpuVAddrToDevPAddr
@Description Maps a DMA_ALLOC CPU virtual address to physical address
@Return Non-zero value on success. Otherwise, a 0
******************************************************************************/
IMG_UINT64 SysDmaCpuVAddrToDevPAddr(IMG_CPU_VIRTADDR pvDMAVirtAddr)
{
IMG_UINT64 uiAddr = 0;
DMA_ALLOC *psHeapDmaAlloc;
IMG_UINT32 ui32Idx;
if (gbEnableDmaIoRemapping == IMG_FALSE)
{
return uiAddr;
}
for (ui32Idx = 0; ui32Idx < DMA_MAX_IOREMAP_ENTRIES; ++ui32Idx)
{
psHeapDmaAlloc = &gsDmaIoRemapArray[ui32Idx];
if (psHeapDmaAlloc->pvVirtAddr && pvDMAVirtAddr >= psHeapDmaAlloc->pvVirtAddr)
{
IMG_UINT64 uiSpan = psHeapDmaAlloc->ui64Size;
IMG_UINT64 uiOffset = pvDMAVirtAddr - psHeapDmaAlloc->pvVirtAddr;
if (uiOffset < uiSpan)
{
uiAddr = psHeapDmaAlloc->sBusAddr.uiAddr + uiOffset;
PVR_DPF((PVR_DBG_MESSAGE,
"DMA: remap: VA: 0x%p => PA: 0x%llx",
pvDMAVirtAddr, uiAddr));
break;
}
}
}
return uiAddr;
}
/******************************************************************************
End of file (dma_support.c)
******************************************************************************/

View File

@@ -0,0 +1,117 @@
/*************************************************************************/ /*!
@File dma_support.h
@Title Device contiguous memory allocator and I/O re-mapper
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description This header provides a contiguous memory allocator API; mainly
used for allocating / ioremapping (DMA/PA <-> CPU/VA)
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ /**************************************************************************/
#ifndef DMA_SUPPORT_H
#define DMA_SUPPORT_H
#include "osfunc.h"
#include "pvrsrv.h"
typedef struct _DMA_ALLOC_
{
IMG_UINT64 ui64Size;
IMG_CPU_VIRTADDR pvVirtAddr;
IMG_DEV_PHYADDR sBusAddr;
IMG_HANDLE hHandle;
#if defined(__linux__)
struct page *psPage;
pgprot_t PageProps;
#endif
void *pvOSDevice;
} DMA_ALLOC;
/*!
*******************************************************************************
@Function SysDmaAllocMem
@Description Allocates physically contiguous memory
@Return PVRSRV_OK on success. Otherwise, a PVRSRV error code
******************************************************************************/
PVRSRV_ERROR SysDmaAllocMem(DMA_ALLOC *psDmaAlloc);
/*!
*******************************************************************************
@Function SysDmaFreeMem
@Description Free physically contiguous memory
@Return void
******************************************************************************/
void SysDmaFreeMem(DMA_ALLOC *psCmaAlloc);
/*!
*******************************************************************************
@Function SysDmaRegisterForIoRemapping
@Description Registers DMA_ALLOC for manual I/O remapping
@Return PVRSRV_OK on success. Otherwise, a PVRSRV error code
******************************************************************************/
PVRSRV_ERROR SysDmaRegisterForIoRemapping(DMA_ALLOC *psPhysHeapDmaAlloc);
/*!
*******************************************************************************
@Function SysDmaDeregisterForIoRemapping
@Description Deregisters DMA_ALLOC from manual I/O remapping
@Return void
******************************************************************************/
void SysDmaDeregisterForIoRemapping(DMA_ALLOC *psPhysHeapDmaAlloc);
/*!
*******************************************************************************
@Function SysDmaDevPAddrToCpuVAddr
@Description Maps a DMA_ALLOC physical address to CPU virtual address
@Return IMG_CPU_VIRTADDR on success. Otherwise, a NULL
******************************************************************************/
IMG_CPU_VIRTADDR
SysDmaDevPAddrToCpuVAddr(IMG_UINT64 uiAddr, IMG_UINT64 ui64Size);
/*!
*******************************************************************************
@Function SysDmaCpuVAddrToDevPAddr
@Description Maps a DMA_ALLOC CPU virtual address to physical address
@Return Non-zero value on success. Otherwise, a 0
******************************************************************************/
IMG_UINT64 SysDmaCpuVAddrToDevPAddr(IMG_CPU_VIRTADDR pvDMAVirtAddr);
#endif /* DMA_SUPPORT_H */
/******************************************************************************
End of file (dma_support.h)
******************************************************************************/

View File

@@ -0,0 +1,143 @@
/*
* @File
* @Codingstyle LinuxKernel
* @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
* @License Dual MIT/GPLv2
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License Version 2 ("GPL") in which case the provisions
* of GPL are applicable instead of those above.
*
* If you wish to allow use of your version of this file only under the terms of
* GPL, and not to allow others to use your version of this file under the terms
* of the MIT license, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by GPL as set
* out in the file called "GPL-COPYING" included in this distribution. If you do
* not delete the provisions above, a recipient may use your version of this file
* under the terms of either the MIT license or GPL.
*
* This License is also included in this distribution in the file called
* "MIT-COPYING".
*
* EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
* PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0))
#include <drm/drm_device.h>
#include <drm/drm_file.h>
#endif
#include "drm_netlink_gem.h"
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
#include <drm/drm_vma_manager.h>
#endif
#include <linux/capability.h>
#include "kernel_compatibility.h"
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
static int netlink_gem_mmap_capsys(struct file *file,
struct vm_area_struct *vma)
{
struct drm_file *file_priv = file->private_data;
struct drm_device *dev = file_priv->minor->dev;
struct drm_vma_offset_node *node;
struct drm_gem_object *obj = NULL;
int err;
drm_vma_offset_lock_lookup(dev->vma_offset_manager);
node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
vma->vm_pgoff,
vma_pages(vma));
if (node) {
obj = container_of(node, struct drm_gem_object, vma_node);
/* Don't mmap an object that is being destroyed */
if (!kref_get_unless_zero(&obj->refcount))
obj = NULL;
}
drm_vma_offset_unlock_lookup(dev->vma_offset_manager);
if (!obj)
return -EINVAL;
err = drm_vma_node_allow(node, file_priv);
if (!err) {
err = drm_gem_mmap(file, vma);
drm_vma_node_revoke(node, file_priv);
}
drm_gem_object_put(obj);
return err;
}
int netlink_gem_mmap(struct file *file, struct vm_area_struct *vma)
{
int err;
err = drm_gem_mmap(file, vma);
if (!!err && capable(CAP_SYS_RAWIO))
err = netlink_gem_mmap_capsys(file, vma);
return err;
}
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) */
int netlink_gem_mmap(struct file *file, struct vm_area_struct *vma)
{
struct drm_file *file_priv = file->private_data;
struct drm_device *dev = file_priv->minor->dev;
struct drm_vma_offset_node *node;
struct drm_gem_object *obj;
int err;
mutex_lock(&dev->struct_mutex);
node = drm_vma_offset_exact_lookup(dev->vma_offset_manager,
vma->vm_pgoff,
vma_pages(vma));
if (!node) {
err = -EINVAL;
goto exit_unlock;
}
/* Allow Netlink clients to mmap any object for reading */
if (!capable(CAP_SYS_RAWIO) || (vma->vm_flags & VM_WRITE)) {
if (!drm_vma_node_is_allowed(node, file_priv)) {
err = -EACCES;
goto exit_unlock;
}
}
obj = container_of(node, struct drm_gem_object, vma_node);
err = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT, vma);
exit_unlock:
mutex_unlock(&dev->struct_mutex);
return err;
}
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) */

Some files were not shown because too many files have changed in this diff Show More