summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2019-02-15 16:36:30 -0500
committerDerek Sollenberger <djsollen@google.com>2019-03-08 09:25:35 -0500
commita19b71a54a0c089a8edb5f2a45dfedb331ce369f (patch)
tree873387c04f768d828600e111fafb7ea6dcea741c /libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
parentfe9b21d6adc638bd3bfca9b22642253d54f1087e (diff)
Directly manage buffer presentation in Vulkan using AHardwareBuffers.
Instead of relying on Vulkan swapchains this CL enables HWUI to directly manage the native window. This allows us to preallocate buffers using our own strategy as well as having no longer having to jump through an unecessary translation layer that resulted in code that was hard to reason about and also introduced inefficiencies. Bug: 123541940 Bug: 119687951 Test: CtsUiRenderingTestCases and CtsGraphicsTestCases Change-Id: I7e5930748795e7ca4a998ab2c608c3c9b6363037
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp')
-rw-r--r--libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
index 87cffb52c150..edde6d3e05c0 100644
--- a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
@@ -55,20 +55,8 @@ MakeCurrentResult SkiaVulkanPipeline::makeCurrent() {
}
Frame SkiaVulkanPipeline::getFrame() {
- LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr,
- "drawRenderNode called on a context with no surface!");
-
- SkSurface* backBuffer = mVkManager.getBackbufferSurface(&mVkSurface);
- LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr,
- "drawRenderNode called on a context with an invalid surface");
- if (backBuffer == nullptr) {
- SkDebugf("failed to get backbuffer");
- return Frame(-1, -1, 0);
- }
-
- Frame frame(mVkSurface->windowWidth(), mVkSurface->windowHeight(),
- mVkManager.getAge(mVkSurface));
- return frame;
+ LOG_ALWAYS_FATAL_IF(mVkSurface == nullptr, "getFrame() called on a context with no surface!");
+ return mVkManager.dequeueNextBuffer(mVkSurface);
}
bool SkiaVulkanPipeline::draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
@@ -77,13 +65,13 @@ bool SkiaVulkanPipeline::draw(const Frame& frame, const SkRect& screenDirty, con
bool opaque, const LightInfo& lightInfo,
const std::vector<sp<RenderNode>>& renderNodes,
FrameInfoVisualizer* profiler) {
- sk_sp<SkSurface> backBuffer = mVkSurface->getBackBufferSurface();
+ sk_sp<SkSurface> backBuffer = mVkSurface->getCurrentSkSurface();
if (backBuffer.get() == nullptr) {
return false;
}
SkiaPipeline::updateLighting(lightGeometry, lightInfo);
renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds,
- backBuffer, mVkSurface->preTransform());
+ backBuffer, mVkSurface->getCurrentPreTransform());
ShaderCache::get().onVkFrameFlushed(mRenderThread.getGrContext());
layerUpdateQueue->clear();
@@ -113,7 +101,7 @@ bool SkiaVulkanPipeline::swapBuffers(const Frame& frame, bool drew, const SkRect
currentFrameInfo->markSwapBuffers();
if (*requireSwap) {
- mVkManager.swapBuffers(mVkSurface);
+ mVkManager.swapBuffers(mVkSurface, screenDirty);
}
return *requireSwap;