diff --git a/android/service/local_socket_connection.cpp b/android/service/local_socket_connection.cpp index f5d090a4953548bf9efb9827b5ec748d23db4e84..aa8567ae3cb7c8a6d76cdddb2d3644ab781c357e 100644 --- a/android/service/local_socket_connection.cpp +++ b/android/service/local_socket_connection.cpp @@ -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 diff --git a/android/service/local_socket_connection.h b/android/service/local_socket_connection.h index eddad1b91e3bb7db400b4e0f17a9807a82856e9a..ce84a52aeaab162f03e1ca383aaff651435df99e 100644 --- a/android/service/local_socket_connection.h +++ b/android/service/local_socket_connection.h @@ -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_; diff --git a/src/anbox/graphics/emugl/RenderControl.cpp b/src/anbox/graphics/emugl/RenderControl.cpp index eba7e43166da2058d612925776682d8160431d7f..9527c5be828bb4fb36f4608e5320c83ac1bafded 100644 --- a/src/anbox/graphics/emugl/RenderControl.cpp +++ b/src/anbox/graphics/emugl/RenderControl.cpp @@ -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 frame_layers; bool is_layer_blacklisted(const std::string &name) { static std::vector 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(); diff --git a/src/anbox/graphics/emugl/RenderThread.cpp b/src/anbox/graphics/emugl/RenderThread.cpp index 71e5986d16968a439ab78c0b657ed964f4025f9f..60430300c11e4d4c2e166ccdff735a4f06d3ee86 100644 --- a/src/anbox/graphics/emugl/RenderThread.cpp +++ b/src/anbox/graphics/emugl/RenderThread.cpp @@ -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; diff --git a/src/anbox/graphics/emugl/RenderThreadInfo.cpp b/src/anbox/graphics/emugl/RenderThreadInfo.cpp index 69c9f99a74750be5059c85289b5e3085077d061d..500a0b4731839e7a8e22ef6498516178d90aa427 100644 --- a/src/anbox/graphics/emugl/RenderThreadInfo.cpp +++ b/src/anbox/graphics/emugl/RenderThreadInfo.cpp @@ -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 s_tls = LAZY_INSTANCE_INIT;