add support for update-on-demand in SurfaceFlinger
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
index 83b333f..8c8fd6b 100644
--- a/libs/ui/FramebufferNativeWindow.cpp
+++ b/libs/ui/FramebufferNativeWindow.cpp
@@ -76,7 +76,7 @@
*/
FramebufferNativeWindow::FramebufferNativeWindow()
- : BASE(), fbDev(0), grDev(0)
+ : BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false)
{
hw_module_t const* module;
if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) {
@@ -86,6 +86,8 @@
int err;
+ mUpdateOnDemand = (fbDev->setUpdateRect != 0);
+
// initialize the buffer FIFO
mNumBuffers = 2;
mNumFreeBuffers = 2;
@@ -131,6 +133,14 @@
framebuffer_close(fbDev);
}
+status_t FramebufferNativeWindow::setUpdateRectangle(const Rect& r)
+{
+ if (!mUpdateOnDemand) {
+ return INVALID_OPERATION;
+ }
+ return fbDev->setUpdateRect(fbDev, r.left, r.top, r.width(), r.height());
+}
+
int FramebufferNativeWindow::setSwapInterval(
android_native_window_t* window, int interval)
{