android4.4 VSync事件处理流程

HWComposer::vsync(int disp, int64_t timestamp)


SurfaceFlinger::onVSyncReceived(int type, nsecs_t timestamp)


DispSync::addResyncSample(nsecs_t timestamp)


DispSync::updateModelLocked
上面这一步计算虚拟VSync事件的周期和相位,相对真实VSync事件作了调整,实现流水线化。

DispSyncThread::updateModel(nsecs_t period, nsecs_t phase)


DispSyncThread::mCond.signal()


DispSyncThread::threadLoop()


DispSyncThread::mCond.wait(mMutex)


DispSyncThread::gatherCallbackInvocationsLocked(now)


DispSyncThread::fireCallbackInvocations(callbackInvocations)


DispSyncSource::onDispSyncEvent(nsecs_t when)


EventThread::onVSyncEvent(nsecs_t timestamp)


EventThread::mCondition.broadcast();


EventThread::threadLoop() 


EventThread::waitForEvent(DisplayEventReceiver::Event* event)::mCondition.wait(mLock);


EventThread::Connection::postEvent(event)


DisplayEventReceiver::sendEvents(mChannel, &event, 1);


BitTube::sendObjects(dataChannel, events, count);


tube->write(vaddr, count*objSize);


::send(mSendFd, vaddr, size, MSG_DONTWAIT | MSG_NOSIGNAL);


MessageQueue::Looper::Loop()


MessageQueue::cb_eventReceiver()


MessageQueue::eventReceiver(int fd, int events) 


MessageQueue::Handler::dispatchInvalidate()


MessageQueue::Looper::sendMessage(this, Message(MessageQueue::INVALIDATE))


MessageQueue::Handler::handleMessage(const Message& message)


SurfaceFlinger::onMessageReceived(int32_t what)


SurfaceFlinger::handleMessageTransaction();


SurfaceFlinger::handleMessageInvalidate();


SurfaceFlinger::signalRefresh();


MessageQueue::refresh()


MessageQueue::Handler::dispatchRefresh()


MessageQueue::Looper::sendMessage(this, Message(MessageQueue::REFRESH));


MessageQueue::Handler::handleMessage(const Message& message)


SurfaceFlinger::onMessageReceived(int32_t what)


SurfaceFlinger::handleMessageRefresh();


你可能感兴趣的:(android)