Merge "SurfaceFlinger: use async mode for video & cam"

This commit is contained in:
Jamie Gennis 2011-08-01 13:40:29 -07:00 committed by Android (Google) Code Review
commit 05ca9998cd
3 changed files with 29 additions and 1 deletions

View File

@ -22,7 +22,7 @@ ifeq ($(TARGET_BOARD_PLATFORM), omap3)
LOCAL_CFLAGS += -DNO_RGBX_8888 LOCAL_CFLAGS += -DNO_RGBX_8888
endif endif
ifeq ($(TARGET_BOARD_PLATFORM), s5pc110) ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -DNEVER_DEFAULT_TO_ASYNC_MODE
endif endif

View File

@ -86,6 +86,32 @@ status_t SurfaceTextureLayer::dequeueBuffer(int *buf,
return res; return res;
} }
status_t SurfaceTextureLayer::connect(int api) {
status_t err = SurfaceTexture::connect(api);
if (err == NO_ERROR) {
switch(api) {
case NATIVE_WINDOW_API_MEDIA:
case NATIVE_WINDOW_API_CAMERA:
// Camera preview and videos are rate-limited on the producer
// side. If enabled for this build, we use async mode to always
// show the most recent frame at the cost of requiring an
// additional buffer.
#ifndef NEVER_DEFAULT_TO_ASYNC_MODE
err = setSynchronousMode(false);
break;
#endif
// fall through to set synchronous mode when not defaulting to
// async mode.
deafult:
err = setSynchronousMode(true);
break;
}
if (err != NO_ERROR) {
disconnect(api);
}
}
return err;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
}; // namespace android }; // namespace android

View File

@ -50,6 +50,8 @@ protected:
virtual status_t dequeueBuffer(int *buf, uint32_t w, uint32_t h, virtual status_t dequeueBuffer(int *buf, uint32_t w, uint32_t h,
uint32_t format, uint32_t usage); uint32_t format, uint32_t usage);
virtual status_t connect(int api);
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------