Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KOS Proper #56

Open
wants to merge 215 commits into
base: master
Choose a base branch
from
Open

Conversation

andressbarajas
Copy link
Collaborator

Pull request to merge KOS Proper changes.

QuzarDC and others added 30 commits October 14, 2024 03:01
Before this it would always simply pick the first. This
change allows registered names to overlap and still be found.
So now you can mount something to `/c` without breaking `/cd`.
- Use bool rather than int for 'presort'.
- Set the param of pvr_allocate_buffers to a const.
- Update block parameter of loads and blocking var to bool.
- Update source pointers of loads to const.
- Update pvr_dma_ready to return a bool.
- Updated enable param to bool, as well as the logic that clamped it.
- Updated examples to use the new type.
This function can be used to wait until the PVR is done rendering a
previous scene. This can be useful for instance to make sure that the
PVR is done using textures that have to be updated, before updating
those.

Signed-off-by: Paul Cercueil <[email protected]>
This function can be used to retrieve a pointer to the front buffer, aka.
the last fully rendered buffer that is either being displayed right now,
or is queued to be displayed.

Signed-off-by: Paul Cercueil <[email protected]>
Having a double-buffering mechanism for the vertex buffer makes it
possible to upload geometry data to the Tile Accelerator while the PVR
is busy rendering the previous scene.

However, it means having two buffers for the geometry data. Some
applications may prefer using a much smaller vertex buffer to lower
VRAM usage, even if it means the TA and PVR cannot be used at the same
time.

Signed-off-by: Paul Cercueil <[email protected]>
"command" is technically the right one as it is recommended over
"which". However, Ubuntu 20.04 does not seem to have a built-in
"command", or at least it is not callable from a Makefile's
$(shell).

Fixes #860.

Signed-off-by: Paul Cercueil <[email protected]>
take wav or raw sound data directly from memory and load into sfx
The "pvr_state.lists_closed" was reset only when DMA mode was not
enabled. This caused problems when the geometry was only submitted via
direct rendering.

Signed-off-by: Paul Cercueil <[email protected]>
Use the vec3f_t type defined by the header, and replace all inline ASM
with C code.

Apart from the "fipr" instruction, which we already have macros for,
there is absolutely no reason to have these algorithms in ASM. Not only
it is unnecessary, it is also harmful as the C compiler cannot
re-organize those instructions as it sees fit.

Signed-off-by: Paul Cercueil <[email protected]>
Posixify environ_*.sh files
dc-chain: Use "which" instead of "command"
Update the changelog and relnotes for v2.1.1
Add snd_sfx_load functions that take pointers instead of files
Ensure the name manager selects the best match on lookup.
Fix and improve CPU cache management for devices on G1 bus.
There is no valid reason to have the spinlock API as macros.
Convert it to static inline functions to benefit from type checking.

Note that spinlock_trylock() was moved up in the file so that it can be
used within spinlock_lock() to factorize code.

Signed-off-by: Paul Cercueil <[email protected]>
QuzarDC and others added 30 commits January 27, 2025 10:10
…ad_attrib

Added thread attribs to cont_btn_callback worker.
Use the BIT() macro instead of the expanded version, to make it more
obvious that we're manipulating individual bits.

Signed-off-by: Paul Cercueil <[email protected]>
Move the initialization of "b" before the loop.
Remove commented DBG() macros.
Replace the loop break by a "return" since nothing else will be executed
after that. This means that the "did" variable can be dropped.

Signed-off-by: Paul Cercueil <[email protected]>
The very first call to dma_next_list() does not run in an interrupt
context, nor does it run with the IRQs disabled.

As soon as pvr_dma_load_ta() is called, it is therefore possible to have
dma_next_list() re-entered from within the DMA complete interrupt
handler. This is fine, as long as we make sure that the function does
not do anything after this point that could race with the interrupt
handler.

One possible race was with the DMA complete interrupt firing before the
"pvr_state.lists_dmaed" was updated, in which case the interrupt handler
wouldn't get the updated value, or when the interrupt was firing in the
middle of updating the "pvr_state.lists_dmaed".

Signed-off-by: Paul Cercueil <[email protected]>
The pvr_dma_transfer() would override the callback data, stored in
global variables, before even checking that no transfer was ongoing.

Address that by moving the place where the variables are set after the
DMA available check.

And while we're at it, disable interrupts to avoid races between
parallel calls of pvr_dma_transfer().

Signed-off-by: Paul Cercueil <[email protected]>
Note: This is the same patch as for the other Windows environments.
First reported with #897, a regression from #877. While it's
appropriate for the generalized dcache_pref_block to not have
outputs, setting the same for the store queue writeback causes
it to be optimized away in some situations (specifically DR).

This simply rolls back to the previous behavior for the sq case.
It should be possible to optimize further, but different attempts
led to build failures.
Fix type clash in vmu example.
Remove duplicated copy of the raytris example.
Revert PR #887: environ.sh: Disable -fno-builtin, enable -ffast-math
pvr: random cleanups and IRQ race fix in dma_next_list()
Ensure sq_writeback is flagged as causing memory to change.
Deprecated string.h and removed usages.
There's no reason for it to be 1kb static. The largest we
currently ever return is 36.
* Fixed #defines for VMU button bitflags.

- Bitflags were never correctly defined for the VMU buttons in vmu.h,
  but it was never caught, since you can also access them via bitfields.
- Corrected the incorrect flags.

* Added tracking for previous VMU button state.

In order to do anything useful in terms of responding to button state
change events, such as when a button is FIRST pressed or FIRST released,
any app would have to maintain the previous state of the buttons in
order to compare them to the current state.

We've been moving this functionality into KOS, so I've done the same
with the VMU buttons. Since the maple state data is static for every
device, we aren't storing any extra information anyway. Just using one
more byte of the 1024 byte buffer at the end of our device (for a
whopping 2 bytes of total button info).

- Pulled VMU buttons out of state and into their own union of raw button
  masks and individual bitfields.
- Added logic to driver to cache the previous frame's state
- Created new vmu_state_t struct exposing these two frames' worth of
  button state info.

* Made vmu_cond_t struct private.

This struct is only for processing the raw maple response packet when
querying for button states... There was no reason to expose it as
something cluttering up the main API and confusing our users.

- Moved vmu_cond_t from vmu.h to vmu.c.
- Updated copyright information.
This should help reduce the possible impact of #840
which describes how types defined in this file escape
out and can conflict with other codebases.

This is in-line with our general move to stdint types
and, as far as I can tell, there was only one use of
these types in the codebase.
* Remove workarounds for the removal of dev->valid.
* Correct comment as dev->valid is now bool.
* Correct bug that would allow null deref
vmu_pkg: Add function to load VMU icons from .ico files
Remove redefined 'BSD-style' types.
We use ISO C style almost everywhere else.
Persist allocated `maple_device_t`s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.