sVU: add an option to remove it

The goal is to reduce the burden for new architecture port.

Patch is mostly inspired from 3kinox initial patch. The diff are
*/ used ifdef instead of raw removal
*/ gui don't rely on UseMicroVU* option
*/ completely remove sVU_micro.* file
This commit is contained in:
Gregory Hainaut 2015-01-06 23:45:43 +01:00
parent 3f521cc7a0
commit b03162747c
14 changed files with 96 additions and 18 deletions

View File

@ -17,6 +17,11 @@
# Game DB installation path : -DGAMEINDEX_DIR="/usr/share/games/pcsx2"
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Misc option
#-------------------------------------------------------------------------------
option(DISABLE_SVU "Disable superVU (don't use it)")
#-------------------------------------------------------------------------------
# Graphical option
#-------------------------------------------------------------------------------
@ -129,6 +134,9 @@ elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64")
# x86_64 requires -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# SuperVU will not be ported
set(DISABLE_SVU TRUE)
if (DISABLE_ADVANCE_SIMD)
set(ARCH_FLAG "-msse -msse2")
else()
@ -213,6 +221,9 @@ endif()
# Set some default compiler flags
#-------------------------------------------------------------------------------
set(COMMON_FLAG "-pipe -std=c++0x -fvisibility=hidden -pthread")
if (DISABLE_SVU)
set(COMMON_FLAG "${COMMON_FLAG} -DDISABLE_SVU")
endif()
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
# -Wno-attributes: "always_inline function might not be inlinable" <= real spam (thousand of warnings!!!)
# -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning.

View File

@ -559,11 +559,15 @@ set(pcsx2x86Sources
x86/newVif_Dynarec.cpp
x86/newVif_Unpack.cpp
x86/newVif_UnpackSSE.cpp
)
if (NOT DISABLE_SVU)
set(pcsx2x86Sources ${pcsx2x86Sources}
x86/sVU_Lower.cpp
x86/sVU_Micro.cpp
x86/sVU_Upper.cpp
x86/sVU_zerorec.cpp
)
endif()
# x86 headers
set(pcsx2x86Headers
@ -602,10 +606,6 @@ set(pcsx2x86Headers
x86/newVif.h
x86/newVif_HashBucket.h
x86/newVif_UnpackSSE.h
x86/sVU_Compare.h
x86/sVU_Debug.h
x86/sVU_Micro.h
x86/sVU_zerorec.h
)
# colect .asm files
@ -614,11 +614,14 @@ set(pcsx2AsmFiles
x86/ix86-32/aVif_proc-32.asm)
# collect .S files
set(pcsx2SSources
x86/aVUzerorec.S)
if (NOT DISABLE_SVU)
set(pcsx2SSources x86/aVUzerorec.S)
# change language of .S-files to c++
set_source_files_properties(${pcsx2SSources} PROPERTIES LANGUAGE CXX)
else()
set(pcsx2SSources "")
endif()
# change language of .S-files to c++
set_source_files_properties(${pcsx2SSources} PROPERTIES LANGUAGE CXX)
# common Sources
set(Common

View File

@ -331,10 +331,11 @@ CpuInitializer< CpuType >::~CpuInitializer() throw()
class CpuInitializerSet
{
public:
#ifndef DISABLE_SVU
// Note: Allocate sVU first -- it's the most picky.
CpuInitializer<recSuperVU0> superVU0;
CpuInitializer<recSuperVU1> superVU1;
#endif
CpuInitializer<recMicroVU0> microVU0;
CpuInitializer<recMicroVU1> microVU1;
@ -491,10 +492,12 @@ bool SysCpuProviderPack::IsRecAvailable_MicroVU1() const { return CpuProviders->
BaseException* SysCpuProviderPack::GetException_MicroVU0() const { return CpuProviders->microVU0.ExThrown; }
BaseException* SysCpuProviderPack::GetException_MicroVU1() const { return CpuProviders->microVU1.ExThrown; }
#ifndef DISABLE_SVU
bool SysCpuProviderPack::IsRecAvailable_SuperVU0() const { return CpuProviders->superVU0.IsAvailable(); }
bool SysCpuProviderPack::IsRecAvailable_SuperVU1() const { return CpuProviders->superVU1.IsAvailable(); }
BaseException* SysCpuProviderPack::GetException_SuperVU0() const { return CpuProviders->superVU0.ExThrown; }
BaseException* SysCpuProviderPack::GetException_SuperVU1() const { return CpuProviders->superVU1.ExThrown; }
#endif
void SysCpuProviderPack::CleanupMess() throw()
@ -522,10 +525,16 @@ bool SysCpuProviderPack::HadSomeFailures( const Pcsx2Config::RecompilerOptions&
{
return (recOpts.EnableEE && !IsRecAvailable_EE()) ||
(recOpts.EnableIOP && !IsRecAvailable_IOP()) ||
#ifndef DISABLE_SVU
(recOpts.EnableVU0 && recOpts.UseMicroVU0 && !IsRecAvailable_MicroVU0()) ||
(recOpts.EnableVU1 && recOpts.UseMicroVU0 && !IsRecAvailable_MicroVU1()) ||
(recOpts.EnableVU0 && !recOpts.UseMicroVU0 && !IsRecAvailable_SuperVU0()) ||
(recOpts.EnableVU1 && !recOpts.UseMicroVU1 && !IsRecAvailable_SuperVU1());
(recOpts.EnableVU1 && !recOpts.UseMicroVU1 && !IsRecAvailable_SuperVU1())
#else
(recOpts.EnableVU0 && !IsRecAvailable_MicroVU0()) ||
(recOpts.EnableVU1 && !IsRecAvailable_MicroVU1())
#endif
;
}
@ -541,12 +550,21 @@ void SysCpuProviderPack::ApplyConfig() const
CpuVU1 = CpuProviders->interpVU1;
if( EmuConfig.Cpu.Recompiler.EnableVU0 )
#ifndef DISABLE_SVU
CpuVU0 = EmuConfig.Cpu.Recompiler.UseMicroVU0 ? (BaseVUmicroCPU*)CpuProviders->microVU0 : (BaseVUmicroCPU*)CpuProviders->superVU0;
#else
CpuVU0 = (BaseVUmicroCPU*)CpuProviders->microVU0;
#endif
if( EmuConfig.Cpu.Recompiler.EnableVU1 )
#ifndef DISABLE_SVU
CpuVU1 = EmuConfig.Cpu.Recompiler.UseMicroVU1 ? (BaseVUmicroCPU*)CpuProviders->microVU1 : (BaseVUmicroCPU*)CpuProviders->superVU1;
#else
CpuVU1 = (BaseVUmicroCPU*)CpuProviders->microVU1;
#endif
}
#ifndef DISABLE_SVU
// This is a semi-hacky function for convenience
BaseVUmicroCPU* SysCpuProviderPack::getVUprovider(int whichProvider, int vuIndex) const {
switch (whichProvider) {
@ -556,6 +574,7 @@ BaseVUmicroCPU* SysCpuProviderPack::getVUprovider(int whichProvider, int vuIndex
}
return NULL;
}
#endif
// Resets all PS2 cpu execution caches, which does not affect that actual PS2 state/condition.
// This can be called at any time outside the context of a Cpu->Execute() block without

View File

@ -141,7 +141,9 @@ public:
virtual ~SysCpuProviderPack() throw();
void ApplyConfig() const;
#ifndef DISABLE_SVU
BaseVUmicroCPU* getVUprovider(int whichProvider, int vuIndex) const;
#endif
bool HadSomeFailures( const Pcsx2Config::RecompilerOptions& recOpts ) const;

View File

@ -167,16 +167,25 @@ void Pcsx2App::AllocateCoreStuffs()
{
scrollableTextArea->AppendText( L"* microVU0\n\t" + ex->FormatDisplayMessage() + L"\n\n" );
recOps.UseMicroVU0 = false;
#ifndef DISABLE_SVU
recOps.EnableVU0 = recOps.EnableVU0 && m_CpuProviders->IsRecAvailable_SuperVU0();
#else
recOps.EnableVU1 = false;
#endif
}
if( BaseException* ex = m_CpuProviders->GetException_MicroVU1() )
{
scrollableTextArea->AppendText( L"* microVU1\n\t" + ex->FormatDisplayMessage() + L"\n\n" );
recOps.UseMicroVU1 = false;
#ifndef DISABLE_SVU
recOps.EnableVU1 = recOps.EnableVU1 && m_CpuProviders->IsRecAvailable_SuperVU1();
#else
recOps.EnableVU1 = false;
#endif
}
#ifndef DISABLE_SVU
if( BaseException* ex = m_CpuProviders->GetException_SuperVU0() )
{
scrollableTextArea->AppendText( L"* SuperVU0\n\t" + ex->FormatDisplayMessage() + L"\n\n" );
@ -190,9 +199,9 @@ void Pcsx2App::AllocateCoreStuffs()
recOps.UseMicroVU1 = m_CpuProviders->IsRecAvailable_MicroVU1();
recOps.EnableVU1 = recOps.EnableVU1 && recOps.UseMicroVU1;
}
#endif
exconf += exconf.Heading( pxE( L"Note: Recompilers are not necessary for PCSX2 to run, however they typically improve emulation speed substantially. You may have to manually re-enable the recompilers listed above, if you resolve the errors." )
);
exconf += exconf.Heading(pxE( L"Note: Recompilers are not necessary for PCSX2 to run, however they typically improve emulation speed substantially. You may have to manually re-enable the recompilers listed above, if you resolve the errors." ));
pxIssueConfirmation( exconf, MsgButtons().OK() );
}

View File

@ -185,8 +185,10 @@ Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
RadioPanelItem(_("microVU Recompiler"))
.SetToolTip(_("New Vector Unit recompiler with much improved compatibility. Recommended.")),
#ifndef DISABLE_SVU
RadioPanelItem(_("superVU Recompiler [legacy]"))
.SetToolTip(_("Useful for diagnosing bugs or clamping issues in the new mVU recompiler."))
#endif
};
m_panel_VU0 = &(new pxRadioPanel( this, tbl_CpuTypes_VU )) ->SetDefaultItem( 1 );
@ -274,8 +276,10 @@ void Panels::CpuPanelVU::Apply()
recOps.EnableVU0 = m_panel_VU0->GetSelection() > 0;
recOps.EnableVU1 = m_panel_VU1->GetSelection() > 0;
#ifndef DISABLE_SVU
recOps.UseMicroVU0 = m_panel_VU0->GetSelection() == 1;
recOps.UseMicroVU1 = m_panel_VU1->GetSelection() == 1;
#endif
}
void Panels::CpuPanelVU::AppStatusEvent_OnSettingsApplied()
@ -289,21 +293,33 @@ void Panels::CpuPanelVU::ApplyConfigToGui( AppConfig& configToApply, int flags )
m_panel_VU1->Enable(true);
m_panel_VU0->EnableItem( 1, true);
#ifndef DISABLE_SVU
m_panel_VU0->EnableItem( 2, true);
#endif
m_panel_VU1->EnableItem( 1, true);
#ifndef DISABLE_SVU
m_panel_VU1->EnableItem( 2, true);
#endif
Pcsx2Config::RecompilerOptions& recOps( configToApply.EmuOptions.Cpu.Recompiler );
#ifndef DISABLE_SVU
if( recOps.UseMicroVU0 )
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 );
else
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 2 : 0 );
#else
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 );
#endif
#ifndef DISABLE_SVU
if( recOps.UseMicroVU1 )
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 1 : 0 );
else
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 2 : 0 );
#else
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 1 : 0 );
#endif
this->Enable(!configToApply.EnablePresets);
m_panel_VU0->Enable(!configToApply.EnablePresets);

View File

@ -50,7 +50,9 @@
// used in VU recs
#define PROCESS_VU_UPDATEFLAGS 0x10
#ifndef DISABLE_SVU
#define PROCESS_VU_SUPER 0x40 // set if using supervu recompilation
#endif
#define PROCESS_VU_COP2 0x80 // simple cop2
#define EEREC_S (((info)>>8)&0xf)

View File

@ -20,10 +20,16 @@
#include "R5900OpcodeTables.h"
#include "iR5900.h"
#include "iFPU.h"
#ifndef DISABLE_SVU
#include "sVU_Micro.h"
#endif
using namespace x86Emitter;
const __aligned16 u32 g_minvals[4] = {0xff7fffff, 0xff7fffff, 0xff7fffff, 0xff7fffff};
const __aligned16 u32 g_maxvals[4] = {0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff};
//------------------------------------------------------------------
namespace R5900 {
namespace Dynarec {

View File

@ -16,6 +16,9 @@
#ifndef __IFPU_H__
#define __IFPU_H__
extern const __aligned16 u32 g_minvals[4];
extern const __aligned16 u32 g_maxvals[4];
namespace R5900 {
namespace Dynarec {

View File

@ -21,7 +21,10 @@
#include "x86emitter/x86emitter.h"
#include "iR5900.h"
#include "iFPU.h"
#ifndef DISABLE_SVU
#include "sVU_Micro.h"
#endif
/* This is a version of the FPU that emulates an exponent of 0xff and overflow/underflow flags */

View File

@ -1972,8 +1972,10 @@ StartRecomp:
for(i = startpc; i < s_nEndBlock; i += 4) {
#ifndef DISABLE_SVU
// superVU hack: it needs vucycles, for some reason. >_<
extern int vucycle;
#endif
g_pCurInstInfo++;
cpuRegs.code = *(u32*)PSM(i);
@ -1983,7 +1985,9 @@ StartRecomp:
if( !usecop2 ) {
// init
#ifndef DISABLE_SVU
vucycle = 0;
#endif
usecop2 = 1;
}
@ -1992,9 +1996,11 @@ StartRecomp:
continue;
}
#ifndef DISABLE_SVU
// fixme - This should be based on the cycle count of the current EE
// instruction being analyzed.
if( usecop2 ) vucycle++;
#endif
}
// This *is* important because g_pCurInstInfo is checked a bit later on and

View File

@ -22,11 +22,13 @@
#include "iMMI.h"
#include "iFPU.h"
#include "iCOP0.h"
#include "sVU_Micro.h"
#include "VU.h"
#include "VUmicro.h"
#ifndef DISABLE_SVU
#include "sVU_Micro.h"
#include "sVU_zerorec.h"
#endif
#include "vtlb.h"

View File

@ -88,8 +88,6 @@ int vucycle;
const __aligned16 float s_fones[8] = {1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f};
const __aligned16 u32 s_mask[4] = {0x007fffff, 0x007fffff, 0x007fffff, 0x007fffff};
const __aligned16 u32 s_expmask[4] = {0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000};
const __aligned16 u32 g_minvals[4] = {0xff7fffff, 0xff7fffff, 0xff7fffff, 0xff7fffff};
const __aligned16 u32 g_maxvals[4] = {0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff};
const __aligned16 u32 const_clip[8] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff,
0x80000000, 0x80000000, 0x80000000, 0x80000000};

View File

@ -59,8 +59,6 @@ extern vFloat vFloats4_useEAX[16];
extern const __aligned16 float s_fones[8];
extern const __aligned16 u32 s_mask[4];
extern const __aligned16 u32 s_expmask[4];
extern const __aligned16 u32 g_minvals[4];
extern const __aligned16 u32 g_maxvals[4];
extern const __aligned16 u32 const_clip[8];
u32 GetVIAddr(VURegs * VU, int reg, int read, int info);