Commit Graph

618 Commits

Author SHA1 Message Date
PixelyIon
662935c35d Attempt Flushing Logger During Fatal Signals
Any signals that lead to exception handling being triggered now attempt to flush all logs given that the log mutex is unoccupied, this is to mostly help logs be more complete when exiting isn't graceful.
2022-04-14 14:14:52 +05:30
PixelyIon
586bee2c59 Remove Maxwell3D Zero Initialization Calls
A lot of calls in Maxwell3D register initialization ended up setting the register to 0 which should be implicit behavior and most calls would be eliminated by the redundancy check which had to be manually disabled. It was determined to be better to move this responsibility to the called function to initialize to state equivalent to the corresponding register being 0. All initialization calls with the argument as 0 have been removed now due to this, it was the vast majority of calls.
2022-04-14 14:14:52 +05:30
PixelyIon
49cc0964e2 Initialize Maxwell3D Registers Correctly
Maxwell3D Registers weren't initialized to the correct values prior, this commit fixes that by doing `HandleMethod` calls with all the register values being initialized. This is in contrast to the registers being set without calling the methods in `GraphicsContext` or otherwise resulting in bugs.
2022-04-14 14:14:52 +05:30
PixelyIon
ea87b8878c Implement B8G8R8A8{Unorm/Srgb} RT Format
Needed by Maxwell3D Register Initialization
2022-04-14 14:14:52 +05:30
PixelyIon
69e7d8b574 Remove Vulkan to Skyline Format Conversion Function
The function `GetFormat` was seemingly no longer required due to us never converting from a Vulkan format to a Skyline format, most conversions only went from Skyline to Vulkan and were generally lossy due to certain formats being missing in Vulkan and approximated using channel swizzles. As a result of this, it was pointless to maintain and has now been removed.
2022-04-14 14:14:52 +05:30
PixelyIon
5ed26fef23 Implement Maxwell3D Rasterizer State
Maxwell3D registers relevant to the Vulkan Rasterizer state have been implemented aside from certain features such as per-face polygon modes that cannot be implemented due to Vulkan limitations. A quirk was utilized to dynamically support the provoking vertex being the last vertex as opposed to the first as well.
2022-04-14 14:14:52 +05:30
PixelyIon
8ef225a37d Introduce QuirkManager for runtime GPU quirk tracking
We require a way to track certain host GPU features that are optional such as Vulkan extensions, this is what the `QuirkManager` class does as it checks for all quirks and holds them allowing other components to branch based off these quirks.
2022-04-14 14:14:52 +05:30
PixelyIon
8803616673 Reorder GraphicsContext Members
All members are now placed at the start of sections they are relevant to rather than  at the start of the class.
2022-04-14 14:14:52 +05:30
PixelyIon
107d337d77 Fix MacroInterpreter::MethodAddress Bitfield Padding
Due to compiler alignment issues, the bitfield member `increment` of `MacroInterpreter::MethodAddress` was mistakenly padded and moved to the next byte. This has now been fixed by making its type `u16` like the member prior to it to prevent natural alignment from kicking in.
2022-04-14 14:14:52 +05:30
PixelyIon
26966287c7 Implement Maxwell3D Shader Program Registers
This commit added basic shader program registers, they simply track the address a shader is pointed to at the moment. No parsing of the shader program is done within them.
2022-04-14 14:14:52 +05:30
PixelyIon
93ea919c8f Fix warnings from NVRESULT due to unused lambda capture
A previously used `this` capture is no longer used since the introduction of the static logger.
2022-04-14 14:14:52 +05:30
lynxnb
882b939335 Automatically import key files from search location 2022-03-25 09:40:21 +05:30
Robin Kertels
6cf2ef8fb9 Grant Uri permission when sharing logs 2022-03-24 03:39:41 +05:30
lynxnb
092dcb18c8 Stub ectx:w and ectx:aw Glue services 2022-02-06 21:57:38 +05:30
Robin Kertels
2993f65a1c Ignore empty lines in key files 2022-02-04 23:51:46 +05:30
MCredstoner2004
0ceecbba4f Implement fixed aspect ratio surface
Adds a setting to letterbox the surface with black bars to 16:9 or 21:9 aspect ratio to avoid stretching out the rendered image
2022-01-12 22:09:39 +05:30
lynxnb
6913a90361 Use the new log file name & ext for every logger context 2021-11-11 16:32:19 +01:00
lynxnb
5cd1f01690 Refactor all logger calls 2021-11-11 16:13:24 +01:00
lynxnb
769e6c933d Make Logger class static and introduce LoggerContext
A thread local LoggerContext is now used to hold the output file stream instead of the `Logger` class. Before doing any logging operations, a LoggerContext must be initialized.
This commit will not build successfully on purpose.
2021-11-11 16:13:24 +01:00
PixelyIon
69ef93bfa8 Add Dividers to ControllerActivity's RecyclerView
Dividers after titles were missing in `ControllerActivity` which made it look inconsistent with `SettingsActivity` which did have them. They have now been added by extending `DividerItemDecoration` to be drawn before any `ControllerHeaderItem`.
2021-11-11 20:20:19 +05:30
PixelyIon
b230afcd35 Fix FAB Icon color in OnScreenEditActivity
The icons in these FABs had the same color as the FAB prior which led them to being invisible. This has been fixed by setting a white tint on them which makes the icons clearly visible.
2021-11-11 18:59:09 +05:30
PixelyIon
e4fbee1626 Style Improvements to LicenseDialog
Additional padding has been added to the text alongside making it be left-aligned rather than center-aligned and justified. A newline has also been added to the copyright notice for Skyline to make it look nicer.
2021-11-11 16:35:30 +05:30
PixelyIon
36a1f2a2ec Make all Dialogs use @color/backgroundColor as the background color
We wanted the color of the modals used by the dialogs to be the same as our regular background color rather than a lighter grey. This has now been enforced with style attributes in the case of `AlertDialog` and `setBackground` in the case of `BottomSheetDialog`.
2021-11-11 16:34:38 +05:30
PixelyIon
3f3891839e Make all AlertDialogs use MaterialComponents theme
We inconsistently used `AppCompat`'s `AlertDialog` theme in Settings while using `MaterialComponents`'s theme in Controller Configuration. This has now been fixed by universally using the `MaterialComponents` theme.
2021-11-11 16:28:57 +05:30
PixelyIon
ff5887975b Remove Logo from MainActivity
The Skyline logo was added to the title area but it ended up being too distracting with a light theme as the logo was designed purely for a white background. Ultimately, even though it looked good with the dark theme we had to remove it.
2021-11-11 13:58:25 +05:30
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
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
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