Merge "display: Remove genlock usage"
diff --git a/common.mk b/common.mk
index 5ae6df9..360032b 100644
--- a/common.mk
+++ b/common.mk
@@ -1,6 +1,5 @@
#Common headers
common_includes := hardware/qcom/display/libgralloc
-common_includes += hardware/qcom/display/libgenlock
common_includes += hardware/qcom/display/liboverlay
common_includes += hardware/qcom/display/libcopybit
common_includes += hardware/qcom/display/libqdutils
diff --git a/libgenlock/genlock.cpp b/libgenlock/genlock.cpp
index 6f4ec6c..c606ecc 100644
--- a/libgenlock/genlock.cpp
+++ b/libgenlock/genlock.cpp
@@ -43,6 +43,7 @@
int get_kernel_lock_type(genlock_lock_type lockType)
{
int kLockType = 0;
+#ifdef USE_GENLOCK
// If the user sets both a read and write lock, higher preference is
// given to the write lock.
if (lockType & GENLOCK_WRITE_LOCK) {
@@ -54,6 +55,7 @@
__FUNCTION__, lockType);
return -1;
}
+#endif
return kLockType;
}
@@ -62,6 +64,7 @@
int lockType, int timeout,
int flags)
{
+#ifdef USE_GENLOCK
if (private_handle_t::validate(buffer_handle)) {
ALOGE("%s: handle is invalid", __FUNCTION__);
return GENLOCK_FAILURE;
@@ -104,6 +107,7 @@
}
#endif
}
+#endif
return GENLOCK_NO_ERROR;
}
@@ -120,7 +124,6 @@
handle = -1;
}
}
-
}
/*
* Create a genlock lock. The genlock lock file descriptor and the lock
@@ -132,13 +135,13 @@
genlock_status_t genlock_create_lock(native_handle_t *buffer_handle)
{
genlock_status_t ret = GENLOCK_NO_ERROR;
+#ifdef USE_GENLOCK
if (private_handle_t::validate(buffer_handle)) {
ALOGE("%s: handle is invalid", __FUNCTION__);
return GENLOCK_FAILURE;
}
private_handle_t *hnd = reinterpret_cast<private_handle_t*>(buffer_handle);
-#ifdef USE_GENLOCK
if ((hnd->flags & private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED) == 0) {
// Open the genlock device
int fd = open(GENLOCK_DEVICE, O_RDWR);
@@ -173,8 +176,6 @@
} else {
hnd->genlockHandle = 0;
}
-#else
- hnd->genlockHandle = 0;
#endif
return ret;
}
diff --git a/libgralloc/Android.mk b/libgralloc/Android.mk
index 749a672..fb2b0df 100644
--- a/libgralloc/Android.mk
+++ b/libgralloc/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
-LOCAL_SHARED_LIBRARIES := $(common_libs) libmemalloc libgenlock
+LOCAL_SHARED_LIBRARIES := $(common_libs) libmemalloc
LOCAL_SHARED_LIBRARIES += libqdutils libGLESv1_CM
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
@@ -35,7 +35,7 @@
LOCAL_MODULE := libmemalloc
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
-LOCAL_SHARED_LIBRARIES := $(common_libs) libgenlock libqdutils libdl
+LOCAL_SHARED_LIBRARIES := $(common_libs) libqdutils libdl
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdmemalloc\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
LOCAL_SRC_FILES := ionalloc.cpp alloc_controller.cpp
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp
index ab36830..cc16a5f 100644
--- a/libgralloc/framebuffer.cpp
+++ b/libgralloc/framebuffer.cpp
@@ -39,7 +39,6 @@
#include "gralloc_priv.h"
#include "fb_priv.h"
#include "gr.h"
-#include <genlock.h>
#include <cutils/properties.h>
#include <profiler.h>
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index f1af045..292012b 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 The Android Open Source Project
- * Copyright (c) 2011-2012 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2013 The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,6 @@
#include <cutils/properties.h>
#include <sys/mman.h>
-#include <genlock.h>
-
#include "gr.h"
#include "gpu.h"
#include "memalloc.h"
@@ -165,10 +163,6 @@
ALOGE_IF(eDataErr, "gralloc failed for eDataErr=%s",
strerror(-eDataErr));
- if (usage & GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED) {
- flags |= private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED;
- }
-
if (usage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) {
flags |= private_handle_t::PRIV_FLAGS_EXTERNAL_ONLY;
//The EXTERNAL_BLOCK flag is always an add-on
@@ -200,6 +194,8 @@
hnd->offset = data.offset;
hnd->base = int(data.base) + data.offset;
+ hnd->gpuaddr = 0;
+
*pHandle = hnd;
}
@@ -265,13 +261,6 @@
return err;
}
- // Create a genlock lock for this buffer handle.
- err = genlock_create_lock((native_handle_t*)(*pHandle));
- if (err) {
- ALOGE("%s: genlock_create_lock failed", __FUNCTION__);
- free_impl(reinterpret_cast<private_handle_t*>(pHandle));
- return err;
- }
*pStride = alignedw;
return 0;
}
@@ -299,12 +288,6 @@
return err;
}
- // Release the genlock
- int err = genlock_release_lock((native_handle_t*)hnd);
- if (err) {
- ALOGE("%s: genlock_release_lock failed", __FUNCTION__);
- }
-
delete hnd;
return 0;
}
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index d2f3073..719a941 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,14 +54,6 @@
* cannot be used with noncontiguous heaps */
GRALLOC_USAGE_PRIVATE_UNCACHED = 0x02000000,
- /* This flag can be set to disable genlock synchronization
- * for the gralloc buffer. If this flag is set the caller
- * is required to perform explicit synchronization.
- * WARNING - flag is outside the standard PRIVATE region
- * and may need to be moved if the gralloc API changes
- */
- GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED = 0X04000000,
-
/* Buffer content should be displayed on an external display only */
GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY = 0x08000000,
@@ -169,8 +161,6 @@
// file-descriptors
int fd;
- // genlock handle to be dup'd by the binder
- int genlockHandle;
int fd_metadata; // fd for the meta-data
// ints
int magic;
@@ -181,28 +171,24 @@
int base;
int offset_metadata;
// The gpu address mapped into the mmu.
- // If using ashmem, set to 0, they don't care
int gpuaddr;
- int pid; // deprecated
int format;
int width;
int height;
- // local fd of the genlock device.
- int genlockPrivFd;
int base_metadata;
#ifdef __cplusplus
- static const int sNumInts = 14;
- static const int sNumFds = 3;
+ static const int sNumInts = 12;
+ static const int sNumFds = 2;
static const int sMagic = 'gmsm';
private_handle_t(int fd, int size, int flags, int bufferType,
int format,int width, int height, int eFd = -1,
int eOffset = 0, int eBase = 0) :
- fd(fd), genlockHandle(-1), fd_metadata(eFd), magic(sMagic),
+ fd(fd), fd_metadata(eFd), magic(sMagic),
flags(flags), size(size), offset(0), bufferType(bufferType),
- base(0), offset_metadata(eOffset), gpuaddr(0), pid(getpid()),
- format(format), width(width), height(height), genlockPrivFd(-1),
+ base(0), offset_metadata(eOffset), gpuaddr(0),
+ format(format), width(width), height(height),
base_metadata(eBase)
{
version = sizeof(native_handle);
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 27761be..268630b 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,8 +34,6 @@
#include <hardware/hardware.h>
#include <hardware/gralloc.h>
-#include <genlock.h>
-
#include <linux/android_pmem.h>
#include "gralloc_priv.h"
@@ -155,24 +153,6 @@
return err;
}
- // Reset the genlock private fd flag in the handle
- hnd->genlockPrivFd = -1;
-
- // Check if there is a valid lock attached to the handle.
- if (-1 == hnd->genlockHandle) {
- ALOGE("%s: the lock is invalid.", __FUNCTION__);
- gralloc_unmap(module, handle);
- hnd->base = 0;
- return -EINVAL;
- }
-
- // Attach the genlock handle
- if (GENLOCK_NO_ERROR != genlock_attach_lock((native_handle_t *)handle)) {
- ALOGE("%s: genlock_attach_lock failed", __FUNCTION__);
- gralloc_unmap(module, handle);
- hnd->base = 0;
- return -EINVAL;
- }
return 0;
}
@@ -195,13 +175,6 @@
}
hnd->base = 0;
hnd->base_metadata = 0;
- // Release the genlock
- if (-1 != hnd->genlockHandle) {
- return genlock_release_lock((native_handle_t *)handle);
- } else {
- ALOGE("%s: there was no genlock attached to this buffer", __FUNCTION__);
- return -EINVAL;
- }
return 0;
}
@@ -250,27 +223,6 @@
}
*vaddr = (void*)hnd->base;
- // Lock the buffer for read/write operation as specified. Write lock
- // has a higher priority over read lock.
- int lockType = 0;
- if (usage & GRALLOC_USAGE_SW_WRITE_MASK) {
- lockType = GENLOCK_WRITE_LOCK;
- } else if (usage & GRALLOC_USAGE_SW_READ_MASK) {
- lockType = GENLOCK_READ_LOCK;
- }
-
- int timeout = GENLOCK_MAX_TIMEOUT;
- if (GENLOCK_NO_ERROR != genlock_lock_buffer((native_handle_t *)handle,
- (genlock_lock_type)lockType,
- timeout)) {
- ALOGE("%s: genlock_lock_buffer (lockType=0x%x) failed", __FUNCTION__,
- lockType);
- return -EINVAL;
- } else {
- // Mark this buffer as locked for SW read/write operation.
- hnd->flags |= private_handle_t::PRIV_FLAGS_SW_LOCK;
- }
-
if ((usage & GRALLOC_USAGE_SW_WRITE_MASK) &&
!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
// Mark the buffer to be flushed after cpu read/write
@@ -304,14 +256,6 @@
hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
}
- if ((hnd->flags & private_handle_t::PRIV_FLAGS_SW_LOCK)) {
- // Unlock the buffer.
- if (GENLOCK_NO_ERROR != genlock_unlock_buffer((native_handle_t *)handle)) {
- ALOGE("%s: genlock_unlock_buffer failed", __FUNCTION__);
- return -EINVAL;
- } else
- hnd->flags &= ~private_handle_t::PRIV_FLAGS_SW_LOCK;
- }
return 0;
}
diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk
index 0ca7ca1..b1ee2da 100644
--- a/libhwcomposer/Android.mk
+++ b/libhwcomposer/Android.mk
@@ -6,7 +6,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
-LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay libgenlock \
+LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay \
libexternal libqdutils libhardware_legacy \
libdl libmemalloc libqservice libsync \
libbinder libmedia