diff options
author | Mathias Agopian <mathias@google.com> | 2011-07-19 15:59:15 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-07-19 17:09:35 -0700 |
commit | 5100916182b05971975f8d8fe65a1255e2c5ac96 (patch) | |
tree | b21c1fe0d888dd6ebb3d6a34e98fd30a9948fc2c /include/system/window.h | |
parent | b32904a9eaff02799713363d5f6817ce86eaca54 (diff) | |
download | system_core-5100916182b05971975f8d8fe65a1255e2c5ac96.zip system_core-5100916182b05971975f8d8fe65a1255e2c5ac96.tar.gz system_core-5100916182b05971975f8d8fe65a1255e2c5ac96.tar.bz2 |
support for "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation"
Bug: 4487161
Change-Id: I36708fd155415adbb666137692252381c19abcf6
Diffstat (limited to 'include/system/window.h')
-rw-r--r-- | include/system/window.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/system/window.h b/include/system/window.h index edb3002..4d519c5 100644 --- a/include/system/window.h +++ b/include/system/window.h @@ -153,6 +153,64 @@ enum { * likely be removed in the near future. */ NATIVE_WINDOW_CONCRETE_TYPE = 5, + + + /* + * Default width and height of the ANativeWindow, these are the dimensions + * of the window irrespective of the NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS + * call. + */ + NATIVE_WINDOW_DEFAULT_WIDTH = 6, + NATIVE_WINDOW_DEFAULT_HEIGHT = 7, + + /* + * transformation that will most-likely be applied to buffers. This is only + * a hint, the actual transformation applied might be different. + * + * INTENDED USE: + * + * The transform hint can be used by a producer, for instance the GLES + * driver, to pre-rotate the rendering such that the final transformation + * in the composer is identity. This can be very useful when used in + * conjunction with the h/w composer HAL, in situations where it + * cannot handle arbitrary rotations. + * + * 1. Before dequeuing a buffer, the GL driver (or any other ANW client) + * queries the ANW for NATIVE_WINDOW_TRANSFORM_HINT. + * + * 2. The GL driver overrides the width and height of the ANW to + * account for NATIVE_WINDOW_TRANSFORM_HINT. This is done by querying + * NATIVE_WINDOW_DEFAULT_{WIDTH | HEIGHT}, swapping the dimensions + * according to NATIVE_WINDOW_TRANSFORM_HINT and calling + * native_window_set_buffers_dimensions(). + * + * 3. The GL driver dequeues a buffer of the new pre-rotated size. + * + * 4. The GL driver renders to the buffer such that the image is + * already transformed, that is applying NATIVE_WINDOW_TRANSFORM_HINT + * to the rendering. + * + * 5. The GL driver calls native_window_set_transform to apply + * inverse transformation to the buffer it just rendered. + * In order to do this, the GL driver needs + * to calculate the inverse of NATIVE_WINDOW_TRANSFORM_HINT, this is + * done easily: + * + * int hintTransform, inverseTransform; + * query(..., NATIVE_WINDOW_TRANSFORM_HINT, &hintTransform); + * inverseTransform = hintTransform; + * if (hintTransform & HAL_TRANSFORM_ROT_90) + * inverseTransform ^= HAL_TRANSFORM_ROT_180; + * + * + * 6. The GL driver queues the pre-transformed buffer. + * + * 7. The composer combines the buffer transform with the display + * transform. If the buffer transform happens to cancel out the + * display transform then no rotation is needed. + * + */ + NATIVE_WINDOW_TRANSFORM_HINT = 8, }; /* valid operations for the (*perform)() hook */ |