mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-21 18:22:33 +01:00
sys_event: cleanup (replace vm::temporary_unlock)
Also made minor changes in sys_rsx.cpp. Removed unused exception std headers.
This commit is contained in:
parent
f972fa26a4
commit
605d57c541
@ -2,8 +2,6 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace fmt
|
||||
|
@ -1220,7 +1220,7 @@ error_code cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32
|
||||
{
|
||||
return CELL_AUDIO_ERROR_PORT_FULL;
|
||||
}
|
||||
|
||||
|
||||
// TODO: is this necessary in any way? (Based on libaudio.prx)
|
||||
//const u64 num_channels_non_0 = std::max<u64>(1, num_channels);
|
||||
|
||||
@ -1491,7 +1491,7 @@ error_code cellAudioSetPortLevel(u32 portNum, float level)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
static error_code AudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key, u32 queue_type)
|
||||
static error_code AudioCreateNotifyEventQueue(ppu_thread& ppu, vm::ptr<u32> id, vm::ptr<u64> key, u32 queue_type)
|
||||
{
|
||||
vm::var<sys_event_queue_attribute_t> attr;
|
||||
attr->protocol = SYS_SYNC_FIFO;
|
||||
@ -1507,7 +1507,7 @@ static error_code AudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key,
|
||||
// So check initialization as well
|
||||
const u32 queue_depth = g_fxo->get<cell_audio>()->init && g_ps3_process_info.sdk_ver <= 0x35FFFF ? 2 : 8;
|
||||
|
||||
if (CellError res{sys_event_queue_create(id, attr, key_value, queue_depth) + 0u})
|
||||
if (CellError res{sys_event_queue_create(ppu, id, attr, key_value, queue_depth) + 0u})
|
||||
{
|
||||
if (res != CELL_EEXIST)
|
||||
{
|
||||
@ -1524,14 +1524,14 @@ static error_code AudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key,
|
||||
return CELL_AUDIO_ERROR_EVENT_QUEUE;
|
||||
}
|
||||
|
||||
error_code cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
|
||||
error_code cellAudioCreateNotifyEventQueue(ppu_thread& ppu, vm::ptr<u32> id, vm::ptr<u64> key)
|
||||
{
|
||||
cellAudio.warning("cellAudioCreateNotifyEventQueue(id=*0x%x, key=*0x%x)", id, key);
|
||||
|
||||
return AudioCreateNotifyEventQueue(id, key, SYS_PPU_QUEUE);
|
||||
return AudioCreateNotifyEventQueue(ppu, id, key, SYS_PPU_QUEUE);
|
||||
}
|
||||
|
||||
error_code cellAudioCreateNotifyEventQueueEx(vm::ptr<u32> id, vm::ptr<u64> key, u32 iFlags)
|
||||
error_code cellAudioCreateNotifyEventQueueEx(ppu_thread& ppu, vm::ptr<u32> id, vm::ptr<u64> key, u32 iFlags)
|
||||
{
|
||||
cellAudio.warning("cellAudioCreateNotifyEventQueueEx(id=*0x%x, key=*0x%x, iFlags=0x%x)", id, key, iFlags);
|
||||
|
||||
@ -1541,7 +1541,7 @@ error_code cellAudioCreateNotifyEventQueueEx(vm::ptr<u32> id, vm::ptr<u64> key,
|
||||
}
|
||||
|
||||
const u32 queue_type = (iFlags & CELL_AUDIO_CREATEEVENTFLAG_SPU) ? SYS_SPU_QUEUE : SYS_PPU_QUEUE;
|
||||
return AudioCreateNotifyEventQueue(id, key, queue_type);
|
||||
return AudioCreateNotifyEventQueue(ppu, id, key, queue_type);
|
||||
}
|
||||
|
||||
error_code AudioSetNotifyEventQueue(u64 key, u32 iFlags)
|
||||
|
@ -509,7 +509,7 @@ bool _spurs::is_libprof_loaded()
|
||||
|
||||
s32 _spurs::create_lv2_eq(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, vm::ptr<u32> queueId, vm::ptr<u8> port, s32 size, const sys_event_queue_attribute_t& attr)
|
||||
{
|
||||
if (s32 rc = sys_event_queue_create(queueId, vm::make_var(attr), SYS_EVENT_QUEUE_LOCAL, size))
|
||||
if (s32 rc = sys_event_queue_create(ppu, queueId, vm::make_var(attr), SYS_EVENT_QUEUE_LOCAL, size))
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
@ -895,7 +895,7 @@ s32 _spurs::create_event_helper(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 p
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (s32 rc = sys_event_port_create(spurs.ptr(&CellSpurs::eventPort), SYS_EVENT_PORT_LOCAL, SYS_EVENT_PORT_NO_NAME))
|
||||
if (s32 rc = sys_event_port_create(ppu, spurs.ptr(&CellSpurs::eventPort), SYS_EVENT_PORT_LOCAL, SYS_EVENT_PORT_NO_NAME))
|
||||
{
|
||||
if (s32 rc2 = _spurs::detach_lv2_eq(spurs, spurs->spuPort, true))
|
||||
{
|
||||
@ -906,7 +906,7 @@ s32 _spurs::create_event_helper(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 p
|
||||
return CELL_SPURS_CORE_ERROR_AGAIN;
|
||||
}
|
||||
|
||||
if (s32 rc = sys_event_port_connect_local(spurs->eventPort, spurs->eventQueue))
|
||||
if (s32 rc = sys_event_port_connect_local(ppu, spurs->eventPort, spurs->eventQueue))
|
||||
{
|
||||
sys_event_port_destroy(ppu, spurs->eventPort);
|
||||
|
||||
@ -3523,10 +3523,10 @@ s32 cellSpursEventFlagAttachLv2EventQueue(ppu_thread& ppu, vm::ptr<CellSpursEven
|
||||
{
|
||||
vm::var<u32> eventPortId;
|
||||
|
||||
s32 rc = sys_event_port_create(eventPortId, SYS_EVENT_PORT_LOCAL, 0);
|
||||
s32 rc = sys_event_port_create(ppu, eventPortId, SYS_EVENT_PORT_LOCAL, 0);
|
||||
if (rc == CELL_OK)
|
||||
{
|
||||
rc = sys_event_port_connect_local(*eventPortId, *eventQueueId);
|
||||
rc = sys_event_port_connect_local(ppu, *eventPortId, *eventQueueId);
|
||||
if (rc == CELL_OK)
|
||||
{
|
||||
eventFlag->eventPortId = *eventPortId;
|
||||
|
@ -70,7 +70,7 @@ error_code cellVoiceConnectIPortToOPort(u32 ips, u32 ops)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellVoiceCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
|
||||
error_code cellVoiceCreateNotifyEventQueue(ppu_thread& ppu, vm::ptr<u32> id, vm::ptr<u64> key)
|
||||
{
|
||||
cellVoice.warning("cellVoiceCreateNotifyEventQueue(id=*0x%x, key=*0x%x)", id, key);
|
||||
|
||||
@ -90,7 +90,7 @@ error_code cellVoiceCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
|
||||
{
|
||||
// Create an event queue "bruteforcing" an available key
|
||||
const u64 key_value = 0x80004d494f323285ull + i;
|
||||
if (CellError res{sys_event_queue_create(id, attr, key_value, 0x40) + 0u})
|
||||
if (CellError res{sys_event_queue_create(ppu, id, attr, key_value, 0x40) + 0u})
|
||||
{
|
||||
if (res != CELL_EEXIST)
|
||||
{
|
||||
@ -858,7 +858,7 @@ error_code cellVoiceReadFromOPort(u32 ops, vm::ptr<void> data, vm::ptr<u32> size
|
||||
|
||||
if (!oport || oport->info.portType <= CELLVOICE_PORTTYPE_IN_VOICE)
|
||||
return CELL_VOICE_ERROR_TOPOLOGY;
|
||||
|
||||
|
||||
if (size)
|
||||
*size = 0;
|
||||
|
||||
|
@ -93,9 +93,9 @@ CellError lv2_event_queue::send(lv2_event event)
|
||||
return {};
|
||||
}
|
||||
|
||||
error_code sys_event_queue_create(vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attribute_t> attr, u64 event_queue_key, s32 size)
|
||||
error_code sys_event_queue_create(cpu_thread& cpu, vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attribute_t> attr, u64 event_queue_key, s32 size)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_event.warning("sys_event_queue_create(equeue_id=*0x%x, attr=*0x%x, event_queue_key=0x%llx, size=%d)", equeue_id, attr, event_queue_key, size);
|
||||
|
||||
@ -365,9 +365,9 @@ error_code sys_event_queue_drain(ppu_thread& ppu, u32 equeue_id)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_event_port_create(vm::ptr<u32> eport_id, s32 port_type, u64 name)
|
||||
error_code sys_event_port_create(cpu_thread& cpu, vm::ptr<u32> eport_id, s32 port_type, u64 name)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_event.warning("sys_event_port_create(eport_id=*0x%x, port_type=%d, name=0x%llx)", eport_id, port_type, name);
|
||||
|
||||
@ -415,9 +415,9 @@ error_code sys_event_port_destroy(ppu_thread& ppu, u32 eport_id)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
||||
error_code sys_event_port_connect_local(cpu_thread& cpu, u32 eport_id, u32 equeue_id)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_event.warning("sys_event_port_connect_local(eport_id=0x%x, equeue_id=0x%x)", eport_id, equeue_id);
|
||||
|
||||
@ -511,7 +511,10 @@ error_code sys_event_port_disconnect(ppu_thread& ppu, u32 eport_id)
|
||||
|
||||
error_code sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
if (auto cpu = get_current_cpu_thread())
|
||||
{
|
||||
cpu->state += cpu_flag::wait;
|
||||
}
|
||||
|
||||
sys_event.trace("sys_event_port_send(eport_id=0x%x, data1=0x%llx, data2=0x%llx, data3=0x%llx)", eport_id, data1, data2, data3);
|
||||
|
||||
|
@ -140,15 +140,15 @@ class ppu_thread;
|
||||
|
||||
// Syscalls
|
||||
|
||||
error_code sys_event_queue_create(vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attribute_t> attr, u64 event_queue_key, s32 size);
|
||||
error_code sys_event_queue_create(cpu_thread& cpu, vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attribute_t> attr, u64 event_queue_key, s32 size);
|
||||
error_code sys_event_queue_destroy(ppu_thread& ppu, u32 equeue_id, s32 mode);
|
||||
error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr<sys_event_t> dummy_event, u64 timeout);
|
||||
error_code sys_event_queue_tryreceive(ppu_thread& ppu, u32 equeue_id, vm::ptr<sys_event_t> event_array, s32 size, vm::ptr<u32> number);
|
||||
error_code sys_event_queue_drain(ppu_thread& ppu, u32 event_queue_id);
|
||||
|
||||
error_code sys_event_port_create(vm::ptr<u32> eport_id, s32 port_type, u64 name);
|
||||
error_code sys_event_port_create(cpu_thread& cpu, vm::ptr<u32> eport_id, s32 port_type, u64 name);
|
||||
error_code sys_event_port_destroy(ppu_thread& ppu, u32 eport_id);
|
||||
error_code sys_event_port_connect_local(u32 event_port_id, u32 event_queue_id);
|
||||
error_code sys_event_port_connect_local(cpu_thread& cpu, u32 event_port_id, u32 event_queue_id);
|
||||
error_code sys_event_port_connect_ipc(ppu_thread& ppu, u32 eport_id, u64 ipc_key);
|
||||
error_code sys_event_port_disconnect(ppu_thread& ppu, u32 eport_id);
|
||||
error_code sys_event_port_send(u32 event_port_id, u64 data1, u64 data2, u64 data3);
|
||||
|
@ -709,8 +709,8 @@ error_code sys_mmapper_enable_page_fault_notification(ppu_thread& ppu, u32 start
|
||||
}
|
||||
|
||||
vm::var<u32> port_id(0);
|
||||
error_code res = sys_event_port_create(port_id, SYS_EVENT_PORT_LOCAL, SYS_MEMORY_PAGE_FAULT_EVENT_KEY);
|
||||
sys_event_port_connect_local(*port_id, event_queue_id);
|
||||
error_code res = sys_event_port_create(ppu, port_id, SYS_EVENT_PORT_LOCAL, SYS_MEMORY_PAGE_FAULT_EVENT_KEY);
|
||||
sys_event_port_connect_local(ppu, *port_id, event_queue_id);
|
||||
|
||||
if (res + 0u == CELL_EAGAIN)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ void lv2_rsx_config::send_event(u64 data1, u64 event_flags, u64 data3) const
|
||||
{
|
||||
rsx->on_semaphore_acquire_wait();
|
||||
}
|
||||
|
||||
|
||||
// Wait a bit before resending event
|
||||
thread_ctrl::wait_for(100);
|
||||
|
||||
@ -161,8 +161,10 @@ error_code sys_rsx_memory_free(u32 mem_handle)
|
||||
* @param mem_ctx (IN): mem_ctx given by sys_rsx_memory_allocate
|
||||
* @param system_mode (IN):
|
||||
*/
|
||||
error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_dma_control, vm::ptr<u64> lpar_driver_info, vm::ptr<u64> lpar_reports, u64 mem_ctx, u64 system_mode)
|
||||
error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm::ptr<u64> lpar_dma_control, vm::ptr<u64> lpar_driver_info, vm::ptr<u64> lpar_reports, u64 mem_ctx, u64 system_mode)
|
||||
{
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_rsx.warning("sys_rsx_context_allocate(context_id=*0x%x, lpar_dma_control=*0x%x, lpar_driver_info=*0x%x, lpar_reports=*0x%x, mem_ctx=0x%llx, system_mode=0x%llx)",
|
||||
context_id, lpar_dma_control, lpar_driver_info, lpar_reports, mem_ctx, system_mode);
|
||||
|
||||
@ -247,10 +249,10 @@ error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_d
|
||||
attr->type = SYS_PPU_QUEUE;
|
||||
attr->name_u64 = 0;
|
||||
|
||||
sys_event_port_create(vm::get_addr(&driverInfo.handler_queue), SYS_EVENT_PORT_LOCAL, 0);
|
||||
sys_event_port_create(cpu, vm::get_addr(&driverInfo.handler_queue), SYS_EVENT_PORT_LOCAL, 0);
|
||||
rsx_cfg->rsx_event_port = driverInfo.handler_queue;
|
||||
sys_event_queue_create(vm::get_addr(&driverInfo.handler_queue), attr, 0, 0x20);
|
||||
sys_event_port_connect_local(rsx_cfg->rsx_event_port, driverInfo.handler_queue);
|
||||
sys_event_queue_create(cpu, vm::get_addr(&driverInfo.handler_queue), attr, 0, 0x20);
|
||||
sys_event_port_connect_local(cpu, rsx_cfg->rsx_event_port, driverInfo.handler_queue);
|
||||
|
||||
rsx_cfg->dma_address = vm::cast(*lpar_dma_control, HERE);
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "Utilities/mutex.h"
|
||||
#include "Emu/Memory/vm_ptr.h"
|
||||
|
||||
class cpu_thread;
|
||||
|
||||
struct RsxDriverInfo
|
||||
{
|
||||
be_t<u32> version_driver; // 0x0
|
||||
@ -141,7 +143,7 @@ error_code sys_rsx_device_open();
|
||||
error_code sys_rsx_device_close();
|
||||
error_code sys_rsx_memory_allocate(vm::ptr<u32> mem_handle, vm::ptr<u64> mem_addr, u32 size, u64 flags, u64 a5, u64 a6, u64 a7);
|
||||
error_code sys_rsx_memory_free(u32 mem_handle);
|
||||
error_code sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u64> lpar_dma_control, vm::ptr<u64> lpar_driver_info, vm::ptr<u64> lpar_reports, u64 mem_ctx, u64 system_mode);
|
||||
error_code sys_rsx_context_allocate(cpu_thread& cpu, vm::ptr<u32> context_id, vm::ptr<u64> lpar_dma_control, vm::ptr<u64> lpar_driver_info, vm::ptr<u64> lpar_reports, u64 mem_ctx, u64 system_mode);
|
||||
error_code sys_rsx_context_free(u32 context_id);
|
||||
error_code sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags);
|
||||
error_code sys_rsx_context_iounmap(u32 context_id, u32 io, u32 size);
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <atomic>
|
||||
#include <exception>
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
@ -43,7 +42,7 @@ namespace rsx
|
||||
if (sys_rsx_memory_allocate(contextInfo.ptr(&rsx_context::mem_handle), contextInfo.ptr(&rsx_context::mem_addr), 0x0F900000, 0, 0, 0, 0) != CELL_OK)
|
||||
fmt::throw_exception("Capture Replay: sys_rsx_memory_allocate failed!");
|
||||
|
||||
if (sys_rsx_context_allocate(contextInfo.ptr(&rsx_context::context_id), contextInfo.ptr(&rsx_context::dma_addr), contextInfo.ptr(&rsx_context::driver_info), contextInfo.ptr(&rsx_context::reports_addr), contextInfo->mem_handle, 0) != CELL_OK)
|
||||
if (sys_rsx_context_allocate(*this, contextInfo.ptr(&rsx_context::context_id), contextInfo.ptr(&rsx_context::dma_addr), contextInfo.ptr(&rsx_context::driver_info), contextInfo.ptr(&rsx_context::reports_addr), contextInfo->mem_handle, 0) != CELL_OK)
|
||||
fmt::throw_exception("Capture Replay: sys_rsx_context_allocate failed!");
|
||||
|
||||
get_current_renderer()->main_mem_size = buffer_size;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <unordered_set>
|
||||
#include <exception>
|
||||
#include <cfenv>
|
||||
|
||||
class GSRender;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
@ -30,8 +30,6 @@ namespace std { inline namespace literals { inline namespace chrono_literals {}}
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <climits>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
Loading…
Reference in New Issue
Block a user