summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-20 14:03:59 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-20 14:03:59 -0800
commitf87393cb242a0de85631c3df4d8f147cdbb43e59 (patch)
tree74af26355359ef9cc135ccb138315ad386a7e755
parent0100d517b1118ec181cf20e8648f3416b0830088 (diff)
downloadlibhardware-f87393cb242a0de85631c3df4d8f147cdbb43e59.tar.gz
auto import from //branches/cupcake/...@127101
-rw-r--r--include/hardware/overlay.h13
-rw-r--r--modules/overlay/overlay.cpp14
2 files changed, 11 insertions, 16 deletions
diff --git a/include/hardware/overlay.h b/include/hardware/overlay.h
index 63230e3d..a5cd2633 100644
--- a/include/hardware/overlay.h
+++ b/include/hardware/overlay.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_OVERLAY_INTERFACE_H
#define ANDROID_OVERLAY_INTERFACE_H
+#include <cutils/native_handle.h>
+
#include <hardware/hardware.h>
#include <stdint.h>
@@ -102,12 +104,7 @@ enum {
/*****************************************************************************/
/* opaque reference to an Overlay kernel object */
-typedef struct {
- int numFds;
- int fds[4];
- int numInts;
- int data[0];
-} overlay_handle_t;
+typedef const native_handle* overlay_handle_t;
typedef struct overlay_t {
uint32_t w;
@@ -118,7 +115,7 @@ typedef struct overlay_t {
uint32_t reserved[3];
/* returns a reference to this overlay's handle (the caller doesn't
* take ownership) */
- overlay_handle_t const* (*getHandleRef)(struct overlay_t* overlay);
+ overlay_handle_t (*getHandleRef)(struct overlay_t* overlay);
uint32_t reserved_procs[7];
} overlay_t;
@@ -183,7 +180,7 @@ struct overlay_data_device_t {
/* initialize the overlay from the given handle. this associates this
* overlay data module to its control module */
int (*initialize)(struct overlay_data_device_t *dev,
- overlay_handle_t const* handle);
+ overlay_handle_t handle);
/* blocks until an overlay buffer is available and return that buffer. */
int (*dequeueBuffer)(struct overlay_data_device_t *dev,
diff --git a/modules/overlay/overlay.cpp b/modules/overlay/overlay.cpp
index becaae3a..0246b5bb 100644
--- a/modules/overlay/overlay.cpp
+++ b/modules/overlay/overlay.cpp
@@ -60,17 +60,14 @@ const struct overlay_module_t HAL_MODULE_INFO_SYM = {
/*
* This is the overlay_t object, it is returned to the user and represents
- * an overlay. here we use a subclass, where we can store our own state.
- * Notice the use of "overlay_handle_t", which is an "opaque" marshallable
- * handle, it can contains any number of ints and up to 4 filedescriptors.
- * In this example we store no fd and 2 ints.
+ * an overlay.
* This handles will be passed across processes and possibly given to other
* HAL modules (for instance video decode modules).
*/
class overlay_object : public overlay_t {
- struct handle_t : public overlay_handle_t {
+ struct handle_t : public native_handle {
/* add the data fields we need here, for instance: */
int width;
int height;
@@ -78,7 +75,7 @@ class overlay_object : public overlay_t {
handle_t mHandle;
- static overlay_handle_t const* getHandleRef(struct overlay_t* overlay) {
+ static overlay_handle_t getHandleRef(struct overlay_t* overlay) {
/* returns a reference to the handle, caller doesn't take ownership */
return &(static_cast<overlay_object *>(overlay)->mHandle);
}
@@ -86,6 +83,7 @@ class overlay_object : public overlay_t {
public:
overlay_object() {
this->overlay_t::getHandleRef = getHandleRef;
+ mHandle.version = sizeof(native_handle);
mHandle.numFds = 0;
mHandle.numInts = 2; // extra ints we have in our handle
}
@@ -213,7 +211,7 @@ static int overlay_control_close(struct hw_device_t *dev)
// ****************************************************************************
int overlay_initialize(struct overlay_data_device_t *dev,
- overlay_handle_t const* handle)
+ overlay_handle_t handle)
{
/*
* overlay_handle_t should contain all the information to "inflate" this
@@ -230,7 +228,7 @@ int overlay_initialize(struct overlay_data_device_t *dev,
}
int overlay_dequeueBuffer(struct overlay_data_device_t *dev,
- overlay_buffer_t buf)
+ overlay_buffer_t* buf)
{
/* blocks until a buffer is available and return an opaque structure
* representing this buffer.