blob: b1de49733c0965b3459dd99f003ef3330ece54e7 [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;
Stan Iliev216b1572018-03-26 14:29:50 -040034class ErrorHandler;
Stan Iliev768e3932016-07-08 21:34:52 -040035
36namespace renderthread {
37
John Reck1bcacfd2017-11-03 10:12:19 -070038enum class MakeCurrentResult { AlreadyCurrent, Failed, Succeeded };
Stan Iliev768e3932016-07-08 21:34:52 -040039
Romain Guy26a2b972017-04-17 09:39:51 -070040enum class ColorMode {
41 Srgb,
42 WideColorGamut,
43 // Hdr
44};
45
Derek Sollenberger0df62092016-09-27 16:04:42 -040046class Frame;
47
Stan Iliev768e3932016-07-08 21:34:52 -040048class IRenderPipeline {
49public:
50 virtual MakeCurrentResult makeCurrent() = 0;
51 virtual Frame getFrame() = 0;
52 virtual bool draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
John Reck1bcacfd2017-11-03 10:12:19 -070053 const FrameBuilder::LightGeometry& lightGeometry,
54 LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds,
55 bool opaque, bool wideColorGamut, const BakedOpRenderer::LightInfo& lightInfo,
56 const std::vector<sp<RenderNode>>& renderNodes,
57 FrameInfoVisualizer* profiler) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040058 virtual bool swapBuffers(const Frame& frame, bool drew, const SkRect& screenDirty,
John Reck1bcacfd2017-11-03 10:12:19 -070059 FrameInfo* currentFrameInfo, bool* requireSwap) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040060 virtual bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) = 0;
Derek Sollenberger56ad6ec2016-07-22 12:13:32 -040061 virtual DeferredLayerUpdater* createTextureLayer() = 0;
Romain Guy26a2b972017-04-17 09:39:51 -070062 virtual bool setSurface(Surface* window, SwapBehavior swapBehavior, ColorMode colorMode) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040063 virtual void onStop() = 0;
64 virtual bool isSurfaceReady() = 0;
65 virtual bool isContextReady() = 0;
66 virtual void onDestroyHardwareResources() = 0;
67 virtual void renderLayers(const FrameBuilder::LightGeometry& lightGeometry,
John Reck1bcacfd2017-11-03 10:12:19 -070068 LayerUpdateQueue* layerUpdateQueue, bool opaque, bool wideColorGamut,
69 const BakedOpRenderer::LightInfo& lightInfo) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040070 virtual TaskManager* getTaskManager() = 0;
John Reck1bcacfd2017-11-03 10:12:19 -070071 virtual bool createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator,
Stan Iliev216b1572018-03-26 14:29:50 -040072 bool wideColorGamut, ErrorHandler* errorHandler) = 0;
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040073 virtual bool pinImages(std::vector<SkImage*>& mutableImages) = 0;
74 virtual bool pinImages(LsaVector<sk_sp<Bitmap>>& images) = 0;
75 virtual void unpinImages() = 0;
Stan Iliev47fed6ba2017-10-18 17:56:43 -040076 virtual void onPrepareTree() = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040077
78 virtual ~IRenderPipeline() {}
79};
80
81} /* namespace renderthread */
82} /* namespace uirenderer */
83} /* namespace android */