Use g_fxo for cellGcm

Rename CellGcmSysConfig -> gcm_config
This commit is contained in:
Nekotekina 2019-08-25 03:44:08 +03:00
parent 9a2338a5ca
commit 1d3c18f4e2

View file

@ -30,7 +30,8 @@ const u32 tiled_pitches[] = {
0x00010000 0x00010000
}; };
struct CellGcmSysConfig { struct gcm_config
{
u32 zculls_addr; u32 zculls_addr;
vm::ptr<CellGcmDisplayInfo> gcm_buffers = vm::null; vm::ptr<CellGcmDisplayInfo> gcm_buffers = vm::null;
u32 tiles_addr; u32 tiles_addr;
@ -96,12 +97,7 @@ void InitOffsetTable()
u32 cellGcmGetLabelAddress(u8 index) u32 cellGcmGetLabelAddress(u8 index)
{ {
cellGcmSys.trace("cellGcmGetLabelAddress(index=%d)", index); cellGcmSys.trace("cellGcmGetLabelAddress(index=%d)", index);
const auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->gcm_info.label_addr + 0x10 * index;
if (!m_config)
return 0;
return m_config->gcm_info.label_addr + 0x10 * index;
} }
vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 location) vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 location)
@ -125,7 +121,7 @@ vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 lo
cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); cellGcmSys.error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index);
} }
return vm::ptr<CellGcmReportData>::make(fxm::get<CellGcmSysConfig>()->gcm_info.label_addr + 0x1400 + index * 0x10); return vm::ptr<CellGcmReportData>::make(g_fxo->get<gcm_config>()->gcm_info.label_addr + 0x1400 + index * 0x10);
} }
u64 cellGcmGetTimeStamp(u32 index) u64 cellGcmGetTimeStamp(u32 index)
@ -137,7 +133,7 @@ u64 cellGcmGetTimeStamp(u32 index)
cellGcmSys.error("cellGcmGetTimeStamp: Wrong local index (%d)", index); cellGcmSys.error("cellGcmGetTimeStamp: Wrong local index (%d)", index);
} }
return vm::read64(fxm::get<CellGcmSysConfig>()->gcm_info.label_addr + 0x1400 + index * 0x10); return vm::read64(g_fxo->get<gcm_config>()->gcm_info.label_addr + 0x1400 + index * 0x10);
} }
u32 cellGcmGetCurrentField() u32 cellGcmGetCurrentField()
@ -164,7 +160,7 @@ u32 cellGcmGetNotifyDataAddress(u32 index)
*/ */
vm::ptr<CellGcmReportData> _cellGcmFunc12() vm::ptr<CellGcmReportData> _cellGcmFunc12()
{ {
return vm::ptr<CellGcmReportData>::make(fxm::get<CellGcmSysConfig>()->gcm_info.label_addr + 0x1400); // TODO return vm::ptr<CellGcmReportData>::make(g_fxo->get<gcm_config>()->gcm_info.label_addr + 0x1400); // TODO
} }
u32 cellGcmGetReport(u32 type, u32 index) u32 cellGcmGetReport(u32 type, u32 index)
@ -193,7 +189,7 @@ u32 cellGcmGetReportDataAddress(u32 index)
cellGcmSys.error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); cellGcmSys.error("cellGcmGetReportDataAddress: Wrong local index (%d)", index);
} }
return fxm::get<CellGcmSysConfig>()->gcm_info.label_addr + 0x1400 + index * 0x10; return g_fxo->get<gcm_config>()->gcm_info.label_addr + 0x1400 + index * 0x10;
} }
u32 cellGcmGetReportDataLocation(u32 index, u32 location) u32 cellGcmGetReportDataLocation(u32 index, u32 location)
@ -213,7 +209,7 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
cellGcmSys.error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index); cellGcmSys.error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index);
return 0; return 0;
} }
return vm::read64(fxm::get<CellGcmSysConfig>()->gcm_info.label_addr + 0x1400 + index * 0x10); return vm::read64(g_fxo->get<gcm_config>()->gcm_info.label_addr + 0x1400 + index * 0x10);
} }
if (location == CELL_GCM_LOCATION_MAIN) { if (location == CELL_GCM_LOCATION_MAIN) {
@ -235,31 +231,19 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
u32 cellGcmGetControlRegister() u32 cellGcmGetControlRegister()
{ {
cellGcmSys.trace("cellGcmGetControlRegister()"); cellGcmSys.trace("cellGcmGetControlRegister()");
const auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->gcm_info.control_addr;
if (!m_config)
return 0;
return m_config->gcm_info.control_addr;
} }
u32 cellGcmGetDefaultCommandWordSize() u32 cellGcmGetDefaultCommandWordSize()
{ {
cellGcmSys.trace("cellGcmGetDefaultCommandWordSize()"); cellGcmSys.trace("cellGcmGetDefaultCommandWordSize()");
const auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->gcm_info.command_size;
if (!m_config)
return 0;
return m_config->gcm_info.command_size;
} }
u32 cellGcmGetDefaultSegmentWordSize() u32 cellGcmGetDefaultSegmentWordSize()
{ {
cellGcmSys.trace("cellGcmGetDefaultSegmentWordSize()"); cellGcmSys.trace("cellGcmGetDefaultSegmentWordSize()");
const auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->gcm_info.segment_size;
if (!m_config)
return 0;
return m_config->gcm_info.segment_size;
} }
s32 cellGcmInitDefaultFifoMode(s32 mode) s32 cellGcmInitDefaultFifoMode(s32 mode)
@ -312,10 +296,7 @@ s32 cellGcmBindZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
void cellGcmGetConfiguration(vm::ptr<CellGcmConfig> config) void cellGcmGetConfiguration(vm::ptr<CellGcmConfig> config)
{ {
cellGcmSys.trace("cellGcmGetConfiguration(config=*0x%x)", config); cellGcmSys.trace("cellGcmGetConfiguration(config=*0x%x)", config);
const auto m_config = fxm::get<CellGcmSysConfig>(); *config = g_fxo->get<gcm_config>()->current_config;
if (m_config)
*config = m_config->current_config;
} }
u32 cellGcmGetFlipStatus() u32 cellGcmGetFlipStatus()
@ -364,12 +345,10 @@ s32 _cellGcmInitBody(ppu_thread& ppu, vm::pptr<CellGcmContextData> context, u32
{ {
cellGcmSys.warning("_cellGcmInitBody(context=**0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context, cmdSize, ioSize, ioAddress); cellGcmSys.warning("_cellGcmInitBody(context=**0x%x, cmdSize=0x%x, ioSize=0x%x, ioAddress=0x%x)", context, cmdSize, ioSize, ioAddress);
auto m_config = fxm::make<CellGcmSysConfig>(); const auto gcm_cfg = g_fxo->get<gcm_config>();
if (!m_config)
return CELL_GCM_ERROR_FAILURE;
m_config->current_config.ioAddress = 0; gcm_cfg->current_config.ioAddress = 0;
m_config->current_config.localAddress = 0; gcm_cfg->current_config.localAddress = 0;
local_size = 0; local_size = 0;
local_addr = 0; local_addr = 0;
@ -402,12 +381,12 @@ s32 _cellGcmInitBody(ppu_thread& ppu, vm::pptr<CellGcmContextData> context, u32
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
m_config->current_config.ioSize = ioSize; gcm_cfg->current_config.ioSize = ioSize;
m_config->current_config.ioAddress = ioAddress; gcm_cfg->current_config.ioAddress = ioAddress;
m_config->current_config.localSize = local_size; gcm_cfg->current_config.localSize = local_size;
m_config->current_config.localAddress = local_addr; gcm_cfg->current_config.localAddress = local_addr;
m_config->current_config.memoryFrequency = 650000000; gcm_cfg->current_config.memoryFrequency = 650000000;
m_config->current_config.coreFrequency = 500000000; gcm_cfg->current_config.coreFrequency = 500000000;
// Create contexts // Create contexts
auto ctx_area = vm::find_map(0x10000000, 0x10000000, 0x403); auto ctx_area = vm::find_map(0x10000000, 0x10000000, 0x403);
@ -419,26 +398,26 @@ s32 _cellGcmInitBody(ppu_thread& ppu, vm::pptr<CellGcmContextData> context, u32
g_defaultCommandBufferBegin = ioAddress; g_defaultCommandBufferBegin = ioAddress;
g_defaultCommandBufferFragmentCount = cmdSize / (32 * 1024); g_defaultCommandBufferFragmentCount = cmdSize / (32 * 1024);
m_config->gcm_info.context_addr = rsx_ctxaddr; gcm_cfg->gcm_info.context_addr = rsx_ctxaddr;
m_config->gcm_info.control_addr = rsx_ctxaddr + 0x100000; gcm_cfg->gcm_info.control_addr = rsx_ctxaddr + 0x100000;
m_config->gcm_info.label_addr = rsx_ctxaddr + 0x300000; gcm_cfg->gcm_info.label_addr = rsx_ctxaddr + 0x300000;
m_config->current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning gcm_cfg->current_context.begin.set(g_defaultCommandBufferBegin + 4096); // 4 kb reserved at the beginning
m_config->current_context.end.set(g_defaultCommandBufferBegin + 32 * 1024 - 4); // 4b at the end for jump gcm_cfg->current_context.end.set(g_defaultCommandBufferBegin + 32 * 1024 - 4); // 4b at the end for jump
m_config->current_context.current = m_config->current_context.begin; gcm_cfg->current_context.current = gcm_cfg->current_context.begin;
m_config->current_context.callback.set(ppu_function_manager::addr + 8 * FIND_FUNC(cellGcmCallback)); gcm_cfg->current_context.callback.set(ppu_function_manager::addr + 8 * FIND_FUNC(cellGcmCallback));
m_config->ctxt_addr = context.addr(); gcm_cfg->ctxt_addr = context.addr();
m_config->gcm_buffers.set(vm::alloc(sizeof(CellGcmDisplayInfo) * 8, vm::main)); gcm_cfg->gcm_buffers.set(vm::alloc(sizeof(CellGcmDisplayInfo) * 8, vm::main));
m_config->zculls_addr = vm::alloc(sizeof(CellGcmZcullInfo) * 8, vm::main); gcm_cfg->zculls_addr = vm::alloc(sizeof(CellGcmZcullInfo) * 8, vm::main);
m_config->tiles_addr = vm::alloc(sizeof(CellGcmTileInfo) * 15, vm::main); gcm_cfg->tiles_addr = vm::alloc(sizeof(CellGcmTileInfo) * 15, vm::main);
vm::_ref<CellGcmContextData>(m_config->gcm_info.context_addr) = m_config->current_context; vm::_ref<CellGcmContextData>(gcm_cfg->gcm_info.context_addr) = gcm_cfg->current_context;
context->set(m_config->gcm_info.context_addr); context->set(gcm_cfg->gcm_info.context_addr);
// 0x40 is to offset CellGcmControl from RsxDmaControl // 0x40 is to offset CellGcmControl from RsxDmaControl
m_config->gcm_info.control_addr += 0x40; gcm_cfg->gcm_info.control_addr += 0x40;
auto& ctrl = vm::_ref<CellGcmControl>(m_config->gcm_info.control_addr); auto& ctrl = vm::_ref<CellGcmControl>(gcm_cfg->gcm_info.control_addr);
ctrl.put = 0; ctrl.put = 0;
ctrl.get = 0; ctrl.get = 0;
ctrl.ref = 0; // Set later to -1 at RSX initialization ctrl.ref = 0; // Set later to -1 at RSX initialization
@ -449,9 +428,9 @@ s32 _cellGcmInitBody(ppu_thread& ppu, vm::pptr<CellGcmContextData> context, u32
render->intr_thread = idm::get<named_thread<ppu_thread>>(*_tid); render->intr_thread = idm::get<named_thread<ppu_thread>>(*_tid);
render->intr_thread->state -= cpu_flag::stop; render->intr_thread->state -= cpu_flag::stop;
render->isHLE = true; render->isHLE = true;
render->label_addr = m_config->gcm_info.label_addr; render->label_addr = gcm_cfg->gcm_info.label_addr;
render->ctxt_addr = m_config->gcm_info.context_addr; render->ctxt_addr = gcm_cfg->gcm_info.context_addr;
render->init(m_config->gcm_info.control_addr - 0x40); render->init(gcm_cfg->gcm_info.control_addr - 0x40);
return CELL_OK; return CELL_OK;
} }
@ -490,9 +469,7 @@ s32 cellGcmSetDisplayBuffer(u8 id, u32 offset, u32 pitch, u32 width, u32 height)
{ {
cellGcmSys.trace("cellGcmSetDisplayBuffer(id=0x%x, offset=0x%x, pitch=%d, width=%d, height=%d)", id, offset, width ? pitch / width : pitch, width, height); cellGcmSys.trace("cellGcmSetDisplayBuffer(id=0x%x, offset=0x%x, pitch=%d, width=%d, height=%d)", id, offset, width ? pitch / width : pitch, width, height);
auto m_config = fxm::get<CellGcmSysConfig>(); const auto gcm_cfg = g_fxo->get<gcm_config>();
if (!m_config)
return CELL_GCM_ERROR_FAILURE;
if (id > 7) if (id > 7)
{ {
@ -509,10 +486,10 @@ s32 cellGcmSetDisplayBuffer(u8 id, u32 offset, u32 pitch, u32 width, u32 height)
buffers[id].width = width; buffers[id].width = width;
buffers[id].height = height; buffers[id].height = height;
m_config->gcm_buffers[id].offset = offset; gcm_cfg->gcm_buffers[id].offset = offset;
m_config->gcm_buffers[id].pitch = pitch; gcm_cfg->gcm_buffers[id].pitch = pitch;
m_config->gcm_buffers[id].width = width; gcm_cfg->gcm_buffers[id].width = width;
m_config->gcm_buffers[id].height = height; gcm_cfg->gcm_buffers[id].height = height;
if (id + 1u > render->display_buffers_count) if (id + 1u > render->display_buffers_count)
{ {
@ -564,9 +541,8 @@ s32 cellGcmSetFlipStatus2()
s32 cellGcmSetPrepareFlip(ppu_thread& ppu, vm::ptr<CellGcmContextData> ctxt, u32 id) s32 cellGcmSetPrepareFlip(ppu_thread& ppu, vm::ptr<CellGcmContextData> ctxt, u32 id)
{ {
cellGcmSys.trace("cellGcmSetPrepareFlip(ctxt=*0x%x, id=0x%x)", ctxt, id); cellGcmSys.trace("cellGcmSetPrepareFlip(ctxt=*0x%x, id=0x%x)", ctxt, id);
auto m_config = fxm::get<CellGcmSysConfig>();
if (!m_config) const auto gcm_cfg = g_fxo->get<gcm_config>();
return CELL_GCM_ERROR_FAILURE;
if (id > 7) if (id > 7)
{ {
@ -585,9 +561,9 @@ s32 cellGcmSetPrepareFlip(ppu_thread& ppu, vm::ptr<CellGcmContextData> ctxt, u32
const u32 cmd_size = rsx::make_command(ctxt->current, GCM_FLIP_COMMAND, { id }); const u32 cmd_size = rsx::make_command(ctxt->current, GCM_FLIP_COMMAND, { id });
if (ctxt.addr() == m_config->gcm_info.context_addr) if (ctxt.addr() == gcm_cfg->gcm_info.context_addr)
{ {
vm::_ref<CellGcmControl>(m_config->gcm_info.control_addr).put += cmd_size; vm::_ref<CellGcmControl>(gcm_cfg->gcm_info.control_addr).put += cmd_size;
} }
return id; return id;
@ -633,9 +609,7 @@ s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
cellGcmSys.warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", cellGcmSys.warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank); index, location, offset, size, pitch, comp, base, bank);
auto m_config = fxm::get<CellGcmSysConfig>(); const auto gcm_cfg = g_fxo->get<gcm_config>();
if (!m_config)
return CELL_GCM_ERROR_FAILURE;
if (index >= rsx::limits::tiles_count || base >= 2048 || bank >= 4) if (index >= rsx::limits::tiles_count || base >= 2048 || bank >= 4)
{ {
@ -671,7 +645,7 @@ s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
tile.base = base; tile.base = base;
tile.bank = bank; tile.bank = bank;
vm::_ptr<CellGcmTileInfo>(m_config->tiles_addr)[index] = tile.pack(); vm::_ptr<CellGcmTileInfo>(gcm_cfg->tiles_addr)[index] = tile.pack();
return CELL_OK; return CELL_OK;
} }
@ -713,9 +687,7 @@ void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
cellGcmSys.todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", cellGcmSys.todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)",
index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask);
auto m_config = fxm::get<CellGcmSysConfig>(); const auto gcm_cfg = g_fxo->get<gcm_config>();
if (!m_config)
return;
if (index >= rsx::limits::zculls_count) if (index >= rsx::limits::zculls_count)
{ {
@ -739,7 +711,7 @@ void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
zcull.sMask = sMask; zcull.sMask = sMask;
zcull.binded = (zCullFormat > 0); zcull.binded = (zCullFormat > 0);
vm::_ptr<CellGcmZcullInfo>(m_config->zculls_addr)[index] = zcull.pack(); vm::_ptr<CellGcmZcullInfo>(gcm_cfg->zculls_addr)[index] = zcull.pack();
} }
s32 cellGcmUnbindTile(u8 index) s32 cellGcmUnbindTile(u8 index)
@ -775,28 +747,19 @@ s32 cellGcmUnbindZcull(u8 index)
u32 cellGcmGetTileInfo() u32 cellGcmGetTileInfo()
{ {
cellGcmSys.warning("cellGcmGetTileInfo()"); cellGcmSys.warning("cellGcmGetTileInfo()");
auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->tiles_addr;
if (!m_config)
return 0;
return m_config->tiles_addr;
} }
u32 cellGcmGetZcullInfo() u32 cellGcmGetZcullInfo()
{ {
cellGcmSys.warning("cellGcmGetZcullInfo()"); cellGcmSys.warning("cellGcmGetZcullInfo()");
auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->zculls_addr;
if (!m_config)
return 0;
return m_config->zculls_addr;
} }
u32 cellGcmGetDisplayInfo() u32 cellGcmGetDisplayInfo()
{ {
cellGcmSys.warning("cellGcmGetDisplayInfo()"); cellGcmSys.warning("cellGcmGetDisplayInfo()");
auto m_config = fxm::get<CellGcmSysConfig>(); return g_fxo->get<gcm_config>()->gcm_buffers.addr();
if (!m_config)
return 0;
return m_config->gcm_buffers.addr();
} }
s32 cellGcmGetCurrentDisplayBufferId(vm::ptr<u8> id) s32 cellGcmGetCurrentDisplayBufferId(vm::ptr<u8> id)
@ -1241,27 +1204,28 @@ s32 cellGcmSetCursorImageOffset(u32 offset)
void cellGcmSetDefaultCommandBuffer() void cellGcmSetDefaultCommandBuffer()
{ {
cellGcmSys.warning("cellGcmSetDefaultCommandBuffer()"); cellGcmSys.warning("cellGcmSetDefaultCommandBuffer()");
auto m_config = fxm::get<CellGcmSysConfig>();
if (m_config) const auto gcm_cfg = g_fxo->get<gcm_config>();
vm::write32(m_config->ctxt_addr, m_config->gcm_info.context_addr);
vm::write32(gcm_cfg->ctxt_addr, gcm_cfg->gcm_info.context_addr);
} }
s32 cellGcmSetDefaultCommandBufferAndSegmentWordSize(u32 bufferSize, u32 segmentSize) s32 cellGcmSetDefaultCommandBufferAndSegmentWordSize(u32 bufferSize, u32 segmentSize)
{ {
cellGcmSys.warning("cellGcmSetDefaultCommandBufferAndSegmentWordSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize); cellGcmSys.warning("cellGcmSetDefaultCommandBufferAndSegmentWordSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize);
auto m_config = fxm::get<CellGcmSysConfig>();
if (!m_config) const auto gcm_cfg = g_fxo->get<gcm_config>();
return CELL_GCM_ERROR_FAILURE;
const auto& put = vm::_ref<CellGcmControl>(m_config->gcm_info.control_addr).put; const auto& put = vm::_ref<CellGcmControl>(gcm_cfg->gcm_info.control_addr).put;
const auto& get = vm::_ref<CellGcmControl>(m_config->gcm_info.control_addr).get; const auto& get = vm::_ref<CellGcmControl>(gcm_cfg->gcm_info.control_addr).get;
if (put != 0x1000 || get != 0x1000 || bufferSize < segmentSize * 2 || segmentSize >= 0x80000000) if (put != 0x1000 || get != 0x1000 || bufferSize < segmentSize * 2 || segmentSize >= 0x80000000)
{ {
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
m_config->gcm_info.command_size = bufferSize; gcm_cfg->gcm_info.command_size = bufferSize;
m_config->gcm_info.segment_size = segmentSize; gcm_cfg->gcm_info.segment_size = segmentSize;
return CELL_OK; return CELL_OK;
} }
@ -1286,11 +1250,11 @@ s32 _cellGcmSetFlipCommand2()
s32 _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptr<CellGcmContextData> ctx, u32 id, u32 label_index, u32 label_value) s32 _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptr<CellGcmContextData> ctx, u32 id, u32 label_index, u32 label_value)
{ {
cellGcmSys.trace("cellGcmSetFlipCommandWithWaitLabel(ctx=*0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)", ctx, id, label_index, label_value); cellGcmSys.trace("cellGcmSetFlipCommandWithWaitLabel(ctx=*0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)", ctx, id, label_index, label_value);
auto m_config = fxm::get<CellGcmSysConfig>();
if (!m_config) const auto gcm_cfg = g_fxo->get<gcm_config>();
return CELL_GCM_ERROR_FAILURE;
s32 res = cellGcmSetPrepareFlip(ppu, ctx, id); s32 res = cellGcmSetPrepareFlip(ppu, ctx, id);
vm::write32(m_config->gcm_info.label_addr + 0x10 * label_index, label_value); vm::write32(gcm_cfg->gcm_info.label_addr + 0x10 * label_index, label_value);
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK; return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
} }
@ -1299,9 +1263,7 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
cellGcmSys.warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", cellGcmSys.warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank); index, location, offset, size, pitch, comp, base, bank);
auto m_config = fxm::get<CellGcmSysConfig>(); const auto gcm_cfg = g_fxo->get<gcm_config>();
if (!m_config)
return CELL_GCM_ERROR_FAILURE;
// Copied form cellGcmSetTileInfo // Copied form cellGcmSetTileInfo
if (index >= rsx::limits::tiles_count || base >= 2048 || bank >= 4) if (index >= rsx::limits::tiles_count || base >= 2048 || bank >= 4)
@ -1339,7 +1301,7 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
tile.bank = bank; tile.bank = bank;
tile.binded = (pitch > 0); tile.binded = (pitch > 0);
vm::_ptr<CellGcmTileInfo>(m_config->tiles_addr)[index] = tile.pack(); vm::_ptr<CellGcmTileInfo>(gcm_cfg->tiles_addr)[index] = tile.pack();
return CELL_OK; return CELL_OK;
} }
@ -1431,11 +1393,10 @@ static bool isInCommandBufferExcept(u32 getPos, u32 bufferBegin, u32 bufferEnd)
s32 cellGcmCallback(ppu_thread& ppu, vm::ptr<CellGcmContextData> context, u32 count) s32 cellGcmCallback(ppu_thread& ppu, vm::ptr<CellGcmContextData> context, u32 count)
{ {
cellGcmSys.trace("cellGcmCallback(context=*0x%x, count=0x%x)", context, count); cellGcmSys.trace("cellGcmCallback(context=*0x%x, count=0x%x)", context, count);
auto m_config = fxm::get<CellGcmSysConfig>();
if (!m_config)
return CELL_GCM_ERROR_FAILURE;
auto& ctrl = vm::_ref<CellGcmControl>(m_config->gcm_info.control_addr); const auto gcm_cfg = g_fxo->get<gcm_config>();
auto& ctrl = vm::_ref<CellGcmControl>(gcm_cfg->gcm_info.control_addr);
// Flush command buffer (ie allow RSX to read up to context->current) // Flush command buffer (ie allow RSX to read up to context->current)
ctrl.put.exchange(getOffsetFromAddress(context->current.addr())); ctrl.put.exchange(getOffsetFromAddress(context->current.addr()));