resolved conflicts for merge of a51a0901
to lmp-mr1-dev-plus-aosp
Change-Id: Id7df835f0bd3d5d276b162635ddfb7fe0918dfed
This commit is contained in:
@ -235,7 +235,7 @@ public abstract class HardwareRenderer {
|
|||||||
* or not the surface used by the HardwareRenderer will be changing. It
|
* or not the surface used by the HardwareRenderer will be changing. It
|
||||||
* Suspends any rendering into the surface, but will not do any destruction
|
* Suspends any rendering into the surface, but will not do any destruction
|
||||||
*/
|
*/
|
||||||
abstract void pauseSurface(Surface surface);
|
abstract boolean pauseSurface(Surface surface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys all hardware rendering resources associated with the specified
|
* Destroys all hardware rendering resources associated with the specified
|
||||||
|
@ -155,8 +155,8 @@ public class ThreadedRenderer extends HardwareRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void pauseSurface(Surface surface) {
|
boolean pauseSurface(Surface surface) {
|
||||||
nPauseSurface(mNativeProxy, surface);
|
return nPauseSurface(mNativeProxy, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -494,7 +494,7 @@ public class ThreadedRenderer extends HardwareRenderer {
|
|||||||
|
|
||||||
private static native boolean nInitialize(long nativeProxy, Surface window);
|
private static native boolean nInitialize(long nativeProxy, Surface window);
|
||||||
private static native void nUpdateSurface(long nativeProxy, Surface window);
|
private static native void nUpdateSurface(long nativeProxy, Surface window);
|
||||||
private static native void nPauseSurface(long nativeProxy, Surface window);
|
private static native boolean nPauseSurface(long nativeProxy, Surface window);
|
||||||
private static native void nSetup(long nativeProxy, int width, int height,
|
private static native void nSetup(long nativeProxy, int width, int height,
|
||||||
float lightX, float lightY, float lightZ, float lightRadius,
|
float lightX, float lightY, float lightZ, float lightRadius,
|
||||||
int ambientShadowAlpha, int spotShadowAlpha);
|
int ambientShadowAlpha, int spotShadowAlpha);
|
||||||
|
@ -1493,7 +1493,11 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
// relayoutWindow may decide to destroy mSurface. As that decision
|
// relayoutWindow may decide to destroy mSurface. As that decision
|
||||||
// happens in WindowManager service, we need to be defensive here
|
// happens in WindowManager service, we need to be defensive here
|
||||||
// and stop using the surface in case it gets destroyed.
|
// and stop using the surface in case it gets destroyed.
|
||||||
mAttachInfo.mHardwareRenderer.pauseSurface(mSurface);
|
if (mAttachInfo.mHardwareRenderer.pauseSurface(mSurface)) {
|
||||||
|
// Animations were running so we need to push a frame
|
||||||
|
// to resume them
|
||||||
|
mDirty.set(0, 0, mWidth, mHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final int surfaceGenerationId = mSurface.getGenerationId();
|
final int surfaceGenerationId = mSurface.getGenerationId();
|
||||||
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
|
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
|
||||||
|
@ -270,14 +270,14 @@ static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject cla
|
|||||||
proxy->updateSurface(window);
|
proxy->updateSurface(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_view_ThreadedRenderer_pauseSurface(JNIEnv* env, jobject clazz,
|
static jboolean android_view_ThreadedRenderer_pauseSurface(JNIEnv* env, jobject clazz,
|
||||||
jlong proxyPtr, jobject jsurface) {
|
jlong proxyPtr, jobject jsurface) {
|
||||||
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
|
RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
|
||||||
sp<ANativeWindow> window;
|
sp<ANativeWindow> window;
|
||||||
if (jsurface) {
|
if (jsurface) {
|
||||||
window = android_view_Surface_getNativeWindow(env, jsurface);
|
window = android_view_Surface_getNativeWindow(env, jsurface);
|
||||||
}
|
}
|
||||||
proxy->pauseSurface(window);
|
return proxy->pauseSurface(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_view_ThreadedRenderer_setup(JNIEnv* env, jobject clazz, jlong proxyPtr,
|
static void android_view_ThreadedRenderer_setup(JNIEnv* env, jobject clazz, jlong proxyPtr,
|
||||||
@ -429,7 +429,7 @@ static JNINativeMethod gMethods[] = {
|
|||||||
{ "nLoadSystemProperties", "(J)Z", (void*) android_view_ThreadedRenderer_loadSystemProperties },
|
{ "nLoadSystemProperties", "(J)Z", (void*) android_view_ThreadedRenderer_loadSystemProperties },
|
||||||
{ "nInitialize", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_initialize },
|
{ "nInitialize", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_initialize },
|
||||||
{ "nUpdateSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_updateSurface },
|
{ "nUpdateSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_updateSurface },
|
||||||
{ "nPauseSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_pauseSurface },
|
{ "nPauseSurface", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_pauseSurface },
|
||||||
{ "nSetup", "(JIIFFFFII)V", (void*) android_view_ThreadedRenderer_setup },
|
{ "nSetup", "(JIIFFFFII)V", (void*) android_view_ThreadedRenderer_setup },
|
||||||
{ "nSetOpaque", "(JZ)V", (void*) android_view_ThreadedRenderer_setOpaque },
|
{ "nSetOpaque", "(JZ)V", (void*) android_view_ThreadedRenderer_setOpaque },
|
||||||
{ "nSyncAndDrawFrame", "(JJJF)I", (void*) android_view_ThreadedRenderer_syncAndDrawFrame },
|
{ "nSyncAndDrawFrame", "(JJJF)I", (void*) android_view_ThreadedRenderer_syncAndDrawFrame },
|
||||||
|
@ -123,8 +123,8 @@ void CanvasContext::updateSurface(ANativeWindow* window) {
|
|||||||
setSurface(window);
|
setSurface(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasContext::pauseSurface(ANativeWindow* /* window */) {
|
bool CanvasContext::pauseSurface(ANativeWindow* /* window */) {
|
||||||
stopDrawing();
|
return mRenderThread.removeFrameCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: don't pass viewport size, it's automatic via EGL
|
// TODO: don't pass viewport size, it's automatic via EGL
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
|
|
||||||
bool initialize(ANativeWindow* window);
|
bool initialize(ANativeWindow* window);
|
||||||
void updateSurface(ANativeWindow* window);
|
void updateSurface(ANativeWindow* window);
|
||||||
void pauseSurface(ANativeWindow* window);
|
bool pauseSurface(ANativeWindow* window);
|
||||||
bool hasSurface() { return mNativeWindow.get(); }
|
bool hasSurface() { return mNativeWindow.get(); }
|
||||||
|
|
||||||
void setup(int width, int height, const Vector3& lightCenter, float lightRadius,
|
void setup(int width, int height, const Vector3& lightCenter, float lightRadius,
|
||||||
|
@ -156,15 +156,14 @@ void RenderProxy::updateSurface(const sp<ANativeWindow>& window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CREATE_BRIDGE2(pauseSurface, CanvasContext* context, ANativeWindow* window) {
|
CREATE_BRIDGE2(pauseSurface, CanvasContext* context, ANativeWindow* window) {
|
||||||
args->context->pauseSurface(args->window);
|
return (void*) args->context->pauseSurface(args->window);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderProxy::pauseSurface(const sp<ANativeWindow>& window) {
|
bool RenderProxy::pauseSurface(const sp<ANativeWindow>& window) {
|
||||||
SETUP_TASK(pauseSurface);
|
SETUP_TASK(pauseSurface);
|
||||||
args->context = mContext;
|
args->context = mContext;
|
||||||
args->window = window.get();
|
args->window = window.get();
|
||||||
postAndWait(task);
|
return (bool) postAndWait(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE_BRIDGE7(setup, CanvasContext* context, int width, int height,
|
CREATE_BRIDGE7(setup, CanvasContext* context, int width, int height,
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
ANDROID_API bool initialize(const sp<ANativeWindow>& window);
|
ANDROID_API bool initialize(const sp<ANativeWindow>& window);
|
||||||
ANDROID_API void updateSurface(const sp<ANativeWindow>& window);
|
ANDROID_API void updateSurface(const sp<ANativeWindow>& window);
|
||||||
ANDROID_API void pauseSurface(const sp<ANativeWindow>& window);
|
ANDROID_API bool pauseSurface(const sp<ANativeWindow>& window);
|
||||||
ANDROID_API void setup(int width, int height, const Vector3& lightCenter, float lightRadius,
|
ANDROID_API void setup(int width, int height, const Vector3& lightCenter, float lightRadius,
|
||||||
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha);
|
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha);
|
||||||
ANDROID_API void setOpaque(bool opaque);
|
ANDROID_API void setOpaque(bool opaque);
|
||||||
|
@ -314,9 +314,11 @@ void RenderThread::postFrameCallback(IFrameCallback* callback) {
|
|||||||
mPendingRegistrationFrameCallbacks.insert(callback);
|
mPendingRegistrationFrameCallbacks.insert(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::removeFrameCallback(IFrameCallback* callback) {
|
bool RenderThread::removeFrameCallback(IFrameCallback* callback) {
|
||||||
mFrameCallbacks.erase(callback);
|
size_t erased;
|
||||||
mPendingRegistrationFrameCallbacks.erase(callback);
|
erased = mFrameCallbacks.erase(callback);
|
||||||
|
erased |= mPendingRegistrationFrameCallbacks.erase(callback);
|
||||||
|
return erased;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::pushBackFrameCallback(IFrameCallback* callback) {
|
void RenderThread::pushBackFrameCallback(IFrameCallback* callback) {
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
// Mimics android.view.Choreographer
|
// Mimics android.view.Choreographer
|
||||||
void postFrameCallback(IFrameCallback* callback);
|
void postFrameCallback(IFrameCallback* callback);
|
||||||
void removeFrameCallback(IFrameCallback* callback);
|
bool removeFrameCallback(IFrameCallback* callback);
|
||||||
// If the callback is currently registered, it will be pushed back until
|
// If the callback is currently registered, it will be pushed back until
|
||||||
// the next vsync. If it is not currently registered this does nothing.
|
// the next vsync. If it is not currently registered this does nothing.
|
||||||
void pushBackFrameCallback(IFrameCallback* callback);
|
void pushBackFrameCallback(IFrameCallback* callback);
|
||||||
|
Reference in New Issue
Block a user