Commit graph

128 commits

Author SHA1 Message Date
Elad 575a245f8d
IDM: Implement lock-free smart pointers (#16403)
Replaces `std::shared_pointer` with `stx::atomic_ptr` and `stx::shared_ptr`.

Notes to programmers:

* This pr kills the use of `dynamic_cast`, `std::dynamic_pointer_cast` and `std::weak_ptr` on IDM objects, possible replacement is to save the object ID on the base object, then use idm::check/get_unlocked to the destination type via the saved ID which may be null. Null pointer check is how you can tell type mismatch (as dynamic cast) or object destruction (as weak_ptr locking).
* Double-inheritance on IDM objects should be used with care, `stx::shared_ptr` does not support constant-evaluated pointer offsetting to parent/child type.
* `idm::check/get_unlocked` can now be used anywhere.

Misc fixes:
* Fixes some segfaults with RPCN with interaction with IDM.
* Fix deadlocks in access violation handler due locking recursion.
* Fixes race condition in process exit-spawn on memory containers read.
* Fix bug that theoretically can prevent RPCS3 from booting - fix `id_manager::typeinfo` comparison to compare members instead of `memcmp` which can fail spuriously on padding bytes.
* Ensure all IDM inherited types of base, either has `id_base` or `id_type` defined locally, this allows to make getters such as `idm::get_unlocked<lv2_socket, lv2_socket_raw>()` which were broken before. (requires save-states invalidation)
* Removes broken operator[] overload of `stx::shared_ptr` and `stx::single_ptr` for non-array types.
2024-12-22 20:59:48 +02:00
Megamouse 106bf5145b Fix ffmpeg deprecation warnings 2024-08-01 18:04:47 +02:00
Eladash 7468d96c51 Savestates: safe saving while cellSaveData is active 2024-03-27 19:59:22 +02:00
Megamouse f7fa5aab70 media_utils: fix segfault when stopping a recording 2024-01-12 19:53:20 +01:00
Ivan Chikish d34287b2cc Linux: use futex_waitv syscall for atomic waiting
In order to make this possible, some unnecessary features were removed.
2023-08-02 21:46:06 +03:00
Megamouse 05064dfaf4 cellVdec: revert RGBA alignment change 2023-03-05 22:49:49 +01:00
oltolm 1800faf0dd cellVdec.cpp: use lock_unlock instead of lock_guard 2023-02-26 22:20:07 +03:00
oltolm ad4677a67c fix use after move in cellVdec.cpp 2023-02-26 22:20:07 +03:00
Megamouse bb2c9196f5 cellVdec: align RGBA/ARGB strides 2023-02-18 22:43:22 +01:00
Megamouse 1c8d3e0dca cellVdec: fix au_count race condition 2023-02-18 15:31:21 +01:00
Elad Ashkenazi 8652b7d358
cellVdec: Fix AU decode count on callback (#13342) 2023-02-05 13:02:51 +01:00
Nekotekina b49a1f27eb Warning fixes 2022-09-17 16:35:02 +03:00
Eladash 89e0dcba5e cellVdec: Adjust for reservations 2022-09-07 16:05:56 +03:00
Elad Ashkenazi fcd297ffb2
Savestates Support For PS3 Emulation (#10478) 2022-07-04 16:02:17 +03:00
Megamouse c175cdf3d8 cellVdec: send AUDONE even when the queue is being flushed/restarted
Fixes GT6 regression
2022-04-24 17:39:49 +02:00
Megamouse 7924784215 cellVdec: log sequence id of commands 2022-04-24 17:39:49 +02:00
Megamouse 06cbc96722 cellVdecStartSeq: log level warning 2022-04-24 17:39:49 +02:00
Megamouse dcda332a93 cellVdec: send AUDONE before PICOUT 2022-04-24 17:39:49 +02:00
Megamouse eac4e991bd cellVdec: add callback and command id logging 2022-04-24 17:39:49 +02:00
Megamouse 9284344480 cellVdec: fix cellVdecStartSeq (restart mode) 2022-04-24 17:39:49 +02:00
Megamouse 2c03467eec cellVdec: improve logging a bit 2022-04-24 17:39:49 +02:00
Megamouse b67cda7cbb cellVdec: add handle to more log messages 2022-04-24 17:39:49 +02:00
Megamouse fb27ed4deb libav: remove deprecated option refcounted_frames
According to fe85afbf8c/doc/APIchanges (L743)
this option is deprecated and obsolete for the newer send/receive logic.
Should fix runtime exceptions with newer ffmpeg versions.
2022-04-24 11:05:22 +02:00
Megamouse 8acb62f6ee HLE: simplify some error formats 2022-04-22 20:56:21 +02:00
Megamouse f42e647430 cellVdec: use av_error_to_string 2022-04-21 22:22:33 +02:00
Megamouse 7c65c1e3aa cellVdec: Remove irritating while loop 2022-04-21 22:22:33 +02:00
Megamouse 9f51003366 cellVdecGetPicture and cellVdecGetPictureExt swap
This fixes a possible issue with the error handling order.
2022-04-21 22:22:33 +02:00
Megamouse 512eb93a62 cellVdecDecodeAu: fix param check 2022-04-21 22:22:33 +02:00
Megamouse 9c919db9ae cellVdec: fix out format line offsets
Fixes video output in Uncharted 2
2022-04-21 22:22:33 +02:00
Megamouse 61ada2c1dc cellVdec: call av_dict_free 2022-04-21 22:22:33 +02:00
Megamouse bd5bff321e cellVdecDecodeAuEx2: some REd guesswork 2022-04-21 22:22:33 +02:00
Megamouse ee3a302cf2 cellVdecDecodeAu: add codec type check 2022-04-21 22:22:33 +02:00
Megamouse fb3752a8ef CellVdecDivxSpecificInfo2 (who knows if this is correct...) 2022-04-21 22:22:33 +02:00
Megamouse 548b748f50 CellVdecPicAttr 2022-04-21 22:22:33 +02:00
Megamouse 771009f333 cellVdec: add more error logging 2022-04-21 22:22:33 +02:00
Megamouse db731d307e CELL_CODEC_PTS_INVALID, CELL_CODEC_DTS_INVALID 2022-04-21 22:22:33 +02:00
Megamouse c6f3f386df cellVdec: implement CELL_VDEC_ERROR_SEQ 2022-04-21 22:22:33 +02:00
Megamouse d8bbec9594 libav: log more error codes as string 2022-04-21 08:10:01 +02:00
Nekotekina 065ee621b8 Call avcodec_register_all in case of old ffmpeg
Apparently it's still possible to break without it.
2022-01-24 22:39:01 +03:00
Jan Beich 511ca82e30 cellAVdec: constify AVCodec for ffmpeg >= 5.0
rpcs3/Emu/Cell/Modules/cellAdec.cpp:325:12: error: assigning to 'AVCodec *' from 'const AVCodec *' discards qualifiers
                        codec = avcodec_find_decoder(AV_CODEC_ID_ATRAC3P);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rpcs3/Emu/Cell/Modules/cellAdec.cpp:331:12: error: assigning to 'AVCodec *' from 'const AVCodec *' discards qualifiers
                        codec = avcodec_find_decoder(AV_CODEC_ID_MP3);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rpcs3/Emu/Cell/Modules/cellVdec.cpp:143:12: error: assigning to 'AVCodec *' from 'const AVCodec *' discards qualifiers
                        codec = avcodec_find_decoder(AV_CODEC_ID_MPEG2VIDEO);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rpcs3/Emu/Cell/Modules/cellVdec.cpp:148:12: error: assigning to 'AVCodec *' from 'const AVCodec *' discards qualifiers
                        codec = avcodec_find_decoder(AV_CODEC_ID_H264);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rpcs3/Emu/Cell/Modules/cellVdec.cpp:153:12: error: assigning to 'AVCodec *' from 'const AVCodec *' discards qualifiers
                        codec = avcodec_find_decoder(AV_CODEC_ID_MPEG4);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-01-21 21:36:17 +03:00
Eladash 65c9cd99cd Patches/PPU: Implement HLE/LLE/With-TOC function call patches
Example patches:
  [ jumpf, 0x12340, "cellGcmSys:cellGcmSetFlip"] // Places a call to cellGcmSetFlip at 0x12340
  [ jumpf, 0x12340, "cellGcmSys:0xDC09357E"] // Same, using FNID
  [ jumpf, 0x12340, 0x2345678 ] # Function OPD based call eading OPD at 0x2345678
2021-09-26 20:49:57 +03:00
Megamouse 0525070898 remove deprecated avcodec_register_all
We already use newer avcodec code anyway.
2021-09-06 10:00:34 +02:00
Megamouse a2da525064 cellVdec: silence "Unsupported time_base" error log spam 2021-05-29 12:46:21 +02:00
Nekotekina 160b131de3 types.hpp: implement smin, smax, amin, amax
Rewritten the following global utility constants:
`umax` returns max number, restricted to unsigned.
`smax` returns max signed number, restricted to integrals.
`smin` returns min signed number, restricted to signed.
`amin` returns smin or zero, less restricted.
`amax` returns smax or umax, less restricted.

Fix operators == and <=> for synthesized rel-ops.
2021-05-22 12:10:57 +03:00
Megamouse a16d8ba3ea More random changes 2021-04-11 14:01:51 +03:00
Nekotekina 87af905018 Enable -Wunused-parameter 2021-03-06 18:07:08 +03:00
Nekotekina 038148bf06 Fix almost all GCC warnings 2021-02-17 22:59:04 +03:00
Eladash f43260bd58
Atomic waiting refactoring (#9208)
* Use atomic waitables instead instead of global thread wait as often as possible.
* Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions)
* Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by #9117)
* Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0")
2021-02-13 17:50:07 +03:00
Nekotekina d0126f0fa0 Fix freezes in HLE Vdec and SPU LLVM precompilation.
Freezes could accidentally occur on close or ingame.
Deprecate range-for loop on lf_queue.
This is a part of PR #9208

Co-authored-by: Eladash <elad3356p@gmail.com>
2021-02-01 19:14:01 +03:00
Nekotekina db8e6fe7a7 Enable -Wunused-variable 2021-01-12 14:34:14 +03:00