am ba6a5751: am e5a9bc4a: am 2dc79df2: Merge commit \'de9b6a49620d14c09bc95a1b80e9c5496cf4029b\' into HEAD
* commit 'ba6a575167f1fe54a8c8d1418495b2e183f6e3db':
diff --git a/gralloc/framebuffer.cpp b/gralloc/framebuffer.cpp
index ce409ce..82a36bc 100644
--- a/gralloc/framebuffer.cpp
+++ b/gralloc/framebuffer.cpp
@@ -40,7 +40,6 @@
#endif
#include "gralloc_priv.h"
-#include "gr.h"
/*****************************************************************************/
diff --git a/gralloc/gr.h b/gralloc/gr.h
deleted file mode 100644
index ad7047c..0000000
--- a/gralloc/gr.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef GR_H_
-#define GR_H_
-
-#include <stdint.h>
-#include <limits.h>
-#include <sys/cdefs.h>
-#include <hardware/gralloc.h>
-#include <pthread.h>
-#include <errno.h>
-
-#include <cutils/native_handle.h>
-
-/*****************************************************************************/
-
-struct private_module_t;
-struct private_handle_t;
-
-int grallocMap(gralloc_module_t const* module, private_handle_t *hnd);
-int grallocUnmap(gralloc_module_t const* module, private_handle_t *hnd);
-
-#endif /* GR_H_ */
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp
index ece9964..e54790c 100644
--- a/gralloc/gralloc.cpp
+++ b/gralloc/gralloc.cpp
@@ -42,7 +42,6 @@
#include "gralloc_priv.h"
#include "exynos_format.h"
-#include "gr.h"
#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4)
#define ION_EXYNOS_FIMD_VIDEO_MASK (1 << 28)
@@ -358,9 +357,10 @@
err = gralloc_alloc_yuv(m->ionfd, w, h, format, usage, ion_flags,
&hnd, &stride);
if (err)
- return err;
+ goto err;
- if (err != 0)
+ err = gralloc_register_buffer(module, hnd);
+ if (err)
goto err;
*pHandle = hnd;
@@ -386,8 +386,8 @@
private_handle_t const* hnd = reinterpret_cast<private_handle_t const*>(handle);
gralloc_module_t* module = reinterpret_cast<gralloc_module_t*>(
dev->common.module);
- if (hnd->base)
- grallocUnmap(module, const_cast<private_handle_t*>(hnd));
+
+ gralloc_unregister_buffer(module, hnd);
close(hnd->fd);
if (hnd->fd1 >= 0)
diff --git a/gralloc/mapper.cpp b/gralloc/mapper.cpp
index e63f749..1a70973 100644
--- a/gralloc/mapper.cpp
+++ b/gralloc/mapper.cpp
@@ -72,16 +72,6 @@
/*****************************************************************************/
-int grallocMap(gralloc_module_t const* module, private_handle_t *hnd)
-{
- return gralloc_map(module, hnd);
-}
-
-int grallocUnmap(gralloc_module_t const* module, private_handle_t *hnd)
-{
- return gralloc_unmap(module, hnd);
-}
-
int getIonFd(gralloc_module_t const *module)
{
private_module_t* m = const_cast<private_module_t*>(reinterpret_cast<const private_module_t*>(module));
@@ -97,12 +87,9 @@
int gralloc_register_buffer(gralloc_module_t const* module,
buffer_handle_t handle)
{
- int err;
if (private_handle_t::validate(handle) < 0)
return -EINVAL;
- err = gralloc_map(module, handle);
-
private_handle_t* hnd = (private_handle_t*)handle;
ALOGV("%s: base %p %d %d %d %d\n", __func__, hnd->base, hnd->size,
hnd->width, hnd->height, hnd->stride);
@@ -122,7 +109,7 @@
ALOGE("error importing handle2 %d %x\n", hnd->fd2, hnd->format);
}
- return err;
+ return ret;
}
int gralloc_unregister_buffer(gralloc_module_t const* module,
diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h
index bf2940e..bce84e4 100644
--- a/include/gralloc_priv.h
+++ b/include/gralloc_priv.h
@@ -33,6 +33,7 @@
struct private_module_t;
struct private_handle_t;
+typedef int ion_user_handle_t;
struct private_module_t {
gralloc_module_t base;
@@ -96,9 +97,9 @@
void *base;
void *base1;
void *base2;
- struct ion_handle *handle;
- struct ion_handle *handle1;
- struct ion_handle *handle2;
+ ion_user_handle_t handle;
+ ion_user_handle_t handle1;
+ ion_user_handle_t handle2;
#ifdef __cplusplus
static const int sNumFds = 3;