Commit Graph

680 Commits

Author SHA1 Message Date
PixelyIon
43b9d95dbc Rework App Dialog Buttons
Aligning the buttons to the bottom of the game image was determined to look odd due to the amount of padding between the title and buttons. They are now back to being below the title but the buttons have been resized with "Play" being a wide button while "Pin" has been replaced with Google Material Icons's "Add To Home Screen" icon and sized down to an icon-only button.
2021-11-11 13:47:20 +05:30
lynxnb
6a0ad25c27 Update BottomSheetDialog appearance
* Fix incorrect dialog surface color
* Adjust buttons' position
2021-11-10 17:41:07 +01:00
lynxnb
df120ab76d Fix unicode characters being turned into emojis for some vendors 2021-11-10 17:41:07 +01:00
lynxnb
b7b0f07ba8 Update application branding
- Logo is now displayed next to the app name
- Remove search bar animation
- New color accent
- Improve visibility of controller binding setting's glyphs
2021-11-10 17:41:07 +01:00
lynxnb
827439d2d1 Use the new font for the application name in main activity 2021-11-10 17:41:07 +01:00
Lynx
7ec533885c Use the new banner in the README 2021-11-10 17:41:07 +01:00
lynxnb
07f899e904 Update application icon 2021-11-10 17:41:07 +01:00
Billy Laws
d88b08d986 Address PR feedback 2021-11-10 21:35:36 +05:30
Billy Laws
1b453c04ca Remove completed nvmap TODO
Pins have been implemented so the to-do is no longer needed.
2021-11-10 21:35:36 +05:30
Billy Laws
d2d181725f Remove unused virtEnd variable in FlatMemoryManager::{Read, Write} 2021-11-10 21:35:36 +05:30
Billy Laws
60fbfad4bc Add virtual dtors to time service code 2021-11-10 21:35:36 +05:30
Billy Laws
fd8e843c6c Add rules on semantic wrapping and bracketed initalisation to contrib 2021-11-10 21:35:36 +05:30
Billy Laws
ef10d3d394 Use semantic wrapping where appropriate for class initialiser lists 2021-11-10 21:35:36 +05:30
Billy Laws
6b33268d85 Remove unused gm20b EngineID enum 2021-11-10 21:35:36 +05:30
Billy Laws
73896c2e6b Fixup nvdrv channel types to follow naming conventions 2021-11-10 21:35:36 +05:30
Billy Laws
ad900aba7a s/Host1X/Host1x/ as per Nvidia naming 2021-11-10 21:35:36 +05:30
Billy Laws
dbfb1cfe20 Fully implement the nvdrv Host1xChannel::Submit operation
This pushes a set of command buffers into the Host1x command FIFO allocated for the channel, returning fence thresholds that can be waited on for completion,
2021-11-10 21:35:36 +05:30
Billy Laws
baefb0fe93 Implement the Host1x command FIFO together with barebones Host1x classes
The Host1x block of the TX1 supports 14 separate channels to which commands can be issued, these all run asynchronously so are emulated the same way as GPU channels with one FIFO emulation thread each. The command FIFO itself is very similar to the GPFIFO found in the GPU however there are some differences, mainly the introduction of classes (similar to engines) and the Mask opcode (which allows writing to a specific set of offsets much more efficiently).

There is an internal Host1x class which functions similar to the GPFIFO class in the GPU, handling general operations such as syncpoint waits, this is accessed via the simple method interface. Other channels such as NVDEC and VIC are behind the 'Tegra Host Interface' (THI) in HW, this abstracts out the classes internal details and provides a uniform method interface ontop of the Host1x method one. We emulate the THI as a templated wrapper for the underlying class.

Syncpoint increments in Host1x are different to GPU, the THI allows submitting increment requests that will be queued up and only be applied after a specific condition in the associated engine is met; however the option to for immediate increments is also available.
2021-11-10 21:35:36 +05:30
Billy Laws
2494cafee8 Cleanup GPFIFO comments and make Run() private 2021-11-10 21:35:36 +05:30
Billy Laws
2577658fc7 Avoid GetPointer on nvmap handles where they would be accessed via SMMU
GetPointer sets the sharedMemMapped flag, which should only be set if
other userspace processes have the handle mapped.
2021-11-10 21:35:36 +05:30
Billy Laws
fd0420443c Add template utils for constructing all elements in an std::array
This avoids the excessive repetition needed for the case where array
members have no default constructor.

eg:
```c++
std::array<Type, 10> channels{util::MakeFilledArray<Type, 10>(typeConstructorArg, <...>)};
```
2021-11-10 21:35:36 +05:30
Billy Laws
34bf413661 Fix bitmask check for event IDs > 32 in Ctrl::SyncpointFreeEventBatch
Doing 1 << 32 would result in an integer overflow rather than the desired behaviour of checking a bit, make 1 64 bit to present that.
2021-11-10 21:34:30 +05:30
Billy Laws
debab7c9c7 Implement nvmap handle pinning/unpinning
nvmap allows mapping handles into the SMMU address space through 'pins'. These are refcounted mappings that are lazily freed when required due to AS space running out. Nvidia implements this by using several MRU lists of handles in order to choose which ones to free and which ones to keep, however as we are unlikely to even run into the case of not having enough address space a naive queue approach works fine. This pin infrastructure is used by nvdrv's host1x channel implementation in order to handle mapping of both command and data buffers for submit.
2021-11-10 21:34:30 +05:30
Billy Laws
a0c57256cc Hookup FlatMemoryManager for SMMU into SoC
The SMMU is used to control the mappings of peripherals such as the VIC
and NVDEC.
2021-11-10 21:34:30 +05:30
Billy Laws
97dc053ffd Move FlatAllocator allocation error handling to the caller
This is a prerequisite for nvmap SMMU memory management, which only frees the memory handles refer to if an allocation fails.
2021-11-10 21:34:30 +05:30
Billy Laws
04e5237ec1 Stub host1x channel devices and IOCTLs
host1x channels are generally similar to GPU channels however there is only one channel for each specific class (like a GPU engine) and an address space is shared between them all.

This PR implements the simple IOCTLs with the larger ones that will depend on changes outside of nvdrv being left for future commits. This is enough to partly run oss-nvjpeg.
2021-11-10 21:34:30 +05:30
Billy Laws
5087d3dc2a Reserve host1x channel syncpoints 2021-11-10 21:34:30 +05:30
Billy Laws
b0a5dab0f7 Support passing additional constructor arguments to nvdrv devices
Needed for host1x channels which use the same class for multiple types.
2021-11-10 21:34:30 +05:30
Billy Laws
eb6f052873 Fixup GpuChannel::SetNvmapFd to take an FD rather than an nvmap handle 2021-11-10 21:34:30 +05:30
Billy Laws
386a3447a8 Introduce variable sized span support to nvdrv deserialisation
The element containing the size first needs to be saved to a save slot with Save<T, slotId>, it can then be read back later as the size of a span with SlotSizeSpan<T, slotId>. This is needed to support the Host1XChannel Submit IOCTL.
2021-11-10 21:34:30 +05:30
Billy Laws
6eeaa343f8 Avoid crash when passing unallocated syncpoint IDs to EventWait 2021-11-10 21:34:30 +05:30
PixelyIon
fbfad21f03 Migrate Maxwell3D::Registers to OffsetMember
Maxwell3D registers were primarily written with absolute offsets and ended up being fairly messy due to attempting to emulate this using struct relative positioning resulting in a lot of pointless padding members. This has now been improved by utilizing `OffsetMember` to directly use offsets resulting in much neater code.
2021-11-10 21:31:45 +05:30
PixelyIon
69761389ff Extend OffsetMember with direct operator=/operator[]
It was found to be semantically advantageous to directly pass-through certain operators such as the assignment (`=`) and array index (`[]`) operators. These would require a dereference prior to their usage otherwise but now can be directly used.
2021-11-10 21:30:02 +05:30
Billy Laws
cc7b2a0ab8 Introduce OffsetMember for offset-based union members
The offset of a member in a structure was determined by its relative position and compiler alignment. This is unoptimal for larger structures such as those found in GPU Engines that are primarily named by offset rather than relative positioning and end up requiring a massive amount of padding to function as is. A solution to this problem was simply to supply member offsets directly which can be done by using `OffsetMember` alongside a `union`.
2021-11-10 21:17:31 +05:30
PixelyIon
fb476567ff Introduce JniString as C++ wrapper over jstring
We used to manually call JNI UTF-8 string allocation and deallocation functions when utilizing a `jstring` but this could be erroneous and is just inconvenient. All of this has now been consolidated into an class `JniString` which is a wrapper around `std::string` and creates a copy of the contents of the `jstring` in its constructor and passes them into the `std::string` constructor.
2021-11-09 21:18:47 +05:30
PixelyIon
79ceb2cf23 Improve Vulkan Texture Synchronization
The Vulkan Pipeline Barriers were unoptimal and incorrect to some degree prior as we purely synchronized images and not staging buffers. This has now been fixed and improved in general with more relevant synchronization.
2021-11-09 21:08:03 +05:30
PixelyIon
bf71804089 Upgrade AGP to 7.1.0-beta02
Newer versions of Android Studio Beta only work correctly with `beta02` rather than `beta01` which we used prior.
2021-11-09 21:02:59 +05:30
PixelyIon
bed9fbf5e7 Fix EmulationActivity.vibrateDevice assert due to null Vibrator
`EmulationActivity.vibrateDevice` would assert when a `null` Vibrator is provided due to one not being set in the controller configuration. This has now been fixed by the code not playing a vibration when a vibration device isn't selected.
2021-11-01 00:28:11 +05:30
PixelyIon
414c0104c3 Rework Joy-Con Vibration Conversion
The guest -> host vibration conversion code was entirely broken as it didn't set the vibration `start`/`end` timestamps correctly for a cycle nor did it subtract from the `totalAmplitude` (`currentAmplitude` now) when it a cycle ended due to an incorrect `if` statement and contents. It would just end up saturating the amplitude as much as possible by adding more and more to `totalAmplitude` on every cycle while never subtracting which is entirely wrong and led to a very noticeable drop in amplitude when a vibration was repeated.

It's been entirely reworked to fix all the issues listed above and remove a lot of code that had no understandable purpose. More comments have also been added to the code to make it more readable with better variable and function naming alongside it.
2021-11-01 00:28:11 +05:30
PixelyIon
df7608c2f7 Use proper names rather than paths for submodules
Submodules were named as their relative paths prior which were not very readable, this has now been replaced with proper titles that correspond to the submodule.
2021-11-01 00:28:11 +05:30
PixelyIon
96027f0f09 Build libraries with -Ofast for debug builds
To offset some of the performance overhead of using debug builds, we now optimize all libraries using `-Ofast` while building Skyline itself with `-O0`.
2021-10-31 16:05:08 +05:30
PixelyIon
4b80e1f91c Use libcxx from LLVM Project submodule
The version of libcxx shipped with Android NDK is fairly outdated and doesn't contain several features we desire such as C++ 20 ranges. This has been fixed by using libcxx directly from the LLVM Project which has been added as a submodule and can be updated independently of NDK.
2021-10-31 16:04:44 +05:30
PixelyIon
82154f3ef6 Upgrade AGP to 7.1.0-beta01 & NDK to 24.0.7856742
We've moved to using a beta AGP as `7.0.2` is breaks `clangd` and other C++ features on Beta/Canary Android Studio. NDK was additionally updated with `mbedtls` to fix warnings caused by it alongside some other minor fixes to code for newer versions of libcxx.

The new AGP has a bug where it does not look for executables specified in `android_gradle_build.json` in `PATH` that includes `ninja` which is provided by the `ninja-build` package on the system rather than Android SDK's CMake on GitHub Actions (Ubuntu 20.04). This has been fixed by symlinking `/usr/bin/ninja` to the project root which is searched in for the `ninja` executable.
2021-10-31 15:50:15 +05:30
PixelyIon
962d8dc4c8 Return immediately for non-joining KProcess::Kills when already killed
Locking `KProcess::threadMutex` when a process is being killed by another thread with `join` can lead to the non-joining killer effectively joining as it's waiting on the joining killer to relinquish the mutex. This has been fixed by having an atomic boolean tracking if the process has already been killed and if it has, immediately returning prior to locking the mutex for any non-joining killers.
2021-10-31 15:45:10 +05:30
Billy Laws
6f59cba68d Adds bounds checks to resampler to avoid OOB reads
Resampling would sometimes perform an OOB read into `inputBuffer` due it not containing enough data to calculate corresponding the output sample, this has been fixed by introducing bounds checking to ensure that the buffer has enough data.
2021-10-29 21:46:51 +05:30
PixelyIon
9e3b7a75b2 Use finishAffinity instead of finishAndRemoveTask
The method used to finish (`finishAndRemoveTask`) an activity prior to going back to `MainActivity` or restarting the process led to the process prematurely exiting entirely and would result in it not being restarted or another activity not being launched. This has now been fixed by utilizing `finishAffinity` in its place which correctly only ends the activities with the same affinity as the caller.
2021-10-29 21:20:04 +05:30
PixelyIon
9f5ab13858 Implement R16G16{Unorm/Sint/Uint} RT Formats
Utilized in "The Touryst"
2021-10-29 20:21:58 +05:30
PixelyIon
afebf77544 Zero-Initialize GuestTexture Members
Members of `GuestTexture` were apparently not being initialized and this led to UB since they would be read as random values. Titles such as Super Mario Odyssey avoided setting `baseArrayLayer` which led to it being left at the default value which was completely random and this would lead to crashes. This commit fixes this by initializing said values correctly.
2021-10-27 22:49:45 +05:30
PixelyIon
a0921f8261 Implement R16G16B16A16Snorm/R16G16B16A16Sint RT Formats
Utilized in "The Touryst"
2021-10-27 22:49:45 +05:30
PixelyIon
df64ff5d14 Zero-Fill IAudioRenderer::RequestUpdate Output Buffer
Some titles don't clear the output buffer prior to submission, as the service is expected to fill all of it in, our audren implementation is incomplete and doesn't end up doing this leaving the contents of the buffer to be undefined leading to UB in the form of SEGFAULTs or the application throwing a fatal error. This has been patched over by 0-filling the buffer which is a sane default value for the fields that aren't filled in albeit not a replacement for a proper audren implementation.
2021-10-27 16:18:20 +05:30