summaryrefslogtreecommitdiffstats
path: root/libs/ui/GraphicBufferMapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ui/GraphicBufferMapper.cpp')
-rw-r--r--libs/ui/GraphicBufferMapper.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index e949b0c..31bfb2d 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -20,7 +20,12 @@
#include <stdint.h>
#include <errno.h>
+// We would eliminate the non-conforming zero-length array, but we can't since
+// this is effectively included from the Linux kernel
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wzero-length-array"
#include <sync/sync.h>
+#pragma clang diagnostic pop
#include <utils/Errors.h>
#include <utils/Log.h>
@@ -44,7 +49,7 @@ GraphicBufferMapper::GraphicBufferMapper()
int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
if (err == 0) {
- mAllocMod = (gralloc_module_t const *)module;
+ mAllocMod = reinterpret_cast<gralloc_module_t const *>(module);
}
}
@@ -72,13 +77,13 @@ status_t GraphicBufferMapper::unregisterBuffer(buffer_handle_t handle)
return err;
}
-status_t GraphicBufferMapper::lock(buffer_handle_t handle,
- int usage, const Rect& bounds, void** vaddr)
+status_t GraphicBufferMapper::lock(buffer_handle_t handle,
+ uint32_t usage, const Rect& bounds, void** vaddr)
{
ATRACE_CALL();
status_t err;
- err = mAllocMod->lock(mAllocMod, handle, usage,
+ err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
vaddr);
@@ -87,7 +92,7 @@ status_t GraphicBufferMapper::lock(buffer_handle_t handle,
}
status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle,
- int usage, const Rect& bounds, android_ycbcr *ycbcr)
+ uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr)
{
ATRACE_CALL();
status_t err;
@@ -96,7 +101,7 @@ status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle,
return -EINVAL; // do not log failure
}
- err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage,
+ err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
ycbcr);
@@ -116,19 +121,19 @@ status_t GraphicBufferMapper::unlock(buffer_handle_t handle)
}
status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
- int usage, const Rect& bounds, void** vaddr, int fenceFd)
+ uint32_t usage, const Rect& bounds, void** vaddr, int fenceFd)
{
ATRACE_CALL();
status_t err;
if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3) {
- err = mAllocMod->lockAsync(mAllocMod, handle, usage,
+ err = mAllocMod->lockAsync(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
vaddr, fenceFd);
} else {
sync_wait(fenceFd, -1);
close(fenceFd);
- err = mAllocMod->lock(mAllocMod, handle, usage,
+ err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
vaddr);
}
@@ -138,20 +143,20 @@ status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
}
status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle,
- int usage, const Rect& bounds, android_ycbcr *ycbcr, int fenceFd)
+ uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr, int fenceFd)
{
ATRACE_CALL();
status_t err;
if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3
&& mAllocMod->lockAsync_ycbcr != NULL) {
- err = mAllocMod->lockAsync_ycbcr(mAllocMod, handle, usage,
- bounds.left, bounds.top, bounds.width(), bounds.height(),
- ycbcr, fenceFd);
+ err = mAllocMod->lockAsync_ycbcr(mAllocMod, handle,
+ static_cast<int>(usage), bounds.left, bounds.top,
+ bounds.width(), bounds.height(), ycbcr, fenceFd);
} else if (mAllocMod->lock_ycbcr != NULL) {
sync_wait(fenceFd, -1);
close(fenceFd);
- err = mAllocMod->lock_ycbcr(mAllocMod, handle, usage,
+ err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
bounds.left, bounds.top, bounds.width(), bounds.height(),
ycbcr);
} else {