diff options
5 files changed, 50 insertions, 22 deletions
diff --git a/bash_completion/adb.bash b/bash_completion/adb.bash index 46ed208..d4d7b4e 100644 --- a/bash_completion/adb.bash +++ b/bash_completion/adb.bash @@ -78,6 +78,9 @@ _adb() { install) _adb_cmd_install "$serial" $i ;; + sideload) + _adb_cmd_sideload "$serial" $i + ;; pull) _adb_cmd_pull "$serial" $i ;; @@ -133,6 +136,17 @@ _adb_cmd_install() { _adb_util_complete_local_file "${cur}" '!*.apk' } +_adb_cmd_sideload() { + local serial i cur + + serial=$1 + i=$2 + + cur="${COMP_WORDS[COMP_CWORD]}" + + _adb_util_complete_local_file "${cur}" '!*.zip' +} + _adb_cmd_push() { local serial IFS=$'\n' i cur diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp index 2c9e8c5..cfadf12 100644 --- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "FrameBuffer.h" #include "NativeSubWindow.h" #include "FBConfig.h" @@ -20,14 +21,14 @@ #include "GLDispatch.h" #include "GL2Dispatch.h" #include "ThreadInfo.h" -#include <stdio.h> #include "TimeUtils.h" +#include <stdio.h> FrameBuffer *FrameBuffer::s_theFrameBuffer = NULL; HandleType FrameBuffer::s_nextHandle = 0; #ifdef WITH_GLES2 -static const char *getGLES2ExtensionString(EGLDisplay p_dpy) +static char* getGLES2ExtensionString(EGLDisplay p_dpy) { EGLConfig config; EGLSurface surface; @@ -74,10 +75,9 @@ static const char *getGLES2ExtensionString(EGLDisplay p_dpy) return NULL; } - const char *extString = (const char *)s_gl2.glGetString(GL_EXTENSIONS); - if (!extString) { - extString = ""; - } + // the string pointer may become invalid when the context is destroyed + const char* s = (const char*)s_gl2.glGetString(GL_EXTENSIONS); + char* extString = strdup(s ? s : ""); s_egl.eglMakeCurrent(p_dpy, NULL, NULL, NULL); s_egl.eglDestroyContext(p_dpy, ctx); @@ -153,7 +153,7 @@ bool FrameBuffer::initialize(int width, int height) // if GLES2 plugin has loaded - try to make GLES2 context and // get GLES2 extension string // - const char *gl2Extensions = NULL; + char* gl2Extensions = NULL; #ifdef WITH_GLES2 if (fb->m_caps.hasGL2) { gl2Extensions = getGLES2ExtensionString(fb->m_eglDisplay); @@ -187,6 +187,7 @@ bool FrameBuffer::initialize(int width, int height) if (!s_egl.eglChooseConfig(fb->m_eglDisplay, configAttribs, &fb->m_eglConfig, 1, &n)) { ERR("Failed on eglChooseConfig\n"); + free(gl2Extensions); delete fb; return false; } @@ -201,6 +202,7 @@ bool FrameBuffer::initialize(int width, int height) glContextAttribs); if (fb->m_eglContext == EGL_NO_CONTEXT) { printf("Failed to create Context 0x%x\n", s_egl.eglGetError()); + free(gl2Extensions); delete fb; return false; } @@ -218,6 +220,7 @@ bool FrameBuffer::initialize(int width, int height) glContextAttribs); if (fb->m_pbufContext == EGL_NO_CONTEXT) { printf("Failed to create Pbuffer Context 0x%x\n", s_egl.eglGetError()); + free(gl2Extensions); delete fb; return false; } @@ -238,6 +241,7 @@ bool FrameBuffer::initialize(int width, int height) pbufAttribs); if (fb->m_pbufSurface == EGL_NO_SURFACE) { printf("Failed to create pbuf surface for FB 0x%x\n", s_egl.eglGetError()); + free(gl2Extensions); delete fb; return false; } @@ -245,6 +249,7 @@ bool FrameBuffer::initialize(int width, int height) // Make the context current if (!fb->bind_locked()) { ERR("Failed to make current\n"); + free(gl2Extensions); delete fb; return false; } @@ -259,8 +264,10 @@ bool FrameBuffer::initialize(int width, int height) } if (fb->m_caps.hasGL2 && has_gl_oes_image) { - has_gl_oes_image &= (strstr(gl2Extensions, "GL_OES_EGL_image") != NULL); + has_gl_oes_image &= strstr(gl2Extensions, "GL_OES_EGL_image") != NULL; } + free(gl2Extensions); + gl2Extensions = NULL; const char *eglExtensions = s_egl.eglQueryString(fb->m_eglDisplay, EGL_EXTENSIONS); @@ -578,9 +585,7 @@ bool FrameBuffer::flushWindowSurfaceColorBuffer(HandleType p_surface) return false; } - (*w).second->flushColorBuffer(); - - return true; + return (*w).second->flushColorBuffer(); } bool FrameBuffer::setWindowSurfaceColorBuffer(HandleType p_surface, diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp index 960dec7..6a15138 100644 --- a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp @@ -239,7 +239,9 @@ static int rcFlushWindowColorBuffer(uint32_t windowSurface) if (!fb) { return -1; } - fb->flushWindowSurfaceColorBuffer(windowSurface); + if (!fb->flushWindowSurfaceColorBuffer(windowSurface)) { + return -1; + } return 0; } diff --git a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp index 3674120..9c32ff8 100644 --- a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp @@ -81,11 +81,12 @@ WindowSurface *WindowSurface::create(int p_config, int p_width, int p_height) // previous attached color buffer is updated, if copy or blit should be done // in order to update it - it is being done here. // -void WindowSurface::flushColorBuffer() +bool WindowSurface::flushColorBuffer() { if (m_attachedColorBuffer.Ptr() != NULL) { - blitToColorBuffer(); + return blitToColorBuffer(); } + return true; } // @@ -140,14 +141,15 @@ void WindowSurface::bind(RenderContextPtr p_ctx, SurfaceBindType p_bindType) } -void WindowSurface::blitToColorBuffer() +bool WindowSurface::blitToColorBuffer() { - if (!m_width && !m_height) return; + if (!m_width && !m_height) return false; if (m_attachedColorBuffer->getWidth() != m_width || m_attachedColorBuffer->getHeight() != m_height) { // XXX: should never happen - how this needs to be handled? - return; + fprintf(stderr, "Dimensions do not match\n"); + return false; } // @@ -157,9 +159,14 @@ void WindowSurface::blitToColorBuffer() EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ); EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW); FrameBuffer *fb = FrameBuffer::getFB(); + if (!m_drawContext.Ptr()) { + fprintf(stderr, "Draw context is NULL\n"); + return false; + } if (!s_egl.eglMakeCurrent(fb->getDisplay(), m_eglSurface, m_eglSurface, m_drawContext->getEGLContext())) { - return; + fprintf(stderr, "Error making draw context current\n"); + return false; } m_attachedColorBuffer->blitFromCurrentReadBuffer(); @@ -167,12 +174,12 @@ void WindowSurface::blitToColorBuffer() // restore current context/surface s_egl.eglMakeCurrent(fb->getDisplay(), prevDrawSurf, prevReadSurf, prevContext); - + return true; } bool WindowSurface::resizePbuffer(unsigned int p_width, unsigned int p_height) { - if (m_eglSurface && + if (m_eglSurface && m_pbufWidth == p_width && m_pbufHeight == p_height) { // no need to resize diff --git a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h index 1b655c9..e9f1f7d 100644 --- a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h +++ b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h @@ -38,13 +38,13 @@ public: EGLSurface getEGLSurface() const { return m_eglSurface; } void setColorBuffer(ColorBufferPtr p_colorBuffer); - void flushColorBuffer(); + bool flushColorBuffer(); void bind(RenderContextPtr p_ctx, SurfaceBindType p_bindType); private: WindowSurface(); - void blitToColorBuffer(); // copy pbuffer content with texload and blit + bool blitToColorBuffer(); // copy pbuffer content with texload and blit bool resizePbuffer(unsigned int p_width, unsigned int p_height); private: |