summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2016-11-07 16:05:41 -0500
committerDerek Sollenberger <djsollen@google.com>2016-11-16 13:30:00 -0500
commitc4fbada76aa840105553b2c2bce2204e673d2983 (patch)
tree9e51b298a86cc2628f0c56c11265bf29679d5f5f /libs/hwui/renderthread/RenderThread.cpp
parentde4355dd590b3d0b5d0355d70da1231af31c5b54 (diff)
Support Surface and Layer Readback in the SkiaPipelines.
Test: CTS TextureViewTests and UIRendering Change-Id: I2969c8f5a975bfd9aebcbb585c64d1fcbb2487c2
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index f3789c8d8cbb..223958a3c319 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -17,8 +17,10 @@
#include "RenderThread.h"
#include "../renderstate/RenderState.h"
+#include "../pipeline/skia/SkiaOpenGLReadback.h"
#include "CanvasContext.h"
#include "EglManager.h"
+#include "OpenGLReadback.h"
#include "RenderProxy.h"
#include "VulkanManager.h"
@@ -196,6 +198,30 @@ void RenderThread::initThreadLocals() {
mVkManager = new VulkanManager(*this);
}
+Readback& RenderThread::readback() {
+
+ if (!mReadback) {
+ auto renderType = Properties::getRenderPipelineType();
+ switch (renderType) {
+ case RenderPipelineType::OpenGL:
+ mReadback = new OpenGLReadbackImpl(*this);
+ break;
+ case RenderPipelineType::SkiaGL:
+ case RenderPipelineType::SkiaVulkan:
+ // It works to use the OpenGL pipeline for Vulkan but this is not
+ // ideal as it causes us to create an OpenGL context in addition
+ // to the Vulkan one.
+ mReadback = new skiapipeline::SkiaOpenGLReadback(*this);
+ break;
+ default:
+ LOG_ALWAYS_FATAL("canvas context type %d not supported", (int32_t) renderType);
+ break;
+ }
+ }
+
+ return *mReadback;
+}
+
int RenderThread::displayEventReceiverCallback(int fd, int events, void* data) {
if (events & (Looper::EVENT_ERROR | Looper::EVENT_HANGUP)) {
ALOGE("Display event receiver pipe was closed or an error occurred. "