Commit 478b718a authored by sletz's avatar sletz
Browse files

Add mixed 32/64 mode (off by default).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3462 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 6758d806
......@@ -26,7 +26,8 @@ Torben Hohn
2009-03-24 Stephane Letz <letz@grame.fr>
* New JackBoomerDriver class for Boomer driver on Solaris.
* New JackBoomerDriver class for Boomer driver on Solaris.
* Add mixed 32/64 mode (off by default).
2009-03-23 Stephane Letz <letz@grame.fr>
......
......@@ -79,7 +79,7 @@ struct JackClientControl : public JackShmMemAble
fActive = false;
}
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -356,7 +356,7 @@ struct JackClientTiming
{}
~JackClientTiming()
{}
};
} POST_PACKED_STRUCTURE;
/*!
\brief Connection manager.
......@@ -445,12 +445,11 @@ class SERVER_EXPORT JackConnectionManager
return fInputCounter[refnum].GetValue();
}
// Graph
void ResetGraph(JackClientTiming* timing);
int ResumeRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing);
int SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec);
};
} // end of namespace
......
......@@ -83,11 +83,7 @@
#define ALL_CLIENTS -1 // for notification
#if defined(__ppc64__) || defined(__x86_64__)
#define JACK_PROTOCOL_VERSION 6
#else
#define JACK_PROTOCOL_VERSION 5
#endif
#define JACK_PROTOCOL_VERSION 7
#define SOCKET_TIME_OUT 5 // in sec
#define DRIVER_OPEN_TIMEOUT 5 // in sec
......
......@@ -166,7 +166,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
void CalcCPULoad(JackClientInterface** table, JackGraphManager* manager, jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end);
void ResetRollingUsecs();
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -52,7 +52,8 @@ struct JackTimingMeasureClient
fFinishedAt(0),
fStatus((jack_client_state_t)0)
{}
};
} POST_PACKED_STRUCTURE;
/*!
\brief Timing interval in the global table for a given client
......@@ -70,7 +71,8 @@ struct JackTimingClientInterval
fBeginInterval(-1),
fEndInterval(-1)
{}
};
} POST_PACKED_STRUCTURE;
/*!
\brief Timing stucture for a table of clients.
......@@ -90,7 +92,8 @@ struct JackTimingMeasure
fCurCycleBegin(0),
fPrevCycleEnd(0)
{}
};
} POST_PACKED_STRUCTURE;
/*!
\brief Client timing monitoring.
......@@ -125,7 +128,7 @@ class SERVER_EXPORT JackEngineProfiling
JackTimingMeasure* GetCurMeasure();
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -93,7 +93,8 @@ class SERVER_EXPORT JackFrameTimer : public JackAtomicState<JackTimer>
void ResetFrameTime(jack_nframes_t frames_rate, jack_time_t callback_usecs, jack_time_t period_usecs);
void IncFrameTime(jack_nframes_t buffer_size, jack_time_t callback_usecs, jack_time_t period_usecs);
void ReadFrameTime(JackTimer* timer);
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -129,7 +129,7 @@ class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState
void Save(JackConnectionManager* dst);
void Restore(JackConnectionManager* src);
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -106,7 +106,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_
}
SetupDriverSync(false);
// Connect shared synchro : the synchro must be usable in I/O mode when several clients live in the same process
if (!fSynchroTable[GetClientControl()->fRefNum].Connect(name_res, fServerName)) {
jack_error("Cannot ConnectSemaphore %s client", name_res);
......
......@@ -247,13 +247,13 @@ int JackPort::UnsetAlias(const char* alias)
void JackPort::ClearBuffer(jack_nframes_t frames)
{
const JackPortType* type = GetPortType(fTypeId);
(type->init)(fBuffer, frames * sizeof(float), frames);
(type->init)(GetBuffer(), frames * sizeof(float), frames);
}
void JackPort::MixBuffers(void** src_buffers, int src_count, jack_nframes_t buffer_size)
{
const JackPortType* type = GetPortType(fTypeId);
(type->mixdown)(fBuffer, src_buffers, src_count, buffer_size);
(type->mixdown)(GetBuffer(), src_buffers, src_count, buffer_size);
}
} // end of namespace
......@@ -55,9 +55,8 @@ class SERVER_EXPORT JackPort
bool fInUse;
jack_port_id_t fTied; // Locally tied source port
MEM_ALIGN(float fBuffer[BUFFER_SIZE_MAX], 64); // 16 bytes alignment for vector code, 64 bytes better for cache loads/stores
float fBuffer[BUFFER_SIZE_MAX + 4];
bool IsUsed() const
{
return fInUse;
......@@ -99,14 +98,15 @@ class SERVER_EXPORT JackPort
return (fMonitorRequests > 0);
}
// Since we are in shared memory, the resulting pointer cannot be cached, so align it here...
float* GetBuffer()
{
return fBuffer;
return (float*)((long)fBuffer & ~15L) + 4;
}
int GetRefNum() const;
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -116,6 +116,7 @@ struct JackResult
{
return trans->Write(&fResult, sizeof(int));
}
};
/*!
......@@ -151,7 +152,8 @@ struct JackClientCheckRequest : public JackRequest
CheckRes(trans->Write(&fProtocol, sizeof(int)));
return trans->Write(&fOptions, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief CheckClient result.
......@@ -186,7 +188,8 @@ struct JackClientCheckResult : public JackResult
CheckRes(trans->Write(&fStatus, sizeof(int)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief NewClient request.
......@@ -218,7 +221,8 @@ struct JackClientOpenRequest : public JackRequest
CheckRes(trans->Write(&fPID, sizeof(int)));
return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1);
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief NewClient result.
......@@ -255,7 +259,8 @@ struct JackClientOpenResult : public JackResult
CheckRes(trans->Write(&fSharedGraph, sizeof(int)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief CloseClient request.
......@@ -281,7 +286,8 @@ struct JackClientCloseRequest : public JackRequest
CheckRes(JackRequest::Write(trans));
return trans->Write(&fRefNum, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief Activate request.
......@@ -312,7 +318,7 @@ struct JackActivateRequest : public JackRequest
return trans->Write(&fState, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief Deactivate request.
......@@ -339,7 +345,7 @@ struct JackDeactivateRequest : public JackRequest
return trans->Write(&fRefNum, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortRegister request.
......@@ -383,7 +389,8 @@ struct JackPortRegisterRequest : public JackRequest
CheckRes(trans->Write(&fBufferSize, sizeof(unsigned int)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortRegister result.
......@@ -408,7 +415,8 @@ struct JackPortRegisterResult : public JackResult
CheckRes(JackResult::Write(trans));
return trans->Write(&fPortIndex, sizeof(jack_port_id_t));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortUnregister request.
......@@ -440,7 +448,8 @@ struct JackPortUnRegisterRequest : public JackRequest
CheckRes(trans->Write(&fPortIndex, sizeof(jack_port_id_t)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortConnectName request.
......@@ -479,7 +488,8 @@ struct JackPortConnectNameRequest : public JackRequest
CheckRes(trans->Write(&fDst, JACK_PORT_NAME_SIZE + 1));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortDisconnectName request.
......@@ -517,7 +527,8 @@ struct JackPortDisconnectNameRequest : public JackRequest
CheckRes(trans->Write(&fDst, JACK_PORT_NAME_SIZE + 1));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortConnect request.
......@@ -552,8 +563,8 @@ struct JackPortConnectRequest : public JackRequest
CheckRes(trans->Write(&fDst, sizeof(jack_port_id_t)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortDisconnect request.
......@@ -589,7 +600,8 @@ struct JackPortDisconnectRequest : public JackRequest
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief PortRename request.
......@@ -627,7 +639,8 @@ struct JackPortRenameRequest : public JackRequest
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief SetBufferSize request.
......@@ -654,7 +667,8 @@ struct JackSetBufferSizeRequest : public JackRequest
CheckRes(JackRequest::Write(trans));
return trans->Write(&fBufferSize, sizeof(jack_nframes_t));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief SetFreeWheel request.
......@@ -681,7 +695,8 @@ struct JackSetFreeWheelRequest : public JackRequest
CheckRes(JackRequest::Write(trans));
return trans->Write(&fOnOff, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief ReleaseTimebase request.
......@@ -708,7 +723,8 @@ struct JackReleaseTimebaseRequest : public JackRequest
CheckRes(JackRequest::Write(trans));
return trans->Write(&fRefNum, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief SetTimebaseCallback request.
......@@ -738,7 +754,8 @@ struct JackSetTimebaseCallbackRequest : public JackRequest
CheckRes(trans->Write(&fRefNum, sizeof(int)));
return trans->Write(&fConditionnal, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief GetInternalClientName request.
......@@ -768,7 +785,8 @@ struct JackGetInternalClientNameRequest : public JackRequest
CheckRes(trans->Write(&fRefNum, sizeof(int)));
return trans->Write(&fIntRefNum, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief GetInternalClient result.
......@@ -800,7 +818,8 @@ struct JackGetInternalClientNameResult : public JackResult
CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief InternalClientHandle request.
......@@ -832,7 +851,8 @@ struct JackInternalClientHandleRequest : public JackRequest
CheckRes(trans->Write(&fRefNum, sizeof(int)));
return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1);
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief InternalClientHandle result.
......@@ -865,7 +885,8 @@ struct JackInternalClientHandleResult : public JackResult
CheckRes(trans->Write(&fIntRefNum, sizeof(int)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief InternalClientLoad request.
......@@ -912,7 +933,8 @@ struct JackInternalClientLoadRequest : public JackRequest
CheckRes(trans->Write(&fLoadInitName, JACK_LOAD_INIT_LIMIT + 1));
return trans->Write(&fOptions, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief InternalClientLoad result.
......@@ -945,7 +967,8 @@ struct JackInternalClientLoadResult : public JackResult
CheckRes(trans->Write(&fIntRefNum, sizeof(int)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief InternalClientUnload request.
......@@ -975,8 +998,7 @@ struct JackInternalClientUnloadRequest : public JackRequest
CheckRes(trans->Write(&fRefNum, sizeof(int)));
return trans->Write(&fIntRefNum, sizeof(int));
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief InternalClientLoad result.
......@@ -1006,7 +1028,8 @@ struct JackInternalClientUnloadResult : public JackResult
CheckRes(trans->Write(&fStatus, sizeof(int)));
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief ClientNotification request.
......@@ -1042,7 +1065,7 @@ struct JackClientNotificationRequest : public JackRequest
return 0;
}
};
} POST_PACKED_STRUCTURE;
/*!
\brief ClientNotification.
......@@ -1087,7 +1110,7 @@ struct JackClientNotification
return 0;
}
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -37,7 +37,7 @@ JackShmMem::JackShmMem()
void JackShmMemAble::Init()
{
fInfo.index = gInfo.index;
fInfo.attached_at = gInfo.attached_at;
fInfo.ptr.attached_at = gInfo.ptr.attached_at;
fInfo.size = gInfo.size;
}
......@@ -71,9 +71,9 @@ void* JackShmMem::operator new(size_t size)
// so use an intermediate global data
gInfo.index = info.index;
gInfo.size = size;
gInfo.attached_at = info.attached_at;
gInfo.ptr.attached_at = info.ptr.attached_at;
jack_log("JackShmMem::new index = %ld attached = %x size = %ld ", info.index, info.attached_at, size);
jack_log("JackShmMem::new index = %ld attached = %x size = %ld ", info.index, info.ptr.attached_at, size);
return obj;
error:
......@@ -86,7 +86,7 @@ void JackShmMem::operator delete(void* p, size_t size)
jack_shm_info_t info;
JackShmMem* obj = (JackShmMem*)p;
info.index = obj->fInfo.index;
info.attached_at = obj->fInfo.attached_at;
info.ptr.attached_at = obj->fInfo.ptr.attached_at;
jack_log("JackShmMem::delete size = %ld index = %ld", size, info.index);
......
......@@ -102,7 +102,7 @@ class JackShmMemAble
char* GetShmAddress()
{
return (char*)fInfo.attached_at;
return (char*)fInfo.ptr.attached_at;
}
void LockMemory()
......@@ -173,7 +173,7 @@ class JackShmReadWritePtr
JackShmReadWritePtr()
{
fInfo.index = -1;
fInfo.attached_at = NULL;
fInfo.ptr.attached_at = (char*)NULL;
}
JackShmReadWritePtr(int index, const char* server_name)
......@@ -192,12 +192,12 @@ class JackShmReadWritePtr
T* operator->() const
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
operator T*() const
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
JackShmReadWritePtr& operator=(int index)
......@@ -218,7 +218,7 @@ class JackShmReadWritePtr
T* GetShmAddress()
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
};
......@@ -259,7 +259,7 @@ class JackShmReadWritePtr1
JackShmReadWritePtr1()
{
fInfo.index = -1;
fInfo.attached_at = NULL;
fInfo.ptr.attached_at = NULL;
}
JackShmReadWritePtr1(int index, const char* server_name)
......@@ -278,12 +278,12 @@ class JackShmReadWritePtr1
T* operator->() const
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
operator T*() const
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
JackShmReadWritePtr1& operator=(int index)
......@@ -304,7 +304,7 @@ class JackShmReadWritePtr1
T* GetShmAddress()
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
};
......@@ -339,7 +339,7 @@ class JackShmReadPtr
JackShmReadPtr()
{
fInfo.index = -1;
fInfo.attached_at = NULL;
fInfo.ptr.attached_at = NULL;
}
JackShmReadPtr(int index, const char* server_name)
......@@ -358,12 +358,12 @@ class JackShmReadPtr
T* operator->() const
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
operator T*() const
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
JackShmReadPtr& operator=(int index)
......@@ -384,7 +384,7 @@ class JackShmReadPtr
T* GetShmAddress()
{
return (T*)fInfo.attached_at;
return (T*)fInfo.ptr.attached_at;
}
};
......
......@@ -193,7 +193,7 @@ class SERVER_EXPORT JackTransportEngine : public JackAtomicArrayState<jack_posit
fNetworkSync = sync;
}
};
} POST_PACKED_STRUCTURE;
} // end of namespace
......
......@@ -111,7 +111,7 @@ static jack_shm_info_t registry_info = {/* SHM info for the registry */
#else
static jack_shm_info_t registry_info = { /* SHM info for the registry */
.index = JACK_SHM_NULL_INDEX,
.attached_at = MAP_FAILED
.ptr.attached_at = MAP_FAILED
};
#endif
......@@ -367,7 +367,7 @@ jack_initialize_shm (const char *server_name)
char* jack_shm_addr (jack_shm_info_t* si)
{
return (char*)si->attached_at;
return (char*)si->ptr.attached_at;
}
void
......@@ -638,7 +638,7 @@ jack_access_registry (jack_shm_info_t *ri)
return rc;
}
if ((ri->attached_at = mmap (0, JACK_SHM_REGISTRY_SIZE,
if ((ri->ptr.attached_at = mmap (0, JACK_SHM_REGISTRY_SIZE,
PROT_READ|PROT_WRITE,
MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
jack_error ("Cannot mmap shm registry segment (%s)",
......@@ -649,7 +649,7 @@ jack_access_registry (jack_shm_info_t *ri)
/* set up global pointers */
ri->index = JACK_SHM_REGISTRY_INDEX;
jack_shm_header = ri->attached_at;
jack_shm_header = ri->ptr.attached_at;
jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
close (shm_fd); // steph
......@@ -694,7 +694,7 @@ jack_create_registry (jack_shm_info_t *ri)