Commit graph

52 commits

Author SHA1 Message Date
Fernando Sahmkow
1595e77913 General: address feedback 2022-10-06 21:00:54 +02:00
Morph
5ee9e5e84b general: Format licenses as per SPDX guidelines 2022-10-06 21:00:54 +02:00
VonChenPlus
9623b1dc5a Core: Fix get nvmap object random crash 2022-10-06 21:00:53 +02:00
Liam White
6df0663a57 General: Fix compilation for GCC 2022-10-06 21:00:53 +02:00
Fernando Sahmkow
43d8a8fb77 NVDRV: Further refactors and eliminate old code. 2022-10-06 21:00:52 +02:00
Fernando Sahmkow
f43a322d65 NVDRV: Fix clearing when destroying. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow
5ed054796f NVDRV: Fix Open/Close and make sure each device is correctly created. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow
3991518f74 NVDRV: Refactor and add new NvMap. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow
2821dbf166 NVDRV: Cleanup. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow
69e08ad83b NVDRV: Implement QueryEvent. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow
4165ead1f1 NvHost: Remake Ctrl Implementation. 2022-10-06 21:00:51 +02:00
Fernando Sahmkow
987ef2824c NvHost: Try a different approach to blocking. 2022-10-06 21:00:51 +02:00
Morph
2b87305d31 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
bunnei
a8ff414423 hle: nvdrv: Rename Fence to NvFence to avoid naming conflicts. 2022-03-24 18:13:32 -07:00
FernandoS27
d265a37688 NVHost_Ctrl: Force wait if the gpu falls behind too long. 2021-10-16 00:22:01 +02:00
bunnei
b7140d7f00 hle: service: Add a helper module for managing kernel objects. 2021-07-20 18:54:55 -07:00
bunnei
617803fb5d hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject. 2021-05-05 16:40:51 -07:00
bunnei
715978756e hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps. 2021-05-05 16:40:51 -07:00
bunnei
949231d69c hle: kernel: Migrate KEvent to KAutoObject. 2021-05-05 16:40:50 -07:00
bunnei
0508831455 hle: kernel: Reimplement KReadableEvent and KWritableEvent. 2021-02-05 14:03:32 -08:00
bunnei
80d0eb3bbd hle: kernel: Rename WritableEvent to KWritableEvent. 2021-02-05 14:00:36 -08:00
bunnei
284a4d9283 hle: kernel: Rename ReadableEvent to KReadableEvent. 2021-02-05 14:00:36 -08:00
bunnei
fd213b5856 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
Lioncash
346271b80b 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.
2020-11-26 20:03:11 -05:00
Chloe Marcec
f8d84ecae2 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
d8f879952c Addressed issues 2020-11-10 15:57:36 +11:00
Chloe Marcec
f0b74aa725 core: Make nvservices more standardized 2020-11-10 15:57:35 +11:00
bunnei
df095c8963 hle service: nvdrv: Update to instantiate SyncpointManager. 2020-11-01 01:52:34 -07:00
Lioncash
e457001dce General: Make use of std::nullopt where applicable
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.
2020-09-22 17:32:33 -04:00
bunnei
5cb0f276fe 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.
2019-11-24 20:15:51 -05:00
David Marcec
87e01ad919 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
94a7beb8b9 NVServices: Address Feedback 2019-07-05 15:49:33 -04:00
Fernando Sahmkow
b8b874005f NVServices: Styling, define constructors as explicit and corrections 2019-07-05 15:49:32 -04:00
Fernando Sahmkow
1238b13642 NVServices: Correct CtrlEventWaitSync to block the ipc until timeout. 2019-07-05 15:49:28 -04:00
Fernando Sahmkow
604dc3f59b GPU: Correct Interrupts to interrupt on syncpt/value instead of event, mirroring hardware 2019-07-05 15:49:26 -04:00
Fernando Sahmkow
575bf9d7fb nv_services: Fixes to event liberation. 2019-07-05 15:49:24 -04:00
Fernando Sahmkow
531e3431fb nv_services: Deglobalize NvServices 2019-07-05 15:49:22 -04:00
Fernando Sahmkow
1fb8727a9a Gpu: Implement Hardware Interrupt Manager and manage GPU interrupts 2019-07-05 15:49:14 -04:00
Fernando Sahmkow
9a3dea2bdc nv_services: Implement NvQueryEvent, NvCtrlEventWait, NvEventRegister, NvEventUnregister 2019-07-05 15:49:13 -04:00
Fernando Sahmkow
6fd625d497 nv_services: Correct buffer queue fencing and GPFifo fencing 2019-07-05 15:49:10 -04:00
Lioncash
8a9b062587 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
Lioncash
e8824d065b nvdrv: Get rid of global std::weak_ptr
Rather than use global state, we can simply pass the instance into the
NVFlinger instance directly.
2018-08-07 21:53:05 -04:00
Lioncash
7e87e94e33 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.
2018-07-25 17:37:43 -04:00
Lioncash
6b1043fab4 nvdrv: Take std::string by const reference in GetDevice()
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.
2018-07-19 11:40:36 -04:00
Lioncash
6d94dd21a5 service: Use nested namespace specifiers where applicable
Tidies up namespace declarations
2018-04-19 22:20:28 -04:00
Subv
b4be5d2e65 Vi: Properly write the BufferProducerFence object in the DequeueBuffer response parcel. 2018-02-14 22:57:54 -05:00
Frederic Meyer
2a9b625cd7 nvdrv: stubbed Close(cmd 2) 2018-01-17 17:08:46 +01:00
Subv
fd950afe3a NV: Move the nvdrv classes into the Nvidia namespace, and move the functionality to a s single module that services call. 2018-01-16 19:03:49 -05:00
MerryMage
41bfd994f6 clang-format 2018-01-16 18:05:21 +00:00
bunnei
182548ec86 yuzu: Update license text to be consistent across project. 2018-01-13 16:22:39 -05:00