Correct emugl includes and move to std::{mutex,shared_ptr} where possible
This commit is contained in:
parent
a21233cb38
commit
4fde30b7b6
27 changed files with 160 additions and 147 deletions
|
|
@ -13,17 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "ColorBuffer.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "TextureDraw.h"
|
||||
#include "TextureResize.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include "anbox/graphics/emugl/ColorBuffer.h"
|
||||
#include "anbox/graphics/emugl/DispatchTables.h"
|
||||
#include "anbox/graphics/emugl/RenderThreadInfo.h"
|
||||
#include "anbox/graphics/emugl/TextureDraw.h"
|
||||
#include "anbox/graphics/emugl/TextureResize.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace {
|
||||
|
|
@ -251,7 +250,7 @@ void ColorBuffer::subUpdate(int x, int y, int width, int height,
|
|||
|
||||
bool ColorBuffer::blitFromCurrentReadBuffer() {
|
||||
RenderThreadInfo* tInfo = RenderThreadInfo::get();
|
||||
if (!tInfo->currContext.Ptr()) {
|
||||
if (!tInfo->currContext) {
|
||||
// no Current context
|
||||
return false;
|
||||
}
|
||||
|
|
@ -312,7 +311,7 @@ bool ColorBuffer::bindToTexture() {
|
|||
return false;
|
||||
}
|
||||
RenderThreadInfo* tInfo = RenderThreadInfo::get();
|
||||
if (!tInfo->currContext.Ptr()) {
|
||||
if (!tInfo->currContext) {
|
||||
return false;
|
||||
}
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
|
|
@ -328,7 +327,7 @@ bool ColorBuffer::bindToRenderbuffer() {
|
|||
return false;
|
||||
}
|
||||
RenderThreadInfo* tInfo = RenderThreadInfo::get();
|
||||
if (!tInfo->currContext.Ptr()) {
|
||||
if (!tInfo->currContext) {
|
||||
return false;
|
||||
}
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES/gl.h>
|
||||
#include "emugl/common/smart_ptr.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
@ -135,6 +134,6 @@ class ColorBuffer {
|
|||
TextureResize* m_resizer;
|
||||
};
|
||||
|
||||
typedef emugl::SmartPtr<ColorBuffer> ColorBufferPtr;
|
||||
typedef std::shared_ptr<ColorBuffer> ColorBufferPtr;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,13 +13,14 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "ReadBuffer.h"
|
||||
|
||||
#include "anbox/graphics/emugl/ReadBuffer.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
ReadBuffer::ReadBuffer(size_t bufsize) {
|
||||
m_size = bufsize;
|
||||
m_buf = static_cast<unsigned char*>(malloc(m_size * sizeof(unsigned char)));
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef _READ_BUFFER_H
|
||||
#define _READ_BUFFER_H
|
||||
|
||||
#include "IOStream.h"
|
||||
#include "external/android-emugl/host/include/libOpenglRender/IOStream.h"
|
||||
|
||||
class ReadBuffer {
|
||||
public:
|
||||
|
|
@ -34,4 +34,5 @@ class ReadBuffer {
|
|||
size_t m_size;
|
||||
size_t m_validData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,15 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "RenderApi.h"
|
||||
#include "anbox/graphics/emugl/RenderApi.h"
|
||||
#include "anbox/graphics/emugl/DispatchTables.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
|
||||
#include "emugl/common/crash_reporter.h"
|
||||
#include "external/android-emugl/shared/emugl/common/crash_reporter.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "emugl/common/logging.h"
|
||||
#include "external/android-emugl/shared/emugl/common/logging.h"
|
||||
|
||||
typedef struct {
|
||||
logger_t coarse;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "RenderContext.h"
|
||||
|
||||
#include "anbox/graphics/emugl/RenderContext.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -13,14 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LIBRENDER_RENDER_CONTEXT_H
|
||||
#define _LIBRENDER_RENDER_CONTEXT_H
|
||||
|
||||
#include "GLDecoderContextData.h"
|
||||
#include "emugl/common/smart_ptr.h"
|
||||
#include "external/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
// A class used to model a guest EGLContext. This simply wraps a host
|
||||
// EGLContext, associated with an GLDecoderContextData instance that is
|
||||
// used to store copies of guest-side arrays.
|
||||
|
|
@ -60,6 +62,6 @@ class RenderContext {
|
|||
GLDecoderContextData mContextData;
|
||||
};
|
||||
|
||||
typedef emugl::SmartPtr<RenderContext> RenderContextPtr;
|
||||
typedef std::shared_ptr<RenderContext> RenderContextPtr;
|
||||
|
||||
#endif // _LIBRENDER_RENDER_CONTEXT_H
|
||||
|
|
|
|||
|
|
@ -13,20 +13,20 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "RenderControl.h"
|
||||
|
||||
#include "ChecksumCalculatorThreadInfo.h"
|
||||
#include "DispatchTables.h"
|
||||
#include "DisplayManager.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "Renderer.h"
|
||||
#include "RendererConfig.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include "anbox/graphics/emugl/RenderControl.h"
|
||||
#include "anbox/graphics/emugl/DispatchTables.h"
|
||||
#include "anbox/graphics/emugl/DisplayManager.h"
|
||||
#include "anbox/graphics/emugl/RenderThreadInfo.h"
|
||||
#include "anbox/graphics/emugl/Renderer.h"
|
||||
#include "anbox/graphics/emugl/RendererConfig.h"
|
||||
#include "anbox/graphics/layer_composer.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include "external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _RENDER_CONTROL_H
|
||||
#define _RENDER_CONTROL_H
|
||||
|
||||
// Generated with emugl at build time
|
||||
#include "renderControl_dec.h"
|
||||
|
||||
#include <memory>
|
||||
|
|
|
|||
|
|
@ -13,32 +13,31 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "RenderThread.h"
|
||||
|
||||
#include "ReadBuffer.h"
|
||||
#include "RenderControl.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "Renderer.h"
|
||||
#include "TimeUtils.h"
|
||||
|
||||
#include "../../../shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h"
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
|
||||
#include "anbox/graphics/emugl/RenderThread.h"
|
||||
#include "anbox/graphics/emugl/ReadBuffer.h"
|
||||
#include "anbox/graphics/emugl/RenderControl.h"
|
||||
#include "anbox/graphics/emugl/RenderThreadInfo.h"
|
||||
#include "anbox/graphics/emugl/Renderer.h"
|
||||
#include "anbox/graphics/emugl/TimeUtils.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include "external/android-emugl/shared/OpenglCodecCommon/ChecksumCalculatorThreadInfo.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/GLESv1Dispatch.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/GLESv2Dispatch.h"
|
||||
|
||||
#define STREAM_BUFFER_SIZE 4 * 1024 * 1024
|
||||
|
||||
RenderThread::RenderThread(const std::shared_ptr<Renderer> &renderer, IOStream *stream, emugl::Mutex *lock)
|
||||
: emugl::Thread(), renderer_(renderer), m_lock(lock), m_stream(stream) {}
|
||||
RenderThread::RenderThread(const std::shared_ptr<Renderer> &renderer, IOStream *stream, std::mutex &m)
|
||||
: emugl::Thread(), renderer_(renderer), m_lock(m), m_stream(stream) {}
|
||||
|
||||
RenderThread::~RenderThread() {
|
||||
forceStop();
|
||||
}
|
||||
|
||||
RenderThread *RenderThread::create(const std::shared_ptr<Renderer> &renderer, IOStream *stream, emugl::Mutex *lock) {
|
||||
return new RenderThread(renderer, stream, lock);
|
||||
RenderThread *RenderThread::create(const std::shared_ptr<Renderer> &renderer, IOStream *stream, std::mutex &m) {
|
||||
return new RenderThread(renderer, stream, m);
|
||||
}
|
||||
|
||||
void RenderThread::forceStop() { m_stream->forceStop(); }
|
||||
|
|
@ -62,7 +61,8 @@ intptr_t RenderThread::main() {
|
|||
do {
|
||||
progress = false;
|
||||
|
||||
m_lock->lock();
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
size_t last =
|
||||
threadInfo.m_glDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
|
||||
if (last > 0) {
|
||||
|
|
@ -83,8 +83,6 @@ intptr_t RenderThread::main() {
|
|||
progress = true;
|
||||
}
|
||||
|
||||
m_lock->unlock();
|
||||
|
||||
} while (progress);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LIB_OPENGL_RENDER_RENDER_THREAD_H
|
||||
#define _LIB_OPENGL_RENDER_RENDER_THREAD_H
|
||||
|
||||
#include "IOStream.h"
|
||||
#include "external/android-emugl/host/include/libOpenglRender/IOStream.h"
|
||||
|
||||
#include "emugl/common/mutex.h"
|
||||
#include "emugl/common/thread.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
class Renderer;
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ class RenderThread : public emugl::Thread {
|
|||
// decoding operations between all threads.
|
||||
// TODO(digit): Why is this needed here? Shouldn't this be handled
|
||||
// by the decoders themselves or at a lower-level?
|
||||
static RenderThread* create(const std::shared_ptr<Renderer>& renderer, IOStream* stream, emugl::Mutex* mutex);
|
||||
static RenderThread* create(const std::shared_ptr<Renderer>& renderer, IOStream* stream, std::mutex &m);
|
||||
|
||||
// Destructor.
|
||||
virtual ~RenderThread();
|
||||
|
|
@ -51,12 +52,12 @@ class RenderThread : public emugl::Thread {
|
|||
private:
|
||||
RenderThread(); // No default constructor
|
||||
|
||||
RenderThread(const std::shared_ptr<Renderer>& renderer, IOStream* stream, emugl::Mutex* mutex);
|
||||
RenderThread(const std::shared_ptr<Renderer>& renderer, IOStream* stream, std::mutex &m);
|
||||
|
||||
virtual intptr_t main();
|
||||
|
||||
std::shared_ptr<Renderer> renderer_;
|
||||
emugl::Mutex* m_lock;
|
||||
std::mutex &m_lock;
|
||||
IOStream* m_stream;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "anbox/graphics/emugl/RenderThreadInfo.h"
|
||||
|
||||
#include "emugl/common/lazy_instance.h"
|
||||
#include "emugl/common/thread_store.h"
|
||||
#include "external/android-emugl/shared/emugl/common/lazy_instance.h"
|
||||
#include "external/android-emugl/shared/emugl/common/thread_store.h"
|
||||
|
||||
namespace {
|
||||
class ThreadInfoStore : public ::emugl::ThreadStore {
|
||||
|
|
|
|||
|
|
@ -13,13 +13,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LIB_OPENGL_RENDER_THREAD_INFO_H
|
||||
#define _LIB_OPENGL_RENDER_THREAD_INFO_H
|
||||
|
||||
#include "GLESv1Decoder.h"
|
||||
#include "GLESv2Decoder.h"
|
||||
#include "RenderContext.h"
|
||||
#include "WindowSurface.h"
|
||||
#include "anbox/graphics/emugl/RenderContext.h"
|
||||
#include "anbox/graphics/emugl/WindowSurface.h"
|
||||
|
||||
#include "external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h"
|
||||
#include "external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h"
|
||||
|
||||
// Generated with emugl at build time
|
||||
#include "renderControl_dec.h"
|
||||
|
||||
#include <set>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Renderable.h"
|
||||
#include "anbox/graphics/emugl/Renderable.h"
|
||||
|
||||
Renderable::Renderable(const std::string &name, const std::uint32_t &buffer,
|
||||
const anbox::graphics::Rect &screen_position,
|
||||
|
|
|
|||
|
|
@ -14,19 +14,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Renderer.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "RenderThreadInfo.h"
|
||||
#include "TimeUtils.h"
|
||||
#include "gles2_dec.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include "anbox/graphics/emugl/Renderer.h"
|
||||
#include "anbox/graphics/emugl/DispatchTables.h"
|
||||
#include "anbox/graphics/emugl/RenderThreadInfo.h"
|
||||
#include "anbox/graphics/emugl/TimeUtils.h"
|
||||
#include "anbox/graphics/gl_extensions.h"
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
// Generated with emugl at build time
|
||||
#include "gles2_dec.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
|
@ -361,13 +360,14 @@ HandleType Renderer::genHandle() {
|
|||
|
||||
HandleType Renderer::createColorBuffer(int p_width, int p_height,
|
||||
GLenum p_internalFormat) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
HandleType ret = 0;
|
||||
|
||||
ColorBufferPtr cb(ColorBuffer::create(
|
||||
getDisplay(), p_width, p_height, p_internalFormat,
|
||||
getCaps().has_eglimage_texture_2d, m_colorBufferHelper));
|
||||
if (cb.Ptr() != NULL) {
|
||||
if (cb) {
|
||||
ret = genHandle();
|
||||
m_colorbuffers[ret].cb = cb;
|
||||
m_colorbuffers[ret].refcount = 1;
|
||||
|
|
@ -377,7 +377,8 @@ HandleType Renderer::createColorBuffer(int p_width, int p_height,
|
|||
|
||||
HandleType Renderer::createRenderContext(int p_config, HandleType p_share,
|
||||
bool p_isGL2) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
HandleType ret = 0;
|
||||
|
||||
const RendererConfig *config = getConfigs()->get(p_config);
|
||||
|
|
@ -394,11 +395,11 @@ HandleType Renderer::createRenderContext(int p_config, HandleType p_share,
|
|||
share = (*s).second;
|
||||
}
|
||||
EGLContext sharedContext =
|
||||
share.Ptr() ? share->getEGLContext() : EGL_NO_CONTEXT;
|
||||
share ? share->getEGLContext() : EGL_NO_CONTEXT;
|
||||
|
||||
RenderContextPtr rctx(RenderContext::create(
|
||||
m_eglDisplay, config->getEglConfig(), sharedContext, p_isGL2));
|
||||
if (rctx.Ptr() != NULL) {
|
||||
if (rctx) {
|
||||
ret = genHandle();
|
||||
m_contexts[ret] = rctx;
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
|
|
@ -409,7 +410,7 @@ HandleType Renderer::createRenderContext(int p_config, HandleType p_share,
|
|||
|
||||
HandleType Renderer::createWindowSurface(int p_config, int p_width,
|
||||
int p_height) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
HandleType ret = 0;
|
||||
|
||||
|
|
@ -420,7 +421,7 @@ HandleType Renderer::createWindowSurface(int p_config, int p_width,
|
|||
|
||||
WindowSurfacePtr win(WindowSurface::create(
|
||||
getDisplay(), config->getEglConfig(), p_width, p_height));
|
||||
if (win.Ptr() != NULL) {
|
||||
if (win) {
|
||||
ret = genHandle();
|
||||
m_windows[ret] = std::pair<WindowSurfacePtr, HandleType>(win, 0);
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
|
|
@ -431,7 +432,8 @@ HandleType Renderer::createWindowSurface(int p_config, int p_width,
|
|||
}
|
||||
|
||||
void Renderer::drainRenderContext() {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
if (tinfo->m_contextSet.empty()) return;
|
||||
for (std::set<HandleType>::iterator it = tinfo->m_contextSet.begin();
|
||||
|
|
@ -443,7 +445,8 @@ void Renderer::drainRenderContext() {
|
|||
}
|
||||
|
||||
void Renderer::drainWindowSurface() {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
if (tinfo->m_windowSet.empty()) return;
|
||||
for (std::set<HandleType>::iterator it = tinfo->m_windowSet.begin();
|
||||
|
|
@ -466,7 +469,8 @@ void Renderer::drainWindowSurface() {
|
|||
}
|
||||
|
||||
void Renderer::DestroyRenderContext(HandleType p_context) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
m_contexts.erase(p_context);
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
if (tinfo->m_contextSet.empty()) return;
|
||||
|
|
@ -474,7 +478,8 @@ void Renderer::DestroyRenderContext(HandleType p_context) {
|
|||
}
|
||||
|
||||
void Renderer::DestroyWindowSurface(HandleType p_surface) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
if (m_windows.find(p_surface) != m_windows.end()) {
|
||||
m_windows.erase(p_surface);
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
|
|
@ -484,7 +489,8 @@ void Renderer::DestroyWindowSurface(HandleType p_surface) {
|
|||
}
|
||||
|
||||
int Renderer::openColorBuffer(HandleType p_colorbuffer) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
|
||||
if (c == m_colorbuffers.end()) {
|
||||
// bad colorbuffer handle
|
||||
|
|
@ -496,7 +502,8 @@ int Renderer::openColorBuffer(HandleType p_colorbuffer) {
|
|||
}
|
||||
|
||||
void Renderer::closeColorBuffer(HandleType p_colorbuffer) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
|
||||
if (c == m_colorbuffers.end()) {
|
||||
// This is harmless: it is normal for guest system to issue
|
||||
|
|
@ -511,7 +518,7 @@ void Renderer::closeColorBuffer(HandleType p_colorbuffer) {
|
|||
}
|
||||
|
||||
bool Renderer::flushWindowSurfaceColorBuffer(HandleType p_surface) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
WindowSurfaceMap::iterator w(m_windows.find(p_surface));
|
||||
if (w == m_windows.end()) {
|
||||
|
|
@ -521,7 +528,10 @@ bool Renderer::flushWindowSurfaceColorBuffer(HandleType p_surface) {
|
|||
return false;
|
||||
}
|
||||
|
||||
WindowSurface *surface = (*w).second.first.Ptr();
|
||||
auto surface = (*w).second.first;
|
||||
if (!surface)
|
||||
return false;
|
||||
|
||||
surface->flushColorBuffer();
|
||||
|
||||
return true;
|
||||
|
|
@ -529,7 +539,7 @@ bool Renderer::flushWindowSurfaceColorBuffer(HandleType p_surface) {
|
|||
|
||||
bool Renderer::setWindowSurfaceColorBuffer(HandleType p_surface,
|
||||
HandleType p_colorbuffer) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
WindowSurfaceMap::iterator w(m_windows.find(p_surface));
|
||||
if (w == m_windows.end()) {
|
||||
|
|
@ -553,7 +563,7 @@ bool Renderer::setWindowSurfaceColorBuffer(HandleType p_surface,
|
|||
void Renderer::readColorBuffer(HandleType p_colorbuffer, int x, int y,
|
||||
int width, int height, GLenum format,
|
||||
GLenum type, void *pixels) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
|
||||
if (c == m_colorbuffers.end()) {
|
||||
|
|
@ -567,7 +577,7 @@ void Renderer::readColorBuffer(HandleType p_colorbuffer, int x, int y,
|
|||
bool Renderer::updateColorBuffer(HandleType p_colorbuffer, int x, int y,
|
||||
int width, int height, GLenum format,
|
||||
GLenum type, void *pixels) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
|
||||
if (c == m_colorbuffers.end()) {
|
||||
|
|
@ -581,7 +591,7 @@ bool Renderer::updateColorBuffer(HandleType p_colorbuffer, int x, int y,
|
|||
}
|
||||
|
||||
bool Renderer::bindColorBufferToTexture(HandleType p_colorbuffer) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
|
||||
if (c == m_colorbuffers.end()) {
|
||||
|
|
@ -593,7 +603,7 @@ bool Renderer::bindColorBufferToTexture(HandleType p_colorbuffer) {
|
|||
}
|
||||
|
||||
bool Renderer::bindColorBufferToRenderbuffer(HandleType p_colorbuffer) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer));
|
||||
if (c == m_colorbuffers.end()) {
|
||||
|
|
@ -606,7 +616,7 @@ bool Renderer::bindColorBufferToRenderbuffer(HandleType p_colorbuffer) {
|
|||
|
||||
bool Renderer::bindContext(HandleType p_context, HandleType p_drawSurface,
|
||||
HandleType p_readSurface) {
|
||||
emugl::Mutex::AutoLock mutex(m_lock);
|
||||
std::unique_lock<std::mutex> l(m_lock);
|
||||
|
||||
WindowSurfacePtr draw(NULL), read(NULL);
|
||||
RenderContextPtr ctx(NULL);
|
||||
|
|
@ -654,7 +664,7 @@ bool Renderer::bindContext(HandleType p_context, HandleType p_drawSurface,
|
|||
//
|
||||
RenderThreadInfo *tinfo = RenderThreadInfo::get();
|
||||
WindowSurfacePtr bindDraw, bindRead;
|
||||
if (draw.Ptr() == NULL && read.Ptr() == NULL) {
|
||||
if (!draw && !read) {
|
||||
// Unbind the current read and draw surfaces from the context
|
||||
bindDraw = tinfo->currDrawSurf;
|
||||
bindRead = tinfo->currReadSurf;
|
||||
|
|
@ -663,8 +673,8 @@ bool Renderer::bindContext(HandleType p_context, HandleType p_drawSurface,
|
|||
bindRead = read;
|
||||
}
|
||||
|
||||
if (bindDraw.Ptr() != NULL && bindRead.Ptr() != NULL) {
|
||||
if (bindDraw.Ptr() != bindRead.Ptr()) {
|
||||
if (bindDraw && bindRead) {
|
||||
if (bindDraw != bindRead) {
|
||||
bindDraw->bind(ctx, WindowSurface::BIND_DRAW);
|
||||
bindRead->bind(ctx, WindowSurface::BIND_READ);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,12 @@
|
|||
#ifndef _LIBRENDER_FRAMEBUFFER_H
|
||||
#define _LIBRENDER_FRAMEBUFFER_H
|
||||
|
||||
#include "ColorBuffer.h"
|
||||
#include "RenderContext.h"
|
||||
#include "RendererConfig.h"
|
||||
#include "TextureDraw.h"
|
||||
#include "WindowSurface.h"
|
||||
#include "emugl/common/mutex.h"
|
||||
|
||||
#include "Renderable.h"
|
||||
#include "anbox/graphics/emugl/ColorBuffer.h"
|
||||
#include "anbox/graphics/emugl/RenderContext.h"
|
||||
#include "anbox/graphics/emugl/RendererConfig.h"
|
||||
#include "anbox/graphics/emugl/TextureDraw.h"
|
||||
#include "anbox/graphics/emugl/WindowSurface.h"
|
||||
#include "anbox/graphics/emugl/Renderable.h"
|
||||
|
||||
#include "anbox/graphics/primitives.h"
|
||||
#include "anbox/graphics/program_family.h"
|
||||
|
|
@ -32,6 +30,7 @@
|
|||
#include <EGL/egl.h>
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
@ -257,7 +256,7 @@ class Renderer : public anbox::graphics::Renderer {
|
|||
private:
|
||||
static Renderer* s_renderer;
|
||||
static HandleType s_nextHandle;
|
||||
emugl::Mutex m_lock;
|
||||
std::mutex m_lock;
|
||||
RendererConfigList* m_configs;
|
||||
RendererCaps m_caps;
|
||||
EGLDisplay m_eglDisplay;
|
||||
|
|
|
|||
|
|
@ -12,15 +12,14 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "RendererConfig.h"
|
||||
#include "anbox/graphics/emugl/RendererConfig.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
namespace {
|
||||
const GLuint kConfigAttributes[] = {
|
||||
EGL_DEPTH_SIZE, // must be first - see getDepthSize()
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "TextureDraw.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "anbox/graphics/emugl/TextureDraw.h"
|
||||
#include "anbox/graphics/emugl/DispatchTables.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
// M_PI isn't defined in C++ (when strict ISO compliance is enabled)
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338327
|
||||
|
|
|
|||
|
|
@ -13,17 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "TextureResize.h"
|
||||
|
||||
#include "DispatchTables.h"
|
||||
#include "anbox/graphics/emugl/TextureResize.h"
|
||||
#include "anbox/graphics/emugl/DispatchTables.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#define MAX_FACTOR_POWER 4
|
||||
|
||||
static const char kCommonShaderSource[] =
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LIBRENDER_TEXTURERESIZE_H
|
||||
#define _LIBRENDER_TEXTURERESIZE_H
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "TimeUtils.h"
|
||||
|
||||
#include "anbox/graphics/emugl/TimeUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _TIME_UTILS_H
|
||||
#define _TIME_UTILS_H
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,18 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "WindowSurface.h"
|
||||
#include "RendererConfig.h"
|
||||
|
||||
#include "OpenGLESDispatch/EGLDispatch.h"
|
||||
#include "anbox/graphics/emugl/WindowSurface.h"
|
||||
#include "anbox/graphics/emugl/RendererConfig.h"
|
||||
#include "anbox/logger.h"
|
||||
|
||||
#include "external/android-emugl/host/include/OpenGLESDispatch/EGLDispatch.h"
|
||||
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "anbox/logger.h"
|
||||
|
||||
WindowSurface::WindowSurface(EGLDisplay display, EGLConfig config)
|
||||
: mSurface(NULL),
|
||||
|
|
@ -84,7 +85,7 @@ void WindowSurface::bind(RenderContextPtr p_ctx, BindType p_bindType) {
|
|||
}
|
||||
|
||||
bool WindowSurface::flushColorBuffer() {
|
||||
if (!mAttachedColorBuffer.Ptr()) {
|
||||
if (!mAttachedColorBuffer) {
|
||||
return true;
|
||||
}
|
||||
if (!mWidth || !mHeight) {
|
||||
|
|
@ -98,7 +99,7 @@ bool WindowSurface::flushColorBuffer() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!mDrawContext.Ptr()) {
|
||||
if (!mDrawContext) {
|
||||
ERROR("Draw context is NULL");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,8 @@
|
|||
#ifndef _LIBRENDER_WINDOW_SURFACE_H
|
||||
#define _LIBRENDER_WINDOW_SURFACE_H
|
||||
|
||||
#include "ColorBuffer.h"
|
||||
#include "RenderContext.h"
|
||||
|
||||
#include "emugl/common/smart_ptr.h"
|
||||
#include "anbox/graphics/emugl/ColorBuffer.h"
|
||||
#include "anbox/graphics/emugl/RenderContext.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
|
|
@ -94,6 +92,6 @@ class WindowSurface {
|
|||
EGLDisplay mDisplay;
|
||||
};
|
||||
|
||||
typedef emugl::SmartPtr<WindowSurface> WindowSurfacePtr;
|
||||
typedef std::shared_ptr<WindowSurface> WindowSurfacePtr;
|
||||
|
||||
#endif // _LIBRENDER_WINDOW_SURFACE_H
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace anbox {
|
||||
namespace graphics {
|
||||
emugl::Mutex OpenGlesMessageProcessor::global_lock{};
|
||||
std::mutex OpenGlesMessageProcessor::global_lock{};
|
||||
|
||||
OpenGlesMessageProcessor::OpenGlesMessageProcessor(
|
||||
const std::shared_ptr<Renderer> &renderer,
|
||||
|
|
@ -43,7 +43,7 @@ OpenGlesMessageProcessor::OpenGlesMessageProcessor(
|
|||
boost::asio::buffer(&client_flags, sizeof(unsigned int)));
|
||||
if (err) ERROR("%s", err.message());
|
||||
|
||||
render_thread_.reset(RenderThread::create(renderer, stream_.get(), &global_lock));
|
||||
render_thread_.reset(RenderThread::create(renderer, stream_.get(), std::ref(global_lock)));
|
||||
if (!render_thread_->start())
|
||||
BOOST_THROW_EXCEPTION(
|
||||
std::runtime_error("Failed to start renderer thread"));
|
||||
|
|
|
|||
|
|
@ -18,16 +18,15 @@
|
|||
#ifndef ANBOX_GRAPHICS_OPENGLES_MESSAGE_PROCESSOR_H_
|
||||
#define ANBOX_GRAPHICS_OPENGLES_MESSAGE_PROCESSOR_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
#include "anbox/network/message_processor.h"
|
||||
#include "anbox/network/socket_connection.h"
|
||||
#include "anbox/network/socket_messenger.h"
|
||||
#include "anbox/runtime.h"
|
||||
|
||||
#include "external/android-emugl/shared/emugl/common/mutex.h"
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
class IOStream;
|
||||
class RenderThread;
|
||||
|
|
@ -45,7 +44,7 @@ class OpenGlesMessageProcessor : public network::MessageProcessor {
|
|||
bool process_data(const std::vector<std::uint8_t> &data) override;
|
||||
|
||||
private:
|
||||
static emugl::Mutex global_lock;
|
||||
static std::mutex global_lock;
|
||||
|
||||
std::shared_ptr<network::SocketMessenger> messenger_;
|
||||
std::shared_ptr<IOStream> stream_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue