mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
cellCamera: fix buffer allocation
This commit is contained in:
parent
d93f16fe87
commit
9a6285942b
@ -541,15 +541,18 @@ error_code cellCameraOpenEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
|
||||
|
||||
std::lock_guard lock(g_camera.mutex);
|
||||
|
||||
if (info->read_mode == CELL_CAMERA_READ_FUNCCALL && !info->buffer)
|
||||
{
|
||||
info->buffer = vm::cast(vm::alloc(vbuf_size, vm::main));
|
||||
info->bytesize = vbuf_size;
|
||||
}
|
||||
else if (info->read_mode && !info->pbuf[0] && !info->pbuf[1])
|
||||
// TODO: find out if the buffers are also checked for nullptr
|
||||
if (info->read_mode == CELL_CAMERA_READ_DIRECT)
|
||||
{
|
||||
info->pbuf[0] = vm::cast(vm::alloc(vbuf_size, vm::main));
|
||||
info->pbuf[1] = vm::cast(vm::alloc(vbuf_size, vm::main));
|
||||
|
||||
// TODO: verify
|
||||
info->bytesize = vbuf_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->buffer = vm::cast(vm::alloc(vbuf_size, vm::main));
|
||||
info->bytesize = vbuf_size;
|
||||
}
|
||||
|
||||
@ -604,7 +607,18 @@ error_code cellCameraClose(s32 dev_num)
|
||||
std::lock_guard lock(g_camera.mutex);
|
||||
g_camera.is_streaming = false;
|
||||
|
||||
vm::dealloc(g_camera.info.buffer.addr(), vm::main);
|
||||
if (g_camera.info.buffer)
|
||||
{
|
||||
vm::dealloc(g_camera.info.buffer.addr(), vm::main);
|
||||
}
|
||||
if (g_camera.info.pbuf[0])
|
||||
{
|
||||
vm::dealloc(g_camera.info.pbuf[0].addr(), vm::main);
|
||||
}
|
||||
if (g_camera.info.pbuf[1])
|
||||
{
|
||||
vm::dealloc(g_camera.info.pbuf[1].addr(), vm::main);
|
||||
}
|
||||
|
||||
g_camera.close_camera();
|
||||
g_camera.is_open = false;
|
||||
@ -1777,6 +1791,19 @@ void camera_context::reset_state()
|
||||
pbuf_locked[0] = false;
|
||||
pbuf_locked[1] = false;
|
||||
|
||||
if (info.buffer)
|
||||
{
|
||||
vm::dealloc(info.buffer.addr(), vm::main);
|
||||
}
|
||||
if (info.pbuf[0])
|
||||
{
|
||||
vm::dealloc(info.pbuf[0].addr(), vm::main);
|
||||
}
|
||||
if (info.pbuf[1])
|
||||
{
|
||||
vm::dealloc(info.pbuf[1].addr(), vm::main);
|
||||
}
|
||||
|
||||
std::scoped_lock lock(mutex_notify_data_map);
|
||||
notify_data_map.clear();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ class null_camera_handler final : public camera_handler_base
|
||||
{
|
||||
public:
|
||||
null_camera_handler() : camera_handler_base() {}
|
||||
|
||||
|
||||
void open_camera() override { m_state = camera_handler_state::open; };
|
||||
void close_camera() override { m_state = camera_handler_state::closed; };
|
||||
void start_camera() override { m_state = camera_handler_state::running; };
|
||||
|
Loading…
x
Reference in New Issue
Block a user