Loading include/ui/FramebufferNativeWindow.h +2 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <ui/egl/android_natives.h> #define NUM_FRAME_BUFFERS 2 extern "C" EGLNativeWindowType android_createDisplaySurface(void); Loading Loading @@ -72,7 +73,7 @@ private: framebuffer_device_t* fbDev; alloc_device_t* grDev; sp<NativeBuffer> buffers[2]; sp<NativeBuffer> buffers[NUM_FRAME_BUFFERS]; sp<NativeBuffer> front; mutable Mutex mutex; Loading libs/ui/FramebufferNativeWindow.cpp +26 −19 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ FramebufferNativeWindow::FramebufferNativeWindow() if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) { int stride; int err; int i; err = framebuffer_open(module, &fbDev); LOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err)); Loading @@ -96,27 +97,33 @@ FramebufferNativeWindow::FramebufferNativeWindow() mUpdateOnDemand = (fbDev->setUpdateRect != 0); // initialize the buffer FIFO mNumBuffers = 2; mNumFreeBuffers = 2; mNumBuffers = NUM_FRAME_BUFFERS; mNumFreeBuffers = NUM_FRAME_BUFFERS; mBufferHead = mNumBuffers-1; buffers[0] = new NativeBuffer( fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB); buffers[1] = new NativeBuffer( for (i = 0; i < mNumBuffers; i++) { buffers[i] = new NativeBuffer( fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB); } for (i = 0; i < mNumBuffers; i++) { err = grDev->alloc(grDev, fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB, &buffers[0]->handle, &buffers[0]->stride); GRALLOC_USAGE_HW_FB, &buffers[i]->handle, &buffers[i]->stride); LOGE_IF(err, "fb buffer 0 allocation failed w=%d, h=%d, err=%s", fbDev->width, fbDev->height, strerror(-err)); LOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s", i, fbDev->width, fbDev->height, strerror(-err)); err = grDev->alloc(grDev, fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB, &buffers[1]->handle, &buffers[1]->stride); LOGE_IF(err, "fb buffer 1 allocation failed w=%d, h=%d, err=%s", fbDev->width, fbDev->height, strerror(-err)); if (err) { mNumBuffers = i; mNumFreeBuffers = i; mBufferHead = mNumBuffers-1; break; } } const_cast<uint32_t&>(ANativeWindow::flags) = fbDev->flags; const_cast<float&>(ANativeWindow::xdpi) = fbDev->xdpi; Loading Loading
include/ui/FramebufferNativeWindow.h +2 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <ui/egl/android_natives.h> #define NUM_FRAME_BUFFERS 2 extern "C" EGLNativeWindowType android_createDisplaySurface(void); Loading Loading @@ -72,7 +73,7 @@ private: framebuffer_device_t* fbDev; alloc_device_t* grDev; sp<NativeBuffer> buffers[2]; sp<NativeBuffer> buffers[NUM_FRAME_BUFFERS]; sp<NativeBuffer> front; mutable Mutex mutex; Loading
libs/ui/FramebufferNativeWindow.cpp +26 −19 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ FramebufferNativeWindow::FramebufferNativeWindow() if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) { int stride; int err; int i; err = framebuffer_open(module, &fbDev); LOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err)); Loading @@ -96,27 +97,33 @@ FramebufferNativeWindow::FramebufferNativeWindow() mUpdateOnDemand = (fbDev->setUpdateRect != 0); // initialize the buffer FIFO mNumBuffers = 2; mNumFreeBuffers = 2; mNumBuffers = NUM_FRAME_BUFFERS; mNumFreeBuffers = NUM_FRAME_BUFFERS; mBufferHead = mNumBuffers-1; buffers[0] = new NativeBuffer( fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB); buffers[1] = new NativeBuffer( for (i = 0; i < mNumBuffers; i++) { buffers[i] = new NativeBuffer( fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB); } for (i = 0; i < mNumBuffers; i++) { err = grDev->alloc(grDev, fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB, &buffers[0]->handle, &buffers[0]->stride); GRALLOC_USAGE_HW_FB, &buffers[i]->handle, &buffers[i]->stride); LOGE_IF(err, "fb buffer 0 allocation failed w=%d, h=%d, err=%s", fbDev->width, fbDev->height, strerror(-err)); LOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s", i, fbDev->width, fbDev->height, strerror(-err)); err = grDev->alloc(grDev, fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB, &buffers[1]->handle, &buffers[1]->stride); LOGE_IF(err, "fb buffer 1 allocation failed w=%d, h=%d, err=%s", fbDev->width, fbDev->height, strerror(-err)); if (err) { mNumBuffers = i; mNumFreeBuffers = i; mBufferHead = mNumBuffers-1; break; } } const_cast<uint32_t&>(ANativeWindow::flags) = fbDev->flags; const_cast<float&>(ANativeWindow::xdpi) = fbDev->xdpi; Loading