Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FramebufferNativeWindow: Fix locking

* No locking needed for query.
* Postpone locking until after fb_post returns

Change-Id: I214afddc1f32295c9fb625d07b27a9d98999859e
  • Loading branch information...
commit 99f42f15e344ba05dc9beadbd1d0267f40859a8c 1 parent c9399db
Naseer Ahmed authored Whitehawkx committed
Showing with 11 additions and 0 deletions.
  1. +4 −0 libs/ui/Android.mk
  2. +7 −0 libs/ui/FramebufferNativeWindow.cpp
View
4 libs/ui/Android.mk
@@ -52,6 +52,10 @@ ifeq ($(TARGET_SOC),exynos5250)
LOCAL_CFLAGS += -DSAMSUNG_EXYNOS5250
endif
+ifeq ($(BOARD_USES_QCOM_HARDWARE), true)
+LOCAL_CFLAGS += -DQCOMHW
+endif
+
LOCAL_MODULE:= libui
include $(BUILD_SHARED_LIBRARY)
View
7 libs/ui/FramebufferNativeWindow.cpp
@@ -264,12 +264,17 @@ int FramebufferNativeWindow::queueBuffer(ANativeWindow* window,
ANativeWindowBuffer* buffer)
{
FramebufferNativeWindow* self = getSelf(window);
+#ifndef QCOMHW
Mutex::Autolock _l(self->mutex);
+#endif
framebuffer_device_t* fb = self->fbDev;
buffer_handle_t handle = static_cast<NativeBuffer*>(buffer)->handle;
const int index = self->mCurrentBufferIndex;
int res = fb->post(fb, handle);
+#ifdef QCOMHW
+ Mutex::Autolock _l(self->mutex);
+#endif
self->front = static_cast<NativeBuffer*>(buffer);
self->mNumFreeBuffers++;
self->mCondition.broadcast();
@@ -301,7 +306,9 @@ int FramebufferNativeWindow::query(const ANativeWindow* window,
int what, int* value)
{
const FramebufferNativeWindow* self = getSelf(window);
+#ifndef QCOMHW
Mutex::Autolock _l(self->mutex);
+#endif
framebuffer_device_t* fb = self->fbDev;
switch (what) {
case NATIVE_WINDOW_WIDTH:
Please sign in to comment.
Something went wrong with that request. Please try again.