blob: 246ab269b838b6fd9287304e6e9746ee377793c4 [file] [log] [blame]
Stan Iliev768e3932016-07-08 21:34:52 -04001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "FrameInfoVisualizer.h"
John Reckf8441e62017-10-23 13:10:41 -070020#include "SwapBehavior.h"
Stan Iliev768e3932016-07-08 21:34:52 -040021
22#include <SkRect.h>
23#include <utils/RefBase.h>
24
Derek Sollenberger0df62092016-09-27 16:04:42 -040025class GrContext;
26
Stan Iliev768e3932016-07-08 21:34:52 -040027namespace android {
28
29class Surface;
30
31namespace uirenderer {
32
33class DeferredLayerUpdater;
34
35namespace renderthread {
36
John Reck1bcacfd2017-11-03 10:12:19 -070037enum class MakeCurrentResult { AlreadyCurrent, Failed, Succeeded };
Stan Iliev768e3932016-07-08 21:34:52 -040038
Romain Guy26a2b972017-04-17 09:39:51 -070039enum class ColorMode {
40 Srgb,
41 WideColorGamut,
42 // Hdr
43};
44
Derek Sollenberger0df62092016-09-27 16:04:42 -040045class Frame;
46
Stan Iliev768e3932016-07-08 21:34:52 -040047class IRenderPipeline {
48public:
49 virtual MakeCurrentResult makeCurrent() = 0;
50 virtual Frame getFrame() = 0;
51 virtual bool draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
John Reck1bcacfd2017-11-03 10:12:19 -070052 const FrameBuilder::LightGeometry& lightGeometry,
53 LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds,
54 bool opaque, bool wideColorGamut, const BakedOpRenderer::LightInfo& lightInfo,
55 const std::vector<sp<RenderNode>>& renderNodes,
56 FrameInfoVisualizer* profiler) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040057 virtual bool swapBuffers(const Frame& frame, bool drew, const SkRect& screenDirty,
John Reck1bcacfd2017-11-03 10:12:19 -070058 FrameInfo* currentFrameInfo, bool* requireSwap) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040059 virtual bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) = 0;
Derek Sollenberger56ad6ec2016-07-22 12:13:32 -040060 virtual DeferredLayerUpdater* createTextureLayer() = 0;
Romain Guy26a2b972017-04-17 09:39:51 -070061 virtual bool setSurface(Surface* window, SwapBehavior swapBehavior, ColorMode colorMode) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040062 virtual void onStop() = 0;
63 virtual bool isSurfaceReady() = 0;
64 virtual bool isContextReady() = 0;
65 virtual void onDestroyHardwareResources() = 0;
66 virtual void renderLayers(const FrameBuilder::LightGeometry& lightGeometry,
John Reck1bcacfd2017-11-03 10:12:19 -070067 LayerUpdateQueue* layerUpdateQueue, bool opaque, bool wideColorGamut,
68 const BakedOpRenderer::LightInfo& lightInfo) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040069 virtual TaskManager* getTaskManager() = 0;
John Reck1bcacfd2017-11-03 10:12:19 -070070 virtual bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator,
71 bool wideColorGamut) = 0;
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040072 virtual bool pinImages(std::vector<SkImage*>& mutableImages) = 0;
73 virtual bool pinImages(LsaVector<sk_sp<Bitmap>>& images) = 0;
74 virtual void unpinImages() = 0;
Stan Iliev47fed6ba2017-10-18 17:56:43 -040075 virtual void onPrepareTree() = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040076
77 virtual ~IRenderPipeline() {}
78};
79
80} /* namespace renderthread */
81} /* namespace uirenderer */
82} /* namespace android */