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;
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t LocalSocketConnection::send_raw(char const* data, size_t length) {
|
||||
(void)data;
|
||||
(void)length;
|
||||
return -EIO;
|
||||
}
|
||||
} // namespace anbox
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public:
|
|||
|
||||
ssize_t read_all(std::uint8_t *buffer, const size_t &size);
|
||||
void send(char const* data, size_t length) override;
|
||||
ssize_t send_raw(char const* data, size_t length) override;
|
||||
|
||||
private:
|
||||
Fd fd_;
|
||||
|
|
|
|||
|
|
@ -363,30 +363,36 @@ static void rcSelectChecksumCalculator(uint32_t protocol, uint32_t reserved) {
|
|||
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) {
|
||||
printf("%s: display_id=%d\n", __func__, display_id);
|
||||
(void)display_id;
|
||||
return DisplayManager::get()->display_info().horizontal_resolution;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int rcGetDisplayDpiX(uint32_t display_id) {
|
||||
printf("%s: display_id=%d\n", __func__, display_id);
|
||||
(void)display_id;
|
||||
return 120;
|
||||
}
|
||||
|
||||
int rcGetDisplayDpiY(uint32_t display_id) {
|
||||
printf("%s: display_id=%d\n", __func__, display_id);
|
||||
(void)display_id;
|
||||
return 120;
|
||||
}
|
||||
|
||||
int rcGetDisplayVsyncPeriod(uint32_t display_id) {
|
||||
printf("%s: display_id=%d\n", __func__, display_id);
|
||||
(void)display_id;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -394,6 +400,10 @@ static std::vector<Renderable> frame_layers;
|
|||
|
||||
bool is_layer_blacklisted(const std::string &name) {
|
||||
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",
|
||||
};
|
||||
return std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#define STREAM_BUFFER_SIZE 4 * 1024 * 1024
|
||||
|
||||
RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock)
|
||||
|
|
@ -33,7 +35,6 @@ RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock)
|
|||
|
||||
RenderThread::~RenderThread() {}
|
||||
|
||||
// static
|
||||
RenderThread *RenderThread::create(IOStream *stream, emugl::Mutex *lock) {
|
||||
return new RenderThread(stream, lock);
|
||||
}
|
||||
|
|
@ -41,54 +42,40 @@ RenderThread *RenderThread::create(IOStream *stream, emugl::Mutex *lock) {
|
|||
void RenderThread::forceStop() { m_stream->forceStop(); }
|
||||
|
||||
intptr_t RenderThread::main() {
|
||||
RenderThreadInfo tInfo;
|
||||
ChecksumCalculatorThreadInfo tChecksumInfo;
|
||||
RenderThreadInfo threadInfo;
|
||||
ChecksumCalculatorThreadInfo threadChecksumInfo;
|
||||
|
||||
//
|
||||
// initialize decoders
|
||||
//
|
||||
tInfo.m_glDec.initGL(gles1_dispatch_get_proc_func, NULL);
|
||||
tInfo.m_gl2Dec.initGL(gles2_dispatch_get_proc_func, NULL);
|
||||
initRenderControlContext(&tInfo.m_rcDec);
|
||||
threadInfo.m_glDec.initGL(gles1_dispatch_get_proc_func, NULL);
|
||||
threadInfo.m_gl2Dec.initGL(gles2_dispatch_get_proc_func, NULL);
|
||||
initRenderControlContext(&threadInfo.m_rcDec);
|
||||
|
||||
ReadBuffer readBuf(STREAM_BUFFER_SIZE);
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
int stat = readBuf.getData(m_stream);
|
||||
if (stat <= 0) {
|
||||
if (stat <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
bool progress;
|
||||
do {
|
||||
progress = false;
|
||||
|
||||
m_lock->lock();
|
||||
//
|
||||
// try to process some of the command buffer using the GLESv1 decoder
|
||||
//
|
||||
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) {
|
||||
progress = true;
|
||||
readBuf.consume(last);
|
||||
}
|
||||
|
||||
//
|
||||
// try to process some of the command buffer using the GLESv2 decoder
|
||||
//
|
||||
last =
|
||||
tInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
threadInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
if (last > 0) {
|
||||
progress = true;
|
||||
readBuf.consume(last);
|
||||
}
|
||||
|
||||
//
|
||||
// try to process some of the command buffer using the
|
||||
// renderControl decoder
|
||||
//
|
||||
last = tInfo.m_rcDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
last = threadInfo.m_rcDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
if (last > 0) {
|
||||
readBuf.consume(last);
|
||||
progress = true;
|
||||
|
|
@ -99,17 +86,12 @@ intptr_t RenderThread::main() {
|
|||
} while (progress);
|
||||
}
|
||||
|
||||
//
|
||||
// Release references to the current thread's context/surfaces if any
|
||||
//
|
||||
Renderer::get()->bindContext(0, 0, 0);
|
||||
if (tInfo.currContext || tInfo.currDrawSurf || tInfo.currReadSurf) {
|
||||
fprintf(stderr,
|
||||
"ERROR: RenderThread exiting with current context/surfaces\n");
|
||||
}
|
||||
if (threadInfo.currContext || threadInfo.currDrawSurf || threadInfo.currReadSurf)
|
||||
ERROR("RenderThread exiting with current context/surfaces");
|
||||
|
||||
Renderer::get()->drainWindowSurface();
|
||||
|
||||
Renderer::get()->drainRenderContext();
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,11 @@
|
|||
#include "emugl/common/thread_store.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ThreadInfoStore : public ::emugl::ThreadStore {
|
||||
public:
|
||||
ThreadInfoStore() : ::emugl::ThreadStore(NULL) {}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
}
|
||||
|
||||
static ::emugl::LazyInstance<ThreadInfoStore> s_tls = LAZY_INSTANCE_INIT;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue