display: Remove genlock usage
genlock is no-op from Android 4.2 onwards since the sync framework
is used for explicit synchronization.
Change-Id: Idd1df589516534a683e0fa1ef0cfbb7f0e411f67
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;
}