Updates in sys_rsx and CellGcmDisplayInfo

Thanks a lot to @3141card for all the relevant information about RSX
related lv2 syscalls.
This commit is contained in:
Alexandro Sánchez Bach 2014-08-16 23:45:56 +02:00
parent 2fb95556a5
commit b7be8b19ef
5 changed files with 121 additions and 36 deletions

View File

@ -238,17 +238,17 @@ struct CellGcmSurface
u8 colorFormat;
u8 colorTarget;
u8 colorLocation[4];
u32 colorOffset[4];
u32 colorPitch[4];
be_t<u32> colorOffset[4];
be_t<u32> colorPitch[4];
u8 depthFormat;
u8 depthLocation;
u8 _padding[2];
u32 depthOffset;
u32 depthPitch;
u16 width;
u16 height;
u16 x;
u16 y;
be_t<u32> depthOffset;
be_t<u32> depthPitch;
be_t<u16> width;
be_t<u16> height;
be_t<u16> x;
be_t<u16> y;
};
struct CellGcmReportData
@ -268,6 +268,14 @@ struct CellGcmZcullInfo
u32 status1;
};
struct CellGcmDisplayInfo
{
be_t<u32> offset;
be_t<u32> pitch;
be_t<u32> width;
be_t<u32> height;
};
struct CellGcmTileInfo
{
be_t<u32> tile;

View File

@ -14,7 +14,7 @@
#define CMD_LOG(...)
#endif
gcmBuffer gcmBuffers[8];
CellGcmDisplayInfo gcmBuffers[8];
GLuint g_flip_tex, g_depth_tex, g_pbo[6];
int last_width = 0, last_height = 0, last_depth_format = 0;
@ -1272,13 +1272,13 @@ void GLGSRender::Flip()
if (m_read_buffer)
{
format = GL_BGRA;
gcmBuffer* buffers = (gcmBuffer*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
u32 addr = GetAddress(re(buffers[m_gcm_current_buffer].offset), CELL_GCM_LOCATION_LOCAL);
CellGcmDisplayInfo* buffers = (CellGcmDisplayInfo*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
u32 addr = GetAddress(buffers[m_gcm_current_buffer].offset, CELL_GCM_LOCATION_LOCAL);
if (Memory.IsGoodAddr(addr))
{
width = re(buffers[m_gcm_current_buffer].width);
height = re(buffers[m_gcm_current_buffer].height);
width = buffers[m_gcm_current_buffer].width;
height = buffers[m_gcm_current_buffer].height;
src_buffer = (u8*)Memory.VirtualToRealAddr(addr);
}
else

View File

@ -33,14 +33,6 @@ struct GSInfo
}
};
struct gcmBuffer
{
u32 offset;
u32 pitch;
u32 width;
u32 height;
};
class GSManager
{
GSInfo m_info;

View File

@ -1320,7 +1320,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t args, const u32
case 2: m_surface_pitch_a = ARGS(1);
}
gcmBuffer* buffers = (gcmBuffer*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
CellGcmDisplayInfo* buffers = (CellGcmDisplayInfo*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
m_width = re(buffers[m_gcm_current_buffer].width);
m_height = re(buffers[m_gcm_current_buffer].height);

View File

@ -19,27 +19,57 @@ s32 sys_rsx_device_close()
return CELL_OK;
}
s32 sys_rsx_memory_allocate()
/*
* lv2 SysCall 668 (0x29C): sys_rsx_memory_allocate
* @param mem_handle (OUT): Context / ID, which is used by sys_rsx_memory_free to free allocated memory.
* @param mem_addr (OUT): Returns the local memory base address, usually 0xC0000000.
* @param size (IN): Local memory size. E.g. 0x0F900000 (249 MB).
* @param flags (IN): E.g. Immediate value passed in cellGcmSys is 8.
* @param a5 (IN): E.g. Immediate value passed in cellGcmSys is 0x00300000 (3 MB?).
* @param a6 (IN): E.g. Immediate value passed in cellGcmSys is 16.
* @param a7 (IN): E.g. Immediate value passed in cellGcmSys is 8.
*/
s32 sys_rsx_memory_allocate(mem32_t mem_handle, mem32_t mem_addr, u32 size, u64 flags, u64 a5, u64 a6, u64 a7)
{
sys_rsx.Todo("sys_rsx_memory_allocate()");
sys_rsx.Todo("sys_rsx_memory_allocate(mem_handle_addr=0x%x, local_mem_addr=0x%x, size=0x%x, flags=0x%x, a5=%d, a6=%d, a7=%d)",
mem_handle.GetAddr(), mem_addr.GetAddr(), size, flags, a5, a6, a7);
return CELL_OK;
}
s32 sys_rsx_memory_free()
/*
* lv2 SysCall 669 (0x29D): sys_rsx_memory_free
* @param mem_handle (OUT): Context / ID, for allocated local memory generated by sys_rsx_memory_allocate
*/
s32 sys_rsx_memory_free(u32 mem_handle)
{
sys_rsx.Todo("sys_rsx_memory_free()");
sys_rsx.Todo("sys_rsx_memory_free(mem_handle=%d)", mem_handle);
return CELL_OK;
}
s32 sys_rsx_context_allocate()
/*
* lv2 SysCall 670 (0x29E): sys_rsx_context_allocate
* @param context_id (OUT): RSX_context, E.g. 0x55555555 (in vsh.self)
* @param lpar_dma_control (OUT): Control register area. E.g. 0x60100000 (in vsh.self)
* @param lpar_driver_info (OUT): RSX data like frequencies, sizes, version... E.g. 0x60200000 (in vsh.self)
* @param lpar_reports (OUT): Report data area. E.g. 0x60300000 (in vsh.self)
* @param mem_ctx (IN): mem_ctx given by sys_rsx_memory_allocate
* @param system_mode (IN):
*/
s32 sys_rsx_context_allocate(mem32_t context_id, mem32_t lpar_dma_control, mem32_t lpar_driver_info, mem32_t lpar_reports, u64 mem_ctx, u64 system_mode)
{
sys_rsx.Todo("sys_rsx_context_allocate()");
sys_rsx.Todo("sys_rsx_context_allocate(context_id_addr=0x%x, lpar_dma_control_addr=0x%x, lpar_driver_info_addr=0x%x, lpar_reports_addr=0x%x, mem_ctx=0x%x, system_mode=0x%x)",
context_id.GetAddr(), lpar_dma_control.GetAddr(), lpar_driver_info.GetAddr(), lpar_reports.GetAddr(), mem_ctx, system_mode);
return CELL_OK;
}
s32 sys_rsx_context_free()
/*
* lv2 SysCall 671 (0x29F): sys_rsx_context_free
* @param a1 (IN): RSX_context generated by sys_rsx_context_allocate to free the context.
*/
s32 sys_rsx_context_free(u32 context_id)
{
sys_rsx.Todo("sys_rsx_context_free()");
sys_rsx.Todo("sys_rsx_context_free(context_id=%d)", context_id);
return CELL_OK;
}
@ -55,21 +85,76 @@ s32 sys_rsx_context_iounmap()
return CELL_OK;
}
s32 sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6)
/*
* lv2 SysCall 674 (0x2A2): sys_rsx_context_attribute
* @param context_id (IN): RSX context, e.g. 0x55555555
* @param package_id (IN):
* @param a3 (IN):
* @param a4 (IN):
* @param a5 (IN):
* @param a6 (IN):
*/
s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u64 a5, u64 a6)
{
sys_rsx.Todo("sys_rsx_context_attribute(context_id=%d, a2=%llu, a3=%llu, a4=%llu, a5=%llu, a6=%llu)", context_id, a2, a3, a4, a5, a6);
sys_rsx.Todo("sys_rsx_context_attribute(context_id=0x%x, package_id=0x%x, a3=%llu, a4=%llu, a5=%llu, a6=%llu)",
context_id, package_id, a3, a4, a5, a6);
switch(package_id)
{
case 0x001: // ?
break;
case 0x101: // ?
break;
case 0x104: // Display buffer
break;
case 0x10a: // ?
break;
case 0x300: // Tiles
break;
case 0x301: // Depth-buffer (Z-cull)
break;
default:
}
return CELL_OK;
}
s32 sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3)
/*
* lv2 SysCall 675 (0x2A3): sys_rsx_device_map
* @param a1 (OUT): For example: In vsh.self it is 0x60000000, global semaphore. For a game it is 0x40000000.
* @param a2 (OUT): Unused?
* @param dev_id (IN): An immediate value and always 8.
*/
s32 sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 dev_id)
{
sys_rsx.Todo("sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.GetAddr(), a2.GetAddr(), a3);
sys_rsx.Todo("sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.GetAddr(), a2.GetAddr(), dev_id);
if (dev_id > 15) {
// TODO: Throw RSX error
return CELL_EINVAL;
}
if (dev_id == 0 || dev_id > 8) {
// TODO: lv1 related so we may ignore it.
// if (something) { return CELL_EPERM; }
}
return CELL_OK;
}
s32 sys_rsx_device_unmap()
/*
* lv2 SysCall 676 (0x2A4): sys_rsx_device_unmap
* @param dev_id (IN): An immediate value and always 8.
*/
s32 sys_rsx_device_unmap(u32 dev_id)
{
sys_rsx.Todo("sys_rsx_device_unmap()");
sys_rsx.Todo("sys_rsx_device_unmap(a1=%d)", dev_id);
return CELL_OK;
}