Annomatg
05ba8057ee
Speed up memory page mapping ( #2141 )
...
- Memory::MapPages total samplecount was reduced from 4.6% to 1.06%.
- From main menu into the game from 1.03% to 0.35%
2019-02-27 17:22:47 -05:00
David Marcec
1dfb0a513a
Fixed uninitialized memory due to missing returns in canary
...
Functions which are suppose to crash on non canary builds usually don't return anything which lead to uninitialized memory being used.
2018-12-19 12:52:32 +11:00
Lioncash
70f16242ca
memory: Convert ASSERT into a DEBUG_ASSERT within GetPointerFromVMA()
...
Given memory should always be expected to be valid during normal
execution, this should be a debug assertion, rather than a check in
regular builds.
2018-12-06 15:02:34 -05:00
Lioncash
bfb412a71a
vm_manager: Make vma_map private
...
This was only ever public so that code could check whether or not a
handle was valid or not. Instead of exposing the object directly and
allowing external code to potentially mess with the map contents, we
just provide a member function that allows checking whether or not a
handle is valid.
This makes all member variables of the VMManager class private except
for the page table.
2018-12-06 15:02:17 -05:00
heapo
7f12622548
Call shrink_to_fit after page-table vector resizing to cause crt to actually lower vector capacity. For 36-bit titles saves 800MB of commit.
2018-12-05 14:40:56 -08:00
Frederic L
c76f4b6aec
global: Use std::optional instead of boost::optional ( #1578 )
...
* get rid of boost::optional
* Remove optional references
* Use std::reference_wrapper for optional references
* Fix clang format
* Fix clang format part 2
* Adressed feedback
* Fix clang format and MacOS build
2018-10-30 00:03:25 -04:00
Lioncash
9d8f4d934b
kernel/process: Make data member variables private
...
Makes the public interface consistent in terms of how accesses are done
on a process object. It also makes it slightly nicer to reason about the
logic of the process class, as we don't want to expose everything to
external code.
2018-09-30 02:30:01 -04:00
Lioncash
577bde60b5
memory: Dehardcode the use of fixed memory range constants
...
The locations of these can actually vary depending on the address space
layout, so we shouldn't be using these when determining where to map
memory or be using them as offsets for calculations. This keeps all the
memory ranges flexible and malleable based off of the virtual memory
manager instance state.
2018-09-24 22:16:03 -04:00
Lioncash
e48b4fd2d8
memory: Dehardcode the use of a 36-bit address space
...
Given games can also request a 32-bit or 39-bit address space, we
shouldn't be hardcoding the address space range as 36-bit.
2018-09-24 22:15:53 -04:00
fearlessTobi
1190ea6ddb
Port #4182 from Citra: "Prefix all size_t with std::"
2018-09-15 15:21:06 +02:00
bunnei
d190b46a38
gl_renderer: Cache textures, framebuffers, and shaders based on CPU address.
2018-08-31 13:07:27 -04:00
Lioncash
b4a81f9bca
gpu: Make memory_manager private
...
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.
2018-08-28 11:11:50 -04:00
Lioncash
69bbe31ca8
renderer_base: Make Rasterizer() return the rasterizer by reference
...
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().
2018-08-04 02:36:58 -04:00
Lioncash
49dc22f84e
video_core: Eliminate the g_renderer global variable
...
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.
2018-08-04 02:36:57 -04:00
Lioncash
0e92e67e06
memory: Remove unused GetSpecialHandlers() function
...
This is just unused code, so we may as well get rid of it.
2018-08-03 14:20:50 -04:00
Lioncash
3bcf090d37
core/memory: Get rid of 3DS leftovers
...
Removes leftover code from citra that isn't needed.
2018-08-03 11:22:47 -04:00
bunnei
90042f35a5
Merge pull request #690 from lioncash/move
...
core/memory, core/hle/kernel: Use std::move where applicable
2018-07-18 20:55:55 -07:00
Lioncash
b7e7ddbdfc
core/memory: Remove unused function GetSpecialHandlers() and an unused variable in ZeroBlock()
2018-07-18 19:55:46 -04:00
Lioncash
b1b1c60009
core/memory, core/hle/kernel: Use std::move where applicable
...
Avoids pointless copies
2018-07-18 19:34:31 -04:00
James Rowe
d74d2a77cb
Update clang format
2018-07-02 21:45:47 -04:00
James Rowe
e159c550d8
Rename logging macro back to LOG_*
2018-07-02 21:45:47 -04:00
Michael Scire
a3509a9e74
Kernel/Arbiters: Fix casts, cleanup comments/magic numbers
2018-06-22 00:47:59 -06:00
bunnei
44c565aeca
core: Implement multicore support.
2018-05-10 19:34:46 -04:00
Lioncash
1b310cbb3a
general: Make formatting of logged hex values more straightforward
...
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).
2018-05-02 09:49:36 -04:00
Lioncash
324ee31fc3
general: Convert assertion macros over to be fmt-compatible
2018-04-27 10:04:02 -04:00
bunnei
9176319a5c
Merge pull request #387 from Subv/maxwell_2d
...
GPU: Partially implemented the 2D surface copy engine
2018-04-25 20:40:17 -04:00
Subv
6418127891
Memory: Added a missing shortcut for Memory::CopyBlock for the current process.
2018-04-25 11:55:30 -05:00
Lioncash
796b5c727d
core/memory: Amend address widths in asserts
...
Addresses are 64-bit, these formatting specifiers are simply holdovers from citra. Adjust them to be the correct width.
2018-04-25 12:17:26 -04:00
Lioncash
62e427d98f
core/memory: Move logging macros over to new fmt-capable ones
...
While we're at it, correct addresses to print all 64 bits where applicable, which were holdovers from citra.
2018-04-25 12:16:33 -04:00
bunnei
31748079de
gl_rasterizer_cache: Update to be based on GPU addresses, not CPU addresses.
2018-04-24 22:31:45 -04:00
bunnei
ad1af61685
memory: Fix cast for ReadBlock/WriteBlock/ZeroBlock/CopyBlock.
2018-03-26 21:17:01 -04:00
bunnei
49b3b519fc
memory: Add RasterizerMarkRegionCached code and cleanup.
2018-03-26 21:16:57 -04:00
bunnei
79b3adba8e
Merge pull request #265 from bunnei/tegra-progress-2
...
Tegra progress 2
2018-03-23 23:30:48 -04:00
bunnei
c13802819b
memory: Fix typo in RasterizerFlushVirtualRegion.
2018-03-23 15:46:21 -04:00
bunnei
4d5c052f34
memory: RasterizerFlushVirtualRegion should also check process image region.
2018-03-23 15:10:02 -04:00
bunnei
6131f96f6a
rasterizer: Flush and invalidate regions should be 64-bit.
2018-03-23 15:01:45 -04:00
bunnei
c9c232727c
memory: Port RasterizerFlushVirtualRegion from Citra.
2018-03-22 22:56:41 -04:00
N00byKing
35d617d342
Remove more N3DS References
2018-03-22 21:25:06 +01:00
bunnei
f16763ed52
core: Move process creation out of global state.
2018-03-14 18:42:19 -04:00
MerryMage
38a3a63ffd
memory: LOG_ERROR when falling off end of page table
2018-02-21 21:39:07 +00:00
Lioncash
af7ddaf0e2
memory: Silence formatting sepecifier warnings
2018-02-14 01:54:54 -05:00
MerryMage
7a23a53396
memory: Replace all memory hooking with Special regions
2018-01-27 15:16:39 +00:00
Rozlette
ecc35e89e0
memory: Return false for large VAddr in IsValidVirtualAddress
2018-01-20 14:56:15 -06:00
James Rowe
bd5740a721
Remove gpu debugger and get yuzu qt to compile
2018-01-12 19:11:04 -07:00
MerryMage
66a015fe9a
fix macos build
2018-01-08 19:20:10 -05:00
bunnei
4728cc141a
core/video_core: Fix a bunch of u64 -> u32 warnings.
2018-01-01 15:40:35 -05:00
bunnei
8b314ec3f9
memory: Print addresses as 64-bit.
2017-10-18 21:29:23 -04:00
bunnei
775cf60729
Merge remote-tracking branch 'upstream/master' into nx
...
# Conflicts:
# src/core/CMakeLists.txt
# src/core/arm/dynarmic/arm_dynarmic.cpp
# src/core/arm/dyncom/arm_dyncom.cpp
# src/core/hle/kernel/process.cpp
# src/core/hle/kernel/thread.cpp
# src/core/hle/kernel/thread.h
# src/core/hle/kernel/vm_manager.cpp
# src/core/loader/3dsx.cpp
# src/core/loader/elf.cpp
# src/core/loader/ncch.cpp
# src/core/memory.cpp
# src/core/memory.h
# src/core/memory_setup.h
2017-10-09 23:56:20 -04:00
Subv
1265575db5
Memory: Make WriteBlock take a Process parameter on which to operate
2017-10-01 14:18:36 -05:00
Subv
bf55d2f57e
Memory: Make ReadBlock take a Process parameter on which to operate
2017-10-01 14:18:36 -05:00
bunnei
55eaa14131
memory: Log with 64-bit values.
2017-09-30 14:28:54 -04:00
bunnei
e5731e94d6
core: Various changes to support 64-bit addressing.
2017-09-30 14:28:54 -04:00
Huw Pascoe
da1c8d1522
Fixed type conversion ambiguity
2017-09-30 09:34:35 +01:00
bunnei
e2a34ccd89
Merge pull request #2961 from Subv/load_titles
...
Loaders: Don't automatically set the current process every time we load an application.
2017-09-29 14:58:42 -04:00
James Rowe
47ca57f00f
Merge pull request #2954 from Subv/cache_unmapped_mem
...
Memory/RasterizerCache: Ignore unmapped memory regions when caching physical regions
2017-09-26 16:55:47 -06:00
Subv
3cb2bf08c3
Memory: Allow IsValidVirtualAddress to be called with a specific process parameter.
...
There is still an overload of IsValidVirtualAddress that only takes the VAddr and will default to the current process.
2017-09-26 17:27:44 -05:00
Subv
bfc70ef1d1
Memory/RasterizerCache: Ignore unmapped memory regions when caching physical regions.
...
Not all physical regions need to be mapped into the address space of every process, for example, system modules do not have a VRAM mapping.
This fixes a crash when loading applets and system modules.
2017-09-25 19:37:45 -05:00
MerryMage
0e49bffe03
ARM_Interface: Implement PageTableChanged
2017-09-24 23:08:25 +01:00
MerryMage
ecf27fbf82
memory: Remove GetCurrentPageTablePointers
2017-09-24 22:43:28 +01:00
MerryMage
6b8ad273fc
memory: Add GetCurrentPageTable/SetCurrentPageTable
...
Don't expose Memory::current_page_table as a global.
2017-09-24 22:42:42 +01:00
B3n30
ccdc31ca9f
Merge pull request #2842 from Subv/switchable_page_table
...
Kernel/Memory: Give each process its own page table and allow switching the current page table upon reschedule
2017-09-15 22:41:45 +02:00
Subv
8932f435fc
Kernel/Memory: Make IsValidPhysicalAddress not go through the current process' virtual memory mapping.
2017-09-15 14:26:18 -05:00
Subv
71281c2114
Kernel/Memory: Changed GetPhysicalPointer so that it doesn't go through the current process' page table to obtain a pointer.
2017-09-15 14:26:13 -05:00
Subv
36100ec791
Kernel/Memory: Give each Process its own page table.
...
The loader is in charge of setting the newly created process's page table as the main one during the loading process.
2017-09-10 15:13:41 -05:00
danzel
e16c96d587
Use recursive_mutex instead of mutex to fix #2902
2017-08-29 20:39:55 +12:00
James Rowe
35e185309b
Merge pull request #2839 from Subv/global_kernel_lock
...
Kernel/HLE: Use a mutex to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
2017-08-23 18:17:44 -06:00
Subv
36220f3873
Kernel/Memory: Acquire the global HLE lock when a memory read/write operation falls outside of the fast path, for it might perform an MMIO operation.
2017-08-22 09:30:58 -05:00
Weiyi Wang
c40c9bf285
Merge pull request #2799 from yuriks/virtual-cached-range-flush
...
Add address conversion functions returning optional, Add function to flush virtual region from rasterizer cache
2017-07-22 10:15:52 +03:00
Yuri Kunde Schlesner
1423b3b10e
Memory: Add function to flush a virtual range from the rasterizer cache
...
This is slightly more ergonomic to use, correctly handles virtual
regions which are disjoint in physical addressing space, and checks only
regions which can be cached by the rasterizer.
2017-06-21 22:57:12 -07:00
Yuri Kunde Schlesner
3bc1034465
Memory: Fix crash when unmapping a VMA covering cached surfaces
...
Unmapping pages tries to flush any cached GPU surfaces touching that
region. When a cached page is invalidated, GetPointerFromVMA() is used
to restore the original pagetable pointer. However, since that VMA has
already been deleted, this hits an UNREACHABLE case in that function.
Now when this happens, just set the page type to Unmapped and continue,
which arrives at the correct end result.
2017-06-21 22:56:31 -07:00
Yuri Kunde Schlesner
75be7907c1
Memory: Add TryVirtualToPhysicalAddress, returning a boost::optional
2017-06-21 22:55:18 -07:00
Yuri Kunde Schlesner
1dd91e371b
Memory: Make PhysicalToVirtualAddress return a boost::optional
...
And fix a few places in the code to take advantage of that.
2017-06-21 22:55:17 -07:00
Yuri Kunde Schlesner
2af0a2a4b7
Memory: Add constants for the n3DS additional RAM
...
This is 4MB of extra, separate memory that was added on the New 3DS.
2017-05-09 21:43:59 -07:00
bunnei
1224db246e
Revert "Memory: Always flush whole pages from surface cache"
2016-12-17 19:13:33 -05:00
Yuri Kunde Schlesner
415064165a
Memory: Always flush whole pages from surface cache
...
This prevents individual writes touching a cached page, but which don't
overlap the surface, from constantly hitting the surface cache lookup.
2016-12-14 23:46:59 -08:00
James Rowe
13888eac06
Expose page table to dynarmic for optimized reads and writes to the JIT
2016-11-24 20:41:18 -07:00
wwylele
7dcbdc4c43
memory: fix IsValidVirtualAddress for RasterizerCachedMemory
...
RasterizerCachedMemory doesn't has pointer but should be considered as valid
2016-09-29 10:01:34 +08:00
Yuri Kunde Schlesner
fa5d9d8266
Use negative priorities to avoid special-casing the self-include
2016-09-21 00:15:56 -07:00
Emmanuel Gil Peyrot
1138ec0d49
Remove empty newlines in #include blocks.
...
This makes clang-format useful on those.
Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Emmanuel Gil Peyrot
628ed4376a
Sources: Run clang-format on everything.
2016-09-18 09:38:01 +09:00
wwylele
3008911345
Memory: add ReadCString function
2016-08-27 21:38:06 +08:00
Subv
b502c2e4d0
Memory: Handle RasterizerCachedMemory and RasterizerCachedSpecial page types in the memory block manipulation functions.
2016-05-28 13:52:50 -05:00
Subv
9d36016350
Memory: Make ReadBlock and WriteBlock accept void pointers.
2016-05-28 13:52:49 -05:00
MerryMage
c3ad268edc
Memory: CopyBlock
2016-05-28 13:44:49 -05:00
MerryMage
73cc880444
Memory: ZeroBlock
2016-05-21 11:14:09 -05:00
MerryMage
c1c78c27c2
Memory: ReadBlock/WriteBlock
2016-05-21 11:12:36 -05:00
MerryMage
b6feee037b
Memory: IsValidVirtualAddress/IsValidPhysicalAddress
2016-05-21 11:12:35 -05:00
tfarley
459035a108
HWRasterizer: Texture forwarding
2016-04-21 17:27:56 -04:00
Yuri Kunde Schlesner
46dc35ae20
Memory: Do correct Phys->Virt address translation for non-APP linheap
2016-03-05 22:09:59 -08:00
MerryMage
e614492dca
Memory: Implement MMIO
2016-01-30 18:41:04 +00:00
Gareth Poole
cfeae1a4f5
Fixed spelling errors
2015-10-09 17:09:52 -04:00
Lioncash
9f37facda2
memory: Get rid of pointer casts
2015-09-10 00:09:55 -04:00
Yuri Kunde Schlesner
e34643a3e4
Kernel: Add more infrastructure to support different memory layouts
...
This adds some structures necessary to support multiple memory regions
in the future. It also adds support for different system memory types
and the new linear heap mapping at 0x30000000.
2015-08-16 01:03:47 -03:00
Yuri Kunde Schlesner
168d376c67
Memory: Move address type conversion routines to memory.cpp/h
...
These helpers aren't really part of the kernel, and mem_map.cpp/h is
going to be moved there next.
2015-08-16 01:03:46 -03:00
Yuri Kunde Schlesner
51820691e7
Memory: Fix unmapping of pages
2015-07-11 23:49:53 -03:00
Emmanuel Gil Peyrot
2d044a67c9
Common: Cleanup memory and misc includes.
2015-06-28 00:36:54 +01:00
Yuri Kunde Schlesner
0a60aa75c2
Kernel: Add VMManager to manage process address spaces
...
This enables more dynamic management of the process address space,
compared to just directly configuring the page table for major areas.
This will serve as the foundation upon which the rest of the Kernel
memory management functions will be built.
2015-05-27 03:24:12 -03:00
Yuri Kunde Schlesner
dd4430609a
Memory: Use a table based lookup scheme to read from memory regions
2015-05-15 00:04:43 -03:00
Yuri Kunde Schlesner
52158c1b8d
Memory: Read SharedPage directly from Memory::Read
2015-05-15 00:04:41 -03:00
Yuri Kunde Schlesner
ec514b16a6
Memory: Read ConfigMem directly from Memory::Read
2015-05-15 00:04:39 -03:00