Commit Graph

65 Commits (ad038609c877ad54dde7b9592f0584deb56a27c5)

Author SHA1 Message Date
Fernando Sahmkow ad038609c8 NVDRV: Fix clearing when destroying. 3 years ago
Fernando Sahmkow af35dbcf63 NVDRV: Fix Open/Close and make sure each device is correctly created. 3 years ago
Fernando Sahmkow de0e8eff42 NVDRV: Implement new NvMap 3 years ago
Fernando Sahmkow 3cbe352c18 NVDRV: Refactor and add new NvMap. 3 years ago
Fernando Sahmkow a21b8824fb NVDRV: Cleanup. 3 years ago
Fernando Sahmkow d30b885d71 NVDRV: Implement QueryEvent. 3 years ago
Fernando Sahmkow 39a5ce4e69 NvHost: Remake Ctrl Implementation. 3 years ago
Morph 99ceb03a1c general: Convert source file copyright comments over to SPDX
This formats all copyright comments according to SPDX formatting guidelines.
Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
3 years ago
ameerj 7c4b6aab2e core: Remove unused includes 3 years ago
bunnei 185b19fd5b hle: service: nvdrv: Remove unused kernel reference. 4 years ago
bunnei 015058fadf hle: service: Add a helper module for managing kernel objects. 4 years ago
Morph c6d7da88c7 service: Append service name prefix to common filenames 4 years ago
bunnei 2e8d6fe9a0 hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject. 4 years ago
bunnei 89edbe8aa2 hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps. 4 years ago
bunnei ab704acab8 hle: kernel: Ensure all kernel objects with KAutoObject are properly created. 4 years ago
bunnei addc0bf037 hle: kernel: Migrate KEvent to KAutoObject. 4 years ago
bunnei 5e5933256b hle: kernel: Refactor IPC interfaces to not use std::shared_ptr. 4 years ago
Chloe Marcec 99fdfa1fcd nvdrv: Pass device fd and handle device create methods for device opening and closing
We pass the fd to the ioctl as well as alert the device when it's opened or closed to allow for fd unique actions to take place
4 years ago
bunnei ff3c7c068b hle: kernel: Reimplement KReadableEvent and KWritableEvent. 4 years ago
bunnei 3f942c01f0 hle: kernel: Rename WritableEvent to KWritableEvent. 4 years ago
bunnei e86a7e3691 hle: kernel: Rename ReadableEvent to KReadableEvent. 4 years ago
ameerj 2c27127d04 nvdec syncpt incorporation
laying the groundwork for async gpu, although this does not fully implement async nvdec operations
4 years ago
bunnei 0c81b83ca9 hle: service: nvdrv: Revert #4981 to remove usage of SleepClientThread.
- Note, this always processes the ioctl right away, which fixes BotW 1.0.0 issues.
4 years ago
Lioncash 1a954b2a59 service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
4 years ago
Chloe Marcec ab25d1fe9a nvservices: Reintroducee IoctlCtrl
Fixes regression caused by #4907 which caused games like Breath of the Wild 1.0.0 not to boot.
4 years ago
Chloe Marcec fc4d692c50 Addressed issues 4 years ago
Chloe Marcec 31c12de0fe core: Make nvservices more standardized 4 years ago
Lioncash da7be67daf ipc_helpers: Remove usage of the global system instance
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.
4 years ago
bunnei e67b8678f8 hle service: nvdrv: nvhost_gpu: Update to use SyncpointManager and other improvements.
- Refactor so that SubmitGPFIFO and KickoffPB use shared functionality.
- Implement add_wait and add_increment flags.
5 years ago
bunnei 66edfd61c6 hle service: nvdrv: nvhost_ctrl: Update to use SyncpointManager. 5 years ago
bunnei 4a3fd97e48 hle service: nvdrv: Update to instantiate SyncpointManager. 5 years ago
bunnei d567b7e841 hle: service: nvdrv: Implement SyncpointManager, to manage syncpoints. 5 years ago
ameerj eb67a45ca8 video_core: NVDEC Implementation
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>
5 years ago
bunnei 9046d4a548
kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)
* 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.
5 years ago
bunnei b0ab803ce8 kernel: events: Remove ResetType::Automatic.
- 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
6 years ago
Fernando Sahmkow 4e9f975935 Nvdrv: Correct Async regression and avoid signaling empty buffer vsyncs 6 years ago
David Marcec f9259c0383 Initial implementation of Ioctl2 & Ioctl3
Purpose of Ioctl2 and Ioctl3 is to prevent the passing of raw pointers through ioctls
6 years ago
Fernando Sahmkow d20ede40b1 NVServices: Styling, define constructors as explicit and corrections 6 years ago
Fernando Sahmkow 0335a25d1f NVServices: Make NVEvents Automatic according to documentation. 6 years ago
Fernando Sahmkow b6844bec60 NVServices: Correct CtrlEventWaitSync to block the ipc until timeout. 6 years ago
Fernando Sahmkow 7d1b974bca GPU: Correct Interrupts to interrupt on syncpt/value instead of event, mirroring hardware 6 years ago
Fernando Sahmkow 24408cce9b nv_services: Deglobalize NvServices 6 years ago
Fernando Sahmkow 78add28aab nvhost_ctrl: Corrections to event handling 6 years ago
Fernando Sahmkow e0027eba85 nv_services: Implement NvQueryEvent, NvCtrlEventWait, NvEventRegister, NvEventUnregister 6 years ago
Lioncash 6ac955a0b4 hle/service: Default constructors and destructors in the cpp file where applicable
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.
7 years ago
David Marcec 76fad8410d Registered missing channel devices 7 years ago
Lioncash d378d98e26 nvdrv: Get rid of global std::weak_ptr
Rather than use global state, we can simply pass the instance into the
NVFlinger instance directly.
7 years ago
Lioncash 300ab211e8 nvdrv: Make Ioctl()'s definition match its prototype
The only reason this wasn't a compilation error is because we use
little-endian systems.
7 years ago
Lioncash f9951352f6 service/nvdrv: Take std::string in Open() by const reference
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.
7 years ago
Lioncash a2cd07d094 service/nvdrv: Use std::move where applicable
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.
7 years ago