Merge "display: Remove genlock usage"

This commit is contained in:
Linux Build Service Account
2013-03-15 15:55:07 -07:00
committed by Gerrit - the friendly Code Review server
8 changed files with 18 additions and 106 deletions

View File

@@ -1,6 +1,5 @@
#Common headers #Common headers
common_includes := hardware/qcom/display/libgralloc common_includes := hardware/qcom/display/libgralloc
common_includes += hardware/qcom/display/libgenlock
common_includes += hardware/qcom/display/liboverlay common_includes += hardware/qcom/display/liboverlay
common_includes += hardware/qcom/display/libcopybit common_includes += hardware/qcom/display/libcopybit
common_includes += hardware/qcom/display/libqdutils common_includes += hardware/qcom/display/libqdutils

View File

@@ -43,6 +43,7 @@ namespace {
int get_kernel_lock_type(genlock_lock_type lockType) int get_kernel_lock_type(genlock_lock_type lockType)
{ {
int kLockType = 0; int kLockType = 0;
#ifdef USE_GENLOCK
// If the user sets both a read and write lock, higher preference is // If the user sets both a read and write lock, higher preference is
// given to the write lock. // given to the write lock.
if (lockType & GENLOCK_WRITE_LOCK) { if (lockType & GENLOCK_WRITE_LOCK) {
@@ -54,6 +55,7 @@ namespace {
__FUNCTION__, lockType); __FUNCTION__, lockType);
return -1; return -1;
} }
#endif
return kLockType; return kLockType;
} }
@@ -62,6 +64,7 @@ namespace {
int lockType, int timeout, int lockType, int timeout,
int flags) int flags)
{ {
#ifdef USE_GENLOCK
if (private_handle_t::validate(buffer_handle)) { if (private_handle_t::validate(buffer_handle)) {
ALOGE("%s: handle is invalid", __FUNCTION__); ALOGE("%s: handle is invalid", __FUNCTION__);
return GENLOCK_FAILURE; return GENLOCK_FAILURE;
@@ -104,6 +107,7 @@ namespace {
} }
#endif #endif
} }
#endif
return GENLOCK_NO_ERROR; return GENLOCK_NO_ERROR;
} }
@@ -120,7 +124,6 @@ namespace {
handle = -1; handle = -1;
} }
} }
} }
/* /*
* Create a genlock lock. The genlock lock file descriptor and the lock * Create a genlock lock. The genlock lock file descriptor and the lock
@@ -132,13 +135,13 @@ namespace {
genlock_status_t genlock_create_lock(native_handle_t *buffer_handle) genlock_status_t genlock_create_lock(native_handle_t *buffer_handle)
{ {
genlock_status_t ret = GENLOCK_NO_ERROR; genlock_status_t ret = GENLOCK_NO_ERROR;
#ifdef USE_GENLOCK
if (private_handle_t::validate(buffer_handle)) { if (private_handle_t::validate(buffer_handle)) {
ALOGE("%s: handle is invalid", __FUNCTION__); ALOGE("%s: handle is invalid", __FUNCTION__);
return GENLOCK_FAILURE; return GENLOCK_FAILURE;
} }
private_handle_t *hnd = reinterpret_cast<private_handle_t*>(buffer_handle); private_handle_t *hnd = reinterpret_cast<private_handle_t*>(buffer_handle);
#ifdef USE_GENLOCK
if ((hnd->flags & private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED) == 0) { if ((hnd->flags & private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED) == 0) {
// Open the genlock device // Open the genlock device
int fd = open(GENLOCK_DEVICE, O_RDWR); int fd = open(GENLOCK_DEVICE, O_RDWR);
@@ -173,8 +176,6 @@ genlock_status_t genlock_create_lock(native_handle_t *buffer_handle)
} else { } else {
hnd->genlockHandle = 0; hnd->genlockHandle = 0;
} }
#else
hnd->genlockHandle = 0;
#endif #endif
return ret; return ret;
} }

View File

@@ -21,7 +21,7 @@ LOCAL_MODULE := gralloc.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) 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_SHARED_LIBRARIES += libqdutils libGLESv1_CM
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\" LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdgralloc\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps) LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
@@ -35,7 +35,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmemalloc LOCAL_MODULE := libmemalloc
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) 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_CFLAGS := $(common_flags) -DLOG_TAG=\"qdmemalloc\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps) LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
LOCAL_SRC_FILES := ionalloc.cpp alloc_controller.cpp LOCAL_SRC_FILES := ionalloc.cpp alloc_controller.cpp

View File

@@ -39,7 +39,6 @@
#include "gralloc_priv.h" #include "gralloc_priv.h"
#include "fb_priv.h" #include "fb_priv.h"
#include "gr.h" #include "gr.h"
#include <genlock.h>
#include <cutils/properties.h> #include <cutils/properties.h>
#include <profiler.h> #include <profiler.h>

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2010 The Android Open Source Project * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -21,8 +21,6 @@
#include <cutils/properties.h> #include <cutils/properties.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <genlock.h>
#include "gr.h" #include "gr.h"
#include "gpu.h" #include "gpu.h"
#include "memalloc.h" #include "memalloc.h"
@@ -165,10 +163,6 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage,
ALOGE_IF(eDataErr, "gralloc failed for eDataErr=%s", ALOGE_IF(eDataErr, "gralloc failed for eDataErr=%s",
strerror(-eDataErr)); strerror(-eDataErr));
if (usage & GRALLOC_USAGE_PRIVATE_UNSYNCHRONIZED) {
flags |= private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED;
}
if (usage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) { if (usage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) {
flags |= private_handle_t::PRIV_FLAGS_EXTERNAL_ONLY; flags |= private_handle_t::PRIV_FLAGS_EXTERNAL_ONLY;
//The EXTERNAL_BLOCK flag is always an add-on //The EXTERNAL_BLOCK flag is always an add-on
@@ -200,6 +194,8 @@ int gpu_context_t::gralloc_alloc_buffer(size_t size, int usage,
hnd->offset = data.offset; hnd->offset = data.offset;
hnd->base = int(data.base) + data.offset; hnd->base = int(data.base) + data.offset;
hnd->gpuaddr = 0;
*pHandle = hnd; *pHandle = hnd;
} }
@@ -265,13 +261,6 @@ int gpu_context_t::alloc_impl(int w, int h, int format, int usage,
return err; 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; *pStride = alignedw;
return 0; return 0;
} }
@@ -299,12 +288,6 @@ int gpu_context_t::free_impl(private_handle_t const* hnd) {
return err; 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; delete hnd;
return 0; return 0;
} }

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2008 The Android Open Source Project * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -54,14 +54,6 @@ enum {
* cannot be used with noncontiguous heaps */ * cannot be used with noncontiguous heaps */
GRALLOC_USAGE_PRIVATE_UNCACHED = 0x02000000, 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 */ /* Buffer content should be displayed on an external display only */
GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY = 0x08000000, GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY = 0x08000000,
@@ -169,8 +161,6 @@ struct private_handle_t : public native_handle {
// file-descriptors // file-descriptors
int fd; int fd;
// genlock handle to be dup'd by the binder
int genlockHandle;
int fd_metadata; // fd for the meta-data int fd_metadata; // fd for the meta-data
// ints // ints
int magic; int magic;
@@ -181,28 +171,24 @@ struct private_handle_t : public native_handle {
int base; int base;
int offset_metadata; int offset_metadata;
// The gpu address mapped into the mmu. // The gpu address mapped into the mmu.
// If using ashmem, set to 0, they don't care
int gpuaddr; int gpuaddr;
int pid; // deprecated
int format; int format;
int width; int width;
int height; int height;
// local fd of the genlock device.
int genlockPrivFd;
int base_metadata; int base_metadata;
#ifdef __cplusplus #ifdef __cplusplus
static const int sNumInts = 14; static const int sNumInts = 12;
static const int sNumFds = 3; static const int sNumFds = 2;
static const int sMagic = 'gmsm'; static const int sMagic = 'gmsm';
private_handle_t(int fd, int size, int flags, int bufferType, private_handle_t(int fd, int size, int flags, int bufferType,
int format,int width, int height, int eFd = -1, int format,int width, int height, int eFd = -1,
int eOffset = 0, int eBase = 0) : 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), flags(flags), size(size), offset(0), bufferType(bufferType),
base(0), offset_metadata(eOffset), gpuaddr(0), pid(getpid()), base(0), offset_metadata(eOffset), gpuaddr(0),
format(format), width(width), height(height), genlockPrivFd(-1), format(format), width(width), height(height),
base_metadata(eBase) base_metadata(eBase)
{ {
version = sizeof(native_handle); version = sizeof(native_handle);

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2008 The Android Open Source Project * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -34,8 +34,6 @@
#include <hardware/hardware.h> #include <hardware/hardware.h>
#include <hardware/gralloc.h> #include <hardware/gralloc.h>
#include <genlock.h>
#include <linux/android_pmem.h> #include <linux/android_pmem.h>
#include "gralloc_priv.h" #include "gralloc_priv.h"
@@ -155,24 +153,6 @@ int gralloc_register_buffer(gralloc_module_t const* module,
return err; 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; return 0;
} }
@@ -195,13 +175,6 @@ int gralloc_unregister_buffer(gralloc_module_t const* module,
} }
hnd->base = 0; hnd->base = 0;
hnd->base_metadata = 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; return 0;
} }
@@ -250,27 +223,6 @@ int gralloc_lock(gralloc_module_t const* module,
} }
*vaddr = (void*)hnd->base; *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) && if ((usage & GRALLOC_USAGE_SW_WRITE_MASK) &&
!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) { !(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
// Mark the buffer to be flushed after cpu read/write // Mark the buffer to be flushed after cpu read/write
@@ -304,14 +256,6 @@ int gralloc_unlock(gralloc_module_t const* module,
hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH; 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; return 0;
} }

View File

@@ -6,7 +6,7 @@ LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) 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 \ libexternal libqdutils libhardware_legacy \
libdl libmemalloc libqservice libsync \ libdl libmemalloc libqservice libsync \
libbinder libmedia libbinder libmedia