summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderProxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp71
1 files changed, 29 insertions, 42 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 020761110ef0..085812a00f71 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -21,6 +21,7 @@
#include "Properties.h"
#include "Readback.h"
#include "Rect.h"
+#include "pipeline/skia/SkiaOpenGLPipeline.h"
#include "pipeline/skia/VectorDrawableAtlas.h"
#include "renderstate/RenderState.h"
#include "renderthread/CanvasContext.h"
@@ -65,10 +66,7 @@ void RenderProxy::setSwapBehavior(SwapBehavior swapBehavior) {
bool RenderProxy::loadSystemProperties() {
return mRenderThread.queue().runSync([this]() -> bool {
- bool needsRedraw = false;
- if (Caches::hasInstance()) {
- needsRedraw = Properties::load();
- }
+ bool needsRedraw = Properties::load();
if (mContext->profiler().consumeProperties()) {
needsRedraw = true;
}
@@ -82,22 +80,16 @@ void RenderProxy::setName(const char* name) {
mRenderThread.queue().runSync([this, name]() { mContext->setName(std::string(name)); });
}
-void RenderProxy::initialize(const sp<Surface>& surface) {
+void RenderProxy::setSurface(const sp<Surface>& surface) {
mRenderThread.queue().post(
[ this, surf = surface ]() mutable { mContext->setSurface(std::move(surf)); });
}
-void RenderProxy::allocateBuffers(const sp<Surface>& surface) {
- mRenderThread.queue().post(
- [ surf = surface ]() mutable { surf->allocateBuffers(); });
-}
-
-void RenderProxy::updateSurface(const sp<Surface>& surface) {
- mRenderThread.queue().post(
- [ this, surf = surface ]() mutable { mContext->setSurface(std::move(surf)); });
+void RenderProxy::allocateBuffers() {
+ mRenderThread.queue().post([=]() { mContext->allocateBuffers(); });
}
-bool RenderProxy::pauseSurface(const sp<Surface>& surface) {
+bool RenderProxy::pause() {
return mRenderThread.queue().runSync([this]() -> bool { return mContext->pauseSurface(); });
}
@@ -105,13 +97,13 @@ void RenderProxy::setStopped(bool stopped) {
mRenderThread.queue().runSync([this, stopped]() { mContext->setStopped(stopped); });
}
-void RenderProxy::setup(float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
+void RenderProxy::setLightAlpha(uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
mRenderThread.queue().post(
- [=]() { mContext->setup(lightRadius, ambientShadowAlpha, spotShadowAlpha); });
+ [=]() { mContext->setLightAlpha(ambientShadowAlpha, spotShadowAlpha); });
}
-void RenderProxy::setLightCenter(const Vector3& lightCenter) {
- mRenderThread.queue().post([=]() { mContext->setLightCenter(lightCenter); });
+void RenderProxy::setLightGeometry(const Vector3& lightCenter, float lightRadius) {
+ mRenderThread.queue().post([=]() { mContext->setLightGeometry(lightCenter, lightRadius); });
}
void RenderProxy::setOpaque(bool opaque) {
@@ -162,8 +154,10 @@ void RenderProxy::buildLayer(RenderNode* node) {
}
bool RenderProxy::copyLayerInto(DeferredLayerUpdater* layer, SkBitmap& bitmap) {
- return mRenderThread.queue().runSync(
- [&]() -> bool { return mContext->copyLayerInto(layer, &bitmap); });
+ auto& thread = RenderThread::getInstance();
+ return thread.queue().runSync(
+ [&]() -> bool { return thread.readback().copyLayerInto(layer, &bitmap)
+ == CopyResult::Success; });
}
void RenderProxy::pushLayerUpdate(DeferredLayerUpdater* layer) {
@@ -200,8 +194,11 @@ void RenderProxy::fence() {
mRenderThread.queue().runSync([]() {});
}
-void RenderProxy::staticFence() {
- RenderThread::getInstance().queue().runSync([]() {});
+int RenderProxy::maxTextureSize() {
+ static int maxTextureSize = RenderThread::getInstance().queue().runSync([]() {
+ return DeviceInfo::get()->maxTextureSize();
+ });
+ return maxTextureSize;
}
void RenderProxy::stopDrawing() {
@@ -283,10 +280,6 @@ void RenderProxy::setFrameCompleteCallback(std::function<void(int64_t)>&& callba
mDrawFrameTask.setFrameCompleteCallback(std::move(callback));
}
-void RenderProxy::serializeDisplayListTree() {
- mRenderThread.queue().post([=]() { mContext->serializeDisplayListTree(); });
-}
-
void RenderProxy::addFrameMetricsObserver(FrameMetricsObserver* observerPtr) {
mRenderThread.queue().post([ this, observer = sp{observerPtr} ]() {
mContext->addFrameMetricsObserver(observer.get());
@@ -299,6 +292,12 @@ void RenderProxy::removeFrameMetricsObserver(FrameMetricsObserver* observerPtr)
});
}
+void RenderProxy::setForceDark(bool enable) {
+ mRenderThread.queue().post([this, enable]() {
+ mContext->setForceDark(enable);
+ });
+}
+
int RenderProxy::copySurfaceInto(sp<Surface>& surface, int left, int top, int right, int bottom,
SkBitmap* bitmap) {
auto& thread = RenderThread::getInstance();
@@ -334,30 +333,18 @@ void RenderProxy::prepareToDraw(Bitmap& bitmap) {
}
}
-sk_sp<Bitmap> RenderProxy::allocateHardwareBitmap(SkBitmap& bitmap) {
- auto& thread = RenderThread::getInstance();
- return thread.queue().runSync([&]() -> auto { return thread.allocateHardwareBitmap(bitmap); });
-}
-
-int RenderProxy::copyGraphicBufferInto(GraphicBuffer* buffer, SkBitmap* bitmap) {
+int RenderProxy::copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap) {
RenderThread& thread = RenderThread::getInstance();
- if (Properties::isSkiaEnabled() && gettid() == thread.getTid()) {
+ if (gettid() == thread.getTid()) {
// TODO: fix everything that hits this. We should never be triggering a readback ourselves.
- return (int)thread.readback().copyGraphicBufferInto(buffer, bitmap);
+ return (int)thread.readback().copyHWBitmapInto(hwBitmap, bitmap);
} else {
return thread.queue().runSync([&]() -> int {
- return (int)thread.readback().copyGraphicBufferInto(buffer, bitmap);
+ return (int)thread.readback().copyHWBitmapInto(hwBitmap, bitmap);
});
}
}
-void RenderProxy::onBitmapDestroyed(uint32_t pixelRefId) {
- if (!RenderThread::hasInstance()) return;
- RenderThread& thread = RenderThread::getInstance();
- thread.queue().post(
- [&thread, pixelRefId]() { thread.renderState().onBitmapDestroyed(pixelRefId); });
-}
-
void RenderProxy::disableVsync() {
Properties::disableVsync = true;
}