Cleanup formatting and code style
This commit is contained in:
parent
3e70f5a548
commit
aeff6e35df
5 changed files with 38 additions and 41 deletions
|
|
@ -75,4 +75,10 @@ void LocalSocketConnection::send(char const* data, size_t length) {
|
||||||
bytes_written += result;
|
bytes_written += result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t LocalSocketConnection::send_raw(char const* data, size_t length) {
|
||||||
|
(void)data;
|
||||||
|
(void)length;
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public:
|
||||||
|
|
||||||
ssize_t read_all(std::uint8_t *buffer, const size_t &size);
|
ssize_t read_all(std::uint8_t *buffer, const size_t &size);
|
||||||
void send(char const* data, size_t length) override;
|
void send(char const* data, size_t length) override;
|
||||||
|
ssize_t send_raw(char const* data, size_t length) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Fd fd_;
|
Fd fd_;
|
||||||
|
|
|
||||||
|
|
@ -363,30 +363,36 @@ static void rcSelectChecksumCalculator(uint32_t protocol, uint32_t reserved) {
|
||||||
ChecksumCalculatorThreadInfo::setVersion(protocol);
|
ChecksumCalculatorThreadInfo::setVersion(protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rcGetNumDisplays() { return 1; }
|
int rcGetNumDisplays() {
|
||||||
|
// For now we only support a single display but that single display
|
||||||
|
// will contain more than one display so that we simply spawn up a big
|
||||||
|
// virtual display which should match the real display arrangement
|
||||||
|
// in most cases.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int rcGetDisplayWidth(uint32_t display_id) {
|
int rcGetDisplayWidth(uint32_t display_id) {
|
||||||
printf("%s: display_id=%d\n", __func__, display_id);
|
(void)display_id;
|
||||||
return DisplayManager::get()->display_info().horizontal_resolution;
|
return DisplayManager::get()->display_info().horizontal_resolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rcGetDisplayHeight(uint32_t display_id) {
|
int rcGetDisplayHeight(uint32_t display_id) {
|
||||||
printf("%s: display_id=%d\n", __func__, display_id);
|
(void)display_id;
|
||||||
return DisplayManager::get()->display_info().vertical_resolution;
|
return DisplayManager::get()->display_info().vertical_resolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rcGetDisplayDpiX(uint32_t display_id) {
|
int rcGetDisplayDpiX(uint32_t display_id) {
|
||||||
printf("%s: display_id=%d\n", __func__, display_id);
|
(void)display_id;
|
||||||
return 120;
|
return 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rcGetDisplayDpiY(uint32_t display_id) {
|
int rcGetDisplayDpiY(uint32_t display_id) {
|
||||||
printf("%s: display_id=%d\n", __func__, display_id);
|
(void)display_id;
|
||||||
return 120;
|
return 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rcGetDisplayVsyncPeriod(uint32_t display_id) {
|
int rcGetDisplayVsyncPeriod(uint32_t display_id) {
|
||||||
printf("%s: display_id=%d\n", __func__, display_id);
|
(void)display_id;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -394,6 +400,10 @@ static std::vector<Renderable> frame_layers;
|
||||||
|
|
||||||
bool is_layer_blacklisted(const std::string &name) {
|
bool is_layer_blacklisted(const std::string &name) {
|
||||||
static std::vector<std::string> blacklist = {
|
static std::vector<std::string> blacklist = {
|
||||||
|
// The 'Sprite' layer is the mouse cursor Android uses as soon
|
||||||
|
// as it has a pointer input device available. We don't want to
|
||||||
|
// display this layer at all but don't have a good way of disabling
|
||||||
|
// the cursor on the Android side yet.
|
||||||
"Sprite",
|
"Sprite",
|
||||||
};
|
};
|
||||||
return std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end();
|
return std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end();
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
||||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||||
|
|
||||||
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
#define STREAM_BUFFER_SIZE 4 * 1024 * 1024
|
#define STREAM_BUFFER_SIZE 4 * 1024 * 1024
|
||||||
|
|
||||||
RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock)
|
RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock)
|
||||||
|
|
@ -33,7 +35,6 @@ RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock)
|
||||||
|
|
||||||
RenderThread::~RenderThread() {}
|
RenderThread::~RenderThread() {}
|
||||||
|
|
||||||
// static
|
|
||||||
RenderThread *RenderThread::create(IOStream *stream, emugl::Mutex *lock) {
|
RenderThread *RenderThread::create(IOStream *stream, emugl::Mutex *lock) {
|
||||||
return new RenderThread(stream, lock);
|
return new RenderThread(stream, lock);
|
||||||
}
|
}
|
||||||
|
|
@ -41,54 +42,40 @@ RenderThread *RenderThread::create(IOStream *stream, emugl::Mutex *lock) {
|
||||||
void RenderThread::forceStop() { m_stream->forceStop(); }
|
void RenderThread::forceStop() { m_stream->forceStop(); }
|
||||||
|
|
||||||
intptr_t RenderThread::main() {
|
intptr_t RenderThread::main() {
|
||||||
RenderThreadInfo tInfo;
|
RenderThreadInfo threadInfo;
|
||||||
ChecksumCalculatorThreadInfo tChecksumInfo;
|
ChecksumCalculatorThreadInfo threadChecksumInfo;
|
||||||
|
|
||||||
//
|
threadInfo.m_glDec.initGL(gles1_dispatch_get_proc_func, NULL);
|
||||||
// initialize decoders
|
threadInfo.m_gl2Dec.initGL(gles2_dispatch_get_proc_func, NULL);
|
||||||
//
|
initRenderControlContext(&threadInfo.m_rcDec);
|
||||||
tInfo.m_glDec.initGL(gles1_dispatch_get_proc_func, NULL);
|
|
||||||
tInfo.m_gl2Dec.initGL(gles2_dispatch_get_proc_func, NULL);
|
|
||||||
initRenderControlContext(&tInfo.m_rcDec);
|
|
||||||
|
|
||||||
ReadBuffer readBuf(STREAM_BUFFER_SIZE);
|
ReadBuffer readBuf(STREAM_BUFFER_SIZE);
|
||||||
|
|
||||||
while (1) {
|
while (true) {
|
||||||
int stat = readBuf.getData(m_stream);
|
int stat = readBuf.getData(m_stream);
|
||||||
if (stat <= 0) {
|
if (stat <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
bool progress;
|
bool progress;
|
||||||
do {
|
do {
|
||||||
progress = false;
|
progress = false;
|
||||||
|
|
||||||
m_lock->lock();
|
m_lock->lock();
|
||||||
//
|
|
||||||
// try to process some of the command buffer using the GLESv1 decoder
|
|
||||||
//
|
|
||||||
size_t last =
|
size_t last =
|
||||||
tInfo.m_glDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
threadInfo.m_glDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||||
if (last > 0) {
|
if (last > 0) {
|
||||||
progress = true;
|
progress = true;
|
||||||
readBuf.consume(last);
|
readBuf.consume(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// try to process some of the command buffer using the GLESv2 decoder
|
|
||||||
//
|
|
||||||
last =
|
last =
|
||||||
tInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
threadInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||||
if (last > 0) {
|
if (last > 0) {
|
||||||
progress = true;
|
progress = true;
|
||||||
readBuf.consume(last);
|
readBuf.consume(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
last = threadInfo.m_rcDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||||
// try to process some of the command buffer using the
|
|
||||||
// renderControl decoder
|
|
||||||
//
|
|
||||||
last = tInfo.m_rcDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
|
||||||
if (last > 0) {
|
if (last > 0) {
|
||||||
readBuf.consume(last);
|
readBuf.consume(last);
|
||||||
progress = true;
|
progress = true;
|
||||||
|
|
@ -99,17 +86,12 @@ intptr_t RenderThread::main() {
|
||||||
} while (progress);
|
} while (progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Release references to the current thread's context/surfaces if any
|
// Release references to the current thread's context/surfaces if any
|
||||||
//
|
|
||||||
Renderer::get()->bindContext(0, 0, 0);
|
Renderer::get()->bindContext(0, 0, 0);
|
||||||
if (tInfo.currContext || tInfo.currDrawSurf || tInfo.currReadSurf) {
|
if (threadInfo.currContext || threadInfo.currDrawSurf || threadInfo.currReadSurf)
|
||||||
fprintf(stderr,
|
ERROR("RenderThread exiting with current context/surfaces");
|
||||||
"ERROR: RenderThread exiting with current context/surfaces\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
Renderer::get()->drainWindowSurface();
|
Renderer::get()->drainWindowSurface();
|
||||||
|
|
||||||
Renderer::get()->drainRenderContext();
|
Renderer::get()->drainRenderContext();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,11 @@
|
||||||
#include "emugl/common/thread_store.h"
|
#include "emugl/common/thread_store.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class ThreadInfoStore : public ::emugl::ThreadStore {
|
class ThreadInfoStore : public ::emugl::ThreadStore {
|
||||||
public:
|
public:
|
||||||
ThreadInfoStore() : ::emugl::ThreadStore(NULL) {}
|
ThreadInfoStore() : ::emugl::ThreadStore(NULL) {}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
static ::emugl::LazyInstance<ThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
|
static ::emugl::LazyInstance<ThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue