blob: 919e75e8a41af34d8935d8b58e3d6395602f87b6 [file] [log] [blame]
Jon Medhurst15ce78d2014-04-10 09:02:02 +01001/**
2 * Copyright (C) ARM Limited 2010-2014. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef EXTERNALSOURCE_H
10#define EXTERNALSOURCE_H
11
12#include <semaphore.h>
13
14#include "Buffer.h"
Jon Medhurste31266f2014-08-04 15:47:44 +010015#include "Monitor.h"
Jon Medhurst15ce78d2014-04-10 09:02:02 +010016#include "OlySocket.h"
17#include "Source.h"
18
Jon Medhurst96b56152014-10-30 18:01:15 +000019// Counters from external sources like graphics drivers and annotations
Jon Medhurst15ce78d2014-04-10 09:02:02 +010020class ExternalSource : public Source {
21public:
22 ExternalSource(sem_t *senderSem);
23 ~ExternalSource();
24
25 bool prepare();
26 void run();
27 void interrupt();
28
29 bool isDone();
30 void write(Sender *sender);
31
32private:
Jon Medhurst96b56152014-10-30 18:01:15 +000033 void waitFor(const int bytes);
Jon Medhurste31266f2014-08-04 15:47:44 +010034 void configureConnection(const int fd, const char *const handshake, size_t size);
Jon Medhurst96b56152014-10-30 18:01:15 +000035 bool connectMali();
Jon Medhurste31266f2014-08-04 15:47:44 +010036 bool connectMve();
37
38 sem_t mBufferSem;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010039 Buffer mBuffer;
Jon Medhurste31266f2014-08-04 15:47:44 +010040 Monitor mMonitor;
41 OlyServerSocket mMveStartupUds;
Jon Medhurst96b56152014-10-30 18:01:15 +000042 OlyServerSocket mMaliStartupUds;
43 OlyServerSocket mAnnotate;
Jon Medhurste31266f2014-08-04 15:47:44 +010044 int mInterruptFd;
Jon Medhurst96b56152014-10-30 18:01:15 +000045 int mMaliUds;
Jon Medhurste31266f2014-08-04 15:47:44 +010046 int mMveUds;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010047
48 // Intentionally unimplemented
49 ExternalSource(const ExternalSource &);
50 ExternalSource &operator=(const ExternalSource &);
51};
52
53#endif // EXTERNALSOURCE_H