blob: 25ae7cd4c4ab32f9a37168a9cf4ebe0dca2beff2 [file] [log] [blame]
Jon Medhurst15ce78d2014-04-10 09:02:02 +01001/**
Jon Medhurstb1d07442015-05-08 12:04:18 +01002 * Copyright (C) ARM Limited 2010-2015. All rights reserved.
Jon Medhurst15ce78d2014-04-10 09:02:02 +01003 *
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 Medhurstb1d07442015-05-08 12:04:18 +010044 OlyServerSocket mAnnotateUds;
Jon Medhurste31266f2014-08-04 15:47:44 +010045 int mInterruptFd;
Jon Medhurst96b56152014-10-30 18:01:15 +000046 int mMaliUds;
Jon Medhurste31266f2014-08-04 15:47:44 +010047 int mMveUds;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010048
49 // Intentionally unimplemented
50 ExternalSource(const ExternalSource &);
51 ExternalSource &operator=(const ExternalSource &);
52};
53
54#endif // EXTERNALSOURCE_H