Commit graph

41 commits

Author SHA1 Message Date
Kelebek1 7464cae24b Rework Nvdec and VIC to fix out-of-order videos, and speed up decoding. 2024-03-03 17:15:46 +00:00
Liam 04867e2456 nvhost_vic: use map erase by key 2024-01-18 21:12:30 -05:00
Liam beb438bb0b nvdrv: use static typing for SessionId, smmu Asid types 2024-01-18 21:12:30 -05:00
Fernando Sahmkow 590d9b7e1d Core: Clang format and other small issues. 2024-01-18 21:12:30 -05:00
Fernando Sahmkow 7a9d1ad2f8 NVDRV: Implement sessions and initial implementation of SMMU 2024-01-18 21:12:30 -05:00
Liam 723df0f368 nvdrv: rework to remove memcpy 2023-10-25 13:05:56 -04:00
Liam efdb2e8f3d nvdrv: convert codec devices 2023-10-25 13:05:56 -04:00
Kelebek1 5da70f7197 Remove memory allocations in some hot paths 2023-06-22 08:05:10 +01:00
ameerj 2d2522693e Revert "Merge pull request #9718 from yuzu-emu/revert-9508-hle-ipc-buffer-span"
This reverts commit 25fc5c0e11, reversing
changes made to af20e25081.
2023-02-03 00:08:45 -05:00
liamwhite b01698775b
Revert "hle_ipc: Use std::span to avoid heap allocations/copies when calling ReadBuffer" 2023-02-02 15:53:28 -05:00
ameerj f517f82416 nvdrv: Use std::span for inputs
Allows the use of HLERequestContext::ReadBufferSpan
2022-12-28 18:46:53 -05:00
Fernando Sahmkow ca3db0d7c9 General: address feedback 2022-10-06 21:00:54 +02:00
Liam White afab6c143c General: Fix compilation for GCC 2022-10-06 21:00:53 +02:00
Fernando Sahmkow a9ca39f859 NVDRV: Further improvements. 2022-10-06 21:00:53 +02:00
Fernando Sahmkow af35dbcf63 NVDRV: Fix Open/Close and make sure each device is correctly created. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow de0e8eff42 NVDRV: Implement new NvMap 2022-10-06 21:00:51 +02:00
Fernando Sahmkow 3cbe352c18 NVDRV: Refactor and add new NvMap. 2022-10-06 21:00:51 +02:00
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.
2022-04-23 05:55:32 -04:00
Feng Chen 5462485cc3 Address feedback 2021-12-05 00:06:14 +08:00
Feng Chen 2c47f8aa18 Support multiple videos playing 2021-12-02 12:48:42 +08:00
ameerj 7c4b6aab2e core: Remove unused includes 2021-11-03 21:42:57 -04:00
Lioncash 9e726a9250 service: Resolve cases of member field shadowing
Now all that remains is for kernel code to be 'shadow-free' and then
-Wshadow can be turned into an error.
2021-05-04 04:38:38 -04:00
ameerj 75e0d16caa nvhost_vic: Fix device closure
Implements the OnClose method of the nvhost_vic device, and removes the remnants of an older implementation.

Also cleans up some of the surrounding code.
2021-04-24 19:22:09 -04:00
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
2021-03-25 12:56:42 +11:00
ameerj 3c37d66c28 Address PR feedback
Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
2021-02-13 13:07:56 -05:00
ameerj ac265a72ce nvdec cleanup 2021-02-13 13:07:31 -05:00
ameerj 2c27127d04 nvdec syncpt incorporation
laying the groundwork for async gpu, although this does not fully implement async nvdec operations
2021-01-07 14:33:45 -05:00
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.
2020-12-28 16:33:48 -08:00
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.
2020-11-24 16:40:23 +11:00
Chloe Marcec fc4d692c50 Addressed issues 2020-11-10 15:57:36 +11:00
Chloe Marcec 31c12de0fe core: Make nvservices more standardized 2020-11-10 15:57:35 +11:00
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>
2020-10-26 23:07:36 -04:00
bunnei 1adf640d37 service: nvhost_vic: Ignore Submit commands. 2020-06-04 22:32:28 -04:00
Zach Hilman 34635a42c0 nvdrv: Stub nvdec/vic ioctls to bypass nvdec movies 2020-06-04 22:32:28 -04:00
David Marcec f9259c0383 Initial implementation of Ioctl2 & Ioctl3
Purpose of Ioctl2 and Ioctl3 is to prevent the passing of raw pointers through ioctls
2019-09-19 15:37:25 +10:00
Fernando Sahmkow d20ede40b1 NVServices: Styling, define constructors as explicit and corrections 2019-07-05 15:49:32 -04:00
Fernando Sahmkow b6844bec60 NVServices: Correct CtrlEventWaitSync to block the ipc until timeout. 2019-07-05 15:49:28 -04:00
Fernando Sahmkow 24408cce9b nv_services: Deglobalize NvServices 2019-07-05 15:49:22 -04:00
David Marcec a2cc3b10bb Changed logging to be "Log before execution", Added more error logging, all services should now log on some level 2018-11-26 17:06:13 +11:00
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.
2018-09-10 23:55:31 -04:00
David Marcec 92492ee23b Added missing channel devices 2018-08-13 14:00:27 +10:00