mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
commit
7624c89d12
10 changed files with 49 additions and 38 deletions
|
@ -280,13 +280,13 @@ void SPUThread::ProcessCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
|
|||
{
|
||||
case MFC_PUT_CMD:
|
||||
{
|
||||
memcpy(vm::get_ptr<void>((u32)ea), vm::get_ptr<void>(ls_offset + lsa), size);
|
||||
memcpy(vm::get_ptr(vm::cast(ea)), vm::get_ptr(ls_offset + lsa), size);
|
||||
return;
|
||||
}
|
||||
|
||||
case MFC_GET_CMD:
|
||||
{
|
||||
memcpy(vm::get_ptr<void>(ls_offset + lsa), vm::get_ptr<void>((u32)ea), size);
|
||||
memcpy(vm::get_ptr(ls_offset + lsa), vm::get_ptr(vm::cast(ea)), size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -470,13 +470,17 @@ void SPUThread::EnqMfcCmd(MFCReg& MFCArgs)
|
|||
{
|
||||
vm::reservation_op(ea, 128, [this, tag, lsa, ea]()
|
||||
{
|
||||
ProcessCmd(MFC_PUT_CMD, tag, lsa, ea, 128);
|
||||
memcpy(vm::get_priv_ptr(vm::cast(ea)), vm::get_ptr(ls_offset + lsa), 128);
|
||||
});
|
||||
|
||||
if (op == MFC_PUTLLUC_CMD)
|
||||
{
|
||||
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLUC_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// tag may be used here
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ public:
|
|||
}
|
||||
|
||||
// Write the FPSCR
|
||||
void Write(u128 & r)
|
||||
void Write(const u128 & r)
|
||||
{
|
||||
_u32[3] = r._u32[3] & 0x00000F07;
|
||||
_u32[2] = r._u32[2] & 0x00003F07;
|
||||
|
|
|
@ -2229,8 +2229,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
|
|||
|
||||
temp.reset(new u8[out_bpp * out_w * out_h]);
|
||||
|
||||
AVPixelFormat in_format = m_color_format == 4 ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_BGRA; // ???
|
||||
AVPixelFormat out_format = m_color_conv_fmt == 7 ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_BGRA; // ???
|
||||
AVPixelFormat in_format = m_color_format == 4 ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_ARGB; // ???
|
||||
AVPixelFormat out_format = m_color_conv_fmt == 7 ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_ARGB; // ???
|
||||
|
||||
std::unique_ptr<SwsContext, void(*)(SwsContext*)> sws(sws_getContext(width, height, in_format, out_w, out_h, out_format, inter ? SWS_FAST_BILINEAR : SWS_POINT, NULL, NULL, NULL), sws_freeContext);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ void LogBase::LogOutput(LogType type, const std::string& text) const
|
|||
case LogWarning: LOG_WARNING(HLE, GetName() + ": " + text); break;
|
||||
case LogError: LOG_ERROR(HLE, GetName() + " error: " + text); break;
|
||||
case LogTodo: LOG_ERROR(HLE, GetName() + " TODO: " + text); break;
|
||||
case LogFatal: throw GetName() + " error: " + text;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ class LogBase
|
|||
LogSuccess,
|
||||
LogWarning,
|
||||
LogError,
|
||||
LogFatal,
|
||||
LogTodo,
|
||||
};
|
||||
|
||||
|
@ -68,6 +69,12 @@ public:
|
|||
LogPrepare(LogError, fmt, fmt::do_unveil(args)...);
|
||||
}
|
||||
|
||||
template<typename... Targs>
|
||||
__forceinline void Fatal(const char* fmt, Targs... args) const
|
||||
{
|
||||
LogPrepare(LogFatal, fmt, fmt::do_unveil(args)...);
|
||||
}
|
||||
|
||||
template<typename... Targs>
|
||||
__forceinline void Todo(const char* fmt, Targs... args) const
|
||||
{
|
||||
|
|
|
@ -679,7 +679,11 @@ int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
|
|||
return CELL_ADEC_ERROR_EMPTY;
|
||||
}
|
||||
|
||||
AVFrame* frame = af.data;
|
||||
std::unique_ptr<AVFrame, void(*)(AVFrame*)> frame(af.data, [](AVFrame* frame)
|
||||
{
|
||||
av_frame_unref(frame);
|
||||
av_frame_free(&frame);
|
||||
});
|
||||
|
||||
if (outBuffer)
|
||||
{
|
||||
|
@ -766,13 +770,10 @@ int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
|
|||
}
|
||||
else
|
||||
{
|
||||
cellAdec->Error("cellAdecGetPcm(): unsupported frame format (channels=%d, format=%d)", frame->channels, frame->format);
|
||||
Emu.Pause();
|
||||
cellAdec->Fatal("cellAdecGetPcm(): unsupported frame format (channels=%d, format=%d)", frame->channels, frame->format);
|
||||
}
|
||||
}
|
||||
|
||||
av_frame_unref(af.data);
|
||||
av_frame_free(&af.data);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -593,7 +593,7 @@ struct CellSpursEventFlag
|
|||
u8 _u8[size];
|
||||
|
||||
// Real data
|
||||
struct _CellSpursEventFlag
|
||||
struct
|
||||
{
|
||||
be_t<u16> events; // 0x00 Event bits
|
||||
be_t<u16> spuTaskPendingRecv; // 0x02 A bit is set to 1 when the condition of the SPU task using the slot are met and back to 0 when the SPU task unblocks
|
||||
|
@ -615,7 +615,7 @@ struct CellSpursEventFlag
|
|||
be_t<u32> eventQueueId; // 0x7C
|
||||
} m;
|
||||
|
||||
static_assert(sizeof(_CellSpursEventFlag) == size, "Wrong _CellSpursEventFlag size");
|
||||
static_assert(sizeof(decltype(m)) == size, "Wrong _CellSpursEventFlag size");
|
||||
|
||||
SPURSManagerEventFlag *eventFlag;
|
||||
};
|
||||
|
@ -652,7 +652,7 @@ struct CellSpursTaskset
|
|||
u8 _u8[size];
|
||||
|
||||
// Real data
|
||||
struct _CellSpursTaskset
|
||||
struct
|
||||
{
|
||||
be_t<u128> running; // 0x00
|
||||
be_t<u128> ready; // 0x10
|
||||
|
@ -678,7 +678,7 @@ struct CellSpursTaskset
|
|||
u8 unk3[0x60]; // 0x18A0
|
||||
} m;
|
||||
|
||||
static_assert(sizeof(_CellSpursTaskset) == size, "Wrong _CellSpursTaskset size");
|
||||
static_assert(sizeof(decltype(m)) == size, "Wrong _CellSpursTaskset size");
|
||||
|
||||
SPURSManagerTaskset *taskset;
|
||||
};
|
||||
|
@ -761,7 +761,7 @@ struct CellSpursTaskset2
|
|||
u8 _u8[size];
|
||||
|
||||
// Real data
|
||||
struct _CellSpursTaskset2
|
||||
struct
|
||||
{
|
||||
be_t<u32> running_set[4]; // 0x00
|
||||
be_t<u32> ready_set[4]; // 0x10
|
||||
|
@ -789,7 +789,7 @@ struct CellSpursTaskset2
|
|||
u8 unk4[0x2900 - 0x2180]; // 0x2180
|
||||
} m;
|
||||
|
||||
static_assert(sizeof(_CellSpursTaskset2) == size, "Wrong _CellSpursTaskset2 size");
|
||||
static_assert(sizeof(decltype(m)) == size, "Wrong _CellSpursTaskset2 size");
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -465,10 +465,10 @@ void spursKernelDispatchWorkload(SPUThread & spu, u64 widAndPollStatus) {
|
|||
auto wid = (u32)(widAndPollStatus >> 32);
|
||||
|
||||
// DMA in the workload info for the selected workload
|
||||
auto wklInfoOffset = wid < CELL_SPURS_MAX_WORKLOAD ? offsetof(CellSpurs, m.wklInfo1[wid]) :
|
||||
wid < CELL_SPURS_MAX_WORKLOAD2 && isKernel2 ? offsetof(CellSpurs, m.wklInfo2[wid & 0xf]) :
|
||||
offsetof(CellSpurs, m.wklInfoSysSrv);
|
||||
spursDma(spu, MFC_GET_CMD, ctxt->spurs.addr() + wklInfoOffset, 0x3FFE0/*LSA*/, 0x20/*size*/, CELL_SPURS_KERNEL_DMA_TAG_ID);
|
||||
auto wklInfoOffset = wid < CELL_SPURS_MAX_WORKLOAD ? &ctxt->spurs->m.wklInfo1[wid] :
|
||||
wid < CELL_SPURS_MAX_WORKLOAD2 && isKernel2 ? &ctxt->spurs->m.wklInfo2[wid & 0xf] :
|
||||
&ctxt->spurs->m.wklInfoSysSrv;
|
||||
spursDma(spu, MFC_GET_CMD, vm::get_addr(wklInfoOffset), 0x3FFE0/*LSA*/, 0x20/*size*/, CELL_SPURS_KERNEL_DMA_TAG_ID);
|
||||
spursDmaWaitForCompletion(spu, 0x80000000);
|
||||
|
||||
// Load the workload to LS
|
||||
|
@ -1423,7 +1423,7 @@ void spursTasksetDispatch(SPUThread & spu) {
|
|||
ctxt->taskId = taskId;
|
||||
|
||||
// DMA in the task info for the selected task
|
||||
spursDma(spu, MFC_GET_CMD, ctxt->taskset.addr() + offsetof(CellSpursTaskset, m.task_info[taskId]), 0x2780/*LSA*/, sizeof(CellSpursTaskset::TaskInfo), ctxt->dmaTagId);
|
||||
spursDma(spu, MFC_GET_CMD, vm::get_addr(&ctxt->taskset->m.task_info[taskId]), 0x2780/*LSA*/, sizeof(CellSpursTaskset::TaskInfo), ctxt->dmaTagId);
|
||||
spursDmaWaitForCompletion(spu, 1 << ctxt->dmaTagId);
|
||||
auto taskInfo = vm::get_ptr<CellSpursTaskset::TaskInfo>(spu.ls_offset + 0x2780);
|
||||
auto elfAddr = taskInfo->elf_addr.addr().value();
|
||||
|
@ -1459,7 +1459,7 @@ void spursTasksetDispatch(SPUThread & spu) {
|
|||
ctxt->x2FD4 = elfAddr & 5; // TODO: Figure this out
|
||||
|
||||
if ((elfAddr & 5) == 1) {
|
||||
spursDma(spu, MFC_GET_CMD, ctxt->taskset.addr() + offsetof(CellSpursTaskset2, m.task_exit_code[taskId]), 0x2FC0/*LSA*/, 0x10/*size*/, ctxt->dmaTagId);
|
||||
spursDma(spu, MFC_GET_CMD, vm::get_addr(&((CellSpursTaskset2*)(ctxt->taskset.get_ptr()))->m.task_exit_code[taskId]), 0x2FC0/*LSA*/, 0x10/*size*/, ctxt->dmaTagId);
|
||||
}
|
||||
|
||||
// Trace - GUID
|
||||
|
|
|
@ -693,36 +693,35 @@ int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
std::unique_ptr<AVFrame, void(*)(AVFrame*)> frame(vf.data, [](AVFrame* frame)
|
||||
{
|
||||
av_frame_unref(frame);
|
||||
av_frame_free(&frame);
|
||||
});
|
||||
|
||||
if (outBuff)
|
||||
{
|
||||
const u32 buf_size = align(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1), 128);
|
||||
|
||||
if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR)
|
||||
{
|
||||
cellVdec->Todo("cellVdecGetPicture: unknown formatType(%d)", (u32)format->formatType);
|
||||
return CELL_OK;
|
||||
cellVdec->Fatal("cellVdecGetPicture: unknown formatType(%d)", format->formatType);
|
||||
}
|
||||
|
||||
if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709)
|
||||
{
|
||||
cellVdec->Todo("cellVdecGetPicture: unknown colorMatrixType(%d)", (u32)format->colorMatrixType);
|
||||
return CELL_OK;
|
||||
cellVdec->Fatal("cellVdecGetPicture: unknown colorMatrixType(%d)", format->colorMatrixType);
|
||||
}
|
||||
|
||||
AVFrame& frame = *vf.data;
|
||||
const u32 buf_size = align(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1), 128);
|
||||
|
||||
// TODO: zero padding bytes
|
||||
|
||||
int err = av_image_copy_to_buffer(outBuff.get_ptr(), buf_size, frame.data, frame.linesize, vdec->ctx->pix_fmt, frame.width, frame.height, 1);
|
||||
int err = av_image_copy_to_buffer(outBuff.get_ptr(), buf_size, frame->data, frame->linesize, vdec->ctx->pix_fmt, frame->width, frame->height, 1);
|
||||
if (err < 0)
|
||||
{
|
||||
cellVdec->Error("cellVdecGetPicture: av_image_copy_to_buffer failed (err=0x%x)", err);
|
||||
Emu.Pause();
|
||||
cellVdec->Fatal("cellVdecGetPicture: av_image_copy_to_buffer failed (err=0x%x)", err);
|
||||
}
|
||||
}
|
||||
|
||||
av_frame_unref(vf.data);
|
||||
av_frame_free(&vf.data);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -863,8 +862,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
|
|||
{
|
||||
auto mp2 = vm::ptr<CellVdecMpeg2Info>::make(info.addr() + sizeof(CellVdecPicItem));
|
||||
|
||||
cellVdec->Todo("cellVdecGetPicItem(MPEG2)");
|
||||
Emu.Pause();
|
||||
cellVdec->Fatal("cellVdecGetPicItem(MPEG2)");
|
||||
}
|
||||
|
||||
*picItem_ptr = info.addr();
|
||||
|
|
|
@ -128,7 +128,7 @@ int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpo
|
|||
//u64 stamp0 = get_system_time();
|
||||
std::unique_ptr<u8[]> pA(new u8[w*h]);
|
||||
|
||||
memset(pA.get(), (const u8)ctrlParam->outAlpha, w*h);
|
||||
memset(pA.get(), ctrlParam->outAlpha, w*h);
|
||||
|
||||
//u64 stamp1 = get_system_time();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue