| Commit message (Collapse) | Author | Files | Lines |
|
Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
|
|
- Use .at() instead of raw indexing when dealing with untrusted indices.
- For the special case of WaitFence with syncpoint id UINT32_MAX,
instead of crashing, log an error and ignore. This is what I get when
running Super Mario Maker 2.
|
|
Fixes regression caused by #4907 which caused games like Breath of the Wild 1.0.0 not to boot.
|
|
|
|
|
|
Resolves numerous deprecation warnings throughout the codebase due to
inclusion of this header. Now building core should be significantly less
noisy (and also relying on less global state).
This also uncovered quite a few modules that were relying on indirect
includes, which have also been fixed.
|
|
- This seems to cause softlocks in Breath of the Wild.
|
|
|
|
- Refactor so that SubmitGPFIFO and KickoffPB use shared functionality.
- Implement add_wait and add_increment flags.
|
|
|
|
|
|
|
|
* Rename to align with switchbrew
* Rename to align with switchbrew and remove gpu function that checks if clearing should be done.
|
|
src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp:41:15: error: unused variable 'OutOfMemory' [-Werror,-Wunused-const-variable]
constexpr u32 OutOfMemory{static_cast<u32>(-12)};
^
|
|
This commit aims to implement the NVDEC (Nvidia Decoder) functionality, with video frame decoding being handled by the FFmpeg library.
The process begins with Ioctl commands being sent to the NVDEC and VIC (Video Image Composer) emulated devices. These allocate the necessary GPU buffers for the frame data, along with providing information on the incoming video data. A Submit command then signals the GPU to process and decode the frame data.
To decode the frame, the respective codec's header must be manually composed from the information provided by NVDEC, then sent with the raw frame data to the ffmpeg library.
Currently, H264 and VP9 are supported, with VP9 having some minor artifacting issues related mainly to the reference frame composition in its uncompressed header.
Async GPU is not properly implemented at the moment.
Co-Authored-By: David <25727384+ogniK5377@users.noreply.github.com>
|
|
|
|
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.
Fixes #4795
|
|
- This is used by Super Mario 3D All-Stars.
|
|
Allows some implementations to avoid completely zeroing out the internal
buffer of the optional, and instead only set the validity byte within
the structure.
This also makes it consistent how we return empty optionals.
|
|
We can amend one of the cascade macros to require semicolons in order to
compile. In other cases, we can just remove the superfluous semicolons.
|
|
C++20 deprecates capturing the this pointer via the '=' capture.
Instead, we replace it or extend the capture specification.
|
|
Co-authored-by: LC <mathew1800@gmail.com>
|
|
|
|
|
|
|
|
|
|
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and
Suspended State, Recreates the bootmanager, Initializes Multicore
system.
|
|
Fixes animal crossing svcBreak on launch
|
|
|
|
|
|
IoctlGetGpuTime should be 16 bytes, not 8.
|
|
|
|
This commit corrects a padding value in Ioctl Remap that was actually an
offset to the mapping address.
|
|
With all of the trivial parts of the memory interface moved over, we can
get right into moving over the bits that are used.
Note that this does require the use of GetInstance from the global
system instance to be used within hle_ipc.cpp and the gdbstub. This is
fine for the time being, as they both already rely on the global system
instance in other functions. These will be removed in a change directed
at both of these respectively.
For now, it's sufficient, as it still accomplishes the goal of
de-globalizing the memory code.
|
|
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects.
- See https://github.com/citra-emu/citra/pull/4710 for details.
|
|
- This does not actually seem to exist in the real kernel - games reset these automatically.
# Conflicts:
# src/core/hle/service/am/applets/applets.cpp
# src/core/hle/service/filesystem/fsp_srv.cpp
|
|
Events are supposed to be cleared on quering. This fixes that issue.
|
|
|
|
|
|
|
|
|
|
|
|
These functions are not stubbed and are called fairly often. Due to the nature of how often they're called, we should keep them marked as LOG_TRACE instead of LOG_DEBUG or LOG_WARNING
|
|
|
|
Purpose of Ioctl2 and Ioctl3 is to prevent the passing of raw pointers through ioctls
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Makes the casing consistent with all of our general function naming
conventions.
|
|
Makes the interface more type-safe and consistent in terms of return
values.
|
|
Renames the members to more accurately indicate what they signify.
"OneShot" and "Sticky" are kind of ambiguous identifiers for the reset
types, and can be kind of misleading. Automatic and Manual communicate
the kind of reset type in a clearer manner. Either the event is
automatically reset, or it isn't and must be manually cleared.
The "OneShot" and "Sticky" terminology is just a hold-over from Citra
where the kernel had a third type of event reset type known as "Pulse".
Given the Switch kernel only has two forms of event reset types, we
don't need to keep the old terminology around anymore.
|
|
Applies the override specifier where applicable. In the case of
destructors that are defaulted in their definition, they can
simply be removed.
This also removes the unnecessary inclusions being done in audin_u and
audrec_u, given their close proximity.
|
|
|
|
|
|
|
|
|
|
|
|
These types are within the common library, so they should be within the
Common namespace.
|
|
Gets rid of the largest set of mutable global state within the core.
This also paves a way for eliminating usages of GetInstance() on the
System class as a follow-up.
Note that no behavioral changes have been made, and this simply extracts
the functionality into a class. This also has the benefit of making
dependencies on the core timing functionality explicit within the
relevant interfaces.
|
|
Places all of the timing-related functionality under the existing Core
namespace to keep things consistent, rather than having the timing
utilities sitting in its own completely separate namespace.
|
|
This is a leftover from the early yuzu days.
We shouldn't log every time when we are drawing by default, so let's change the log level to Trace.
|
|
This commit it automatically generated by command in zsh:
sed -i -- 's/BitField<\(.*\)_le>/BitField<\1>/g' **/*(D.)
BitField is now aware to endianness and default to little endian. It expects a value representation type without storage specification for its template parameter.
|
|
|
|
|
|
|
|
|
|
- More accurate impl., fixes Undertale (among other games).
|
|
|
|
|
|
- Used by Undertale.
|
|
- Used by Undertale.
|
|
|
|
|
|
|
|
Added error for invalid nmap handles
|
|
|
|
Hardware tests show that trying to unmap an unmapped buffer already should always succeed. Hardware test was tested up to 32 iterations of attempting to unmap
|
|
|
|
When a destructor isn't defaulted into a cpp file, it can cause the use
of forward declarations to seemingly fail to compile for non-obvious
reasons. It also allows inlining of the construction/destruction logic
all over the place where a constructor or destructor is invoked, which
can lead to code bloat. This isn't so much a worry here, given the
services won't be created and destroyed frequently.
The cause of the above mentioned non-obvious errors can be demonstrated
as follows:
------- Demonstrative example, if you know how the described error happens, skip forwards -------
Assume we have the following in the header, which we'll call "thing.h":
\#include <memory>
// Forward declaration. For example purposes, assume the definition
// of Object is in some header named "object.h"
class Object;
class Thing {
public:
// assume no constructors or destructors are specified here,
// or the constructors/destructors are defined as:
//
// Thing() = default;
// ~Thing() = default;
//
// ... Some interface member functions would be defined here
private:
std::shared_ptr<Object> obj;
};
If this header is included in a cpp file, (which we'll call "main.cpp"),
this will result in a compilation error, because even though no
destructor is specified, the destructor will still need to be generated by
the compiler because std::shared_ptr's destructor is *not* trivial (in
other words, it does something other than nothing), as std::shared_ptr's
destructor needs to do two things:
1. Decrement the shared reference count of the object being pointed to,
and if the reference count decrements to zero,
2. Free the Object instance's memory (aka deallocate the memory it's
pointing to).
And so the compiler generates the code for the destructor doing this inside main.cpp.
Now, keep in mind, the Object forward declaration is not a complete type. All it
does is tell the compiler "a type named Object exists" and allows us to
use the name in certain situations to avoid a header dependency. So the
compiler needs to generate destruction code for Object, but the compiler
doesn't know *how* to destruct it. A forward declaration doesn't tell
the compiler anything about Object's constructor or destructor. So, the
compiler will issue an error in this case because it's undefined
behavior to try and deallocate (or construct) an incomplete type and
std::shared_ptr and std::unique_ptr make sure this isn't the case
internally.
Now, if we had defaulted the destructor in "thing.cpp", where we also
include "object.h", this would never be an issue, as the destructor
would only have its code generated in one place, and it would be in a
place where the full class definition of Object would be visible to the
compiler.
---------------------- End example ----------------------------
Given these service classes are more than certainly going to change in
the future, this defaults the constructors and destructors into the
relevant cpp files to make the construction and destruction of all of
the services consistent and unlikely to run into cases where forward
declarations are indirectly causing compilation errors. It also has the
plus of avoiding the need to rebuild several services if destruction
logic changes, since it would only be necessary to recompile the single
cpp file.
|
|
This moves the hot loop into video_core. This refactoring shall reduce the CPU overhead of calling ProcessCommandList.
|
|
|
|
core.h is kind of a massive header in terms what it includes within
itself. It includes VFS utilities, kernel headers, file_sys header,
ARM-related headers, etc. This means that changing anything in the
headers included by core.h essentially requires you to rebuild almost
all of core.
Instead, we can modify the System class to use the PImpl idiom, which
allows us to move all of those headers to the cpp file and forward
declare the bulk of the types that would otherwise be included, reducing
compile times. This change specifically only performs the PImpl portion.
|
|
As means to pave the way for getting rid of global state within core,
This eliminates kernel global state by removing all globals. Instead
this introduces a KernelCore class which acts as a kernel instance. This
instance lives in the System class, which keeps its lifetime contained
to the lifetime of the System class.
This also forces the kernel types to actually interact with the main
kernel instance itself instead of having transient kernel state placed
all over several translation units, keeping everything together. It also
has a nice consequence of making dependencies much more explicit.
This also makes our initialization a tad bit more correct. Previously we
were creating a kernel process before the actual kernel was initialized,
which doesn't really make much sense.
The KernelCore class itself follows the PImpl idiom, which allows
keeping all the implementation details sealed away from everything else,
which forces the use of the exposed API and allows us to avoid any
unnecessary inclusions within the main kernel header.
|
|
Makes the class interface consistent and provides accessors for
obtaining a reference to the memory manager instance.
Given we also return references, this makes our more flimsy uses of
const apparent, given const doesn't propagate through pointers in the
way one would typically expect. This makes our mutable state more
apparent in some places.
|
|
|
|
|
|
|
|
Rather than use global state, we can simply pass the instance into the
NVFlinger instance directly.
|
|
The only reason this wasn't a compilation error is because we use
little-endian systems.
|
|
|
|
All calling code assumes that the rasterizer will be in a valid state,
which is a totally fine assumption. The only way the rasterizer wouldn't
be is if initialization is done incorrectly or fails, which is checked
against in System::Init().
|
|
We move the initialization of the renderer to the core class, while
keeping the creation of it and any other specifics in video_core. This
way we can ensure that the renderer is initialized and doesn't give
unfettered access to the renderer. This also makes dependencies on types
more explicit.
For example, the GPU class doesn't need to depend on the
existence of a renderer, it only needs to care about whether or not it
has a rasterizer, but since it was accessing the global variable, it was
also making the renderer a part of its dependency chain. By adjusting
the interface, we can get rid of this dependency.
|
|
|
|
Passing nullptr to memcpy is undefined behavior.
|
|
Avoids copies from being made, since the string is only ever used for
lookup, the data is never transfered anywhere.
Ideally, we'd use a std::string_view here, but devices is a
std::unordered_map, not a std::map, so we can't use heterogenous lookup
here.
|
|
Avoids unnecessary reference count increments and decrements.
In one case, we don't need to make a shared_ptr copy at all,
just to call a member function.
|
|
This behaves quite similarly to the SubmitGPFIFO command. Referenced from Ryujinx.
Many thanks to @gdkchan for investigating this!
|
|
Prevents implicit construction and makes these lingering non-explicit
constructors consistent with the rest of the other classes in services.
|
|
This is only ever used as a lookup into the device map, so we don't need to
take the std::string instance by value here.
|
|
|
|
Settings are only used when RMOS_SET_PRODUCTION_MODE is set to 0.
If production mode is set, the error code 0x30006 is returned instead
|
|
|
|
|
|
|
|
|
|
This behavior is confirmed by reverse engineering.
|
|
|
|
* add IoctlCommands with their params in nvidia_ctrl_gpu.h
* add function related to the changes done previously
* fix clang-format
* delete trailing whitespace
* correct mistake
|
|
* Add some IoctlCommand with their params to nvhost_gpu
* fix clang-format
* delete trailing whitespace
* fix some clang-format
* delete one other trailing whitespace
* last clang-format fix
|
|
|
|
|
|
|
|
|
|
We have no clue on what this actually does yet so stubbing it since it's just input only should be fine for now
|
|
Used in Nintendo Labo ToyCon 1&2
|
|
according to the changes made previously
|
|
|
|
|
|
* Implemented NVHOST_IOCTL_CHANNEL_GET_WAITBASE
struct + 4 seems to be hard coded at 0 and struct + 0 seems to be ignored?
* IocGetWaitbase -> IocChannelGetWaitbaseCommand
* Added super late fixes
|
|
It releases a reference to an nvmap object
|
|
It removes a mapping previously created with the MapBufferEx ioctl.
|
|
|
|
This makes the formatting expectations more obvious (e.g. any zero padding specified
is padding that's entirely dedicated to the value being printed, not any pretty-printing
that also gets tacked on).
|
|
|
|
|
|
|
|
Also added a consistency check and a comment for the case when the object id is different than its handle. The real nvservices doesn't make a distinction between ids and handles, each object gets an unique handle which doubles as its id.
|
|
It takes a previously-reserved (AllocateSpace) GPU memory address and maps it to the address of the nvmap object passed to Remap.
|
|
|
|
|
|
|
|
Tidies up namespace declarations
|
|
|
|
|
|
|
|
|
|
|
|
- Workaround for texture forwarding until we have a better place.
|
|
|
|
|
|
|
|
Games like Puyo Puyo Tetris and BOTW seem to depend on the buffer always having the same handle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Also moved the GPU MemoryManager class to video_core since it makes more sense for it to be there.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* FinishInitalize needed for 3.0.1+ games
* nvdrv:s and nvdrv:t both use NVDRV
* Most settings return 0 on hardware, disabled NV_MEMORY_PROFILER for now.
NVN_THROUGH_OPENGL & NVRM_GPU_PREVENT_USE are a few interesting settings to look at. Carefully choosing settings can help with drawing graphics later on
* Initial /dev/nvhost-gpu support
* ZCullBind
* Stubbed SetErrorNotifier
* Fixed SetErrorNotifier log, Added SetChannelPriority
* Allocate GPFIFO Ex2, Allocate Obj Ctx, Submit GPFIFO
* oops
* Fixed up naming/structs/enums. Used vector instead of array for "gpfifo_entry"
* Added missing fixes
* /dev/nvhost-ctrl-gpu
* unneeded struct
* Forgot u32 in enum class
* Automatic descriptor swapping for ioctls, fixed nvgpu_gpu_get_tpc_masks_args being incorrect size
* nvdrv#QueryEvent
* Renamed logs for nvdrv
* Refactor ioctl so nv_result isn't needed
* /dev/nvhost-as-gpu
* Fixed Log service naming, CtxObjects now u32, renamed all structs, added static_asserts to structs, used INSERT_PADDING_WORDS instead of u32s
* nvdevices now uses "Ioctl" union,
* IoctlGpfifoEntry now uses bit field
* final changes
|
|
|
|
|
|
* Added nvmemp, Added /dev/nvhost-ctrl, SetClientPID now stores pid
* used clang-format-3.9 instead
* lowercase pid
* Moved nvmemp handlers to cpp
* Removed unnecessary logging for NvOsGetConfigU32. Cleaned up log and changed to LOG_DEBUG
* using std::arrays instead of c arrays
* nvhost get config now uses std::array completely
* added pid logging back
* updated cmakelist
* missing includes
* added array, removed memcpy
* clang-format6.0
|
|
This macro resolves to an empty macro in release builds.
|
|
Prevents the enum values from polluting the surrounding scope
|
|
|
|
|
|
|
|
Adds in a missing EndGameFrame when nvdrv swaps buffers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NVFlinger will call into the nvdisp_disp0 device to perform screen flips, bypassing the ioctl interface.
We now have the address of the framebuffer to draw, we just need to actually put it on the screen.
|
|
|