summaryrefslogtreecommitdiffstats
path: root/include/ui/egl
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-08-10 21:59:56 -0700
committerMathias Agopian <mathias@google.com>2009-08-11 16:12:56 -0700
commit8b76a0ac6fbf07254629ed1ea86af014d5abe050 (patch)
treee492e09655269fff3ca14b6a62f9b07f2d484038 /include/ui/egl
parentc5ea43920919eeaec4ec0686de9fa3d034d82337 (diff)
downloadframeworks_base-8b76a0ac6fbf07254629ed1ea86af014d5abe050.zip
frameworks_base-8b76a0ac6fbf07254629ed1ea86af014d5abe050.tar.gz
frameworks_base-8b76a0ac6fbf07254629ed1ea86af014d5abe050.tar.bz2
SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything.
This change makes SurfaceHolder.setType(GPU) obsolete (it's now ignored). Added an API to android_native_window_t to allow extending the functionality without ever breaking binary compatibility. This is used to implement the new set_usage() API. This API needs to be called by software renderers because the default is to use usage flags suitable for h/w.
Diffstat (limited to 'include/ui/egl')
-rw-r--r--include/ui/egl/android_natives.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h
index 7da69b1..4c58e47 100644
--- a/include/ui/egl/android_natives.h
+++ b/include/ui/egl/android_natives.h
@@ -67,6 +67,11 @@ enum {
NATIVE_WINDOW_FORMAT = 2,
};
+/* valid operations for the (*perform)() hook */
+enum {
+ NATIVE_WINDOW_SET_USAGE = 0
+};
+
struct android_native_window_t
{
#ifdef __cplusplus
@@ -142,11 +147,45 @@ struct android_native_window_t
* Returns 0 on success or -errno on error.
*/
int (*query)(struct android_native_window_t* window,
- int what, int* value);
+ int what, int* value);
+
+ /*
+ * hook used to perform various operations on the surface.
+ * (*perform)() is a generic mechanism to add functionality to
+ * android_native_window_t while keeping backward binary compatibility.
+ *
+ * This hook should not be called directly, instead use the helper functions
+ * defined below.
+ *
+ * The valid operations are:
+ * NATIVE_WINDOW_SET_USAGE
+ *
+ */
+
+ int (*perform)(struct android_native_window_t* window,
+ int operation, ... );
- void* reserved_proc[4];
+ void* reserved_proc[3];
};
+
+/*
+ * native_window_set_usage() sets the intended usage flags for the next
+ * buffers acquired with (*lockBuffer)() and on.
+ * By default (if this function is never called), a usage of
+ * GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE
+ * is assumed.
+ * Calling this function will usually cause following buffers to be
+ * reallocated.
+ */
+
+inline int native_window_set_usage(
+ struct android_native_window_t* window, int usage)
+{
+ return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage);
+}
+
+
// ---------------------------------------------------------------------------
/* FIXME: this is legacy for pixmaps */