am ac21dce2: am 2fc43c35: am ff33d0b2: Merge "libcamera2: fix test crash issue due to garbage function pointer." into klp-dev
* commit 'ac21dce2b0be89048630dac6289aca64e8b63f9e':
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;
diff --git a/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp b/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
index 5855bed..62b7cb6 100644
--- a/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
+++ b/mobicore/daemon/Daemon/Device/Platforms/Generic/TrustZoneDevice.cpp
@@ -256,9 +256,10 @@
// Notify MobiCore about new data
-notification_t notification = { sessionId :
- sessionId, payload : 0
- };
+ notification_t notification = {
+ .sessionId = sessionId,
+ .payload = 0
+ };
nq->putNotification(¬ification);
//IMPROVEMENT-2012-03-07-maneaval What happens when/if nsiq fails?
diff --git a/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp b/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp
index cddda51..7971ad0 100644
--- a/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp
+++ b/mobicore/daemon/Kernel/Platforms/Generic/CMcKMod.cpp
@@ -65,9 +65,9 @@
}
// mapping response data is in the buffer
-struct mc_ioctl_map mapParams = { len:
- len
- };
+struct mc_ioctl_map mapParams = {
+ .len = len
+};
ret = ioctl(fdKMod, MC_IO_MAP_WSM, &mapParams);
if (ret != 0) {
@@ -111,8 +111,8 @@
{
LOG_I("Mapping MCI: len=%d", len);
// mapping response data is in the buffer
-struct mc_ioctl_map mapParams = { len:
- len
+ struct mc_ioctl_map mapParams = {
+ .len = len
};
if (!isOpen()) {
@@ -216,15 +216,12 @@
// Init MC with NQ and MCP buffer addresses
struct mc_ioctl_init fcInitParams = {
-nq_offset :
- nqOffset,
-nq_length :
- nqLength,
-mcp_offset :
- mcpOffset,
-mcp_length :
- mcpLength
+ .nq_offset = nqOffset,
+ .nq_length = nqLength,
+ .mcp_offset = mcpOffset,
+ .mcp_length = mcpLength
};
+
ret = ioctl(fdKMod, MC_IO_INIT, &fcInitParams);
if (ret != 0) {
LOG_ERRNO("ioctl MC_IO_INIT");
@@ -244,8 +241,8 @@
}
// Init MC with NQ and MCP buffer addresses
-struct mc_ioctl_info fcInfoParams = {ext_info_id :
- extInfoId
+ struct mc_ioctl_info fcInfoParams = {
+ .ext_info_id = extInfoId
};
ret = ioctl(fdKMod, MC_IO_INFO, &fcInfoParams);
if (ret != 0) {
@@ -347,12 +344,9 @@
}
struct mc_ioctl_reg_wsm params = {
-buffer :
- (uint32_t) buffer,
-len :
- len,
-pid :
- pid
+ .buffer = (uint32_t) buffer,
+ .len = len,
+ .pid = pid
};
int ret = ioctl(fdKMod, MC_IO_REG_WSM, ¶ms);
@@ -511,10 +505,8 @@
{
int ret = 0;
struct mc_ioctl_execute params = {
-phys_start_addr :
- (uint32_t)startAddr,
-length :
- areaLength
+ .phys_start_addr = (uint32_t)startAddr,
+ .length = areaLength
};
if (!isOpen()) {